@sentry/junior 0.116.1 → 0.118.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 (93) hide show
  1. package/dist/{agent-hooks-GUAAS3XH.js → agent-hooks-J2FB7XD6.js} +8 -10
  2. package/dist/api/conversations/detail.d.ts +7 -0
  3. package/dist/api/conversations/event-list.d.ts +7 -0
  4. package/dist/api/conversations/events.d.ts +1 -1
  5. package/dist/api/schema/conversation.d.ts +28 -0
  6. package/dist/api/schema/stats.d.ts +22 -0
  7. package/dist/api/schema.d.ts +2 -0
  8. package/dist/api/schema.js +7 -3
  9. package/dist/api/stats.d.ts +16 -0
  10. package/dist/api/user-pages/routes.d.ts +4 -0
  11. package/dist/api.js +192 -18
  12. package/dist/app.js +53 -46
  13. package/dist/{catalog-runtime-WMPC4J4U.js → catalog-runtime-UHHLU53I.js} +5 -5
  14. package/dist/chat/agent/prompt.d.ts +6 -2
  15. package/dist/chat/agent/request.d.ts +2 -1
  16. package/dist/chat/agent/resume.d.ts +2 -0
  17. package/dist/chat/agent/tools.d.ts +1 -0
  18. package/dist/chat/conversations/history.d.ts +22 -1
  19. package/dist/chat/conversations/projection.d.ts +6 -0
  20. package/dist/chat/mcp/client.d.ts +4 -0
  21. package/dist/chat/mcp/errors.d.ts +22 -1
  22. package/dist/chat/oauth-response.d.ts +21 -0
  23. package/dist/chat/plugins/prompt.d.ts +9 -0
  24. package/dist/chat/plugins/types.d.ts +2 -21
  25. package/dist/chat/plugins/user-pages.d.ts +15 -0
  26. package/dist/chat/plugins/viewer-actors.d.ts +6 -0
  27. package/dist/chat/prompt.d.ts +1 -2
  28. package/dist/chat/sandbox/paths.d.ts +2 -0
  29. package/dist/chat/sandbox/sandbox.d.ts +3 -1
  30. package/dist/chat/sandbox/snapshot/install.d.ts +6 -0
  31. package/dist/chat/sandbox/snapshot/profile.d.ts +14 -0
  32. package/dist/chat/sandbox/snapshot/resolve.d.ts +22 -0
  33. package/dist/chat/sandbox/snapshot/span.d.ts +2 -0
  34. package/dist/chat/sandbox/workspace.d.ts +1 -0
  35. package/dist/chat/services/context-compaction-marker.d.ts +1 -0
  36. package/dist/chat/services/turn-session-record.d.ts +2 -0
  37. package/dist/chat/skills.d.ts +1 -2
  38. package/dist/chat/state/turn-session.d.ts +2 -0
  39. package/dist/chat/tools/index.d.ts +4 -1
  40. package/dist/chat/tools/query-conversation-events.d.ts +1 -1
  41. package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
  42. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  43. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  44. package/dist/chat/tools/sandbox/view-image.d.ts +11 -0
  45. package/dist/chat/tools/types.d.ts +7 -0
  46. package/dist/{chunk-XA3VLFPK.js → chunk-3LGCVRBQ.js} +154 -20
  47. package/dist/{chunk-JPKGW6L6.js → chunk-3MUSSFMP.js} +78 -39
  48. package/dist/{chunk-7CSVG54J.js → chunk-3N3FMCKN.js} +30 -2
  49. package/dist/{chunk-VBMMMVVQ.js → chunk-4LPPH7Y6.js} +405 -446
  50. package/dist/{chunk-2YYPXQNQ.js → chunk-4SOQPUF4.js} +1 -1
  51. package/dist/{chunk-H35BDAUS.js → chunk-6BGUAOYP.js} +8 -8
  52. package/dist/{chunk-GDAXWEIJ.js → chunk-6K2QE2UI.js} +731 -424
  53. package/dist/{chunk-DLLW5ITL.js → chunk-7GADTCNS.js} +30 -9
  54. package/dist/{chunk-TC4ZEM2D.js → chunk-7SM3P4XR.js} +28 -1
  55. package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
  56. package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
  57. package/dist/{chunk-ZYHLNTC2.js → chunk-GT2ZUALJ.js} +584 -25
  58. package/dist/{chunk-KNCELO2M.js → chunk-HN6LFYG3.js} +1 -1
  59. package/dist/{chunk-N3C4XCRE.js → chunk-HWUBBHLK.js} +1 -1
  60. package/dist/{chunk-BFYVIOTS.js → chunk-KC5EE27Y.js} +13 -3
  61. package/dist/chunk-L72GDKSN.js +37 -0
  62. package/dist/{chunk-F3SWGSPG.js → chunk-MLZFK4KP.js} +1 -1
  63. package/dist/{chunk-RYFAVWP3.js → chunk-PJPKHGLG.js} +34 -15
  64. package/dist/{chunk-CY7NXM32.js → chunk-PWRFTDTY.js} +4 -2
  65. package/dist/{chunk-WLT72MRP.js → chunk-QWCF4RAC.js} +1 -1
  66. package/dist/{chunk-CGXLCMWI.js → chunk-S6R23MFB.js} +117 -17
  67. package/dist/{chunk-OY2PQQ4P.js → chunk-UXLYAVYL.js} +1 -1
  68. package/dist/cli/chat.js +23 -24
  69. package/dist/cli/check.js +6 -6
  70. package/dist/cli/main.js +1 -1
  71. package/dist/cli/plugins.js +12 -14
  72. package/dist/cli/{snapshot-warmup.js → snapshot-create.js} +17 -20
  73. package/dist/cli/upgrade.js +7 -7
  74. package/dist/db/schema/stats.d.ts +93 -0
  75. package/dist/db/schema.d.ts +94 -1
  76. package/dist/{db-FH4R5ZQ4.js → db-PMRHFSYL.js} +6 -6
  77. package/dist/handlers/oauth-html.d.ts +4 -2
  78. package/dist/instrumentation.js +2 -2
  79. package/dist/nitro.js +3 -3
  80. package/dist/{oauth-callback-server-C2SSJ3FQ.js → oauth-callback-server-QJUC7S4X.js} +15 -17
  81. package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
  82. package/dist/{runner-NAALFIXM.js → runner-PZMV6JQW.js} +10 -12
  83. package/dist/{skills-UN2JXYYF.js → skills-W4JETYSV.js} +6 -6
  84. package/dist/stats.d.ts +18 -0
  85. package/dist/{validation-EEF4ROHR.js → validation-IJLNHZSU.js} +6 -6
  86. package/dist/version.js +1 -1
  87. package/migrations/0011_sour_golden_guardian.sql +8 -0
  88. package/migrations/meta/0011_snapshot.json +1195 -0
  89. package/migrations/meta/_journal.json +8 -1
  90. package/package.json +5 -5
  91. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +0 -20
  92. package/dist/chunk-4ZNGQH7C.js +0 -25
  93. package/dist/chunk-FAEALXEH.js +0 -517
