@sentry/junior 0.194.0 → 0.196.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/{agent-hooks-IDX764FD.js → agent-hooks-IQLRR4RC.js} +13 -13
  2. package/dist/api/activity.d.ts +9 -1
  3. package/dist/api/code/overview.d.ts +12 -0
  4. package/dist/api/locations/detail.d.ts +8 -0
  5. package/dist/api/locations/list.d.ts +5 -0
  6. package/dist/api/people/code.d.ts +6 -0
  7. package/dist/api/people/shared.d.ts +9 -1
  8. package/dist/api/reporting-window.d.ts +39 -1
  9. package/dist/api/schema/code.d.ts +12 -0
  10. package/dist/api/schema/conversation.d.ts +25 -0
  11. package/dist/api/schema/location.d.ts +13 -0
  12. package/dist/api/schema/person.d.ts +14 -0
  13. package/dist/api/schema/task.d.ts +12 -0
  14. package/dist/api/schema.js +3 -3
  15. package/dist/api.js +244 -65
  16. package/dist/app.d.ts +8 -2
  17. package/dist/app.js +166 -70
  18. package/dist/{catalog-runtime-MICXEBLK.js → catalog-runtime-EM7V2F4I.js} +4 -4
  19. package/dist/chat/agent/handoff.d.ts +73 -0
  20. package/dist/chat/config.d.ts +3 -2
  21. package/dist/chat/event-tasks/store.d.ts +27 -17
  22. package/dist/chat/model-profile.d.ts +12 -0
  23. package/dist/chat/no-reply.d.ts +4 -3
  24. package/dist/chat/resource-events/notification.d.ts +2 -1
  25. package/dist/chat/services/automated-turn-limit.d.ts +110 -0
  26. package/dist/chat/services/subscribed-decision.d.ts +8 -0
  27. package/dist/chat/slack/automated-turn-limit-notice.d.ts +38 -0
  28. package/dist/chat/tasks/execution-stats.d.ts +2 -1
  29. package/dist/chat/tasks/read.d.ts +5 -2
  30. package/dist/chat/tools/types.d.ts +6 -2
  31. package/dist/{chunk-U76RWMFR.js → chunk-5XSEOJPC.js} +87 -14
  32. package/dist/{chunk-OEQOAONV.js → chunk-6LQNW2CJ.js} +7 -7
  33. package/dist/{chunk-GFBR4S3Q.js → chunk-7NL7T6VU.js} +1 -1
  34. package/dist/{chunk-CFGBKPWQ.js → chunk-7TUDDW3Y.js} +3 -3
  35. package/dist/{chunk-RFE7DCZK.js → chunk-B5WJBVHY.js} +2 -2
  36. package/dist/{chunk-S7GX44BU.js → chunk-BXIVMNLR.js} +1 -1
  37. package/dist/{chunk-QMEF4Z7R.js → chunk-CNI74T7U.js} +6 -6
  38. package/dist/{chunk-X76JVHQ4.js → chunk-CTS72G4B.js} +1 -1
  39. package/dist/{chunk-G35QGPO2.js → chunk-DFWJJOW3.js} +2 -6
  40. package/dist/{chunk-INTBMGNX.js → chunk-EEUFKVCD.js} +22 -22
  41. package/dist/{chunk-H4DCWLTR.js → chunk-EFNUCRB5.js} +8 -8
  42. package/dist/{chunk-V4HXV5MY.js → chunk-EQBHN4JK.js} +1 -1
  43. package/dist/{chunk-JOI3DHML.js → chunk-ES7KCEND.js} +1 -1
  44. package/dist/{chunk-WWXJUURQ.js → chunk-G6YRPYDC.js} +1 -1
  45. package/dist/{chunk-WMJS5DDV.js → chunk-GZ336GZ5.js} +148 -19
  46. package/dist/{chunk-IME5OW4Y.js → chunk-I7GEGEHZ.js} +1 -1
  47. package/dist/{chunk-2NL3Y47F.js → chunk-J357NJQ5.js} +5 -5
  48. package/dist/{chunk-53IEEFFP.js → chunk-KJGH3KWA.js} +3 -3
  49. package/dist/{chunk-ELCYG6UU.js → chunk-KZX7LORG.js} +3 -3
  50. package/dist/{chunk-YSLIB7ER.js → chunk-LBN67OZR.js} +83 -7
  51. package/dist/{chunk-73JEAQRT.js → chunk-LCAM2P7H.js} +4 -4
  52. package/dist/{chunk-VOB2DKO6.js → chunk-LGXI6PWX.js} +24 -13
  53. package/dist/{chunk-P2P6MUQ4.js → chunk-LSPUMNZK.js} +2 -2
  54. package/dist/{chunk-AWZS5SVX.js → chunk-N2MSPOGG.js} +8 -8
  55. package/dist/{chunk-CCTYK5RH.js → chunk-NE2UQMC7.js} +10 -7
  56. package/dist/{chunk-D4YV5TDV.js → chunk-NHJU2ZAL.js} +11 -0
  57. package/dist/{chunk-G4RARFNT.js → chunk-OVWAO5KY.js} +1194 -726
  58. package/dist/{chunk-XRDSML3K.js → chunk-P3LE2CSJ.js} +2 -2
  59. package/dist/{chunk-KNIAWMBU.js → chunk-PI6VXVBK.js} +1 -1
  60. package/dist/{chunk-XLWZRHX5.js → chunk-PIZJBSGZ.js} +23 -29
  61. package/dist/{chunk-GY5SEFVL.js → chunk-QAINJHI4.js} +5 -5
  62. package/dist/{chunk-XND3J6AT.js → chunk-RAWYH7TW.js} +1 -1
  63. package/dist/{chunk-ENWIHU54.js → chunk-RFNMWONZ.js} +6 -6
  64. package/dist/{chunk-E53C73ML.js → chunk-S74KAE77.js} +4 -4
  65. package/dist/{chunk-7ANA7PBB.js → chunk-SR5FS2JP.js} +3 -3
  66. package/dist/{chunk-F2KSURTJ.js → chunk-VKLQ2M7V.js} +9 -9
  67. package/dist/{chunk-NWWDFHXP.js → chunk-VRHZXY5X.js} +1 -1
  68. package/dist/{chunk-6H2MKVV5.js → chunk-VSOO3Y6M.js} +1 -1
  69. package/dist/{chunk-NPO24LAN.js → chunk-VVU7GHIZ.js} +9 -9
  70. package/dist/{chunk-IOGDKPVU.js → chunk-VXAQTJSR.js} +1 -1
  71. package/dist/{chunk-ADEACKAH.js → chunk-XNXKRWWI.js} +11 -4
  72. package/dist/cli/chat.js +35 -35
  73. package/dist/cli/check.js +5 -5
  74. package/dist/cli/plugins.js +14 -14
  75. package/dist/cli/snapshot-create.js +10 -10
  76. package/dist/cli/upgrade.js +7 -7
  77. package/dist/db/schema/event-tasks.d.ts +21 -0
  78. package/dist/db/schema.d.ts +19 -0
  79. package/dist/{db-3IEVINAY.js → db-YTM7ZXPK.js} +8 -8
  80. package/dist/instrumentation.js +3 -3
  81. package/dist/nitro.js +7 -7
  82. package/dist/{oauth-callback-server-N7L2BB4L.js → oauth-callback-server-OXW4KQLQ.js} +31 -31
  83. package/dist/{runner-PTTZV3WU.js → runner-RJY5RNJO.js} +23 -23
  84. package/dist/{skills-POMWS2RR.js → skills-WZV6NLFY.js} +5 -5
  85. package/dist/spawn-J7SQJLYF.js +42 -0
  86. package/dist/task-runner-SMUQ5464.js +36 -0
  87. package/dist/{validation-U6LOMXR7.js → validation-XS5ZHV3W.js} +5 -5
  88. package/dist/version.js +1 -1
  89. package/dist/{work-FHA3BS4L.js → work-LJMSDEY3.js} +23 -23
  90. package/dist/worker-NMFZ7A2N.js +24 -0
  91. package/migrations/0038_event_task_status.sql +5 -0
  92. package/migrations/meta/0038_snapshot.json +3323 -0
  93. package/migrations/meta/_journal.json +8 -1
  94. package/package.json +4 -4
  95. package/dist/spawn-R75MXXKE.js +0 -42
  96. package/dist/task-runner-OQLRHADB.js +0 -36
  97. package/dist/worker-GR4UNVVP.js +0 -24
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  AgentRunError,
6
6
  executeTurn
