@sentry/junior 0.156.0 → 0.157.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 (80) hide show
  1. package/dist/{agent-hooks-CCAR46PQ.js → agent-hooks-QI5EPOKQ.js} +10 -10
  2. package/dist/api/conversations/attachments.d.ts +32 -0
  3. package/dist/api/conversations/priority.d.ts +21 -0
  4. package/dist/api/conversations/routes.d.ts +4 -1
  5. package/dist/api/locations/detail.d.ts +3 -1
  6. package/dist/api/schema/conversation.d.ts +14 -4
  7. package/dist/api/schema/location.d.ts +3 -1
  8. package/dist/api/schema/person.d.ts +3 -1
  9. package/dist/api/schema/task.d.ts +8 -8
  10. package/dist/api/schema.js +1 -1
  11. package/dist/api.js +158 -36
  12. package/dist/app.js +35 -54
  13. package/dist/{catalog-runtime-3SNKYCBG.js → catalog-runtime-HUGHAFUN.js} +5 -5
  14. package/dist/chat/agent-invocations/types.d.ts +12 -12
  15. package/dist/chat/attachments/storage.d.ts +2 -0
  16. package/dist/chat/attachments/store.d.ts +16 -0
  17. package/dist/chat/event-tasks/tool-support.d.ts +1 -1
  18. package/dist/chat/event-tasks/types.d.ts +1 -1
  19. package/dist/chat/plugins/unfinished-work.d.ts +6 -1
  20. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  21. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  22. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  23. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  24. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  25. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  26. package/dist/chat/task-execution/slack-work.d.ts +2 -2
  27. package/dist/{chunk-AIJRG227.js → chunk-3GS7O66Z.js} +1 -1
  28. package/dist/{chunk-KBGMYLSV.js → chunk-46ADYIPE.js} +1 -1
  29. package/dist/{chunk-SE3D225X.js → chunk-4M25PSFB.js} +1 -1
  30. package/dist/{chunk-TN4LVILT.js → chunk-5TIH5GOE.js} +5 -5
  31. package/dist/{chunk-EDJ64P2P.js → chunk-6MI43QZO.js} +1 -1
  32. package/dist/{chunk-WD7SEUZO.js → chunk-77QB5FNI.js} +1 -1
  33. package/dist/{chunk-CN2XSVKF.js → chunk-7J65DOBL.js} +6 -6
  34. package/dist/{chunk-4ZZDTHFC.js → chunk-AFQ47JQ7.js} +8 -8
  35. package/dist/{chunk-6CINHXIL.js → chunk-BLCVTEE7.js} +4 -4
  36. package/dist/{chunk-X5NZQH5U.js → chunk-CZCMFRUQ.js} +16 -0
  37. package/dist/{chunk-MJE7XKWP.js → chunk-D7BNWRYL.js} +1 -1
  38. package/dist/{chunk-OGZPRMZA.js → chunk-F7VOY4VQ.js} +1 -1
  39. package/dist/{chunk-IIO5PFZX.js → chunk-G2FN3I66.js} +3 -3
  40. package/dist/{chunk-3L2PMOSR.js → chunk-GEY6IFXH.js} +4 -4
  41. package/dist/{chunk-6JUU7J2B.js → chunk-GO2W3VZY.js} +4 -4
  42. package/dist/{chunk-KCA5MKHU.js → chunk-HJ3EZHIX.js} +351 -5
  43. package/dist/{chunk-MC57E5U5.js → chunk-I3OQVVMV.js} +1 -1
  44. package/dist/{chunk-NTNU6T2D.js → chunk-MDZQ62PB.js} +2 -2
  45. package/dist/{chunk-3FFUC32L.js → chunk-MGJW3SW4.js} +6 -6
  46. package/dist/{chunk-X7W45B5G.js → chunk-MKA3T2R6.js} +1 -1
  47. package/dist/{chunk-IZEBHYI4.js → chunk-MXO6VFB3.js} +1 -1
  48. package/dist/{chunk-53W3LZEW.js → chunk-OWASYHHV.js} +64 -361
  49. package/dist/{chunk-GSBPZHLQ.js → chunk-PP4UQTH3.js} +9 -9
  50. package/dist/{chunk-SRJA6QLM.js → chunk-RQBRGPUF.js} +2 -2
  51. package/dist/{chunk-A6WPDFHQ.js → chunk-S4PFOWRA.js} +1 -1
  52. package/dist/{chunk-OMQJB7YN.js → chunk-TA5R6BME.js} +18 -18
  53. package/dist/{chunk-GKC43TLS.js → chunk-UJYA75N5.js} +2 -2
  54. package/dist/{chunk-PMFGVLDU.js → chunk-VBKFO65J.js} +35 -10
  55. package/dist/{chunk-7RAETIYO.js → chunk-VDAEXEBB.js} +6 -6
  56. package/dist/{chunk-JUJR6WTL.js → chunk-VIBHFGQC.js} +4 -4
  57. package/dist/{chunk-CK2H7CFO.js → chunk-VYDM7HUF.js} +1 -1
  58. package/dist/{chunk-ZNWRYNCA.js → chunk-WNNYOPXX.js} +5 -5
  59. package/dist/{chunk-TNXGMFWV.js → chunk-XRERMHPN.js} +1 -1
  60. package/dist/cli/chat.js +30 -30
  61. package/dist/cli/check.js +6 -6
  62. package/dist/cli/plugins.js +13 -13
  63. package/dist/cli/snapshot-create.js +9 -9
  64. package/dist/cli/upgrade.js +7 -7
  65. package/dist/db/schema/agent-invocations.d.ts +4 -4
  66. package/dist/db/schema.d.ts +4 -4
  67. package/dist/{db-TYUUKGJX.js → db-VQAV4PJ3.js} +7 -7
  68. package/dist/instrumentation.js +4 -4
  69. package/dist/nitro.js +2 -2
  70. package/dist/{oauth-callback-server-AWVDKPR5.js → oauth-callback-server-K5KQAAAX.js} +23 -23
  71. package/dist/{runner-JUQXMACC.js → runner-U7QI7P4S.js} +14 -15
  72. package/dist/{skills-4GZTZX4V.js → skills-ENKRBZ7K.js} +6 -6
  73. package/dist/spawn-4XGNONLS.js +37 -0
  74. package/dist/{validation-DRLNJRND.js → validation-VKCDVGA6.js} +6 -6
  75. package/dist/version.js +1 -1
  76. package/dist/{work-TGIXRRJY.js → work-IBD6PWP2.js} +17 -17
  77. package/dist/worker-TJFXOZRC.js +24 -0
  78. package/package.json +4 -4
  79. package/dist/spawn-32SSRWU4.js +0 -37
  80. package/dist/worker-IFXZOYED.js +0 -24