package/dist/app.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  startConversationWork,
49
49
  startSlackProcessingReaction,
50
50
  stripLeadingBotMention
51
- } from "./chunk-JPKGW6L6.js";
51
+ } from "./chunk-3MUSSFMP.js";
52
52
  import "./chunk-FA6POGLH.js";
53
53
  import {
54
54
  ConversationTurnLifecycleService,
@@ -63,13 +63,13 @@ import {
63
63
  processPluginTask,
64
64
  requireTurnFailureEventId,
65
65
  scheduleSessionCompletedPluginTasks
66
- } from "./chunk-H35BDAUS.js";
66
+ } from "./chunk-6BGUAOYP.js";
67
67
  import {
68
68
  GET,
69
69
  conversationVisibilityFromSlackChannelType,
70
70
  resolveSlackChannelTypeFromMessage,
71
71
  resolveSlackConversationContext
72
- } from "./chunk-KNCELO2M.js";
72
+ } from "./chunk-HN6LFYG3.js";
73
73
  import "./chunk-4CODA7P5.js";
74
74
  import "./chunk-PE44LDDQ.js";
75
75
  import {
@@ -88,13 +88,13 @@ import {
88
88
  import {
89
89
  validatePluginEgressCredentialHooks,
90
90
  validatePluginRegistrations
91
- } from "./chunk-2YYPXQNQ.js";
91
+ } from "./chunk-4SOQPUF4.js";
92
92
  import {
93
93
  defineJuniorPlugins,
94
94
  pluginCatalogConfigFromEnv,
95
95
  pluginCatalogConfigFromPluginSet,
96
96
  pluginRuntimeRegistrationsFromPluginSet
97
- } from "./chunk-WKU7TY22.js";
97
+ } from "./chunk-FIANEE7Z.js";
98
98
  import {
99
99
  AuthorizationFlowDisabledError,
100
100
  PluginCredentialFailureError,
@@ -121,7 +121,7 @@ import {
121
121
  setConfigDefaults,
122
122
  shouldEmitDevAgentTrace,
123
123
  shouldPropagateSandboxEgressTrace
124
- } from "./chunk-GDAXWEIJ.js";
124
+ } from "./chunk-6K2QE2UI.js";
125
125
  import "./chunk-DIB4GX3G.js";
126
126
  import {
127
127
  RetryableDeliveryError,
@@ -134,7 +134,7 @@ import {
134
134
  postSlackMessage,
135
135
  splitSlackReplyText,
136
136
  startOAuthFlow
137
- } from "./chunk-CGXLCMWI.js";
137
+ } from "./chunk-S6R23MFB.js";
138
138
  import {
139
139
  ConversationTurnBoundaryError,
140
140
  CooperativeTurnYieldError,
@@ -188,40 +188,35 @@ import {
188
188
  trimTrailingAssistantMessages,
189
189
  updateConversationStats,
190
190
  upsertConversationMessage
191
- } from "./chunk-RYFAVWP3.js";
191
+ } from "./chunk-PJPKHGLG.js";
192
192
  import "./chunk-HDSDCEPK.js";
193
- import "./chunk-VBMMMVVQ.js";
193
+ import "./chunk-4LPPH7Y6.js";
194
+ import "./chunk-L72GDKSN.js";
194
195
  import "./chunk-MU6HHZEN.js";
195
196
  import "./chunk-PDO5BLNM.js";
