@sentry/junior 0.159.0 → 0.161.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 (82) hide show
  1. package/dist/{agent-hooks-IAD3AANZ.js → agent-hooks-O75UJNC6.js} +13 -10
  2. package/dist/api/conversations/events.d.ts +1 -1
  3. package/dist/api/locations/detail.d.ts +17 -0
  4. package/dist/api/people/plugin-reports.d.ts +7 -0
  5. package/dist/api/schema/conversation.d.ts +109 -8
  6. package/dist/api/schema/location.d.ts +29 -0
  7. package/dist/api/schema/person.d.ts +29 -0
  8. package/dist/api/schema.js +1 -1
  9. package/dist/api.js +137 -27
  10. package/dist/app.js +73 -42
  11. package/dist/{catalog-runtime-6VANKLH5.js → catalog-runtime-Z3FHU4ZY.js} +5 -5
  12. package/dist/chat/artifacts/store.d.ts +42 -0
  13. package/dist/chat/conversations/history.d.ts +31 -1
  14. package/dist/chat/conversations/projection.d.ts +13 -0
  15. package/dist/chat/plugins/agent-hooks.d.ts +9 -1
  16. package/dist/chat/plugins/annotations.d.ts +3 -0
  17. package/dist/chat/plugins/conversation-sidebar.d.ts +3 -0
  18. package/dist/chat/plugins/viewer.d.ts +4 -0
  19. package/dist/chat/slack/mrkdwn.d.ts +3 -4
  20. package/dist/chat/slack/tools/send-files.d.ts +2 -2
  21. package/dist/chat/tool-support/action-review.d.ts +5 -4
  22. package/dist/chat/tools/publish-image.d.ts +44 -0
  23. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  24. package/dist/chat/tools/unpublish-image.d.ts +35 -0
  25. package/dist/{chunk-YSMAMSOU.js → chunk-4WAZ6DGX.js} +10 -10
  26. package/dist/{chunk-AIQKUJKK.js → chunk-6ILVZOF6.js} +4 -4
  27. package/dist/{chunk-YCBZ47LC.js → chunk-6WTDZKFR.js} +1 -1
  28. package/dist/{chunk-CNHELV2P.js → chunk-CGAIDDLD.js} +1 -1
  29. package/dist/{chunk-U7D4VLUF.js → chunk-DGKLYDX7.js} +2 -2
  30. package/dist/{chunk-TD7ZQZ5W.js → chunk-DNSIU27S.js} +1 -1
  31. package/dist/{chunk-PT7B6A3O.js → chunk-EAIQBR66.js} +1 -1
  32. package/dist/{chunk-O2DZWUPQ.js → chunk-FLMD25Y5.js} +239 -199
  33. package/dist/{chunk-FWDN67U3.js → chunk-G35DUPNB.js} +4 -4
  34. package/dist/{chunk-UG673UVL.js → chunk-HSFYTIS2.js} +1 -1
  35. package/dist/{chunk-WTQ3CKC3.js → chunk-IRHX2S46.js} +1 -1
  36. package/dist/{chunk-DXSZJAVZ.js → chunk-IW7C5C7E.js} +19 -21
  37. package/dist/{chunk-Q5X37U6G.js → chunk-IYFKONIL.js} +1 -1
  38. package/dist/{chunk-EBP6IS66.js → chunk-MNY5M7RB.js} +537 -27
  39. package/dist/{chunk-6IADZQJR.js → chunk-MVG5UPLM.js} +1 -1
  40. package/dist/{chunk-27UQ7UB3.js → chunk-O7JTSJPU.js} +6 -6
  41. package/dist/{chunk-NCJV265M.js → chunk-OPIJ6HY3.js} +9 -9
  42. package/dist/{chunk-X7AIXRVJ.js → chunk-OY2DBUV4.js} +5 -5
  43. package/dist/{chunk-SQOVZSWF.js → chunk-OYQEO72I.js} +480 -125
  44. package/dist/{chunk-UP6KQVF5.js → chunk-QHXT7LLF.js} +1 -1
  45. package/dist/{chunk-UKKOKMRE.js → chunk-QQ7SY5IZ.js} +5 -5
  46. package/dist/{chunk-PQWWCKNB.js → chunk-RULQD7OX.js} +4 -4
  47. package/dist/{chunk-L2PEQ2PY.js → chunk-RVENVPNO.js} +2 -2
  48. package/dist/{chunk-EQXVKNLM.js → chunk-SA6BEEAB.js} +27 -9
  49. package/dist/{chunk-54O6IKUS.js → chunk-STZVUVMS.js} +40 -4
  50. package/dist/{chunk-QODFNKQS.js → chunk-U2XOBFDK.js} +17 -3
  51. package/dist/{chunk-AZW5HKC5.js → chunk-V67ORYKQ.js} +8 -10
  52. package/dist/{chunk-DJZPA72K.js → chunk-VXFDVY4C.js} +8 -36
  53. package/dist/{chunk-LUIKMY35.js → chunk-WKN4ZQTZ.js} +1 -1
  54. package/dist/{chunk-OGMHLKNO.js → chunk-WVSQ2SCS.js} +1 -1
  55. package/dist/{chunk-IJ6KWS3V.js → chunk-YSWHAOPQ.js} +1 -1
  56. package/dist/{chunk-NT6V5WEE.js → chunk-ZBCLWBMV.js} +5 -5
  57. package/dist/cli/chat.js +29 -30
  58. package/dist/cli/check.js +6 -6
  59. package/dist/cli/plugins.js +12 -13
  60. package/dist/cli/snapshot-create.js +9 -9
  61. package/dist/cli/upgrade.js +7 -7
  62. package/dist/db/schema/artifacts.d.ts +178 -0
  63. package/dist/db/schema.d.ts +179 -1
  64. package/dist/{db-BIIMAPFB.js → db-KKOZRE62.js} +7 -7
  65. package/dist/handlers/artifacts.d.ts +8 -0
  66. package/dist/instrumentation.js +4 -4
  67. package/dist/nitro.js +2 -2
  68. package/dist/{oauth-callback-server-4BENCPP3.js → oauth-callback-server-5AUZDWXA.js} +22 -23
  69. package/dist/{runner-TUBJLEYO.js → runner-K5H5NDEC.js} +12 -13
  70. package/dist/{skills-MBRLNBRV.js → skills-OZGPB6G4.js} +6 -6
  71. package/dist/spawn-RCQSC2L5.js +37 -0
  72. package/dist/{validation-YTJGRJYT.js → validation-TVHCNCYL.js} +6 -6
  73. package/dist/version.js +1 -1
  74. package/dist/{work-5MRHKA54.js → work-DXCQMJ5U.js} +17 -17
  75. package/dist/worker-24HZ5HRI.js +24 -0
  76. package/migrations/0028_artifacts.sql +16 -0
  77. package/migrations/meta/0028_snapshot.json +2685 -0
  78. package/migrations/meta/_journal.json +8 -1
  79. package/package.json +4 -4
  80. package/dist/chunk-K2LAI7RW.js +0 -441
  81. package/dist/spawn-ZWIXA46E.js +0 -37
  82. package/dist/worker-S2V7HZJ4.js +0 -24