7
- } from "./chunk-53IEEFFP.js";
7
+ } from "./chunk-KJGH3KWA.js";
8
8
  import {
9
9
  buildDeliveredTurnStatePatch,
10
10
  finalizeFailedTurnReplyWithEvent,
@@ -15,14 +15,14 @@ import {
15
15
  getTurnUserSlackMessageTs,
16
16
  persistAuthPauseTurnState,
17
17
  requireTurnFailureEventId
18
- } from "./chunk-2NL3Y47F.js";
18
+ } from "./chunk-J357NJQ5.js";
19
19
  import {
20
20
  resolveTurnSessionRouting,
21
21
  scheduleSessionCompletedPluginTasks
22
- } from "./chunk-NPO24LAN.js";
22
+ } from "./chunk-VVU7GHIZ.js";
23
23
  import {
24
24
  getTurnLifecycle
25
- } from "./chunk-6H2MKVV5.js";
25
+ } from "./chunk-VSOO3Y6M.js";
26
26
  import {
27
27
  coerceThreadConversationState,
28
28
  configValueSchema,
@@ -30,11 +30,11 @@ import {
30
30
  getPersistedSandboxState,
31
31
  getPersistedThreadState,
32
32
  persistThreadStateById
33
- } from "./chunk-GY5SEFVL.js";
33
+ } from "./chunk-QAINJHI4.js";
34
34
  import {
35
35
  buildSentryConversationUrl,
36
36
  deleteWebAuthorization
37
- } from "./chunk-XND3J6AT.js";
37
+ } from "./chunk-RAWYH7TW.js";
38
38
  import {
39
39
  createUserTokenStore,
40
40
  deleteMcpAuthSession,
@@ -45,7 +45,7 @@ import {
45
45
  lookupSlackUserProfile,
46
46
  putMcpStoredOAuthCredentials,
47
47
  resolvePluginOAuthAccount
48
- } from "./chunk-AWZS5SVX.js";
48
+ } from "./chunk-N2MSPOGG.js";
49
49
  import {
50
50
  RetryableDeliveryError,
51
51
  addReactionToMessage,
@@ -59,7 +59,7 @@ import {
59
59
  removeReactionFromMessage,
60
60
  resolveBaseUrl,
61
61
  truncateStatusText
62
- } from "./chunk-ENWIHU54.js";
62
+ } from "./chunk-RFNMWONZ.js";
63
63
  import {
64
64
  CooperativeTurnYieldError,
65
65
  clearPendingAuth,
@@ -68,7 +68,7 @@ import {
68
68
  isCooperativeTurnYieldError,
69
69
  isPendingAuthLatestRequest,
70
70
  markTurnFailed
71
- } from "./chunk-G35QGPO2.js";
71
+ } from "./chunk-DFWJJOW3.js";
72
72
  import {
73
73
  abandonTurnRecord,
74
74
  buildConversationContext,
@@ -87,20 +87,20 @@ import {
87
87
  recordTurnSummary,
88
88
  saveTurnCheckpoint,
89
89
  turnHasReply
90
- } from "./chunk-OEQOAONV.js";
90
+ } from "./chunk-6LQNW2CJ.js";
91
91
  import {
92
92
  parseSlackThreadId,
93
93
  readSlackRawMessageContext,
94
94
  resolveSlackChannelIdFromMessage,
95
95
  resolveSlackChannelIdFromThreadId
96
- } from "./chunk-IOGDKPVU.js";
96
+ } from "./chunk-VXAQTJSR.js";
97
97
  import {
98
98
  ensureConversationWake,
99
99
  requestConversationWork
100
- } from "./chunk-E53C73ML.js";
100
+ } from "./chunk-S74KAE77.js";
101
101
  import {
102
102
  getTurnRequestDeadline
103
- } from "./chunk-NWWDFHXP.js";
103
+ } from "./chunk-VRHZXY5X.js";
104
104
  import {
105
105
  getVercelConversationWorkQueue
106
106
  } from "./chunk-DKIJ2RP5.js";