package/dist/api.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  apiErrorSchema,
7
7
  archiveConversationBodySchema,
8
8
  archiveConversationResponseSchema,
9
+ conversationAttachmentParamsSchema,
9
10
  conversationDetailQuerySchema,
10
11
  conversationDetailReportSchema,
11
12
  conversationEventPageSchema,
@@ -33,23 +34,24 @@ import {
33
34
  taskListSchema,
34
35
  taskParamsSchema,
35
36
  taskRunListSchema
36
- } from "./chunk-X5NZQH5U.js";
37
+ } from "./chunk-CZCMFRUQ.js";
37
38
  import {
38
39
  appendAndEnqueueApiConversationMessage,
39
40
  createAndEnqueueApiConversation,
41
+ createVercelAttachmentStorage,
40
42
  formatSlackConversationRedactedLabel,
41
43
  lookupSlackUser,
42
44
  readHealthReport,
43
45
  resolveSlackConversationContextFromThreadId,
44
46
  webActorFromEmail
45
- } from "./chunk-PMFGVLDU.js";
47
+ } from "./chunk-VBKFO65J.js";
46
48
  import {
47
49
  buildSentryConversationUrl,
48
50
  getWebAuthorization
49
- } from "./chunk-SE3D225X.js";
51
+ } from "./chunk-4M25PSFB.js";
50
52
  import {
51
53
  getConversation
52
- } from "./chunk-6CINHXIL.js";
54
+ } from "./chunk-BLCVTEE7.js";
53
55
  import {
54
56
  readTaskExecutionByConversationId,
55
57
  readTaskExecutionDays,
@@ -57,8 +59,8 @@ import {
57
59
  readTaskExecutionSummaries,
58
60
  readTaskExecutions,
59
61
  readTaskRuns
60
- } from "./chunk-GSBPZHLQ.js";
61
- import "./chunk-TN4LVILT.js";
62
+ } from "./chunk-PP4UQTH3.js";
63
+ import "./chunk-5TIH5GOE.js";
62
64
  import {
63
65
  healthReportSchema,
64
66
  pluginOperationalReportFeedSchema,
@@ -81,17 +83,18 @@ import {
81
83
  listEventTasksCreatedBy,
82
84
  listPublicEventTasksForTeams,
83
85
  listPublicScheduledTasksForTeams,
86
+ readLiveAttachment,
84
87
  readStats
85
- } from "./chunk-KCA5MKHU.js";
88
+ } from "./chunk-HJ3EZHIX.js";
86
89
  import {
87
90
  parseSlackThreadId
88
- } from "./chunk-CK2H7CFO.js";
91
+ } from "./chunk-VYDM7HUF.js";
89
92
  import {
90
93
  agentTurnUsageSchema,
91
94
  fallbackShortTitle,
92
95
  hasAgentTurnUsage,
93
96
  renderJuniorNativeConversationEvent
94
- } from "./chunk-3L2PMOSR.js";
97
+ } from "./chunk-GEY6IFXH.js";
95
98
  import "./chunk-3Y47VMHV.js";