package/dist/api.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  taskListSchema,
37
37
  taskParamsSchema,
38
38
  taskRunListSchema
39
- } from "./chunk-EQXVKNLM.js";
39
+ } from "./chunk-SA6BEEAB.js";
40
40
  import {
41
41
  appendAndEnqueueApiConversationMessage,
42
42
  createAndEnqueueApiConversation,
@@ -46,15 +46,15 @@ import {
46
46
  readHealthReport,
47
47
  resolveSlackConversationContextFromThreadId,
48
48
  webActorFromEmail
49
- } from "./chunk-YSMAMSOU.js";
49
+ } from "./chunk-4WAZ6DGX.js";
50
50
  import {
51
51
  buildSentryConversationUrl,
52
52
  getWebAuthorization
53
- } from "./chunk-UG673UVL.js";
53
+ } from "./chunk-HSFYTIS2.js";
54
54
  import {
55
55
  cancelHumanFacingPendingMessages,
56
56
  getConversation
57
- } from "./chunk-FWDN67U3.js";
57
+ } from "./chunk-G35DUPNB.js";
58
58
  import {
59
59
  readTaskExecutionByConversationId,
60
60
  readTaskExecutionDays,
@@ -62,8 +62,8 @@ import {
62
62
  readTaskExecutionSummaries,
63
63
  readTaskExecutions,
64
64
  readTaskRuns
65
- } from "./chunk-NCJV265M.js";
66
- import "./chunk-UKKOKMRE.js";
65
+ } from "./chunk-OPIJ6HY3.js";
66
+ import "./chunk-QQ7SY5IZ.js";
67
67
  import {
68
68
  healthReportSchema,
69
69
  pluginOperationalReportFeedSchema,
@@ -88,30 +88,30 @@ import {
88
88
  listPublicScheduledTasksForTeams,
89
89
  readLiveAttachment,
90
90
  readStats
91
- } from "./chunk-NT6V5WEE.js";
91
+ } from "./chunk-ZBCLWBMV.js";
92
92
  import {
93
93
  parseSlackThreadId
94
- } from "./chunk-IJ6KWS3V.js";
94
+ } from "./chunk-YSWHAOPQ.js";
95
95
  import {
96
96
  agentTurnUsageSchema,
97
97
  fallbackShortTitle,
98
98
  hasAgentTurnUsage,
99
99
  renderJuniorNativeConversationEvent
100
- } from "./chunk-54O6IKUS.js";
100
+ } from "./chunk-STZVUVMS.js";
101
101
  import "./chunk-3Y47VMHV.js";