@@ -112,39 +112,39 @@ import {
112
112
  getSlackClient,
113
113
  isDmChannel,
114
114
  normalizeSlackConversationId
115
- } from "./chunk-CCTYK5RH.js";
115
+ } from "./chunk-NE2UQMC7.js";
116
116
  import {
117
117
  getConversationStore,
118
118
  getSqlExecutor,
119
119
  requireSlackDestination,
120
120
  upsertIdentity,
121
121
  upsertLinkedIdentity
122
- } from "./chunk-ADEACKAH.js";
122
+ } from "./chunk-XNXKRWWI.js";
123
123
  import {
124
124
  acquireActiveLock,
125
125
  getStateAdapter
126
- } from "./chunk-V4HXV5MY.js";
126
+ } from "./chunk-EQBHN4JK.js";
127
127
  import {
128
128
  botConfig,
129
129
  escapeXml,
130
130
  getChatConfig,
131
131
  getRuntimeMetadata,
132
132
  normalizeSlackEmojiName
133
- } from "./chunk-U76RWMFR.js";
133
+ } from "./chunk-5XSEOJPC.js";
134
134
  import {
135
135
  defaultModelId
136
- } from "./chunk-D4YV5TDV.js";
136
+ } from "./chunk-NHJU2ZAL.js";
137
137
  import {
138
138
  discoverSkills
139
- } from "./chunk-P2P6MUQ4.js";
139
+ } from "./chunk-LSPUMNZK.js";
140
140
  import {
141
141
  pluginCatalogRuntime
142
- } from "./chunk-WWXJUURQ.js";
142
+ } from "./chunk-G6YRPYDC.js";
143
143
  import {
144
144
  buildOAuthTokenRequest,
145
145
  hasRequiredOAuthScope,
146
146
  parseOAuthTokenResponse
147
- } from "./chunk-S7GX44BU.js";
147
+ } from "./chunk-BXIVMNLR.js";
148
148
  import {
149
149
  createSlackResumeActor,
150
150
  isUserActor,
@@ -162,7 +162,7 @@ import {
162
162
  setTags,
163
163
  toOptionalString,
164
164
  withLogContext
165
- } from "./chunk-X76JVHQ4.js";
165
+ } from "./chunk-CTS72G4B.js";
166
166
 