196
197
  import "./chunk-UIE3R5XU.js";
197
198
  import {
199
+ SlackActionError,
198
200
  bindScheduledTaskCredentialSubject,
199
201
  bindSlackDirectCredentialSubject,
200
202
  createPluginLogger,
201
203
  createPluginState,
204
+ downloadPrivateSlackFile,
202
205
  getPluginApiRoutes,
203
206
  getPluginRoutes,
204
207
  getPlugins,
205
- setDashboardConversationLinkOptions,
206
- setPlugins,
207
- validatePlugins,
208
- verifyScheduledTaskCredentialSubject,
209
- verifySlackDirectCredentialSubject
210
- } from "./chunk-ZYHLNTC2.js";
211
- import {
212
- acquireActiveLock,
213
- getStateAdapter
214
- } from "./chunk-7CSVG54J.js";
215
- import {
216
- SlackActionError,
217
- downloadPrivateSlackFile,
218
208
  getSlackClient,
219
209
  getWorkspaceTeamId,
220
210
  isDmChannel,
221
211
  normalizeSlackConversationId,
222
212
  runWithSlackInstallationToken,
223
- runWithWorkspaceTeamId
224
- } from "./chunk-FAEALXEH.js";
213
+ runWithWorkspaceTeamId,
214
+ setDashboardConversationLinkOptions,
215
+ setPlugins,
216
+ validatePlugins,
217
+ verifyScheduledTaskCredentialSubject,
218
+ verifySlackDirectCredentialSubject
219
+ } from "./chunk-GT2ZUALJ.js";
225
220
  import {
226
221
  contextProvenance,
227
222
  createSlackDestination,
@@ -232,14 +227,16 @@ import {
232
227
  instructionProvenanceFor,
233
228
  requireSlackDestination,
234
229
  withConversationEventLock
235
- } from "./chunk-BFYVIOTS.js";
230
+ } from "./chunk-KC5EE27Y.js";
236
231
  import {
237
232
  juniorConversationEvents,
238
233
  juniorConversations
239
- } from "./chunk-RXRQJF7Y.js";
234
+ } from "./chunk-GCGJGSQL.js";
240
235
  import {
236
+ acquireActiveLock,
237
+ getStateAdapter,
241
238
  sleep
242
- } from "./chunk-4ZNGQH7C.js";
239
+ } from "./chunk-3N3FMCKN.js";
243
240
  import {
244
241
  STANDARD_MODEL_PROFILE,
245
242
  botConfig,
@@ -257,18 +254,18 @@ import {
257
254
  modelIdForProfile,
258
255
  setSlackReactionConfig,
259
256
  standardModelId
260
- } from "./chunk-CY7NXM32.js";
257
+ } from "./chunk-PWRFTDTY.js";
261
258
  import {
262
259
  juniorDestinations
263
260
  } from "./chunk-VFUK3X5B.js";
264
261
  import {
265
262
  parseSlackThreadId
266
263
  } from "./chunk-FXOYURO4.js";
267
- import "./chunk-DLLW5ITL.js";
264
+ import "./chunk-7GADTCNS.js";
268
265
  import {
269
266
  pluginCatalogRuntime
270
- } from "./chunk-OY2PQQ4P.js";
271
- import "./chunk-XA3VLFPK.js";
267
+ } from "./chunk-UXLYAVYL.js";
268
+ import "./chunk-3LGCVRBQ.js";
272
269
  import {
273
270
  credentialSubjectSchema
274
271
  } from "./chunk-W3U3YQYI.js";
@@ -294,7 +291,7 @@ import {
294
291
  setTags,
295
292
  withContext,
296
293
  withSpan
297
- } from "./chunk-F3SWGSPG.js";
294
+ } from "./chunk-MLZFK4KP.js";
298
295
  import {
299
296
  toOptionalString
300
297
  } from "./chunk-OB42YVAE.js";
@@ -309,10 +306,10 @@ import "./chunk-B3IT5END.js";
309
306
  import "./chunk-3V7OFJZC.js";
310
307
  import {
311
308
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
312
- } from "./chunk-WLT72MRP.js";
309
+ } from "./chunk-QWCF4RAC.js";
313
310
  import {
314
311
  JUNIOR_VERSION
315
- } from "./chunk-N3C4XCRE.js";
312
+ } from "./chunk-HWUBBHLK.js";
316
313
  import "./chunk-MLKGABMK.js";
317
314
 
318
315
  // src/app.ts
@@ -4882,26 +4879,27 @@ function getSubscribedReplyPreflightDecision(args) {
4882
4879
  };
4883
4880
  }
