@sentry/junior 0.116.1 → 0.117.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 (67) hide show
  1. package/dist/{agent-hooks-GUAAS3XH.js → agent-hooks-5IK4LPLP.js} +8 -8
  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.js +1 -1
  7. package/dist/api.js +25 -12
  8. package/dist/app.js +32 -30
  9. package/dist/{catalog-runtime-WMPC4J4U.js → catalog-runtime-MTUYW3AA.js} +5 -5
  10. package/dist/chat/agent/prompt.d.ts +2 -0
  11. package/dist/chat/agent/request.d.ts +2 -1
  12. package/dist/chat/agent/resume.d.ts +2 -0
  13. package/dist/chat/agent/tools.d.ts +1 -0
  14. package/dist/chat/conversations/history.d.ts +22 -1
  15. package/dist/chat/conversations/projection.d.ts +6 -0
  16. package/dist/chat/mcp/client.d.ts +4 -0
  17. package/dist/chat/mcp/errors.d.ts +22 -1
  18. package/dist/chat/oauth-response.d.ts +21 -0
  19. package/dist/chat/plugins/prompt.d.ts +9 -0
  20. package/dist/chat/plugins/types.d.ts +2 -21
  21. package/dist/chat/sandbox/snapshot/install.d.ts +6 -0
  22. package/dist/chat/sandbox/snapshot/profile.d.ts +14 -0
  23. package/dist/chat/sandbox/snapshot/resolve.d.ts +22 -0
  24. package/dist/chat/sandbox/snapshot/span.d.ts +2 -0
  25. package/dist/chat/services/context-compaction-marker.d.ts +1 -0
  26. package/dist/chat/services/turn-session-record.d.ts +2 -0
  27. package/dist/chat/state/turn-session.d.ts +2 -0
  28. package/dist/chat/tools/query-conversation-events.d.ts +1 -1
  29. package/dist/chat/tools/sandbox/view-image.d.ts +11 -0
  30. package/dist/chat/tools/types.d.ts +7 -0
  31. package/dist/{chunk-RYFAVWP3.js → chunk-27KWTFP6.js} +33 -12
  32. package/dist/{chunk-N3C4XCRE.js → chunk-3GE3F4LT.js} +1 -1
  33. package/dist/{chunk-XA3VLFPK.js → chunk-5O3JDQDG.js} +154 -20
  34. package/dist/{chunk-CGXLCMWI.js → chunk-6G45D3YG.js} +114 -10
  35. package/dist/{chunk-F3SWGSPG.js → chunk-72Z3HNTQ.js} +1 -1
  36. package/dist/{chunk-DLLW5ITL.js → chunk-AKG4TZNH.js} +2 -2
  37. package/dist/{chunk-TC4ZEM2D.js → chunk-BFIRIZPH.js} +9 -0
  38. package/dist/{chunk-OY2PQQ4P.js → chunk-CU7HTGNI.js} +1 -1
  39. package/dist/{chunk-CY7NXM32.js → chunk-DS27ZBSP.js} +4 -2
  40. package/dist/{chunk-VBMMMVVQ.js → chunk-FAWBONPC.js} +404 -443
  41. package/dist/{chunk-7CSVG54J.js → chunk-KU6ALEJC.js} +1 -1
  42. package/dist/{chunk-H35BDAUS.js → chunk-LN765Y4N.js} +6 -6
  43. package/dist/{chunk-KNCELO2M.js → chunk-LUMEBOWC.js} +1 -1
  44. package/dist/{chunk-GDAXWEIJ.js → chunk-NHZEUHKH.js} +514 -344
  45. package/dist/{chunk-ZYHLNTC2.js → chunk-STUI6NIL.js} +78 -16
  46. package/dist/{chunk-2YYPXQNQ.js → chunk-W5JEQQEA.js} +1 -1
  47. package/dist/{chunk-JPKGW6L6.js → chunk-WEK3V5RI.js} +73 -32
  48. package/dist/{chunk-WLT72MRP.js → chunk-WUNPRM76.js} +1 -1
  49. package/dist/{chunk-FAEALXEH.js → chunk-YRWJ3KEU.js} +2 -2
  50. package/dist/{chunk-BFYVIOTS.js → chunk-ZRQUQJUV.js} +12 -2
  51. package/dist/cli/chat.js +21 -21
  52. package/dist/cli/check.js +6 -6
  53. package/dist/cli/main.js +1 -1
  54. package/dist/cli/plugins.js +11 -11
  55. package/dist/cli/{snapshot-warmup.js → snapshot-create.js} +17 -19
  56. package/dist/cli/upgrade.js +5 -5
  57. package/dist/{db-FH4R5ZQ4.js → db-J2ITKS63.js} +5 -5
  58. package/dist/handlers/oauth-html.d.ts +4 -2
  59. package/dist/instrumentation.js +2 -2
  60. package/dist/nitro.js +2 -2
  61. package/dist/{oauth-callback-server-C2SSJ3FQ.js → oauth-callback-server-NQYKBT24.js} +15 -15
  62. package/dist/{runner-NAALFIXM.js → runner-53V5GIQM.js} +10 -10
  63. package/dist/{skills-UN2JXYYF.js → skills-BU3ZMLVB.js} +6 -6
  64. package/dist/{validation-EEF4ROHR.js → validation-74EIKKE6.js} +6 -6
  65. package/dist/version.js +1 -1
  66. package/package.json +5 -5
  67. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +0 -20