167
167
  // src/chat/slack/assistant-thread/status-render.ts
168
168
  var DEFAULT_STATUS_CONTEXTS = {
@@ -3,39 +3,39 @@ import {
3
3
  } from "./chunk-RC745GGZ.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-IOGDKPVU.js";
6
+ } from "./chunk-VXAQTJSR.js";
7
7
  import {
8
8
  appendAndEnqueueExclusiveInboundMessage,
9
9
  appendAndEnqueueInboundMessage
10
- } from "./chunk-E53C73ML.js";
10
+ } from "./chunk-S74KAE77.js";
11
11
  import {
12
12
  buildDeterministicTurnId
13
13
  } from "./chunk-DA2KGZZI.js";
14
14
  import {
15
15
  normalizeSlackConversationId
16
- } from "./chunk-CCTYK5RH.js";
16
+ } from "./chunk-NE2UQMC7.js";
17
17
  import {
18
18
  getConversationStore,
19
19
  getDb
20
- } from "./chunk-ADEACKAH.js";
20
+ } from "./chunk-XNXKRWWI.js";
21
21
  import {
22
22
  juniorConversationParticipants,
23
23
  juniorConversations,
24
24
  juniorIdentities,
25
25
  juniorUsers
26
- } from "./chunk-XLWZRHX5.js";
26
+ } from "./chunk-PIZJBSGZ.js";
27
27
  import {
28
28
  juniorDestinations
29
29
  } from "./chunk-VFUK3X5B.js";