4884
4881
  function buildRouterSystemPrompt(botUserName) {
4882
+ const assistantName = escapeXml(botUserName);
4885
4883
  return [
4886
- "You are a message router for a Slack assistant named Junior in a subscribed Slack thread.",
4887
- "Decide whether Junior should reply to the latest message.",
4884
+ `You are a message router for a Slack assistant named ${assistantName} in a subscribed Slack thread.`,
4885
+ `Decide whether ${assistantName} should reply to the latest message.`,
4888
4886
  "Subscribed threads are passive by default.",
4889
- "Reply true only when the latest message is aimed at Junior.",
4887
+ `Reply true only when the latest message is aimed at ${assistantName}.`,
4890
4888
  "Use who currently has the conversation floor, not just topic overlap.",
4891
- "If Junior was the last speaker, only a clear turn back to Junior should count as an implicit follow-up.",
4892
- "Terse clarifications like 'which one?' or 'why?' right after Junior answers can be should_reply=true.",
4893
- "Direct self-reference to Junior's prior answer like 'what did you just say?' or 'explain that more' can be should_reply=true.",
4894
- "If one or more humans spoke after Junior, require a clear turn back to Junior. Shared domain vocabulary alone is not enough.",
4895
- "Questions like 'what about auth?' or 'can you check on this?' are usually human-to-human unless the thread clearly turns back to Junior.",
4896
- "A vague question like 'is that the right approach?' is still should_reply=false unless it clearly turns back to Junior.",
4889
+ `If ${assistantName} was the last speaker, only a clear turn back to ${assistantName} should count as an implicit follow-up.`,
4890
+ `Terse clarifications like 'which one?' or 'why?' right after ${assistantName} answers can be should_reply=true.`,
4891
+ `Direct self-reference to ${assistantName}'s prior answer like 'what did you just say?' or 'explain that more' can be should_reply=true.`,
4892
+ `If one or more humans spoke after ${assistantName}, require a clear turn back to ${assistantName}. Shared domain vocabulary alone is not enough.`,
4893
+ `Questions like 'what about auth?' or 'can you check on this?' are usually human-to-human unless the thread clearly turns back to ${assistantName}.`,
4894
+ `A vague question like 'is that the right approach?' is still should_reply=false unless it clearly turns back to ${assistantName}.`,
4897
4895
  "Acknowledgments, reactions, status chatter, and team coordination should be should_reply=false.",
4898
- "If the latest message clearly tells Junior to stop watching, replying, or participating, set should_unsubscribe=true and should_reply=false.",
4896
+ `If the latest message clearly tells ${assistantName} to stop watching, replying, or participating, set should_unsubscribe=true and should_reply=false.`,
4899
4897
  "When uncertain, prefer should_reply=false with low confidence.",
4900
4898
  "",
4901
4899
  "Return JSON with should_reply, should_unsubscribe, confidence, and a reason under 160 characters.",
4902
4900
  "Do not return any extra keys.",
4903
4901
  "",
4904
- `<assistant-name>${escapeXml(botUserName)}</assistant-name>`
4902
+ `<assistant-name>${assistantName}</assistant-name>`
4905
4903
  ].join("\n");
4906
4904
  }