96
99
  import "./chunk-PDO5BLNM.js";
97
100
  import {
@@ -101,11 +104,11 @@ import {
101
104
  renderPluginConversationEvent,
102
105
  resolveViewerUser,
103
106
  updateViewerDisplayName
104
- } from "./chunk-3FFUC32L.js";
107
+ } from "./chunk-MGJW3SW4.js";
105
108
  import {
106
109
  getSlackClient,
107
110
  withSlackRetries
108
- } from "./chunk-NTNU6T2D.js";
111
+ } from "./chunk-MDZQ62PB.js";
109
112
  import {
110
113
  decodeStoredConversationEvent,
111
114
  getConversationStore,
@@ -113,7 +116,7 @@ import {
113
116
  getSqlExecutor,
114
117
  locationFromRow,
115
118
  parseSessionSource
116
- } from "./chunk-IIO5PFZX.js";
119
+ } from "./chunk-G2FN3I66.js";
117
120
  import {
118
121
  juniorApiTokens,
119
122
  juniorConversationEvents,
@@ -121,16 +124,16 @@ import {
121
124
  juniorConversations,
122
125
  juniorIdentities,
123
126
  juniorUsers
124
- } from "./chunk-AIJRG227.js";
127
+ } from "./chunk-3GS7O66Z.js";
125
128
  import "./chunk-EM225ITJ.js";
126
- import "./chunk-MC57E5U5.js";
127
- import "./chunk-GKC43TLS.js";
129
+ import "./chunk-I3OQVVMV.js";
130
+ import "./chunk-UJYA75N5.js";
128
131
  import {
129
132
  juniorDestinations
130
133
  } from "./chunk-VFUK3X5B.js";
131
134
  import {
132
135
  canExposeConversationPayload
133
- } from "./chunk-MJE7XKWP.js";
136
+ } from "./chunk-D7BNWRYL.js";
134
137
  import "./chunk-BDUENQD3.js";
135
138
  import {
136
139
  parseSlackChannelId,
@@ -140,10 +143,10 @@ import {
140
143
  import {
141
144
  logException,
142
145
  logWarn
143
- } from "./chunk-X7W45B5G.js";
146
+ } from "./chunk-MKA3T2R6.js";
144
147
  import "./chunk-6GWA276C.js";
145
- import "./chunk-OGZPRMZA.js";
146
- import "./chunk-KBGMYLSV.js";
148
+ import "./chunk-F7VOY4VQ.js";
149
+ import "./chunk-46ADYIPE.js";
147
150
  import "./chunk-MLKGABMK.js";
148
151
 
149
152
  // src/api.ts
@@ -353,6 +356,47 @@ async function readConversationAccessFromSql(db, conversationIds, viewer) {
353
356
  );
354
357
  }
355
358
 