@@ -11,22 +11,22 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-ZYHLNTC2.js";
15
- import "./chunk-7CSVG54J.js";
16
- import "./chunk-FAEALXEH.js";
17
- import "./chunk-BFYVIOTS.js";
14
+ } from "./chunk-STUI6NIL.js";
15
+ import "./chunk-KU6ALEJC.js";
16
+ import "./chunk-YRWJ3KEU.js";
17
+ import "./chunk-ZRQUQJUV.js";
18
18
  import "./chunk-RXRQJF7Y.js";
19
19
  import "./chunk-4ZNGQH7C.js";
20
- import "./chunk-CY7NXM32.js";
20
+ import "./chunk-DS27ZBSP.js";
21
21
  import "./chunk-VFUK3X5B.js";
22
22
  import "./chunk-FXOYURO4.js";
23
23
  import "./chunk-HZF5P5UN.js";
24
- import "./chunk-F3SWGSPG.js";
24
+ import "./chunk-72Z3HNTQ.js";
25
25
  import "./chunk-OB42YVAE.js";
26
26
  import "./chunk-F3B2YJ76.js";
27
27
  import "./chunk-6GWA276C.js";
28
- import "./chunk-WLT72MRP.js";
29
- import "./chunk-N3C4XCRE.js";
28
+ import "./chunk-WUNPRM76.js";
29
+ import "./chunk-3GE3F4LT.js";
30
30
  import "./chunk-MLKGABMK.js";
31
31
  export {
32
32
  PluginHookDeniedError,
@@ -137,6 +137,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
137
137
  agent: "agent";
138
138
  }>;
139
139
  }, import("zod/v4/core").$strict>], "state">, import("zod").ZodObject<{
140
+ type: import("zod").ZodLiteral<"turn_context">;
141
+ turnId: import("zod").ZodString;
142
+ pluginName: import("zod").ZodString;
143
+ kind: import("zod").ZodString;
144
+ version: import("zod").ZodNumber;
145
+ content: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
146
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
140
147
  type: import("zod").ZodLiteral<"turn_routed">;
141
148
  turnId: import("zod").ZodString;
142
149
  modelProfile: import("zod").ZodString;
@@ -54,6 +54,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
54
54
  agent: "agent";
55
55
  }>;