4907
4905
  async function decideSubscribedThreadReply(args) {
@@ -9439,7 +9437,10 @@ function dashboardHostRoutePaths(dashboard) {
9439
9437
  peoplePath,
9440
9438
  `${peoplePath}/*`,
9441
9439
  pagePath("system"),
9442
- `${pagePath("system")}/*`
9440
+ `${pagePath("system")}/*`,
9441
+ pagePath("settings/plugins"),
9442
+ `${pagePath("settings/plugins")}/*`,
9443
+ pagePath("settings/api-tokens")
9443
9444
  ];
9444
9445
  if (dashboard.componentGallery) {
9445
9446
  pagePaths.push(pagePath("dev"), `${pagePath("dev")}/*`);
@@ -9456,13 +9457,18 @@ function dashboardHostRoutePaths(dashboard) {
9456
9457
  "/api/plugins",
9457
9458
  "/api/plugins/*",
9458
9459
  "/api/plugin-reports",
9460
+ "/api/user-pages",
9461
+ "/api/user-pages/*",
9459
9462
  "/api/skills",
9463
+ "/api/stats",
9460
9464
  "/api/conversations",
9461
9465
  "/api/conversations/*",
9462
9466
  "/api/locations",
9463
9467
  "/api/locations/*",
9464
9468
  "/api/people",
9465
9469
  "/api/people/*",
9470
+ "/api/personal-tokens",
9471
+ "/api/personal-tokens/*",
9466
9472
  "/api/config",
9467
9473
  "/api/me",
9468
9474
  authPath,
@@ -9525,6 +9531,7 @@ function dashboardRouteRegistrations(args) {
9525
9531
  const fetch2 = (request) => {
9526
9532
  app ??= args.createDashboardApp({
9527
9533
  ...args.dashboard,
9534
+ agentName: botConfig.userName,
9528
9535
  pluginRoutes: args.pluginRoutes
9529
9536
  });
9530
9537
  if (!app || typeof app.fetch !== "function") {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-OY2PQQ4P.js";
4
- import "./chunk-XA3VLFPK.js";
3
+ } from "./chunk-UXLYAVYL.js";
4
+ import "./chunk-3LGCVRBQ.js";
5
5
  import "./chunk-W3U3YQYI.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
- import "./chunk-F3SWGSPG.js";
7
+ import "./chunk-MLZFK4KP.js";
8
8
  import "./chunk-OB42YVAE.js";
9
9
  import "./chunk-F3B2YJ76.js";
10
10
  import "./chunk-6GWA276C.js";
11
11
  import "./chunk-B3IT5END.js";
12
12
  import "./chunk-3V7OFJZC.js";
13
- import "./chunk-WLT72MRP.js";
14
- import "./chunk-N3C4XCRE.js";
13
+ import "./chunk-QWCF4RAC.js";
14
+ import "./chunk-HWUBBHLK.js";
15
15
  import "./chunk-MLKGABMK.js";
16
16
  export {
17
17
  pluginCatalogRuntime
@@ -1,12 +1,13 @@
1
1
  import type { PiMessage } from "@/chat/pi/messages";
2
2
  import { type LogContext } from "@/chat/logging";
3
3
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
4
- import type { SkillInvocation, SkillMetadata } from "@/chat/skills";
4
+ import type { Skill, SkillMetadata } from "@/chat/skills";
5
5
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
6
6
  import type { ToolRuntimeContext } from "@/chat/tools/types";
7
7
  import type { AnyToolDefinition } from "@/chat/tools/definition";
8
8
  import { type Actor } from "@/chat/actor";
9
9
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
10
+ import type { PluginTurnContext } from "@/chat/plugins/prompt";
10
11
  import type { AgentRunInput, AgentRunInstructionActor, AgentRunRouting, AgentRunSteeringMessage } from "@/chat/agent/request";
11
12
  export type UserContentPart = {
12
13
  type: "text";
@@ -32,11 +33,14 @@ export interface PromptAssembly {
32
33
  promptContentParts: UserContentPart[];
33
34
  promptHistoryMessages: PiMessage[];
34
35
  shouldPromptAgent: boolean;
36
+ turnContexts: PluginTurnContext[];
35
37
  }
36
38
  /**
37
39
  * Keep thread text separate from the canonical active task boundary.
38
40
  */
39
41
  export declare function buildUserTurnText(userInput: string, conversationContext?: string, actor?: AgentRunInstructionActor): string;
42
+ /** Render an explicitly selected skill as instructions for the current turn. */
43
+ export declare function renderExplicitSkillInstructions(skill: Skill): string;
40
44
  /** Encode a non-image attachment as base64 XML for the prompt. */
41
45
  export declare function encodeNonImageAttachmentForPrompt(attachment: {
42
46
  data: Buffer;
@@ -63,7 +67,7 @@ export declare function assemblePrompt(args: {
63
67
  conversationPrivacy?: ConversationPrivacy;
64
68
  existingSessionPiMessages?: PiMessage[];
65
69
  existingTurnStartMessageIndex?: number;
66
- invocation: SkillInvocation | null;
70
+ explicitSkill: Skill | null;
67
71
  priorPiMessages?: PiMessage[];
68
72
  resumedFromSessionRecord: boolean;
69
73
  routing: AgentRunRouting;
@@ -27,7 +27,7 @@ import type { AgentTurnSurface } from "@/chat/state/turn-session";
27
27
  import type { ToolExecutionReport } from "@/chat/tool-support/tool-execution-report";
28
28
  import type { SlackActionToken } from "@/chat/slack/action-token";
29
29
  import type { TurnReasoningLevel } from "@/chat/reasoning-level";
30
- import type { ImageGenerateToolDeps, WebFetchToolDeps, WebSearchToolDeps } from "@/chat/tools/types";
30
+ import type { ImageGenerateToolDeps, ViewImageToolDeps, WebFetchToolDeps, WebSearchToolDeps } from "@/chat/tools/types";
31
31
  export interface AgentRunAttachment {
32
32
  data?: Buffer;
33
33
  mediaType: string;
@@ -101,6 +101,7 @@ export interface AgentRunPolicy {
101
101
  sandboxEgressSignals?: SandboxEgressSignalTransport;
102
102
  toolOverrides?: {
103
103
  imageGenerate?: ImageGenerateToolDeps;
104
+ viewImage?: ViewImageToolDeps;
104
105
  webFetch?: WebFetchToolDeps;
105
106
  webSearch?: WebSearchToolDeps;
106
107
  };
@@ -18,6 +18,7 @@ import { loadTurnSessionRecord, persistRunningSessionRecord } from "@/chat/servi
18
18
  import { type AuthorizationPauseError } from "@/chat/services/auth-pause";
19
19
  import { type AgentTurnUsage } from "@/chat/usage";
20
20
  import { type AgentRunDurability } from "@/chat/agent/request";
21
+ import type { PluginTurnContext } from "@/chat/plugins/prompt";
21
22
  type LoadedSessionRecordState = Awaited<ReturnType<typeof loadTurnSessionRecord>>;
22
23
  type SessionRecordLogContext = NonNullable<Parameters<typeof persistRunningSessionRecord>[0]["logContext"]>;
23
24
  interface ResumeStateArgs {
@@ -48,6 +49,7 @@ export declare function createResumeState(args: ResumeStateArgs): {
48
49
  readonly timedOut: boolean;
49
50
  setTurnStartMessageIndex(index: number | undefined): void;
50
51
  setBeforeMessageCount(count: number): void;
52
+ setTurnContexts(contexts: PluginTurnContext[]): void;
51
53
  /** Adopt an already committed epoch replacement as every resume baseline. */
52
54
  adoptCommittedBoundary(messages: PiMessage[]): void;
53
55
  captureResumeSnapshot(messages: PiMessage[]): void;
@@ -56,6 +56,7 @@ interface ToolWiringArgs {
56
56
  skillSandbox: SkillSandbox;
57
57
  spanContext: LogContext;
58
58
  state: AgentRunState;
59
+ supportsImageInput: () => boolean;
59
60
  surface: AgentTurnSurface;
60
61
  syncLoadedSkillNamesForResume: () => void;
61
62
  toolCalls: string[];
@@ -245,6 +245,13 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
245
245
  internal: "internal";
246
246
  scheduler: "scheduler";
247
247
  }>;
248
+ }, z.core.$strict>, z.ZodObject<{
249
+ type: z.ZodLiteral<"turn_context">;
250
+ turnId: z.ZodString;
251
+ pluginName: z.ZodString;
252
+ kind: z.ZodString;
253
+ version: z.ZodNumber;
254
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
248
255
  }, z.core.$strict>, z.ZodObject<{
249
256
  type: z.ZodLiteral<"turn_routed">;
250
257
  turnId: z.ZodString;
@@ -385,7 +392,7 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
385
392
  /** One durable conversation event's validated data. */
386
393
  export type ConversationEventData = z.output<typeof conversationEventDataSchema>;
387
394
  /** Event type names recognized by current readers and observational queries. */
388
- export declare const KNOWN_CONVERSATION_EVENT_TYPES: readonly ["message", "message_updated", "user_message", "assistant_message", "tool_result", "mcp_provider_connected", "authorization_requested", "authorization_completed", "tool_execution_started", "message_handled", "messages_summarized", "turn_started", "turn_routed", "turn_completed", "turn_failed", "subagent_started", "subagent_ended", "handoff", "compaction"];
395
+ export declare const KNOWN_CONVERSATION_EVENT_TYPES: readonly ["message", "message_updated", "user_message", "assistant_message", "tool_result", "mcp_provider_connected", "authorization_requested", "authorization_completed", "tool_execution_started", "message_handled", "messages_summarized", "turn_started", "turn_context", "turn_routed", "turn_completed", "turn_failed", "subagent_started", "subagent_ended", "handoff", "compaction"];
389
396
  /** One known durable conversation event type name. */
390
397
  export type KnownConversationEventType = (typeof KNOWN_CONVERSATION_EVENT_TYPES)[number];
391
398
  declare const unknownConversationEventDataSchema: z.ZodObject<{
@@ -490,6 +497,13 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
490
497
  internal: "internal";
491
498
  scheduler: "scheduler";
492
499
  }>;
500
+ }, z.core.$strict>, z.ZodObject<{
501
+ type: z.ZodLiteral<"turn_context">;
502
+ turnId: z.ZodString;
503
+ pluginName: z.ZodString;
504
+ kind: z.ZodString;
505
+ version: z.ZodNumber;
506
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
493
507
  }, z.core.$strict>, z.ZodObject<{
494
508
  type: z.ZodLiteral<"turn_routed">;
495
509
  turnId: z.ZodString;
@@ -758,6 +772,13 @@ export declare const newConversationEventSchema: z.ZodObject<{
758
772
  internal: "internal";
759
773
  scheduler: "scheduler";
760
774
  }>;
775
+ }, z.core.$strict>, z.ZodObject<{
776
+ type: z.ZodLiteral<"turn_context">;
777
+ turnId: z.ZodString;
778
+ pluginName: z.ZodString;
779
+ kind: z.ZodString;
780
+ version: z.ZodNumber;
781
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
761
782
  }, z.core.$strict>, z.ZodObject<{
762
783
  type: z.ZodLiteral<"turn_routed">;
763
784
  turnId: z.ZodString;
@@ -5,6 +5,7 @@ import type { JuniorSqlDatabase } from "@/db/db";
5
5
  import { type PiConversationEventProjection, type PiConversationProjection } from "@/chat/pi/conversation-events";
6
6
  import type { ModelProfile } from "@/chat/model-profile";
7
7
  import type { TurnReasoningLevel } from "@/chat/reasoning-level";
8
+ import type { PluginTurnContext } from "@/chat/plugins/prompt";
8
9
  interface ScopedConversation {
9
10
  conversationId: string;
10
11
  }
@@ -46,6 +47,11 @@ export declare function commitMessages(args: {
46
47
  trailingMessageProvenance?: ConversationMessageProvenance[];
47
48
  /** Default applied to the last new user message when no explicit array. */
48
49
  newMessageProvenance?: ConversationMessageProvenance;
50
+ /** Structured plugin context committed atomically with this turn's input. */
51
+ turnContext?: {
52
+ contexts: PluginTurnContext[];
53
+ turnId: string;
54
+ };
49
55
  /** SQL authority for the atomic commit; defaults to the process executor. */
50
56
  executor?: JuniorSqlDatabase;
51
57
  }): Promise<{
@@ -17,8 +17,10 @@ export declare class PluginMcpClient {
17
17
  private client?;
18
18
  private clientPromise?;
19
19
  private lastAttemptedTransportSessionId?;
20
+ private readonly providerStatusStore;
20
21
  private transport?;
21
22
  private listedTools?;
23
+ private readonly resourceHost?;
22
24
  constructor(plugin: PluginDefinition, options?: PluginMcpClientOptions);
23
25
  listTools(): Promise<ListedTool[]>;
24
26
  callTool(name: string, args: Record<string, unknown> | undefined): Promise<ToolCallResult>;
@@ -28,6 +30,8 @@ export declare class PluginMcpClient {
28
30
  private connectClient;
29
31
  private wrapAuth;
30
32
  private shouldResetMissingSession;
33
+ private resetClientState;
34
+ private cleanupClientAfterFailure;
31
35
  private disposeClient;
32
36
  private getStoredTransportSessionId;
33
37
  private clearStoredTransportSessionId;
@@ -1,4 +1,25 @@
1
1
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
2
+ export type McpProviderErrorPhase = "connect" | "list_tools" | "call_tool" | "close" | "oauth_callback";
3
+ export interface McpProviderErrorDetails {
4
+ phase: McpProviderErrorPhase;
5
+ provider: string;
6
+ missingSession?: boolean;
7
+ resourceHost?: string;
8
+ status?: number;
9
+ }
10
+ /** Safe failure at an MCP network or OAuth boundary. */
11
+ export declare class McpProviderError extends Error {
12
+ readonly phase: McpProviderErrorPhase;
13
+ readonly provider: string;
14
+ readonly missingSession?: boolean;
15
+ readonly resourceHost?: string;
16
+ readonly status?: number;
17
+ constructor(details: McpProviderErrorDetails);
18
+ }
19
+ /** Replace an external MCP failure without retaining its provider-controlled cause. */
20
+ export declare function toMcpProviderError(error: unknown, details: McpProviderErrorDetails): McpProviderError;
21
+ /** Return safe MCP provider fields for logs and spans. */
22
+ export declare function getMcpProviderErrorAttributes(error: unknown): Record<string, string | number>;
2
23
  /** Thrown when an MCP failure should be returned as a model-visible tool error. */
3
24
  export declare class McpToolError extends Error {
4
25
  constructor(message: string);
@@ -8,4 +29,4 @@ export declare function getMcpAwareErrorType(error: unknown, fallback: string):
8
29
  /** Return the display-safe error message for MCP-aware tool failures. */
9
30
  export declare function getMcpAwareErrorMessage(error: unknown): string;
10
31
  /** Return an error message safe for logs and span attributes. */
11
- export declare function getMcpAwareTelemetryMessage(error: unknown, privacy: ConversationPrivacy | undefined): string;
32
+ export declare function getMcpAwareTelemetryMessage(error: unknown, _privacy: ConversationPrivacy | undefined): string;
@@ -0,0 +1,21 @@
1
+ export type OAuthProviderErrorPhase = "token_exchange" | "token_refresh";
2
+ export interface OAuthProviderErrorDetails {
3
+ phase: OAuthProviderErrorPhase;
4
+ provider: string;
5
+ resourceHost: string;
6
+ status?: number;
7
+ }
8
+ /** Safe failure at a generic OAuth provider boundary. */
9
+ export declare class OAuthProviderError extends Error {
10
+ readonly phase: OAuthProviderErrorPhase;
11
+ readonly provider: string;
12
+ readonly resourceHost: string;
13
+ readonly status?: number;
14
+ constructor(details: OAuthProviderErrorDetails);
15
+ }
16
+ /** Return safe generic OAuth provider fields for logs and spans. */
17
+ export declare function getOAuthProviderErrorAttributes(error: unknown): Record<string, string | number>;
18
+ /** Read only the bounded prefix needed to classify an OAuth error response. */
19
+ export declare function readBoundedOAuthErrorBody(response: Response): Promise<string>;
20
+ /** Preserve small OAuth error responses while bounding bodies before SDK parsing. */
21
+ export declare function fetchWithBoundedOAuthErrorBodies(fetchFn?: typeof fetch, onErrorResponseStatus?: (status: number) => void): typeof fetch;
@@ -1,4 +1,13 @@
1
+ /** Validated plugin context retained for the current turn. */
2
+ export interface PluginTurnContext {
3
+ content: Record<string, unknown>;
4
+ kind: string;
5
+ loadedAtMs: number;
6
+ pluginName: string;
7
+ version: number;
8
+ }
1
9
  export interface PluginPromptContributionContext {
10
+ context?: PluginTurnContext;
2
11
  id: string;
3
12
  pluginName: string;
4
13
  text: string;
@@ -1,4 +1,6 @@
1
+ import type { PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "@sentry/junior-plugin-api";
1
2
  import type { UserTokenStore } from "@/chat/credentials/user-token-store";
3
+ export type { PluginNpmRuntimeDependency, PluginRuntimeDependency, PluginRuntimePostinstallCommand, PluginSystemRuntimeDependency, PluginSystemRuntimeDependencyFromUrl, } from "@sentry/junior-plugin-api";
2
4
  export interface PluginOAuthConfig {
3
5
  clientIdEnv: string;
4
6
  clientSecretEnv: string;
@@ -28,26 +30,6 @@ export interface OAuthBearerCredentials {
28
30
  authTokenPlaceholder?: string;
29
31
  }
30
32
  export type PluginCredentials = OAuthBearerCredentials;
31
- export interface PluginNpmRuntimeDependency {
32
- type: "npm";
33
- package: string;
34
- version: string;
35
- }
36
- export interface PluginSystemRuntimeDependency {
37
- type: "system";
38
- package: string;
39
- }
40
- export interface PluginSystemRuntimeDependencyFromUrl {
41
- type: "system";
42
- url: string;
43
- sha256: string;
44
- }
45
- export type PluginRuntimeDependency = PluginNpmRuntimeDependency | PluginSystemRuntimeDependency | PluginSystemRuntimeDependencyFromUrl;
46
- export interface PluginRuntimePostinstallCommand {
47
- cmd: string;
48
- args?: string[];
49
- sudo?: boolean;
50
- }
51
33
  export interface PluginMcpHttpConfig {
52
34
  transport: "http";
53
35
  url: string;
@@ -148,4 +130,3 @@ export interface InlinePluginManifestDefinition {
148
130
  manifest: PluginManifest;
149
131
  packageName?: string;
150
132
  }
151
- export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Runtime ownership for plugin user pages.
3
+ *
4
+ * This module joins registered readers with the authenticated viewer and
5
+ * validates every plugin response before it reaches the dashboard.
6
+ */
7
+ import { type PluginUserPageContent, type PluginUserPageLink } from "@sentry/junior-plugin-api";
8
+ /** List safe navigation metadata for registered plugin user pages. */
9
+ export declare function readPluginUserPageLinks(): PluginUserPageLink[];
10
+ /** Read one registered plugin user page for the authenticated viewer. */
11
+ export declare function readPluginUserPage(input: {
12
+ email: string;
13
+ pageId: string;
14
+ pluginName: string;
15
+ }): Promise<PluginUserPageContent | undefined>;
@@ -0,0 +1,6 @@
1
+ import { type PluginUserPageActor } from "@sentry/junior-plugin-api";
2
+ import type { JuniorDatabase } from "@/db/db";
3
+ /** Resolve runtime-owned actors linked to a viewer email from SQL. */
4
+ export declare function readViewerActorsFromSql(db: JuniorDatabase, email: string): Promise<PluginUserPageActor[]>;
5
+ /** Resolve runtime-owned actors linked to the authenticated viewer. */
6
+ export declare function readViewerActors(email: string): Promise<PluginUserPageActor[]>;
@@ -1,6 +1,6 @@
1
1
  import type { SlackConversationContext } from "@/chat/slack/conversation-context";
2
2
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
3
- import type { SkillMetadata, SkillInvocation } from "@/chat/skills";
3
+ import type { SkillMetadata } from "@/chat/skills";
4
4
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
5
5
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
6
6
  import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
@@ -30,7 +30,6 @@ type TurnContextPromptInput = {
30
30
  plugin?: string;
31
31
  source: Source;
32
32
  };
33
- invocation: SkillInvocation | null;
34
33
  actor?: {
35
34
  userName?: string;
36
35
  fullName?: string;
@@ -3,3 +3,5 @@ export declare const SANDBOX_SKILLS_ROOT: string;
3
3
  export declare const SANDBOX_DATA_ROOT: string;
4
4
  export declare function sandboxSkillDir(skillName: string): string;
5
5
  export declare function sandboxSkillFile(skillName: string): string;
6
+ /** Explain how the agent should resolve files and commands owned by a skill. */
7
+ export declare function sandboxSkillPathResolution(skillName: string): string;
@@ -1,4 +1,4 @@
1
- import { type LogContext } from "@/chat/logging";
1
+ import { type LogContext, type SetSpanAttributes } from "@/chat/logging";
2
2
  import type { SandboxEgressSignalTransport } from "@/chat/sandbox/egress/signals";
3
3
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
4
4
  import type { CredentialContext } from "@/chat/credentials/context";
@@ -9,6 +9,8 @@ export interface SandboxToolCall {
9
9
  toolName: string;
10
10
  input: unknown;
11
11
  signal?: AbortSignal;
12
+ /** Add safe sandbox measurements to the caller-owned tool span. */
13
+ setToolCallSpanAttributes?: SetSpanAttributes;
12
14
  }
13
15
  export interface SandboxTools {
14
16
  supports(toolName: string): boolean;
@@ -0,0 +1,6 @@
1
+ import type { PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "@/chat/plugins/types";
2
+ import type { SandboxSession } from "@/chat/sandbox/workspace";
3
+ /** Install declared system and npm dependencies into a snapshot sandbox. */
4
+ export declare function dependencies(sandbox: SandboxSession, values: PluginRuntimeDependency[]): Promise<void>;
5
+ /** Run declared postinstall commands after dependency binaries are available. */
6
+ export declare function postinstall(sandbox: SandboxSession, commands: PluginRuntimePostinstallCommand[]): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import type { PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "@/chat/plugins/types";
2
+ export type Profile = {
3
+ hash: string;
4
+ dependencyCount: number;
5
+ floating: boolean;
6
+ dependencies: PluginRuntimeDependency[];
7
+ postinstall: PluginRuntimePostinstallCommand[];
8
+ };
9
+ /** Build the dependency profile that selects a reusable sandbox snapshot. */
10
+ export declare function create(runtime: string): Profile | null;
11
+ /** Return the current dependency profile hash without building its snapshot. */
12
+ export declare function hash(runtime: string): string | undefined;
13
+ /** Decide whether a cached snapshot has outlived a floating profile. */
14
+ export declare function isStale(profile: Profile, createdAtMs: number): boolean;