30
30
  import {
31
31
  getSlackBotToken
32
- } from "./chunk-U76RWMFR.js";
32
+ } from "./chunk-5XSEOJPC.js";
33
33
  import {
34
34
  canExposeConversationPayload
35
- } from "./chunk-JOI3DHML.js";
35
+ } from "./chunk-ES7KCEND.js";
36
36
  import {
37
37
  logWarn
38
- } from "./chunk-X76JVHQ4.js";
38
+ } from "./chunk-CTS72G4B.js";
39
39
 
40
40
  // src/handlers/health.ts
41
41
  function readHealthReport() {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-U76RWMFR.js";
3
+ } from "./chunk-5XSEOJPC.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-X76JVHQ4.js";
3
+ } from "./chunk-CTS72G4B.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-S7GX44BU.js";
3
+ } from "./chunk-BXIVMNLR.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-RFE7DCZK.js";
3
+ } from "./chunk-B5WJBVHY.js";
4
4
  import {
5
5
  getPlugins
6
- } from "./chunk-CCTYK5RH.js";
6
+ } from "./chunk-NE2UQMC7.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-ADEACKAH.js";
9
+ } from "./chunk-XNXKRWWI.js";
10
10
  import {
11
11
  juniorAttachments,
12
12
  juniorConversations,
@@ -14,7 +14,7 @@ import {
14
14
  juniorSchedulerRuns,
15
15
  juniorSchedulerTasks,
16
16
  juniorStats
17
- } from "./chunk-XLWZRHX5.js";
17
+ } from "./chunk-PIZJBSGZ.js";
18
18
  import {
19
19
  juniorDestinations
20
20
  } from "./chunk-VFUK3X5B.js";
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  resourceEventMatches
25
25
  } from "@sentry/junior-plugin-api";
26
- import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
26
+ import { and, asc, desc, eq, inArray, ne, or, sql } from "drizzle-orm";
27
27
 
28
28
  // src/chat/event-tasks/types.ts