56
56
  }, import("zod/v4/core").$strict>], "state">, import("zod").ZodObject<{
57
+ type: import("zod").ZodLiteral<"turn_context">;
58
+ turnId: import("zod").ZodString;
59
+ pluginName: import("zod").ZodString;
60
+ kind: import("zod").ZodString;
61
+ version: import("zod").ZodNumber;
62
+ content: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
63
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
57
64
  type: import("zod").ZodLiteral<"turn_routed">;
58
65
  turnId: import("zod").ZodString;
59
66
  modelProfile: import("zod").ZodString;
@@ -1,7 +1,7 @@
1
1
  import type { ConversationEvent } from "@/chat/conversations/history";
2
2
  import { type ConversationReportEvent } from "../schema/conversation";
3
3
  /** Canonical event types that can contribute to the reporting projection. */
4
- export declare const conversationReportSourceEventTypes: readonly ["message", "message_handled", "assistant_message", "tool_result", "tool_execution_started", "turn_started", "turn_routed", "turn_completed", "turn_failed", "compaction", "handoff", "subagent_started", "subagent_ended"];
4
+ export declare const conversationReportSourceEventTypes: readonly ["message", "message_handled", "assistant_message", "tool_result", "tool_execution_started", "turn_started", "turn_context", "turn_routed", "turn_completed", "turn_failed", "compaction", "handoff", "subagent_started", "subagent_ended"];
5
5
  /** Return tool result ids that may need start metadata from outside a page. */
6
6
  export declare function conversationReportToolResultIds(events: ConversationEvent[]): string[];
7
7
  /**
@@ -153,6 +153,13 @@ export declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<
153
153
  agent: "agent";
154
154
  }>;
155
155
  }, z.core.$strict>], "state">, z.ZodObject<{
156
+ type: z.ZodLiteral<"turn_context">;
157
+ turnId: z.ZodString;
158
+ pluginName: z.ZodString;
159
+ kind: z.ZodString;
160
+ version: z.ZodNumber;
161
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
162
+ }, z.core.$strict>, z.ZodObject<{
156
163
  type: z.ZodLiteral<"turn_routed">;
157
164
  turnId: z.ZodString;
158
165
  modelProfile: z.ZodString;
@@ -250,6 +257,13 @@ export declare const conversationReportEventSchema: z.ZodObject<{
250
257
  agent: "agent";
251
258
  }>;
252
259
  }, z.core.$strict>], "state">, z.ZodObject<{
260
+ type: z.ZodLiteral<"turn_context">;
261
+ turnId: z.ZodString;
262
+ pluginName: z.ZodString;
263
+ kind: z.ZodString;
264
+ version: z.ZodNumber;
265
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
266
+ }, z.core.$strict>, z.ZodObject<{
253
267
  type: z.ZodLiteral<"turn_routed">;
254
268
  turnId: z.ZodString;
255
269
  modelProfile: z.ZodString;
@@ -458,6 +472,13 @@ export declare const conversationDetailReportSchema: z.ZodObject<{
458
472
  agent: "agent";
459
473
  }>;
460
474
  }, z.core.$strict>], "state">, z.ZodObject<{
475
+ type: z.ZodLiteral<"turn_context">;
476
+ turnId: z.ZodString;
477
+ pluginName: z.ZodString;
478
+ kind: z.ZodString;
479
+ version: z.ZodNumber;
480
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
481
+ }, z.core.$strict>, z.ZodObject<{
461
482
  type: z.ZodLiteral<"turn_routed">;
462
483
  turnId: z.ZodString;
463
484
  modelProfile: z.ZodString;
@@ -569,6 +590,13 @@ export declare const conversationEventPageSchema: z.ZodObject<{
569
590
  agent: "agent";
570
591
  }>;
571
592
  }, z.core.$strict>], "state">, z.ZodObject<{
593
+ type: z.ZodLiteral<"turn_context">;
594
+ turnId: z.ZodString;
595
+ pluginName: z.ZodString;
596
+ kind: z.ZodString;
597
+ version: z.ZodNumber;
598
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
599
+ }, z.core.$strict>, z.ZodObject<{
572
600
  type: z.ZodLiteral<"turn_routed">;
573
601
  turnId: z.ZodString;
574
602
  modelProfile: z.ZodString;
@@ -28,7 +28,7 @@ import {
28
28
  personalTokenMetadataSchema,
29
29
  personalTokenParamsSchema,
30
30
  revokePersonalTokenResponseSchema
31
- } from "../chunk-TC4ZEM2D.js";
31
+ } from "../chunk-BFIRIZPH.js";
32
32
  import {
33
33
  healthReportSchema,
34
34
  pluginOperationalReportFeedSchema,
package/dist/api.js CHANGED
@@ -23,12 +23,12 @@ import {
23
23
  personalTokenListSchema,
24
24
  personalTokenParamsSchema,
25
25
  revokePersonalTokenResponseSchema
26
- } from "./chunk-TC4ZEM2D.js";
26
+ } from "./chunk-BFIRIZPH.js";
27
27
  import {
28
28
  formatSlackConversationRedactedLabel,
29
29
  readHealthReport,
30
30
  resolveSlackConversationContextFromThreadId
31
- } from "./chunk-KNCELO2M.js";
31
+ } from "./chunk-LUMEBOWC.js";
32
32
  import {
33
33
  buildSentryConversationUrl
34
34
  } from "./chunk-4CODA7P5.js";
@@ -46,12 +46,12 @@ import {
46
46
  import "./chunk-PDO5BLNM.js";
47
47
  import {
48
48
  listConversationAnnotations
49
- } from "./chunk-FAEALXEH.js";
49
+ } from "./chunk-YRWJ3KEU.js";
50
50
  import {
51
51
  decodeStoredConversationEvent,
52
52
  getDb,
53
53
  getSqlExecutor
54
- } from "./chunk-BFYVIOTS.js";
54
+ } from "./chunk-ZRQUQJUV.js";
55
55
  import {
56
56
  juniorApiTokens,
57
57
  juniorConversationEvents,
@@ -60,7 +60,7 @@ import {
60
60
  juniorUsers
61
61
  } from "./chunk-RXRQJF7Y.js";
62
62
  import "./chunk-4ZNGQH7C.js";
63
- import "./chunk-CY7NXM32.js";
63
+ import "./chunk-DS27ZBSP.js";
64
64
  import {
65
65
  juniorDestinations
66
66
  } from "./chunk-VFUK3X5B.js";
@@ -68,12 +68,12 @@ import {
68
68
  canExposeConversationPayload,
69
69
  parseSlackThreadId
70
70
  } from "./chunk-FXOYURO4.js";
71
- import "./chunk-F3SWGSPG.js";
71
+ import "./chunk-72Z3HNTQ.js";
72
72
  import "./chunk-OB42YVAE.js";
73
73
  import "./chunk-F3B2YJ76.js";
74
74
  import "./chunk-6GWA276C.js";
75
- import "./chunk-WLT72MRP.js";
76
- import "./chunk-N3C4XCRE.js";
75
+ import "./chunk-WUNPRM76.js";
76
+ import "./chunk-3GE3F4LT.js";
77
77
  import "./chunk-MLKGABMK.js";
78
78
 
79
79
  // src/api.ts
@@ -353,6 +353,7 @@ var conversationReportSourceEventTypes = [
353
353
  "tool_result",
354
354
  "tool_execution_started",
355
355
  "turn_started",
356
+ "turn_context",
356
357
  "turn_routed",
357
358
  "turn_completed",
358
359
  "turn_failed",
@@ -483,6 +484,18 @@ function reportEventData(args) {
483
484
  turnId: data.turnId,
484
485
  state: "started"
485
486
  };
487
+ case "turn_context":
488
+ if (!args.canExposePayload) {
489
+ return void 0;
490
+ }
491
+ return {
492
+ type: "turn_context",
493
+ turnId: data.turnId,
494
+ pluginName: data.pluginName,
495
+ kind: data.kind,
496
+ version: data.version,
497
+ content: data.content
498
+ };
486
499
  case "turn_routed":
487
500
  return {
488
501
  type: "turn_routed",
@@ -1677,7 +1690,7 @@ function readDescriptionText(home) {
1677
1690
  }
1678
1691
  }
1679
1692
  async function readSkillReports() {
1680
- const { discoverSkills } = await import("./skills-UN2JXYYF.js");
1693
+ const { discoverSkills } = await import("./skills-BU3ZMLVB.js");
1681
1694
  const skills = await discoverSkills();
1682
1695
  return skillReportsSchema.parse(
1683
1696
  skills.map((skill) => ({
@@ -1687,7 +1700,7 @@ async function readSkillReports() {
1687
1700
  );
1688
1701
  }
1689
1702
  async function readPlugins() {
1690
- const { pluginCatalogRuntime } = await import("./catalog-runtime-WMPC4J4U.js");
1703
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-MTUYW3AA.js");
1691
1704
  return pluginsSchema.parse(
1692
1705
  pluginCatalogRuntime.getProviders().map((plugin) => ({
1693
1706
  configKeys: plugin.manifest.configKeys ?? [],
@@ -1700,7 +1713,7 @@ async function readPlugins() {
1700
1713
  async function readRuntimeInfoReport() {
1701
1714
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
1702
1715
  import("./discovery-RMHYSRL7.js"),
1703
- import("./catalog-runtime-WMPC4J4U.js"),
1716
+ import("./catalog-runtime-MTUYW3AA.js"),
1704
1717
  readPlugins(),
1705
1718
  readSkillReports()
1706
1719
  ]);
@@ -1716,7 +1729,7 @@ async function readRuntimeInfoReport() {
1716
1729
  }
1717
1730
  async function readPluginOperationalReportFeed() {
1718
1731
  const nowMs = Date.now();
1719
- const { getPluginOperationalReports } = await import("./agent-hooks-GUAAS3XH.js");
1732
+ const { getPluginOperationalReports } = await import("./agent-hooks-5IK4LPLP.js");
1720
1733
  return pluginOperationalReportFeedSchema.parse({
1721
1734
  source: "plugins",
1722
1735
  generatedAt: new Date(nowMs).toISOString(),
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-WEK3V5RI.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-LN765Y4N.js";
67
67
  import {
68
68
  GET,
69
69
  conversationVisibilityFromSlackChannelType,
70
70
  resolveSlackChannelTypeFromMessage,
71
71
  resolveSlackConversationContext
72
- } from "./chunk-KNCELO2M.js";
72
+ } from "./chunk-LUMEBOWC.js";
73
73
  import "./chunk-4CODA7P5.js";
74
74
  import "./chunk-PE44LDDQ.js";
75
75
  import {
@@ -88,7 +88,7 @@ import {
88
88
  import {
89
89
  validatePluginEgressCredentialHooks,
90
90
  validatePluginRegistrations
91
- } from "./chunk-2YYPXQNQ.js";
91
+ } from "./chunk-W5JEQQEA.js";
92
92
  import {
93
93
  defineJuniorPlugins,
94
94
  pluginCatalogConfigFromEnv,
@@ -121,7 +121,7 @@ import {
121
121
  setConfigDefaults,
122
122
  shouldEmitDevAgentTrace,
123
123
  shouldPropagateSandboxEgressTrace
124
- } from "./chunk-GDAXWEIJ.js";
124
+ } from "./chunk-NHZEUHKH.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-6G45D3YG.js";
138
138
  import {
139
139
  ConversationTurnBoundaryError,
140
140
  CooperativeTurnYieldError,
@@ -188,9 +188,9 @@ import {
188
188
  trimTrailingAssistantMessages,
189
189
  updateConversationStats,
190
190
  upsertConversationMessage
191
- } from "./chunk-RYFAVWP3.js";
191
+ } from "./chunk-27KWTFP6.js";
192
192
  import "./chunk-HDSDCEPK.js";
193
- import "./chunk-VBMMMVVQ.js";
193
+ import "./chunk-FAWBONPC.js";
194
194
  import "./chunk-MU6HHZEN.js";
195
195
  import "./chunk-PDO5BLNM.js";
196
196
  import "./chunk-UIE3R5XU.js";
@@ -207,11 +207,11 @@ import {
207
207
  validatePlugins,
208
208
  verifyScheduledTaskCredentialSubject,
209
209
  verifySlackDirectCredentialSubject
210
- } from "./chunk-ZYHLNTC2.js";
210
+ } from "./chunk-STUI6NIL.js";
211
211
  import {
212
212
  acquireActiveLock,
213
213
  getStateAdapter
214
- } from "./chunk-7CSVG54J.js";
214
+ } from "./chunk-KU6ALEJC.js";
215
215
  import {
216
216
  SlackActionError,
217
217
  downloadPrivateSlackFile,
@@ -221,7 +221,7 @@ import {
221
221
  normalizeSlackConversationId,
222
222
  runWithSlackInstallationToken,
223
223
  runWithWorkspaceTeamId
224
- } from "./chunk-FAEALXEH.js";
224
+ } from "./chunk-YRWJ3KEU.js";
225
225
  import {
226
226
  contextProvenance,
227
227
  createSlackDestination,
@@ -232,7 +232,7 @@ import {
232
232
  instructionProvenanceFor,
233
233
  requireSlackDestination,
234
234
  withConversationEventLock
235
- } from "./chunk-BFYVIOTS.js";
235
+ } from "./chunk-ZRQUQJUV.js";
236
236
  import {
237
237
  juniorConversationEvents,
238
238
  juniorConversations
@@ -257,18 +257,18 @@ import {
257
257
  modelIdForProfile,
258
258
  setSlackReactionConfig,
259
259
  standardModelId
260
- } from "./chunk-CY7NXM32.js";
260
+ } from "./chunk-DS27ZBSP.js";
261
261
  import {
262
262
  juniorDestinations
263
263
  } from "./chunk-VFUK3X5B.js";
264
264
  import {
265
265
  parseSlackThreadId
266
266
  } from "./chunk-FXOYURO4.js";
267
- import "./chunk-DLLW5ITL.js";
267
+ import "./chunk-AKG4TZNH.js";
268
268
  import {
269
269
  pluginCatalogRuntime
270
- } from "./chunk-OY2PQQ4P.js";
271
- import "./chunk-XA3VLFPK.js";
270
+ } from "./chunk-CU7HTGNI.js";
271
+ import "./chunk-5O3JDQDG.js";
272
272
  import {
273
273
  credentialSubjectSchema
274
274
  } from "./chunk-W3U3YQYI.js";
@@ -294,7 +294,7 @@ import {
294
294
  setTags,
295
295
  withContext,
296
296
  withSpan
297
- } from "./chunk-F3SWGSPG.js";
297
+ } from "./chunk-72Z3HNTQ.js";
298
298
  import {
299
299
  toOptionalString
300
300
  } from "./chunk-OB42YVAE.js";
@@ -309,10 +309,10 @@ import "./chunk-B3IT5END.js";
309
309
  import "./chunk-3V7OFJZC.js";
310
310
  import {
311
311
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
312
- } from "./chunk-WLT72MRP.js";
312
+ } from "./chunk-WUNPRM76.js";
313
313
  import {
314
314
  JUNIOR_VERSION
315
- } from "./chunk-N3C4XCRE.js";
315
+ } from "./chunk-3GE3F4LT.js";
316
316
  import "./chunk-MLKGABMK.js";
317
317
 
318
318
  // src/app.ts
@@ -4882,26 +4882,27 @@ function getSubscribedReplyPreflightDecision(args) {
4882
4882
  };
4883
4883
  }
4884
4884
  function buildRouterSystemPrompt(botUserName) {
4885
+ const assistantName = escapeXml(botUserName);
4885
4886
  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.",
4887
+ `You are a message router for a Slack assistant named ${assistantName} in a subscribed Slack thread.`,
4888
+ `Decide whether ${assistantName} should reply to the latest message.`,
4888
4889
  "Subscribed threads are passive by default.",
4889
- "Reply true only when the latest message is aimed at Junior.",
4890
+ `Reply true only when the latest message is aimed at ${assistantName}.`,
4890
4891
  "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.",
4892
+ `If ${assistantName} was the last speaker, only a clear turn back to ${assistantName} should count as an implicit follow-up.`,
4893
+ `Terse clarifications like 'which one?' or 'why?' right after ${assistantName} answers can be should_reply=true.`,
4894
+ `Direct self-reference to ${assistantName}'s prior answer like 'what did you just say?' or 'explain that more' can be should_reply=true.`,
4895
+ `If one or more humans spoke after ${assistantName}, require a clear turn back to ${assistantName}. Shared domain vocabulary alone is not enough.`,
4896
+ `Questions like 'what about auth?' or 'can you check on this?' are usually human-to-human unless the thread clearly turns back to ${assistantName}.`,
4897
+ `A vague question like 'is that the right approach?' is still should_reply=false unless it clearly turns back to ${assistantName}.`,
4897
4898
  "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.",
4899
+ `If the latest message clearly tells ${assistantName} to stop watching, replying, or participating, set should_unsubscribe=true and should_reply=false.`,
4899
4900
  "When uncertain, prefer should_reply=false with low confidence.",
4900
4901
  "",
4901
4902
  "Return JSON with should_reply, should_unsubscribe, confidence, and a reason under 160 characters.",
4902
4903
  "Do not return any extra keys.",
4903
4904
  "",
4904
- `<assistant-name>${escapeXml(botUserName)}</assistant-name>`
4905
+ `<assistant-name>${assistantName}</assistant-name>`
4905
4906
  ].join("\n");
4906
4907
  }
4907
4908
  async function decideSubscribedThreadReply(args) {
@@ -9525,6 +9526,7 @@ function dashboardRouteRegistrations(args) {
9525
9526
  const fetch2 = (request) => {
9526
9527
  app ??= args.createDashboardApp({
9527
9528
  ...args.dashboard,
9529
+ agentName: botConfig.userName,
9528
9530
  pluginRoutes: args.pluginRoutes
9529
9531
  });
9530
9532
  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-CU7HTGNI.js";
4
+ import "./chunk-5O3JDQDG.js";
5
5
  import "./chunk-W3U3YQYI.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
- import "./chunk-F3SWGSPG.js";
7
+ import "./chunk-72Z3HNTQ.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-WUNPRM76.js";
14
+ import "./chunk-3GE3F4LT.js";
15
15
  import "./chunk-MLKGABMK.js";
16
16
  export {
17
17
  pluginCatalogRuntime
@@ -7,6 +7,7 @@ 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,6 +33,7 @@ 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.
@@ -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;