102
102
  import "./chunk-PDO5BLNM.js";
103
103
  import {
104
104
  createPluginLogger,
105
+ findUserByEmail,
105
106
  getPlugins,
107
+ getSlackClient,
106
108
  listConversationAnnotations,
109
+ listConversationAnnotationsById,
107
110
  renderPluginConversationEvent,
108
111
  resolveViewerUser,
109
- updateViewerDisplayName
110
- } from "./chunk-EBP6IS66.js";
111
- import {
112
- getSlackClient,
112
+ updateViewerDisplayName,
113
113
  withSlackRetries
114
- } from "./chunk-K2LAI7RW.js";
114
+ } from "./chunk-MNY5M7RB.js";
115
115
  import {
116
116
  decodeStoredConversationEvent,
117
117
  getConversationStore,
@@ -119,7 +119,7 @@ import {
119
119
  getSqlExecutor,
120
120
  locationFromRow,
121
121
  parseSessionSource
122
- } from "./chunk-QODFNKQS.js";
122
+ } from "./chunk-U2XOBFDK.js";
123
123
  import {
124
124
  juniorApiTokens,
125
125
  juniorConversationEvents,
@@ -127,16 +127,16 @@ import {
127
127
  juniorConversations,
128
128
  juniorIdentities,
129
129
  juniorUsers
130
- } from "./chunk-O2DZWUPQ.js";
130
+ } from "./chunk-FLMD25Y5.js";
131
131
  import "./chunk-EM225ITJ.js";
132
- import "./chunk-Q5X37U6G.js";
133
- import "./chunk-L2PEQ2PY.js";
132
+ import "./chunk-IYFKONIL.js";
133
+ import "./chunk-RVENVPNO.js";
134
134
  import {
135
135
  juniorDestinations
136
136
  } from "./chunk-VFUK3X5B.js";
137
137
  import {
138
138
  canExposeConversationPayload
139
- } from "./chunk-PT7B6A3O.js";
139
+ } from "./chunk-EAIQBR66.js";
140
140
  import "./chunk-BDUENQD3.js";