29
29
  import {
@@ -61,7 +61,11 @@ var eventTaskSchema = z.object({
61
61
 
62
62
  // src/chat/event-tasks/store.ts
63
63
  function eventTaskJsonPayload(task) {
64
- const { title: _title, ...payload } = task;
64
+ const {
65
+ status: _status,
66
+ title: _title,
67
+ ...payload
68
+ } = task;
65
69
  return payload;
66
70
  }
67
71
  function parseTask(row) {
@@ -71,10 +75,21 @@ function parseTask(row) {
71
75
  }
72
76
  const payload = eventTaskSchema.parse(raw);
73
77
  const title = row.title?.trim();
74
- return title ? { ...payload, title } : payload;
78
+ return {
79
+ ...payload,
80
+ status: row.status === "deleted" ? "deleted" : "active",
81
+ ...title ? { title } : void 0
82
+ };
83
+ }
84
+ function activeEventTaskWhere() {
85
+ return ne(juniorEventTasks.status, "deleted");
75
86
  }
76
87
  async function getEventTask(db, id) {
77
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(eq(juniorEventTasks.id, id)).limit(1);
88
+ const rows = await db.select({
89
+ status: juniorEventTasks.status,
90
+ task: juniorEventTasks.task,
91
+ title: juniorEventTasks.title
92
+ }).from(juniorEventTasks).where(eq(juniorEventTasks.id, id)).limit(1);
78
93
  return rows[0] ? parseTask(rows[0]) : void 0;
79
94
  }
80
95
  async function createEventTask(db, task) {
@@ -86,10 +101,43 @@ async function createEventTask(db, task) {
86
101
  namespace: parsed.trigger.namespace,
87
102
  identifier: parsed.trigger.identifier,
88
103
  createdAtMs: parsed.createdAtMs,
104
+ status: "active",
89
105
  title,
90
106
  task: parsed
91
107
  }).onConflictDoNothing();
92
- return await getEventTask(db, parsed.id) ?? { ...parsed, ...title ? { title } : void 0 };
108
+ const existing = await getEventTask(db, parsed.id);
109
+ if (!existing) {
110
+ return {
111
+ ...parsed,
112
+ status: "active",
113
+ ...title ? { title } : void 0
114
+ };
115
+ }
116
+ if (existing.status !== "deleted") {
117
+ return existing;
118
+ }
119
+ const rows = await db.update(juniorEventTasks).set({
120
+ teamId: parsed.destination.teamId,
121
+ namespace: parsed.trigger.namespace,
122
+ identifier: parsed.trigger.identifier,
123
+ status: "active",
124
+ title,
125
+ task: parsed
126
+ }).where(
127
+ and(
128
+ eq(juniorEventTasks.id, parsed.id),
129
+ eq(juniorEventTasks.status, "deleted")
130
+ )
131
+ ).returning({
132
+ status: juniorEventTasks.status,
133
+ task: juniorEventTasks.task,
134
+ title: juniorEventTasks.title
135
+ });
136
+ return rows[0] ? parseTask(rows[0]) : await getEventTask(db, parsed.id) ?? {
137
+ ...parsed,
138
+ status: "active",
139
+ ...title ? { title } : void 0
140
+ };
93
141
  }
94
142
  async function saveEventTask(db, task) {
95
143
  const parsed = eventTaskSchema.parse(eventTaskJsonPayload(task));
@@ -99,15 +147,27 @@ async function saveEventTask(db, task) {
99
147
  identifier: parsed.trigger.identifier,
100
148
  title,
101
149
  task: parsed
102
- }).where(eq(juniorEventTasks.id, parsed.id)).returning({ task: juniorEventTasks.task, title: juniorEventTasks.title });
150
+ }).where(and(eq(juniorEventTasks.id, parsed.id), activeEventTaskWhere())).returning({
151
+ status: juniorEventTasks.status,
152
+ task: juniorEventTasks.task,
153
+ title: juniorEventTasks.title
154
+ });
103
155
  return rows[0] ? parseTask(rows[0]) : void 0;
104
156
  }
105
157
  async function deleteEventTask(db, id) {
106
- const rows = await db.delete(juniorEventTasks).where(eq(juniorEventTasks.id, id)).returning({ task: juniorEventTasks.task, title: juniorEventTasks.title });
158
+ const rows = await db.update(juniorEventTasks).set({ status: "deleted" }).where(and(eq(juniorEventTasks.id, id), activeEventTaskWhere())).returning({
159
+ status: juniorEventTasks.status,
160
+ task: juniorEventTasks.task,
161
+ title: juniorEventTasks.title
162
+ });
107
163
  return rows[0] ? parseTask(rows[0]) : void 0;
108
164
  }
109
165
  async function listEventTasksForTeam(db, teamId) {
110
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(eq(juniorEventTasks.teamId, teamId)).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
166
+ const rows = await db.select({
167
+ status: juniorEventTasks.status,
168
+ task: juniorEventTasks.task,
169
+ title: juniorEventTasks.title
170
+ }).from(juniorEventTasks).where(and(eq(juniorEventTasks.teamId, teamId), activeEventTaskWhere())).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
111
171
  return rows.map(parseTask);
112
172
  }
113
173
  function viewerSlackIdentities(user) {
@@ -131,12 +191,38 @@ async function listEventTasksCreatedBy(db, user, limit) {
131
191
  )
132
192
  );
133
193
  if (!ownership) return [];