359
+ // src/api/conversations/attachments.ts
360
+ function mayDisplayInline(contentType) {
361
+ return contentType === "image/gif" || contentType === "image/jpeg" || contentType === "image/png" || contentType === "image/webp";
362
+ }
363
+ function contentDisposition(filename, contentType) {
364
+ const disposition = mayDisplayInline(contentType) ? "inline" : "attachment";
365
+ const fallback = filename.replace(/[^\x20-\x7e]|["\\]/g, "_");
366
+ return `${disposition}; filename="${fallback}"; filename*=UTF-8''${encodeURIComponent(filename)}`;
367
+ }
368
+ function conversationAttachmentHeaders(args) {
369
+ return new Headers({
370
+ "cache-control": "private, no-store",
371
+ "content-disposition": contentDisposition(args.filename, args.contentType),
372
+ "content-length": String(args.bytes),
373
+ "content-type": args.contentType,
374
+ "x-content-type-options": "nosniff"
375
+ });
376
+ }
377
+ async function openConversationAttachment(args) {
378
+ const access = (await readConversationAccessFromSql(
379
+ getDb(),
380
+ [args.conversationId],
381
+ args.viewer
382
+ )).get(args.conversationId);
383
+ if (!access?.canViewPrivateContent) return null;
384
+ const attachment = await readLiveAttachment({
385
+ attachmentId: args.attachmentId,
386
+ conversationId: args.conversationId,
387
+ db: getSqlExecutor()
388
+ });
389
+ if (!attachment) return null;
390
+ if (attachment.provider !== args.storage.provider) return null;
391
+ const body = await args.storage.get(attachment.storageKey);
392
+ return body ? { attachment, body } : null;
393
+ }
394
+ async function requireConversationAttachment(args) {
395
+ const opened = await openConversationAttachment(args);
396
+ if (!opened) throwApiError(404, "Attachment not found.");
397
+ return opened;
398
+ }
399
+
356
400
  // src/api/conversations/create.ts
357
401
  function actorFromViewer(viewer) {
358
402
  const normalized = viewer.email.trim().toLowerCase();
@@ -1607,10 +1651,11 @@ async function readConversationAuxiliaryCostsFromSql(db, conversationIds, option
1607
1651
  // src/chat/plugins/unfinished-work.ts
1608
1652
  async function listConversationWork(conversationIds) {
1609
1653
  if (conversationIds.length === 0) {
1610
- return { assignedIds: [], unfinishedIds: [] };
1654
+ return { assignedIds: [], finishedAtById: {}, unfinishedIds: [] };
1611
1655
  }
1612
1656
  const candidates = new Set(conversationIds);
1613
1657
  const assigned = /* @__PURE__ */ new Set();
1658
+ const finishedAtById = /* @__PURE__ */ new Map();
1614
1659
  const unfinished = /* @__PURE__ */ new Set();
1615
1660
  for (const plugin of getPlugins()) {
1616
1661
  const hook = plugin.hooks?.unfinishedWork;
@@ -1630,6 +1675,17 @@ async function listConversationWork(conversationIds) {
1630
1675
  for (const conversationId of result.assignedConversationIds ?? []) {
1631
1676
  if (candidates.has(conversationId)) assigned.add(conversationId);
1632
1677
  }
1678
+ for (const [conversationId, finishedAt] of Object.entries(
1679
+ result.finishedWorkAtByConversationId ?? {}
1680
+ )) {
1681
+ if (!candidates.has(conversationId)) continue;
1682
+ const time = Date.parse(finishedAt);
1683
+ if (!Number.isFinite(time)) continue;
1684
+ const current = finishedAtById.get(conversationId);
1685
+ if (!current || time > Date.parse(current)) {
1686
+ finishedAtById.set(conversationId, finishedAt);
1687
+ }
1688
+ }
1633
1689
  } catch (error) {
1634
1690
  logWarn("plugin.unfinished_work.hook.failed", {
1635
1691
  "app.plugin.name": plugin.manifest.name,
@@ -1641,12 +1697,34 @@ async function listConversationWork(conversationIds) {
1641
1697
  assignedIds: conversationIds.filter(
1642
1698
  (conversationId) => assigned.has(conversationId)
1643
1699
  ),
1700
+ finishedAtById: Object.fromEntries(
1701
+ conversationIds.flatMap((conversationId) => {
1702
+ const finishedAt = finishedAtById.get(conversationId);
1703
+ return finishedAt ? [[conversationId, finishedAt]] : [];
1704
+ })
1705
+ ),
1644
1706
  unfinishedIds: conversationIds.filter(
1645
1707
  (conversationId) => unfinished.has(conversationId)
1646
1708
  )
1647
1709
  };
1648
1710
  }
1649
1711
 
1712
+ // src/api/conversations/priority.ts
1713
+ var UNASSIGNED_PRIORITY_WINDOW_MS = 3 * 60 * 60 * 1e3;
1714
+ var UNFINISHED_PRIORITY_WINDOW_MS = 48 * 60 * 60 * 1e3;
1715
+ function isConversationPriority(conversation, nowMs) {
1716
+ const lastSeenAt = Date.parse(conversation.lastSeenAt);
1717
+ if (!Number.isFinite(lastSeenAt)) return false;
1718
+ if (conversation.unfinishedWork) {
1719
+ return nowMs - lastSeenAt <= UNFINISHED_PRIORITY_WINDOW_MS;
1720
+ }
1721
+ if (conversation.assignedWork) {
1722
+ const finishedAt = Date.parse(conversation.finishedWorkAt ?? "");
1723
+ return Number.isFinite(finishedAt) && lastSeenAt > finishedAt;
1724
+ }
1725
+ return nowMs - lastSeenAt <= UNASSIGNED_PRIORITY_WINDOW_MS;
1726
+ }
1727
+
1650
1728
  // src/api/conversations/list.ts
1651
1729
  var CONVERSATION_FEED_LIMIT = 50;
1652
1730
  function conversationFeedMembershipFilter(filter) {
@@ -1807,19 +1885,33 @@ async function readConversationFeedFromSql(options = {}) {
1807
1885
  conversations: conversations.map((conversation, index) => {
1808
1886
  const row = rows[index];
1809
1887
  const metrics = metricsByRoot.get(conversation.conversationId);
1810
- return {
1811
- ...conversationSummaryFromStoredConversation({
1812
- conversation,
1813
- access: accessByConversation.get(conversation.conversationId),
1814
- auxiliaryCosts: auxiliaryCostsByRoot.get(conversation.conversationId),
1815
- durationMs: metrics?.durationMs ?? row.conversation.durationMs,
1816
- teamDomainByTeamId,
1817
- ...row.destination?.visibility === "public" ? { locationId: row.destination.id } : {},
1818
- usage: metrics?.usage ?? row.conversation.usage ?? void 0
1819
- }),
1888
+ const summary = conversationSummaryFromStoredConversation({
1889
+ conversation,
1890
+ access: accessByConversation.get(conversation.conversationId),
1891
+ auxiliaryCosts: auxiliaryCostsByRoot.get(conversation.conversationId),
1892
+ durationMs: metrics?.durationMs ?? row.conversation.durationMs,
1893
+ teamDomainByTeamId,
1894
+ ...row.destination?.visibility === "public" ? { locationId: row.destination.id } : {},
1895
+ usage: metrics?.usage ?? row.conversation.usage ?? void 0
1896
+ });
1897
+ const work = {
1820
1898
  ...assignedWork.has(conversation.conversationId) ? { assignedWork: true } : {},
1899
+ ...conversationWork.finishedAtById[conversation.conversationId] ? {
1900
+ finishedWorkAt: conversationWork.finishedAtById[conversation.conversationId]
1901
+ } : {},
1821
1902
  ...unfinishedWork.has(conversation.conversationId) ? { unfinishedWork: true } : {}
1822
1903
  };
1904
+ return {
1905
+ ...summary,
1906
+ ...work,
1907
+ isPriority: isConversationPriority(
1908
+ {
1909
+ lastSeenAt: summary.lastSeenAt,
1910
+ ...work
1911
+ },
1912
+ nowMs
1913
+ )
1914
+ };
1823
1915
  }),
1824
1916
  generatedAt: new Date(nowMs).toISOString(),
1825
1917
  source: "conversation_index"
@@ -3016,7 +3108,7 @@ async function readConversationStats() {
3016
3108
  }
3017
3109
 
3018
3110
  // src/api/conversations/routes.ts
3019
- function createConversationRoutes() {
3111
+ function createConversationRoutes(options) {
3020
3112
  const app = new Hono();
3021
3113
  app.get(
3022
3114
  "/",
@@ -3144,6 +3236,31 @@ function createConversationRoutes() {
3144
3236
  );
3145
3237
  }
3146
3238
  );
3239
+ app.get(
3240
+ "/:conversationId/attachments/:attachmentId",
3241
+ validateRequest(
3242
+ "param",
3243
+ conversationAttachmentParamsSchema,
3244
+ "Invalid route parameters."
3245
+ ),
3246
+ async (context) => {
3247
+ const { attachmentId, conversationId } = context.req.valid("param");
3248
+ const viewer = context.get("viewer");
3249
+ const opened = await requireConversationAttachment({
3250
+ attachmentId,
3251
+ conversationId,
3252
+ storage: options.attachmentStorage,
3253
+ ...viewer ? { viewer } : {}
3254
+ });
3255
+ return new Response(opened.body, {
3256
+ headers: conversationAttachmentHeaders({
3257
+ bytes: opened.attachment.bytes,
3258
+ contentType: opened.attachment.contentType,
3259
+ filename: opened.attachment.filename
3260
+ })
3261
+ });
3262
+ }
3263
+ );
3147
3264
  app.get(
3148
3265
  "/:conversationId",
3149
3266
  validateRequest(
@@ -4502,7 +4619,7 @@ function readDescriptionText(home) {
4502
4619
  }
4503
4620
  }
4504
4621
  async function readSkillReports() {
4505
- const { discoverSkills } = await import("./skills-4GZTZX4V.js");
4622
+ const { discoverSkills } = await import("./skills-ENKRBZ7K.js");
4506
4623
  const skills = await discoverSkills();
4507
4624
  return skillReportsSchema.parse(
4508
4625
  skills.map((skill) => ({
@@ -4512,7 +4629,7 @@ async function readSkillReports() {
4512
4629
  );
4513
4630
  }
4514
4631
  async function readPlugins() {
4515
- const { pluginCatalogRuntime } = await import("./catalog-runtime-3SNKYCBG.js");
4632
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-HUGHAFUN.js");
4516
4633
  return pluginsSchema.parse(
4517
4634
  pluginCatalogRuntime.getProviders().map((plugin) => ({
4518
4635
  configKeys: plugin.manifest.configKeys ?? [],
@@ -4525,7 +4642,7 @@ async function readPlugins() {
4525
4642
  async function readRuntimeInfoReport() {
4526
4643
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4527
4644
  import("./discovery-GUFTFBTL.js"),
4528
- import("./catalog-runtime-3SNKYCBG.js"),
4645
+ import("./catalog-runtime-HUGHAFUN.js"),
4529
4646
  readPlugins(),
4530
4647
  readSkillReports()
4531
4648
  ]);
@@ -4541,7 +4658,7 @@ async function readRuntimeInfoReport() {
4541
4658
  }
4542
4659
  async function readPluginOperationalReportFeed() {
4543
4660
  const nowMs = Date.now();
4544
- const { getPluginOperationalReports } = await import("./agent-hooks-CCAR46PQ.js");
4661
+ const { getPluginOperationalReports } = await import("./agent-hooks-QI5EPOKQ.js");
4545
4662
  return pluginOperationalReportFeedSchema.parse({
4546
4663
  source: "plugins",
4547
4664
  generatedAt: new Date(nowMs).toISOString(),
@@ -4579,7 +4696,12 @@ function createJuniorApi() {
4579
4696
  "/api/stats",
4580
4697
  async () => jsonResponse(statsReportSchema, await readStatsReport())
4581
4698
  );
4582
- app.route("/api/conversations", createConversationRoutes());
4699
+ app.route(
4700
+ "/api/conversations",
4701
+ createConversationRoutes({
4702
+ attachmentStorage: createVercelAttachmentStorage()
4703
+ })
4704
+ );
4583
4705
  app.route("/api/personal-tokens", createPersonalTokenRoutes());
4584
4706
  app.route("/api/people", createPeopleRoutes());
4585
4707
  app.route("/api/locations", createLocationRoutes());
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-JUJR6WTL.js";
3
+ } from "./chunk-VIBHFGQC.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-IZEBHYI4.js";
6
+ } from "./chunk-MXO6VFB3.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-CN2XSVKF.js";
12
+ } from "./chunk-7J65DOBL.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,22 +36,23 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-OMQJB7YN.js";
39
+ } from "./chunk-TA5R6BME.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-A6WPDFHQ.js";
44
+ } from "./chunk-S4PFOWRA.js";
45
45
  import {
46
46
  GET,
47
47
  conversationVisibilityFromSlackChannelType,
48
48
  createApiTurnWorker,
49
+ createVercelAttachmentStorage,
49
50
  lookupSlackUser,
50
51
  resolveSlackChannelTypeFromMessage,
51
52
  resolveSlackConversationContext,
52
53
  routeApiTurnWork
53
- } from "./chunk-PMFGVLDU.js";
54
- import "./chunk-SE3D225X.js";
54
+ } from "./chunk-VBKFO65J.js";
55
+ import "./chunk-4M25PSFB.js";
55
56
  import {
56
57
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
57
58
  appendAndEnqueueInboundMessage,
@@ -62,7 +63,7 @@ import {
62
63
  isInvalidConversationRecordError,
63
64
  listActiveConversationIds,
64
65
  removeActiveConversation
65
- } from "./chunk-6CINHXIL.js";
66
+ } from "./chunk-BLCVTEE7.js";
66
67
  import {
67
68
  buildDeliveredTurnStatePatch,
68
69
  claimDispatchMailboxAppend,
@@ -93,7 +94,7 @@ import {
93
94
  requireTurnFailureEventId,
94
95
  resolveTurnSessionRouting,
95
96
  scheduleSessionCompletedPluginTasks
96
- } from "./chunk-GSBPZHLQ.js";
97
+ } from "./chunk-PP4UQTH3.js";
97
98
  import {
98
99
  ConversationTurnLifecycleService,
99
100
  coerceThreadConversationState,
@@ -103,7 +104,7 @@ import {
103
104
  persistThreadRuntimeState,
104
105
  persistThreadState,
105
106
  persistThreadStateById
106
- } from "./chunk-TN4LVILT.js";
107
+ } from "./chunk-5TIH5GOE.js";
107
108
  import "./chunk-UTL3MHPC.js";
108
109
  import {
109
110
  getVercelConversationWorkQueue,
@@ -122,7 +123,7 @@ import {
122
123
  import {
123
124
  validatePluginEgressCredentialHooks,
124
125
  validatePluginRegistrations
125
- } from "./chunk-TNXGMFWV.js";
126
+ } from "./chunk-XRERMHPN.js";
126
127
  import {
127
128
  defineJuniorPlugins,
128
129
  pluginCatalogConfigFromEnv,
@@ -134,7 +135,6 @@ import {
134
135
  buildSteeringPiMessage,
135
136
  cancelSubscriptions,
136
137
  clearSandboxEgressSignals,
137
- collectAttachmentGarbage,
138
138
  consumeSandboxEgressAuthRequiredSignal,
139
139
  consumeSandboxEgressPermissionDeniedSignal,
140
140
  createContextCompactor,
@@ -149,18 +149,17 @@ import {
149
149
  parseSandboxEgressCredentialToken,
150
150
  renderAttachmentText,
151
151
  renderBlockText,
152
- requestAttachmentDeletion,
153
152
  resolveDestinationVisibility,
154
153
  resolveSandboxEgressProviderForHost,
155
154
  sanitizeScheduledTaskPrincipal,
156
155
  setConfigDefaults,
157
156
  shouldEmitDevAgentTrace,
158
157
  shouldPropagateSandboxEgressTrace
159
- } from "./chunk-53W3LZEW.js";
158
+ } from "./chunk-OWASYHHV.js";
160
159
  import {
161
160
  AuthorizationFlowDisabledError,
162
161
  PluginCredentialFailureError
163
- } from "./chunk-ZNWRYNCA.js";
162
+ } from "./chunk-WNNYOPXX.js";
164
163
  import "./chunk-DIB4GX3G.js";
165
164
  import {
166
165
  createAgentRunner,
@@ -168,7 +167,7 @@ import {
168
167
  deleteMcpAuthSessionsForUserProvider,
169
168
  deleteMcpServerSessionId,
170
169
  deleteMcpStoredOAuthCredentials
171
- } from "./chunk-4ZZDTHFC.js";
170
+ } from "./chunk-AFQ47JQ7.js";
172
171
  import {
173
172
  RetryableDeliveryError
174
173
  } from "./chunk-RF6J3DIO.js";
@@ -176,7 +175,7 @@ import {
176
175
  formatProviderLabel,
177
176
  postSlackMessage,
178
177
  startOAuthFlow
179
- } from "./chunk-7RAETIYO.js";
178
+ } from "./chunk-VDAEXEBB.js";
180
179
  import "./chunk-7MA4HV4W.js";
181
180
  import {
182
181
  getExperimentalFeatures,
@@ -185,16 +184,18 @@ import {
185
184
  import {
186
185
  getSandboxResourceConfig,
187
186
  setSandboxResourceConfig
188
- } from "./chunk-6JUU7J2B.js";
187
+ } from "./chunk-GO2W3VZY.js";
189
188
  import {
189
+ collectAttachmentGarbage,
190
190
  createSchedulerSqlStore,
191
191
  findMatchingEventTasks,
192
192
  logScheduledTaskRunSkipped,
193
+ requestAttachmentDeletion,
193
194
  scheduledTaskRunAttributes
194
- } from "./chunk-KCA5MKHU.js";
195
+ } from "./chunk-HJ3EZHIX.js";
195
196
  import {
196
197
  parseSlackThreadId
197
- } from "./chunk-CK2H7CFO.js";
198
+ } from "./chunk-VYDM7HUF.js";
198
199
  import {
199
200
  ConversationTurnBoundaryError,
200
201
  CooperativeTurnYieldError,
@@ -244,7 +245,7 @@ import {
244
245
  trimTrailingAssistantMessages,
245
246
  turnHasReply,
246
247
  upsertConversationMessage
247
- } from "./chunk-3L2PMOSR.js";
248
+ } from "./chunk-GEY6IFXH.js";
248
249
  import "./chunk-3Y47VMHV.js";
249
250
  import "./chunk-PDO5BLNM.js";
250
251
  import "./chunk-UIE3R5XU.js";
@@ -264,7 +265,7 @@ import {
264
265
  verifyEventTaskCredentialSubject,
265
266
  verifyScheduledTaskCredentialSubject,
266
267
  verifySlackDirectCredentialSubject
267
- } from "./chunk-3FFUC32L.js";
268
+ } from "./chunk-MGJW3SW4.js";
268
269
  import {
269
270
  SlackActionError,
270
271
  downloadPrivateSlackFile,
@@ -274,7 +275,7 @@ import {
274
275
  normalizeSlackConversationId,
275
276
  runWithSlackInstallationToken,
276
277
  runWithWorkspaceTeamId
277
- } from "./chunk-NTNU6T2D.js";
278
+ } from "./chunk-MDZQ62PB.js";
278
279
  import {
279
280
  contextProvenance,
280
281
  createSlackDestination,
@@ -287,19 +288,19 @@ import {
287
288
  requireSlackDestination,
288
289
  withConversationEventLock,
289
290
  withConversationMutationLock
290
- } from "./chunk-IIO5PFZX.js";
291
+ } from "./chunk-G2FN3I66.js";
291
292
  import {
292
293
  juniorAgentBindings,
293
294
  juniorAgentInvocations,
294
295
  juniorConversationEvents,
295
296
  juniorConversations
296
- } from "./chunk-AIJRG227.js";
297
+ } from "./chunk-3GS7O66Z.js";
297
298
  import "./chunk-EM225ITJ.js";
298
299
  import {
299
300
  acquireActiveLock,
300
301
  getStateAdapter,
301
302
  withActiveLock
302
- } from "./chunk-MC57E5U5.js";
303
+ } from "./chunk-I3OQVVMV.js";
303
304
  import {
304
305
  STANDARD_MODEL_PROFILE,
305
306
  botConfig,
@@ -317,16 +318,16 @@ import {
317
318
  modelIdForProfile,
318
319
  setSlackReactionConfig,
319
320
  standardModelId
320
- } from "./chunk-GKC43TLS.js";
321
+ } from "./chunk-UJYA75N5.js";
321
322
  import {
322
323
  juniorDestinations
323
324
  } from "./chunk-VFUK3X5B.js";
324
- import "./chunk-MJE7XKWP.js";
325
- import "./chunk-SRJA6QLM.js";
325
+ import "./chunk-D7BNWRYL.js";
326
+ import "./chunk-RQBRGPUF.js";
326
327
  import {
327
328
  pluginCatalogRuntime
328
- } from "./chunk-EDJ64P2P.js";
329
- import "./chunk-WD7SEUZO.js";
329
+ } from "./chunk-6MI43QZO.js";
330
+ import "./chunk-77QB5FNI.js";
330
331
  import {
331
332
  credentialContextForActor
332
333
  } from "./chunk-BDUENQD3.js";
@@ -358,7 +359,7 @@ import {
358
359
  withContext,
359
360
  withLogContext,
360
361
  withSpan
361
- } from "./chunk-X7W45B5G.js";
362
+ } from "./chunk-MKA3T2R6.js";
362
363
  import {
363
364
  continueTrace
364
365
  } from "./chunk-6GWA276C.js";
@@ -366,10 +367,10 @@ import "./chunk-OOUNJNMR.js";
366
367
  import "./chunk-H4HBKISO.js";
367
368
  import {
368
369
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
369
- } from "./chunk-OGZPRMZA.js";
370
+ } from "./chunk-F7VOY4VQ.js";
370
371
  import {
371
372
  JUNIOR_VERSION
372
- } from "./chunk-KBGMYLSV.js";
373
+ } from "./chunk-46ADYIPE.js";
373
374
  import "./chunk-MLKGABMK.js";
374
375
 
375
376
  // src/app.ts
@@ -2014,26 +2015,6 @@ async function runRetentionPurge(executor, args) {
2014
2015
  };
2015
2016
  }
2016
2017
 
2017
- // src/chat/attachments/vercel.ts
2018
- import { del, put } from "@vercel/blob";
2019
- function createVercelAttachmentStorage() {
2020
- return {
2021
- provider: "vercel-blob",
2022
- async put(input) {
2023
- await put(input.key, input.body, {
2024
- access: "private",
2025
- addRandomSuffix: false,
2026
- allowOverwrite: true,
2027
- contentType: input.contentType
2028
- });
2029
- },
2030
- async delete(keys) {
2031
- if (keys.length === 0) return;
2032
- await del(keys);
2033
- }
2034
- };
2035
- }
2036
-
2037
2018
  // src/handlers/retention.ts
2038
2019
  function getRetentionSecret() {
2039
2020
  return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-EDJ64P2P.js";
4
- import "./chunk-WD7SEUZO.js";
3
+ } from "./chunk-6MI43QZO.js";
4
+ import "./chunk-77QB5FNI.js";
5
5
  import "./chunk-BDUENQD3.js";
6
6
  import "./chunk-V7YE4WCP.js";
7
- import "./chunk-X7W45B5G.js";
7
+ import "./chunk-MKA3T2R6.js";
8
8
  import "./chunk-6GWA276C.js";
9
9
  import "./chunk-OOUNJNMR.js";
10
10
  import "./chunk-H4HBKISO.js";
11
- import "./chunk-OGZPRMZA.js";
12
- import "./chunk-KBGMYLSV.js";
11
+ import "./chunk-F7VOY4VQ.js";
12
+ import "./chunk-46ADYIPE.js";
13
13
  import "./chunk-MLKGABMK.js";
14
14
  export {
15
15
  pluginCatalogRuntime