141
141
  import {
142
142
  parseSlackChannelId,
@@ -146,10 +146,10 @@ import {
146
146
  import {
147
147
  logException,
148
148
  logWarn
149
- } from "./chunk-TD7ZQZ5W.js";
149
+ } from "./chunk-DNSIU27S.js";
150
150
  import "./chunk-6GWA276C.js";
151
- import "./chunk-OGMHLKNO.js";
152
- import "./chunk-LUIKMY35.js";
151
+ import "./chunk-WVSQ2SCS.js";
152
+ import "./chunk-WKN4ZQTZ.js";
153
153
  import "./chunk-MLKGABMK.js";
154
154
 
155
155
  // src/api.ts
@@ -768,6 +768,7 @@ var conversationReportSourceEventTypes = [
768
768
  "turn_started",
769
769
  "turn_context",
770
770
  "structured_event",
771
+ "attachments_delivered",
771
772
  "turn_routed",
772
773
  "turn_completed",
773
774
  "turn_failed",
@@ -987,6 +988,14 @@ function reportEventData(args) {
987
988
  version: data.version,
988
989
  content: data.content
989
990
  };
991
+ case "attachments_delivered":
992
+ if (!args.canExposePayload) {
993
+ return void 0;
994
+ }
995
+ return {
996
+ type: "attachments_delivered",
997
+ attachments: data.attachments
998
+ };
990
999
  case "turn_routed":
991
1000
  return {
992
1001
  type: "turn_routed",
@@ -1651,6 +1660,53 @@ async function readConversationAuxiliaryCostsFromSql(db, conversationIds, option
1651
1660
  return result;
1652
1661
  }
1653
1662
 
1663
+ // src/chat/plugins/conversation-sidebar.ts
1664
+ import {
1665
+ conversationSidebarAnnotationSchema
1666
+ } from "@sentry/junior-plugin-api";
1667
+ async function listConversationSidebarAnnotations(conversationIds, annotationsByConversation) {
1668
+ const candidates = new Set(conversationIds);
1669
+ const selected = {};
1670
+ for (const plugin of getPlugins()) {
1671
+ const hook = plugin.hooks?.conversationSidebar;
1672
+ if (!hook) continue;
1673
+ const annotationsByConversationId = Object.fromEntries(
1674
+ conversationIds.flatMap((conversationId) => {
1675
+ const annotations = (annotationsByConversation.get(conversationId) ?? []).filter(
1676
+ (annotation) => annotation.plugin === plugin.manifest.name
1677
+ );
1678
+ return annotations.length > 0 ? [[conversationId, annotations]] : [];
1679
+ })
1680
+ );
1681
+ try {
1682
+ const result = await hook({
1683
+ annotationsByConversationId,
1684
+ conversationIds,
1685
+ db: getDb(),
1686
+ log: createPluginLogger(plugin.manifest.name),
1687
+ plugin: { name: plugin.manifest.name }
1688
+ });
1689
+ for (const [conversationId, annotations] of Object.entries(
1690
+ result.annotationsByConversationId
1691
+ )) {
1692
+ if (!candidates.has(conversationId)) continue;
1693
+ const parsed = conversationSidebarAnnotationSchema.array().safeParse(annotations);
1694
+ if (!parsed.success || parsed.data.length === 0) continue;
1695
+ selected[conversationId] = [
1696
+ ...selected[conversationId] ?? [],
1697
+ ...parsed.data
1698
+ ];
1699
+ }
1700
+ } catch (error) {
1701
+ logWarn("plugin.conversation_sidebar.hook.failed", {
1702
+ "app.plugin.name": plugin.manifest.name,
1703
+ "exception.message": error instanceof Error ? error.message : String(error)
1704
+ });
1705
+ }
1706
+ }
1707
+ return selected;
1708
+ }
1709
+
1654
1710
  // src/chat/plugins/unfinished-work.ts
1655
1711
  async function listConversationWork(conversationIds) {
1656
1712
  if (conversationIds.length === 0) {
@@ -1901,6 +1957,7 @@ async function readConversationFeedFromSql(options = {}) {
1901
1957
  );
1902
1958
  const [
1903
1959
  accessByConversation,
1960
+ annotationsByConversation,
1904
1961
  auxiliaryCostsByRoot,
1905
1962
  metricsByRoot,
1906
1963
  teamDomainByTeamId,
@@ -1908,6 +1965,7 @@ async function readConversationFeedFromSql(options = {}) {
1908
1965
  lastUserMessageAtByConversation
1909
1966
  ] = await Promise.all([
1910
1967
  readConversationAccessFromSql(db, conversationIds, options.viewer),
1968
+ listConversationAnnotationsById(db, conversationIds),
1911
1969
  readConversationAuxiliaryCostsFromSql(db, conversationIds, {
1912
1970
  includeDescendants: true
1913
1971
  }),
@@ -1920,15 +1978,26 @@ async function readConversationFeedFromSql(options = {}) {
1920
1978
  listConversationWork(conversationIds),
1921
1979
  readLastUserMessageAtByConversation(db, conversationIds)
1922
1980
  ]);
1981
+ const visibleAnnotationsByConversation = new Map(
1982
+ conversationIds.map((conversationId) => [
1983
+ conversationId,
1984
+ accessByConversation.get(conversationId)?.canViewPrivateContent ? annotationsByConversation.get(conversationId) ?? [] : []
1985
+ ])
1986
+ );
1987
+ const sidebarAnnotationsByConversation = await listConversationSidebarAnnotations(
1988
+ conversationIds,
1989
+ visibleAnnotationsByConversation
1990
+ );
1923
1991
  const assignedWork = new Set(conversationWork.assignedIds);
1924
1992
  const unfinishedWork = new Set(conversationWork.unfinishedIds);
1925
1993
  return {
1926
1994
  conversations: conversations.map((conversation, index) => {
1927
1995
  const row = rows[index];
1996
+ const access = accessByConversation.get(conversation.conversationId);
1928
1997
  const metrics = metricsByRoot.get(conversation.conversationId);
1929
1998
  const summary = conversationSummaryFromStoredConversation({
1930
1999
  conversation,
1931
- access: accessByConversation.get(conversation.conversationId),
2000
+ access,
1932
2001
  auxiliaryCosts: auxiliaryCostsByRoot.get(conversation.conversationId),
1933
2002
  durationMs: metrics?.durationMs ?? row.conversation.durationMs,
1934
2003
  teamDomainByTeamId,
@@ -1942,9 +2011,14 @@ async function readConversationFeedFromSql(options = {}) {
1942
2011
  } : {},
1943
2012
  ...unfinishedWork.has(conversation.conversationId) ? { unfinishedWork: true } : {}
1944
2013
  };
2014
+ const annotations = access?.canViewPrivateContent ? annotationsByConversation.get(conversation.conversationId) ?? [] : [];
1945
2015
  return {
1946
2016
  ...summary,
1947
2017
  ...work,
2018
+ ...annotations.length > 0 ? { annotations } : {},
2019
+ ...sidebarAnnotationsByConversation[conversation.conversationId] ? {
2020
+ sidebarAnnotations: sidebarAnnotationsByConversation[conversation.conversationId]
2021
+ } : {},
1948
2022
  isPriority: isConversationPriority(
1949
2023
  {
1950
2024
  lastSeenAt: summary.lastSeenAt,
@@ -4091,6 +4165,29 @@ async function readPeopleList() {
4091
4165
  return actorDirectoryReportSchema.parse(await readPeopleListFromSql());
4092
4166
  }
4093
4167
 
4168
+ // src/api/people/plugin-reports.ts
4169
+ async function readPeoplePluginReports(args) {
4170
+ const nowMs = Date.now();
4171
+ const subject = await findUserByEmail(args.email);
4172
+ if (!subject) {
4173
+ return pluginOperationalReportFeedSchema.parse({
4174
+ generatedAt: new Date(nowMs).toISOString(),
4175
+ reports: [],
4176
+ source: "plugins"
4177
+ });
4178
+ }
4179
+ const { getPluginProfileReports } = await import("./agent-hooks-O75UJNC6.js");
4180
+ return pluginOperationalReportFeedSchema.parse({
4181
+ generatedAt: new Date(nowMs).toISOString(),
4182
+ reports: await getPluginProfileReports({
4183
+ nowMs,
4184
+ subject,
4185
+ viewer: args.viewer
4186
+ }),
4187
+ source: "plugins"
4188
+ });
4189
+ }
4190
+
4094
4191
  // src/api/people/profile.query.ts
4095
4192
  import { and as and14, eq as eq15, gte as gte4, sql as sql11 } from "drizzle-orm";
4096
4193
  function emptyProfile(email, nowMs) {
@@ -4378,6 +4475,19 @@ function createPeopleRoutes() {
4378
4475
  "/",
4379
4476
  async () => jsonResponse(actorDirectoryReportSchema, await readPeopleList())
4380
4477
  );
4478
+ app.get(
4479
+ "/:email/plugin-reports",
4480
+ requireViewer,
4481
+ validateRequest("param", personParamsSchema, "Invalid route parameters."),
4482
+ async (context) => {
4483
+ const { email } = context.req.valid("param");
4484
+ const viewer = context.get("viewer");
4485
+ return jsonResponse(
4486
+ pluginOperationalReportFeedSchema,
4487
+ await readPeoplePluginReports({ email, viewer })
4488
+ );
4489
+ }
4490
+ );
4381
4491
  app.get(
4382
4492
  "/:email",
4383
4493
  validateRequest("param", personParamsSchema, "Invalid route parameters."),
@@ -4724,7 +4834,7 @@ function readDescriptionText(home) {
4724
4834
  }
4725
4835
  }
4726
4836
  async function readSkillReports() {
4727
- const { discoverSkills } = await import("./skills-MBRLNBRV.js");
4837
+ const { discoverSkills } = await import("./skills-OZGPB6G4.js");
4728
4838
  const skills = await discoverSkills();
4729
4839
  return skillReportsSchema.parse(
4730
4840
  skills.map((skill) => ({
@@ -4734,7 +4844,7 @@ async function readSkillReports() {
4734
4844
  );
4735
4845
  }
4736
4846
  async function readPlugins() {
4737
- const { pluginCatalogRuntime } = await import("./catalog-runtime-6VANKLH5.js");
4847
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-Z3FHU4ZY.js");
4738
4848
  return pluginsSchema.parse(
4739
4849
  pluginCatalogRuntime.getProviders().map((plugin) => ({
4740
4850
  configKeys: plugin.manifest.configKeys ?? [],
@@ -4747,7 +4857,7 @@ async function readPlugins() {
4747
4857
  async function readRuntimeInfoReport() {
4748
4858
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4749
4859
  import("./discovery-GUFTFBTL.js"),
4750
- import("./catalog-runtime-6VANKLH5.js"),
4860
+ import("./catalog-runtime-Z3FHU4ZY.js"),
4751
4861
  readPlugins(),
4752
4862
  readSkillReports()
4753
4863
  ]);
@@ -4763,7 +4873,7 @@ async function readRuntimeInfoReport() {
4763
4873
  }
4764
4874
  async function readPluginOperationalReportFeed() {
4765
4875
  const nowMs = Date.now();
4766
- const { getPluginOperationalReports } = await import("./agent-hooks-IAD3AANZ.js");
4876
+ const { getPluginOperationalReports } = await import("./agent-hooks-O75UJNC6.js");
4767
4877
  return pluginOperationalReportFeedSchema.parse({
4768
4878
  source: "plugins",
4769
4879
  generatedAt: new Date(nowMs).toISOString(),
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-AIQKUJKK.js";
3
+ } from "./chunk-6ILVZOF6.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-UP6KQVF5.js";
6
+ } from "./chunk-QHXT7LLF.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-27UQ7UB3.js";
12
+ } from "./chunk-O7JTSJPU.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,12 +36,12 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-DXSZJAVZ.js";
39
+ } from "./chunk-IW7C5C7E.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-WTQ3CKC3.js";
44
+ } from "./chunk-IRHX2S46.js";
45
45
  import {
46
46
  GET,
47
47
  conversationVisibilityFromSlackChannelType,
@@ -51,8 +51,8 @@ import {
51
51
  resolveSlackChannelTypeFromMessage,
52
52
  resolveSlackConversationContext,
53
53
  routeApiTurnWork
54
- } from "./chunk-YSMAMSOU.js";
55
- import "./chunk-UG673UVL.js";
54
+ } from "./chunk-4WAZ6DGX.js";
55
+ import "./chunk-HSFYTIS2.js";
56
56
  import {
57
57
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
58
58
  appendAndEnqueueInboundMessage,
@@ -63,7 +63,7 @@ import {
63
63
  isInvalidConversationRecordError,
64
64
  listActiveConversationIds,
65
65
  removeActiveConversation
66
- } from "./chunk-FWDN67U3.js";
66
+ } from "./chunk-G35DUPNB.js";
67
67
  import {
68
68
  buildDeliveredTurnStatePatch,
69
69
  claimDispatchMailboxAppend,
@@ -94,7 +94,7 @@ import {
94
94
  requireTurnFailureEventId,
95
95
  resolveTurnSessionRouting,
96
96
  scheduleSessionCompletedPluginTasks
97
- } from "./chunk-NCJV265M.js";
97
+ } from "./chunk-OPIJ6HY3.js";
98
98
  import {
99
99
  ConversationTurnLifecycleService,
100
100
  coerceThreadConversationState,
@@ -104,7 +104,7 @@ import {
104
104
  persistThreadRuntimeState,
105
105
  persistThreadState,
106
106
  persistThreadStateById
107
- } from "./chunk-UKKOKMRE.js";
107
+ } from "./chunk-QQ7SY5IZ.js";
108
108
  import "./chunk-UTL3MHPC.js";
109
109
  import {
110
110
  getVercelConversationWorkQueue,
@@ -123,7 +123,7 @@ import {
123
123
  import {
124
124
  validatePluginEgressCredentialHooks,
125
125
  validatePluginRegistrations
126
- } from "./chunk-6IADZQJR.js";
126
+ } from "./chunk-MVG5UPLM.js";
127
127
  import {
128
128
  defineJuniorPlugins,
129
129
  pluginCatalogConfigFromEnv,
@@ -147,6 +147,8 @@ import {
147
147
  listThreadReplies,
148
148
  normalizeSandboxEgressTracePropagationDomains,
149
149
  parseSandboxEgressCredentialToken,
150
+ publicArtifactHeaders,
151
+ readPublicArtifact,
150
152
  renderAttachmentText,
151
153
  renderBlockText,
152
154
  resolveDestinationVisibility,
@@ -154,12 +156,13 @@ import {
154
156
  sanitizeScheduledTaskPrincipal,
155
157
  setConfigDefaults,
156
158
  shouldEmitDevAgentTrace,
157
- shouldPropagateSandboxEgressTrace
158
- } from "./chunk-SQOVZSWF.js";
159
+ shouldPropagateSandboxEgressTrace,
160
+ unpublishedArtifactHeaders
161
+ } from "./chunk-OYQEO72I.js";
159
162
  import {
160
163
  AuthorizationFlowDisabledError,
161
164
  PluginCredentialFailureError
162
- } from "./chunk-X7AIXRVJ.js";
165
+ } from "./chunk-OY2DBUV4.js";
163
166
  import "./chunk-DIB4GX3G.js";
164
167
  import {
165
168
  createAgentRunner,
@@ -167,7 +170,7 @@ import {
167
170
  deleteMcpAuthSessionsForUserProvider,
168
171
  deleteMcpServerSessionId,
169
172
  deleteMcpStoredOAuthCredentials
170
- } from "./chunk-AZW5HKC5.js";
173
+ } from "./chunk-V67ORYKQ.js";
171
174
  import {
172
175
  RetryableDeliveryError
173
176
  } from "./chunk-RF6J3DIO.js";
@@ -175,7 +178,7 @@ import {
175
178
  formatProviderLabel,
176
179
  postSlackMessage,
177
180
  startOAuthFlow
178
- } from "./chunk-DJZPA72K.js";
181
+ } from "./chunk-VXFDVY4C.js";
179
182
  import "./chunk-7MA4HV4W.js";
180
183
  import {
181
184
  getExperimentalFeatures,
@@ -184,7 +187,7 @@ import {
184
187
  import {
185
188
  getSandboxResourceConfig,
186
189
  setSandboxResourceConfig
187
- } from "./chunk-PQWWCKNB.js";
190
+ } from "./chunk-RULQD7OX.js";
188
191
  import {
189
192
  collectAttachmentGarbage,
190
193
  createSchedulerSqlStore,
@@ -192,10 +195,10 @@ import {
192
195
  logScheduledTaskRunSkipped,
193
196
  requestAttachmentDeletion,
194
197
  scheduledTaskRunAttributes
195
- } from "./chunk-NT6V5WEE.js";
198
+ } from "./chunk-ZBCLWBMV.js";
196
199
  import {
197
200
  parseSlackThreadId
198
- } from "./chunk-IJ6KWS3V.js";
201
+ } from "./chunk-YSWHAOPQ.js";
199
202
  import {
200
203
  ConversationTurnBoundaryError,
201
204
  CooperativeTurnYieldError,
@@ -245,37 +248,35 @@ import {
245
248
  trimTrailingAssistantMessages,
246
249
  turnHasReply,
247
250
  upsertConversationMessage
248
- } from "./chunk-54O6IKUS.js";
251
+ } from "./chunk-STZVUVMS.js";
249
252
  import "./chunk-3Y47VMHV.js";
250
253
  import "./chunk-PDO5BLNM.js";
251
254
  import "./chunk-UIE3R5XU.js";
252
255
  import {
256
+ SlackActionError,
253
257
  bindEventTaskCredentialSubject,
254
258
  bindScheduledTaskCredentialSubject,
255
259
  bindSlackDirectCredentialSubject,
256
260
  createPluginLogger,
257
261
  createPluginState,
258
262
  createResourceEventTeamIdResolver,
263
+ downloadPrivateSlackFile,
259
264
  getPluginApiRoutes,
260
265
  getPluginRoutes,
261
266
  getPlugins,
267
+ getSlackClient,
268
+ getWorkspaceTeamId,
269
+ isDmChannel,
270
+ normalizeSlackConversationId,
271
+ runWithSlackInstallationToken,
272
+ runWithWorkspaceTeamId,
262
273
  setDashboardConversationLinkOptions,
263
274
  setPlugins,
264
275
  validatePlugins,
265
276
  verifyEventTaskCredentialSubject,
266
277
  verifyScheduledTaskCredentialSubject,
267
278
  verifySlackDirectCredentialSubject
268
- } from "./chunk-EBP6IS66.js";
269
- import {
270
- SlackActionError,
271
- downloadPrivateSlackFile,
272
- getSlackClient,
273
- getWorkspaceTeamId,
274
- isDmChannel,
275
- normalizeSlackConversationId,
276
- runWithSlackInstallationToken,
277
- runWithWorkspaceTeamId
278
- } from "./chunk-K2LAI7RW.js";
279
+ } from "./chunk-MNY5M7RB.js";
279
280
  import {
280
281
  contextProvenance,
281
282
  createSlackDestination,
@@ -288,19 +289,19 @@ import {
288
289
  requireSlackDestination,
289
290
  withConversationEventLock,
290
291
  withConversationMutationLock
291
- } from "./chunk-QODFNKQS.js";
292
+ } from "./chunk-U2XOBFDK.js";
292
293
  import {
293
294
  juniorAgentBindings,
294
295
  juniorAgentInvocations,
295
296
  juniorConversationEvents,
296
297
  juniorConversations
297
- } from "./chunk-O2DZWUPQ.js";
298
+ } from "./chunk-FLMD25Y5.js";
298
299
  import "./chunk-EM225ITJ.js";
299
300
  import {
300
301
  acquireActiveLock,
301
302
  getStateAdapter,
302
303
  withActiveLock
303
- } from "./chunk-Q5X37U6G.js";
304
+ } from "./chunk-IYFKONIL.js";
304
305
  import {
305
306
  STANDARD_MODEL_PROFILE,
306
307
  botConfig,
@@ -318,16 +319,16 @@ import {
318
319
  modelIdForProfile,
319
320
  setSlackReactionConfig,
320
321
  standardModelId
321
- } from "./chunk-L2PEQ2PY.js";
322
+ } from "./chunk-RVENVPNO.js";
322
323
  import {
323
324
  juniorDestinations
324
325
  } from "./chunk-VFUK3X5B.js";
325
- import "./chunk-PT7B6A3O.js";
326
- import "./chunk-U7D4VLUF.js";
326
+ import "./chunk-EAIQBR66.js";
327
+ import "./chunk-DGKLYDX7.js";
327
328
  import {
328
329
  pluginCatalogRuntime
329
- } from "./chunk-CNHELV2P.js";
330
- import "./chunk-YCBZ47LC.js";
330
+ } from "./chunk-CGAIDDLD.js";
331
+ import "./chunk-6WTDZKFR.js";
331
332
  import {
332
333
  credentialContextForActor
333
334
  } from "./chunk-BDUENQD3.js";
@@ -359,7 +360,7 @@ import {
359
360
  withContext,
360
361
  withLogContext,
361
362
  withSpan
362
- } from "./chunk-TD7ZQZ5W.js";
363
+ } from "./chunk-DNSIU27S.js";
363
364
  import {
364
365
  continueTrace
365
366
  } from "./chunk-6GWA276C.js";
@@ -367,10 +368,10 @@ import "./chunk-OOUNJNMR.js";
367
368
  import "./chunk-H4HBKISO.js";
368
369
  import {
369
370
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
370
- } from "./chunk-OGMHLKNO.js";
371
+ } from "./chunk-WVSQ2SCS.js";
371
372
  import {
372
373
  JUNIOR_VERSION
373
- } from "./chunk-LUIKMY35.js";
374
+ } from "./chunk-WKN4ZQTZ.js";
374
375
  import "./chunk-MLKGABMK.js";
375
376
 
376
377
  // src/app.ts
@@ -8524,6 +8525,29 @@ function createProductionConversationWorkOptions(options) {
8524
8525
  });
8525
8526
  }
8526
8527
 
8528
+ // src/handlers/artifacts.ts
8529
+ async function publicArtifactGET(args) {
8530
+ try {
8531
+ const artifact = await readPublicArtifact({
8532
+ db: args.db ?? getSqlExecutor(),
8533
+ filename: args.filename,
8534
+ storage: args.storage ?? createVercelAttachmentStorage()
8535
+ });
8536
+ if (!artifact) {
8537
+ return new Response("Not Found", {
8538
+ headers: unpublishedArtifactHeaders(),
8539
+ status: 404
8540
+ });
8541
+ }
8542
+ return new Response(artifact.body, {
8543
+ headers: publicArtifactHeaders(artifact.contentType)
8544
+ });
8545
+ } catch (error) {
8546
+ logException(error, "public_artifact.get.failed");
8547
+ return new Response("Internal Server Error", { status: 500 });
8548
+ }
8549
+ }
8550
+
8527
8551
  // src/chat/resource-events/ingest.ts
8528
8552
  import { resourceEventSchema } from "@sentry/junior-plugin-api";
8529
8553
 
@@ -9178,6 +9202,13 @@ async function createApp(options) {
9178
9202
  );
9179
9203
  app.get("/", () => GET());
9180
9204
  app.get("/health", () => GET());
9205
+ app.get(
9206
+ "/public/artifacts/:filename",
9207
+ (c) => publicArtifactGET({
9208
+ filename: c.req.param("filename"),
9209
+ storage: attachmentStorage
9210
+ })
9211
+ );
9181
9212
  app.get("/api/oauth/callback/mcp/:provider", (c) => {
9182
9213
  return GET2(c.req.raw, c.req.param("provider"), waitUntil, {
9183
9214
  agentRunner,
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-CNHELV2P.js";
4
- import "./chunk-YCBZ47LC.js";
3
+ } from "./chunk-CGAIDDLD.js";
4
+ import "./chunk-6WTDZKFR.js";
5
5
  import "./chunk-BDUENQD3.js";
6
6
  import "./chunk-V7YE4WCP.js";
7
- import "./chunk-TD7ZQZ5W.js";
7
+ import "./chunk-DNSIU27S.js";
8
8
  import "./chunk-6GWA276C.js";
9
9
  import "./chunk-OOUNJNMR.js";
10
10
  import "./chunk-H4HBKISO.js";
11
- import "./chunk-OGMHLKNO.js";
12
- import "./chunk-LUIKMY35.js";
11
+ import "./chunk-WVSQ2SCS.js";
12
+ import "./chunk-WKN4ZQTZ.js";
13
13
  import "./chunk-MLKGABMK.js";
14
14
  export {
15
15
  pluginCatalogRuntime
@@ -0,0 +1,42 @@
1
+ import type { AttachmentStorage } from "@/chat/attachments/storage";
2
+ import type { JuniorSqlDatabase } from "@/db/db";
3
+ /** Parse a public artifact URL or filename into a content-addressed filename. */
4
+ export declare function artifactFilenameFromRef(ref: string): string | null;
5
+ /** Publish validated image bytes as a conversation-owned public artifact. */
6
+ export declare function publishImage(args: {
7
+ body: Buffer;
8
+ conversationId: string;
9
+ db: JuniorSqlDatabase;
10
+ now?: Date;
11
+ publicBaseUrl: string;
12
+ storage: Pick<AttachmentStorage, "put">;
13
+ }): Promise<{
14
+ bytes: number;
15
+ contentType: string;
16
+ url: string;
17
+ }>;
18
+ /**
19
+ * Mark one public artifact unavailable for unauthenticated reads.
20
+ * Only the owning conversation may unpublish it.
21
+ */
22
+ export declare function unpublishArtifact(args: {
23
+ conversationId: string;
24
+ db: JuniorSqlDatabase;
25
+ now?: Date;
26
+ ref: string;
27
+ }): Promise<{
28
+ filename: string;
29
+ }>;
30
+ /** Open one public artifact by id when the row allows it. */
31
+ export declare function readPublicArtifact(args: {
32
+ db: JuniorSqlDatabase;
33
+ filename: string;
34
+ storage: Pick<AttachmentStorage, "get">;
35
+ }): Promise<{
36
+ body: ReadableStream<Uint8Array>;
37
+ contentType: string;
38
+ } | null>;
39
+ /** Build public response headers for one live public artifact. */
40
+ export declare function publicArtifactHeaders(contentType: string): Headers;
41
+ /** Build short-lived headers for missing or unpublished artifact responses. */
42
+ export declare function unpublishedArtifactHeaders(): Headers;