134
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(ownership).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
194
+ const rows = await db.select({
195
+ status: juniorEventTasks.status,
196
+ task: juniorEventTasks.task,
197
+ title: juniorEventTasks.title
198
+ }).from(juniorEventTasks).where(and(ownership, activeEventTaskWhere())).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
199
+ return rows.map(parseTask);
200
+ }
201
+ async function listDeletedEventTasksCreatedBy(db, user, limit) {
202
+ const identities = viewerSlackIdentities(user);
203
+ const ownership = or(
204
+ ...identities.map(
205
+ (identity) => and(
206
+ eq(juniorEventTasks.teamId, identity.providerTenantId),
207
+ sql`${juniorEventTasks.task}->'createdBy'->>'slackUserId' = ${identity.providerSubjectId}`
208
+ )
209
+ )
210
+ );
211
+ if (!ownership) return [];
212
+ const rows = await db.select({
213
+ status: juniorEventTasks.status,
214
+ task: juniorEventTasks.task,
215
+ title: juniorEventTasks.title
216
+ }).from(juniorEventTasks).where(and(ownership, eq(juniorEventTasks.status, "deleted"))).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
135
217
  return rows.map(parseTask);
136
218
  }
137
219
  async function listPublicEventTasksForTeams(db, teamIds, limit) {
138
220
  if (teamIds.length === 0) return [];
139
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).innerJoin(
221
+ const rows = await db.select({
222
+ status: juniorEventTasks.status,
223
+ task: juniorEventTasks.task,
224
+ title: juniorEventTasks.title
225
+ }).from(juniorEventTasks).innerJoin(
140
226
  juniorDestinations,
141
227
  and(
142
228
  eq(juniorDestinations.provider, "slack"),
@@ -146,6 +232,7 @@ async function listPublicEventTasksForTeams(db, teamIds, limit) {
146
232
  ).where(
147
233
  and(
148
234
  inArray(juniorEventTasks.teamId, teamIds),
235
+ activeEventTaskWhere(),
149
236
  eq(juniorDestinations.visibility, "public")
150
237
  )
151
238
  ).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
@@ -159,11 +246,16 @@ async function collectEventTaskMatchKeys(db, input) {
159
246
  ...new Set(input.identifiers.map((value) => value.trim()).filter(Boolean))
160
247
  ];
161
248
  if (eventTypes.size === 0 || identifiers.length === 0) return [];
162
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(
249
+ const rows = await db.select({
250
+ status: juniorEventTasks.status,
251
+ task: juniorEventTasks.task,
252
+ title: juniorEventTasks.title
253
+ }).from(juniorEventTasks).where(
163
254
  and(
164
255
  eq(juniorEventTasks.teamId, input.teamId),
165
256
  eq(juniorEventTasks.namespace, input.namespace),
166
- inArray(juniorEventTasks.identifier, identifiers)
257
+ inArray(juniorEventTasks.identifier, identifiers),
258
+ activeEventTaskWhere()
167
259
  )
168
260
  ).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
169
261
  const keys = /* @__PURE__ */ new Set();
@@ -179,11 +271,16 @@ async function collectEventTaskMatchKeys(db, input) {
179
271
  return [...keys].sort();
180
272
  }
181
273
  async function findMatchingEventTasks(db, event, teamId) {
182
- const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(
274
+ const rows = await db.select({
275
+ status: juniorEventTasks.status,
276
+ task: juniorEventTasks.task,
277
+ title: juniorEventTasks.title
278
+ }).from(juniorEventTasks).where(
183
279
  and(
184
280
  eq(juniorEventTasks.teamId, teamId),
185
281
  eq(juniorEventTasks.namespace, event.namespace),
186
- eq(juniorEventTasks.identifier, event.identifier)
282
+ eq(juniorEventTasks.identifier, event.identifier),
283
+ activeEventTaskWhere()
187
284
  )
188
285
  ).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
189
286
  return rows.map(parseTask).filter(
@@ -569,7 +666,7 @@ function eventTaskIsWritableFrom(task, destination) {
569
666
  async function writableEventTask(context, id) {
570
667
  const { destination } = requireEventTaskSlackContext(context);
571
668
  const task = await getEventTask(getDb(), id);
572
- if (!task || !eventTaskIsWritableFrom(task, destination)) {
669
+ if (!task || task.status === "deleted" || !eventTaskIsWritableFrom(task, destination)) {
573
670
  throw new ToolInputError("Event task was not found.");
574
671
  }
575
672
  return task;
@@ -845,8 +942,39 @@ async function writeScheduledTask(db, task, current) {
845
942
  )
846
943
  );
847
944
  }
945
+ if (task.status === "deleted" && current?.status !== "deleted") {
946
+ await skipPendingRunsForDeletedTask(db, task);
947
+ }
848
948
  await upsertScheduledTask(db, task);
849
949
  }
950
+ async function skipPendingRunsForDeletedTask(db, task) {
951
+ const errorMessage = `Scheduled task ${task.id} was deleted before the run started.`;
952
+ const rows = await db.select({ record: juniorSchedulerRuns.record }).from(juniorSchedulerRuns).where(
953
+ and3(
954
+ eq2(juniorSchedulerRuns.taskId, task.id),
955
+ eq2(juniorSchedulerRuns.status, "pending")
956
+ )
957
+ );
958
+ for (const row of rows) {
959
+ const parsed = scheduledRunSchema.safeParse(row.record);
960
+ if (!parsed.success || parsed.data.status !== "pending") continue;
961
+ const next = scheduledRunSchema.parse({
962
+ ...parsed.data,
963
+ completedAtMs: task.updatedAtMs,
964
+ errorMessage,
965
+ status: "skipped"
966
+ });
967
+ await db.update(juniorSchedulerRuns).set({
968
+ record: next,
969
+ status: next.status
970
+ }).where(
971
+ and3(
972
+ eq2(juniorSchedulerRuns.id, next.id),
973
+ eq2(juniorSchedulerRuns.status, "pending")
974
+ )
975
+ );
976
+ }
977
+ }
850
978
  async function createScheduledTask(db, task) {
851
979
  const next = requireStoredTask(task);
852
980
  return await withScheduledTaskLock(db, task.id, async (tx) => {
@@ -1263,6 +1391,7 @@ export {
1263
1391
  listEventTasksForTeam,
1264
1392
  eventTaskBelongsToUser,
1265
1393
  listEventTasksCreatedBy,
1394
+ listDeletedEventTasksCreatedBy,
1266
1395
  listPublicEventTasksForTeams,
1267
1396
  collectEventTaskMatchKeys,
1268
1397
  findMatchingEventTasks,
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.194.0",
4
+ version: "0.196.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-GY5SEFVL.js";
5
+ } from "./chunk-QAINJHI4.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-G35QGPO2.js";
10
+ } from "./chunk-DFWJJOW3.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-OEQOAONV.js";
14
+ } from "./chunk-6LQNW2CJ.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-U76RWMFR.js";
23
+ } from "./chunk-5XSEOJPC.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-X76JVHQ4.js";
29
+ } from "./chunk-CTS72G4B.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConversationTurnLifecycleService
3
- } from "./chunk-6H2MKVV5.js";
3
+ } from "./chunk-VSOO3Y6M.js";
4
4
  import {
5
5
  runAgentWithTimeout
6
- } from "./chunk-ENWIHU54.js";
6
+ } from "./chunk-RFNMWONZ.js";
7
7
  import {
8
8
  getConversationEventStore
9
- } from "./chunk-ADEACKAH.js";
9
+ } from "./chunk-XNXKRWWI.js";
10
10
 
11
11
  // src/chat/runtime/turn-execution.ts
12
12
  var AgentRunError = class extends Error {
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-7ANA7PBB.js";
9
+ } from "./chunk-SR5FS2JP.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-V4HXV5MY.js";
12
+ } from "./chunk-EQBHN4JK.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-X76JVHQ4.js";
16
+ } from "./chunk-CTS72G4B.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;