@sentry/junior 0.182.0 → 0.183.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 (86) hide show
  1. package/dist/{agent-hooks-3S25UIHO.js → agent-hooks-SNRBZYAU.js} +11 -11
  2. package/dist/api/code/overview.d.ts +35 -0
  3. package/dist/api/code/routes.d.ts +4 -0
  4. package/dist/api/schema/code.d.ts +75 -0
  5. package/dist/api/schema.d.ts +2 -0
  6. package/dist/api/schema.js +9 -1
  7. package/dist/api.js +258 -134
  8. package/dist/app.js +71 -48
  9. package/dist/{catalog-runtime-ESLMBQBV.js → catalog-runtime-3I3JOIIH.js} +4 -4
  10. package/dist/chat/agent-invocations/store.d.ts +4 -2
  11. package/dist/chat/agent-invocations/work.d.ts +1 -3
  12. package/dist/chat/app/factory.d.ts +3 -3
  13. package/dist/chat/app/services.d.ts +3 -3
  14. package/dist/chat/code/publisher.d.ts +3 -0
  15. package/dist/chat/code/store.d.ts +9 -0
  16. package/dist/chat/event-tasks/store.d.ts +10 -0
  17. package/dist/chat/ingress/slack-webhook.d.ts +1 -1
  18. package/dist/chat/plugins/agent-hooks.d.ts +5 -0
  19. package/dist/chat/{runtime/slack-runtime.d.ts → providers/slack/runtime.d.ts} +2 -2
  20. package/dist/chat/{runtime/reply-executor.d.ts → providers/slack/turn.d.ts} +10 -9
  21. package/dist/chat/resource-events/store.d.ts +12 -0
  22. package/dist/chat/runtime/turn-execution.d.ts +30 -0
  23. package/dist/chat/slack/dispatch-turn.d.ts +12 -14
  24. package/dist/chat/task-execution/slack-work.d.ts +1 -1
  25. package/dist/{chunk-SXOZIG5X.js → chunk-24OJZ5OU.js} +6 -6
  26. package/dist/{chunk-SVFSYQMT.js → chunk-2ADFGSUS.js} +1 -1
  27. package/dist/{chunk-GGYA5NPN.js → chunk-2EPYYVJC.js} +8 -8
  28. package/dist/{chunk-KGMHUDVF.js → chunk-35PM4YY5.js} +6 -6
  29. package/dist/{chunk-3ENUMZNG.js → chunk-37IQ6DGU.js} +3 -3
  30. package/dist/{chunk-3THPTNN6.js → chunk-3HJ4F4L7.js} +4 -4
  31. package/dist/{chunk-3NFHI2NA.js → chunk-3L7CWDQQ.js} +1 -1
  32. package/dist/{chunk-CVBIM4Z3.js → chunk-4WGFWHWP.js} +1 -1
  33. package/dist/{chunk-YHL2L2ZZ.js → chunk-56XONJPF.js} +1 -1
  34. package/dist/{chunk-44BQ3TSK.js → chunk-6UXDTPEN.js} +233 -173
  35. package/dist/{chunk-2CEOXDG2.js → chunk-AHMWPFIW.js} +174 -6
  36. package/dist/{chunk-6TSWXBTQ.js → chunk-AX3UDIMA.js} +3 -3
  37. package/dist/{chunk-S35OZMSL.js → chunk-AYW7J6K4.js} +13 -13
  38. package/dist/{chunk-WOIALVN2.js → chunk-E3OBGRHN.js} +1 -1
  39. package/dist/{chunk-4DZ62L36.js → chunk-EENQGEIP.js} +1 -1
  40. package/dist/{chunk-UUMBHORH.js → chunk-FJMTMGBC.js} +1 -1
  41. package/dist/{chunk-Z7ALSQS3.js → chunk-G2B2XZQW.js} +1 -1
  42. package/dist/{chunk-TEFNHMO2.js → chunk-HUK5XIZL.js} +4 -4
  43. package/dist/{chunk-LT4QYGKM.js → chunk-IO6KFXYE.js} +160 -97
  44. package/dist/{chunk-JIOKUIAS.js → chunk-KTXOGLNE.js} +2 -2
  45. package/dist/{chunk-LHQK5XCU.js → chunk-LMNMMESF.js} +2 -2
  46. package/dist/{chunk-UQP54CXZ.js → chunk-LZBPGX5A.js} +1 -1
  47. package/dist/{chunk-PQES5LB5.js → chunk-PLZT45VC.js} +5 -5
  48. package/dist/{chunk-V5UZCCNW.js → chunk-QI5JW5AG.js} +6 -6
  49. package/dist/{chunk-A7THOQ6N.js → chunk-QZV76CM4.js} +21 -21
  50. package/dist/{chunk-LB4FWMCV.js → chunk-R767Y7QV.js} +183 -155
  51. package/dist/{chunk-MJISSOWB.js → chunk-SQHFVIMZ.js} +1 -1
  52. package/dist/{chunk-BDDWVY32.js → chunk-T5MTGX2E.js} +19 -19
  53. package/dist/{chunk-DZR3L74W.js → chunk-V64JCZUV.js} +3 -3
  54. package/dist/{chunk-VHMAFMHB.js → chunk-VOV3SCM3.js} +1 -1
  55. package/dist/{chunk-BZD4ADQH.js → chunk-W46NIB5H.js} +1 -1
  56. package/dist/{chunk-QHALFHZA.js → chunk-W5JMPEBO.js} +9 -9
  57. package/dist/{chunk-D6OHGAIO.js → chunk-WOKJRLM2.js} +5 -5
  58. package/dist/chunk-WVIA7V3M.js +975 -0
  59. package/dist/{chunk-UKIHNBBD.js → chunk-X52ESOBP.js} +3 -3
  60. package/dist/cli/chat.js +33 -35
  61. package/dist/cli/check.js +5 -5
  62. package/dist/cli/plugins.js +12 -12
  63. package/dist/cli/snapshot-create.js +9 -9
  64. package/dist/cli/upgrade.js +6 -6
  65. package/dist/db/schema/code.d.ts +367 -0
  66. package/dist/db/schema.d.ts +367 -1
  67. package/dist/{db-NYIWZ4L5.js → db-K2VMNLHQ.js} +6 -6
  68. package/dist/instrumentation.js +3 -3
  69. package/dist/nitro.js +6 -6
  70. package/dist/{oauth-callback-server-A2YTPVVX.js → oauth-callback-server-DZZMTKSS.js} +25 -25
  71. package/dist/{runner-VKAEU52J.js → runner-IIAKWDXI.js} +18 -18
  72. package/dist/{skills-52GMXUTY.js → skills-EXIQ7BP5.js} +5 -5
  73. package/dist/spawn-ZR6OOEAN.js +37 -0
  74. package/dist/task-runner-C52HYCVD.js +32 -0
  75. package/dist/{validation-VD2YQX2W.js → validation-XUGIWBJF.js} +5 -5
  76. package/dist/version.js +1 -1
  77. package/dist/{work-ZWBTGEQP.js → work-G4RLJ634.js} +18 -18
  78. package/dist/worker-R2JEHK67.js +22 -0
  79. package/migrations/0036_complex_rage.sql +32 -0
  80. package/migrations/meta/0036_snapshot.json +3186 -0
  81. package/migrations/meta/_journal.json +8 -1
  82. package/package.json +6 -6
  83. package/dist/chunk-CZYNWPWD.js +0 -930
  84. package/dist/spawn-GSS4EBLR.js +0 -37
  85. package/dist/task-runner-DUGDWF5O.js +0 -32
  86. package/dist/worker-XUWD5WS7.js +0 -22
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-3THPTNN6.js";
3
+ } from "./chunk-3HJ4F4L7.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-VHMAFMHB.js";
6
+ } from "./chunk-VOV3SCM3.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-LT4QYGKM.js";
12
+ } from "./chunk-IO6KFXYE.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,7 +36,7 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-BDDWVY32.js";
39
+ } from "./chunk-T5MTGX2E.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  GET,
@@ -53,8 +53,8 @@ import {
53
53
  resolveSlackConversationContext,
54
54
  routeApiTurnWork,
55
55
  webActorFromEmail
56
- } from "./chunk-S35OZMSL.js";
57
- import "./chunk-CVBIM4Z3.js";
56
+ } from "./chunk-AYW7J6K4.js";
57
+ import "./chunk-4WGFWHWP.js";
58
58
  import {
59
59
  buildDeliveredTurnStatePatch,
60
60
  completeAuthPauseTurn,
@@ -65,7 +65,7 @@ import {
65
65
  getTurnUserSlackMessageTs,
66
66
  persistAuthPauseTurnState,
67
67
  requireTurnFailureEventId
68
- } from "./chunk-D6OHGAIO.js";
68
+ } from "./chunk-WOKJRLM2.js";
69
69
  import {
70
70
  claimDispatchMailboxAppend,
71
71
  confirmDispatchMailboxAppend,
@@ -85,7 +85,7 @@ import {
85
85
  recordTaskExecution,
86
86
  resolveTurnSessionRouting,
87
87
  scheduleSessionCompletedPluginTasks
88
- } from "./chunk-QHALFHZA.js";
88
+ } from "./chunk-W5JMPEBO.js";
89
89
  import {
90
90
  ConversationTurnLifecycleService
91
91
  } from "./chunk-M3QYTBQ6.js";
@@ -97,17 +97,17 @@ import {
97
97
  persistThreadRuntimeState,
98
98
  persistThreadState,
99
99
  persistThreadStateById
100
- } from "./chunk-PQES5LB5.js";
100
+ } from "./chunk-PLZT45VC.js";
101
101
  import "./chunk-UTL3MHPC.js";
102
102
  import {
103
103
  createVercelPluginTaskCallback,
104
104
  queueCallback,
105
105
  registerVercelPluginTaskDevConsumer
106
- } from "./chunk-DZR3L74W.js";
106
+ } from "./chunk-V64JCZUV.js";
107
107
  import {
108
108
  validatePluginEgressCredentialHooks,
109
109
  validatePluginRegistrations
110
- } from "./chunk-3NFHI2NA.js";
110
+ } from "./chunk-3L7CWDQQ.js";
111
111
  import {
112
112
  defineJuniorPlugins,
113
113
  pluginCatalogConfigFromEnv,
@@ -155,11 +155,11 @@ import {
155
155
  unpublishedArtifactHeaders,
156
156
  verifySlackSignature,
157
157
  withNormalizedThreadId
158
- } from "./chunk-A7THOQ6N.js";
158
+ } from "./chunk-QZV76CM4.js";
159
159
  import {
160
160
  AuthorizationFlowDisabledError,
161
161
  PluginCredentialFailureError
162
- } from "./chunk-KGMHUDVF.js";
162
+ } from "./chunk-35PM4YY5.js";
163
163
  import "./chunk-6Y5B5PEX.js";
164
164
  import "./chunk-DIB4GX3G.js";
165
165
  import {
@@ -168,7 +168,7 @@ import {
168
168
  deleteMcpAuthSessionsForUserProvider,
169
169
  deleteMcpServerSessionId,
170
170
  deleteMcpStoredOAuthCredentials
171
- } from "./chunk-GGYA5NPN.js";
171
+ } from "./chunk-2EPYYVJC.js";
172
172
  import {
173
173
  RetryableDeliveryError
174
174
  } from "./chunk-RF6J3DIO.js";
@@ -176,7 +176,7 @@ import {
176
176
  formatProviderLabel,
177
177
  postSlackMessage,
178
178
  startOAuthFlow
179
- } from "./chunk-V5UZCCNW.js";
179
+ } from "./chunk-QI5JW5AG.js";
180
180
  import {
181
181
  getExperimentalFeatures,
182
182
  isExperimentalFeatureEnabled,
@@ -184,6 +184,7 @@ import {
184
184
  } from "./chunk-2LYHWMR4.js";
185
185
  import {
186
186
  collectAttachmentGarbage,
187
+ collectEventTaskMatchKeys,
187
188
  findMatchingEventTasks,
188
189
  getResourceEventCatalog,
189
190
  listScheduledTasks,
@@ -196,10 +197,10 @@ import {
196
197
  scheduledRunId,
197
198
  scheduledRunSchema,
198
199
  withScheduledTaskLock
199
- } from "./chunk-LB4FWMCV.js";
200
+ } from "./chunk-R767Y7QV.js";
200
201
  import {
201
202
  parseSlackThreadId
202
- } from "./chunk-MJISSOWB.js";
203
+ } from "./chunk-SQHFVIMZ.js";
203
204
  import {
204
205
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
205
206
  appendAndEnqueueInboundMessage,
@@ -214,7 +215,7 @@ import {
214
215
  removeActiveConversation,
215
216
  requestConversationWork,
216
217
  stopConversationWork
217
- } from "./chunk-TEFNHMO2.js";
218
+ } from "./chunk-HUK5XIZL.js";
218
219
  import {
219
220
  ConversationTurnBoundaryError,
220
221
  CooperativeTurnYieldError,
@@ -232,7 +233,7 @@ import {
232
233
  markTurnCompleted,
233
234
  markTurnFailed,
234
235
  startActiveTurn
235
- } from "./chunk-YHL2L2ZZ.js";
236
+ } from "./chunk-56XONJPF.js";
236
237
  import {
237
238
  abandonTurnRecord,
238
239
  appendThreadContextMessages,
@@ -268,11 +269,11 @@ import {
268
269
  trimTrailingAssistantMessages,
269
270
  turnHasReply,
270
271
  upsertConversationMessage
271
- } from "./chunk-SXOZIG5X.js";
272
+ } from "./chunk-24OJZ5OU.js";
272
273
  import {
273
274
  getSandboxResourceConfig,
274
275
  setSandboxResourceConfig
275
- } from "./chunk-3ENUMZNG.js";
276
+ } from "./chunk-37IQ6DGU.js";
276
277
  import "./chunk-PDO5BLNM.js";
277
278
  import "./chunk-UIE3R5XU.js";
278
279
  import {
@@ -291,13 +292,14 @@ import {
291
292
  import "./chunk-7H2VZTWN.js";
292
293
  import {
293
294
  getTurnRequestDeadline
294
- } from "./chunk-UUMBHORH.js";
295
+ } from "./chunk-FJMTMGBC.js";
295
296
  import {
296
297
  SlackActionError,
297
298
  bindEventTaskCredentialSubject,
298
299
  bindScheduledTaskCredentialSubject,
299
300
  bindSlackDirectCredentialSubject,
300
301
  cancelSubscriptions,
302
+ collectResourceEventMatchKeys,
301
303
  createPluginLogger,
302
304
  createPluginState,
303
305
  createResourceEventTeamIdResolver,
@@ -316,7 +318,7 @@ import {
316
318
  verifyEventTaskCredentialSubject,
317
319
  verifyScheduledTaskCredentialSubject,
318
320
  verifySlackDirectCredentialSubject
319
- } from "./chunk-2CEOXDG2.js";
321
+ } from "./chunk-AHMWPFIW.js";
320
322
  import "./chunk-3Y47VMHV.js";
321
323
  import {
322
324
  contextProvenance,
@@ -329,7 +331,7 @@ import {
329
331
  requireSlackDestination,
330
332
  withConversationEventLock,
331
333
  withConversationMutationLock
332
- } from "./chunk-6TSWXBTQ.js";
334
+ } from "./chunk-AX3UDIMA.js";
333
335
  import {
334
336
  juniorAgentBindings,
335
337
  juniorAgentInvocations,
@@ -337,13 +339,13 @@ import {
337
339
  juniorConversations,
338
340
  juniorSchedulerRuns,
339
341
  juniorSchedulerTasks
340
- } from "./chunk-44BQ3TSK.js";
341
- import "./chunk-UKIHNBBD.js";
342
+ } from "./chunk-6UXDTPEN.js";
343
+ import "./chunk-X52ESOBP.js";
342
344
  import {
343
345
  acquireActiveLock,
344
346
  getStateAdapter,
345
347
  withActiveLock
346
- } from "./chunk-Z7ALSQS3.js";
348
+ } from "./chunk-G2B2XZQW.js";
347
349
  import {
348
350
  juniorDestinations
349
351
  } from "./chunk-VFUK3X5B.js";
@@ -364,13 +366,13 @@ import {
364
366
  modelIdForProfile,
365
367
  setProfiles,
366
368
  setSlackReactionConfig
367
- } from "./chunk-LHQK5XCU.js";
368
- import "./chunk-SVFSYQMT.js";
369
- import "./chunk-JIOKUIAS.js";
369
+ } from "./chunk-LMNMMESF.js";
370
+ import "./chunk-2ADFGSUS.js";
371
+ import "./chunk-KTXOGLNE.js";
370
372
  import {
371
373
  pluginCatalogRuntime
372
- } from "./chunk-WOIALVN2.js";
373
- import "./chunk-4DZ62L36.js";
374
+ } from "./chunk-E3OBGRHN.js";
375
+ import "./chunk-EENQGEIP.js";
374
376
  import {
375
377
  credentialContextForActor
376
378
  } from "./chunk-CEMMLV5L.js";
@@ -405,13 +407,13 @@ import {
405
407
  withContext,
406
408
  withLogContext,
407
409
  withSpan
408
- } from "./chunk-UQP54CXZ.js";
410
+ } from "./chunk-LZBPGX5A.js";
409
411
  import {
410
412
  continueTrace
411
413
  } from "./chunk-PEQXYSSE.js";
412
414
  import {
413
415
  JUNIOR_VERSION
414
- } from "./chunk-BZD4ADQH.js";
416
+ } from "./chunk-W46NIB5H.js";
415
417
 
416
418
  // src/app.ts
417
419
  import { createRequire } from "module";
@@ -4208,7 +4210,7 @@ function combineTurnText(queuedMessages, latestText) {
4208
4210
  };
4209
4211
  }
4210
4212
 
4211
- // src/chat/runtime/slack-runtime.ts
4213
+ // src/chat/providers/slack/runtime.ts
4212
4214
  var THREAD_OPTOUT_ACK = "Understood. I'll stay out of this thread unless someone @mentions me again.";
4213
4215
  function shouldRethrowTurnControlError(error) {
4214
4216
  return isCooperativeTurnYieldError(error) || isTurnInputCommitLostError(error) || isTurnInputDeferredError(error) || isProviderRetryError(error);
@@ -4587,7 +4589,7 @@ function createSlackTurnRuntime(deps) {
4587
4589
  }),
4588
4590
  stripLeadingBotMention: deps.stripLeadingBotMention
4589
4591
  });
4590
- await deps.replyToThread(thread, message, {
4592
+ await deps.executeSlackTurn(thread, message, {
4591
4593
  explicitMention: true,
4592
4594
  beforeFirstResponsePost: hooks.beforeFirstResponsePost,
4593
4595
  conversationId: hooks.conversationId,
@@ -4877,7 +4879,7 @@ function createSlackTurnRuntime(deps) {
4877
4879
  processingReaction,
4878
4880
  hooks
4879
4881
  );
4880
- await deps.replyToThread(thread, message, {
4882
+ await deps.executeSlackTurn(thread, message, {
4881
4883
  explicitMention: Boolean(message.isMention),
4882
4884
  conversationId: hooks.conversationId,
4883
4885
  destination: hooks.destination,
@@ -5516,7 +5518,7 @@ function createJuniorRuntimeServices(overrides = {}) {
5516
5518
  };
5517
5519
  }
5518
5520
 
5519
- // src/chat/runtime/reply-executor.ts
5521
+ // src/chat/providers/slack/turn.ts
5520
5522
  import { createSlackSource as createSlackSource2 } from "@sentry/junior-plugin-api";
5521
5523
 
5522
5524
  // src/chat/slack/message/identity.ts
@@ -5614,7 +5616,7 @@ async function maybeApplyProviderDefaultConfigRequest(args) {
5614
5616
  };
5615
5617
  }
5616
5618
 
5617
- // src/chat/runtime/reply-executor.ts
5619
+ // src/chat/providers/slack/turn.ts
5618
5620
  async function persistThreadRuntimeStateWithRetry(thread, patch) {
5619
5621
  await persistWithRetry(() => persistThreadRuntimeState(thread, patch));
5620
5622
  }
@@ -5739,8 +5741,8 @@ async function loadPiMessagesForTurn(args) {
5739
5741
  function shouldPublishExternally2(publishExternally) {
5740
5742
  return publishExternally !== false;
5741
5743
  }
5742
- function createReplyToThread(deps) {
5743
- return async function replyToThread(thread, message, options) {
5744
+ function createSlackTurn(deps) {
5745
+ return async function executeSlackTurn(thread, message, options) {
5744
5746
  if (message.author.isMe) {
5745
5747
  return;
5746
5748
  }
@@ -7148,7 +7150,7 @@ function createSlackDispatchTurnRunner(options) {
7148
7150
  let errorMessage;
7149
7151
  let resultMessageTs;
7150
7152
  const routing = buildDispatchRoutingContext(dispatch2);
7151
- await options.replyToThread(thread, message, {
7153
+ await options.executeSlackTurn(thread, message, {
7152
7154
  ack: hooks.ack,
7153
7155
  conversationId,
7154
7156
  destination: dispatch2.destination,
@@ -7228,7 +7230,7 @@ function createSlackRuntime(options) {
7228
7230
  );
7229
7231
  }
7230
7232
  });
7231
- const replyToThread = createReplyToThread({
7233
+ const executeSlackTurn = createSlackTurn({
7232
7234
  getSlackAdapter: options.getSlackAdapter,
7233
7235
  prepareTurnState,
7234
7236
  resolveUserAttachments: services.visionContext.resolveUserAttachments,
@@ -7327,7 +7329,7 @@ function createSlackRuntime(options) {
7327
7329
  conversation: preparedState.conversation
7328
7330
  });
7329
7331
  },
7330
- replyToThread,
7332
+ executeSlackTurn,
7331
7333
  initializeAssistantThread: async ({
7332
7334
  channelId,
7333
7335
  threadTs,
@@ -7358,7 +7360,7 @@ function createSlackRuntime(options) {
7358
7360
  runDispatchTurn: createSlackDispatchTurnRunner({
7359
7361
  getLocationConfiguration: getLocationConfigurationService,
7360
7362
  getSlackAdapter: options.getSlackAdapter,
7361
- replyToThread
7363
+ executeSlackTurn
7362
7364
  })
7363
7365
  };
7364
7366
  }
@@ -7951,9 +7953,7 @@ function createConversationWork(options) {
7951
7953
  turnLifecycle: services.replyExecutor?.turnLifecycle
7952
7954
  }),
7953
7955
  fallbackWorker: routeAgentInvocationWork({
7954
- invocationWorker: createAgentInvocationWorker({
7955
- agentRunner: options.agentRunner
7956
- }),
7956
+ invocationWorker: createAgentInvocationWorker(options.agentRunner),
7957
7957
  fallbackWorker: providerWorker
7958
7958
  })
7959
7959
  }),
@@ -8501,6 +8501,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
8501
8501
  const peoplePath = pagePath("people");
8502
8502
  const pagePaths = [
8503
8503
  basePath,
8504
+ pagePath("code"),
8504
8505
  conversationsPath,
8505
8506
  `${conversationsPath}/*`,
8506
8507
  pagePath("locations"),
@@ -8540,6 +8541,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
8540
8541
  "/api/tasks",
8541
8542
  "/api/tasks/*",
8542
8543
  "/api/skills",
8544
+ "/api/code",
8543
8545
  "/api/stats",
8544
8546
  "/api/conversations",
8545
8547
  "/api/conversations/*",
@@ -8703,6 +8705,27 @@ async function createApp(options) {
8703
8705
  let pluginApiRoutes = [];
8704
8706
  const resolveResourceEventTeamId = createResourceEventTeamIdResolver();
8705
8707
  const resourceEvents = {
8708
+ async neededMatchKeys(input) {
8709
+ const teamId = await resolveResourceEventTeamId();
8710
+ if (!teamId) return [];
8711
+ const conversationWork = getConversationWorkOptions();
8712
+ const [watchKeys, taskKeys] = await Promise.all([
8713
+ collectResourceEventMatchKeys({
8714
+ eventTypes: input.eventTypes,
8715
+ identifiers: input.identifiers,
8716
+ namespace: input.namespace,
8717
+ state: conversationWork.state,
8718
+ teamId
8719
+ }),
8720
+ collectEventTaskMatchKeys(getDb(), {
8721
+ eventTypes: input.eventTypes,
8722
+ identifiers: input.identifiers,
8723
+ namespace: input.namespace,
8724
+ teamId
8725
+ })
8726
+ ]);
8727
+ return [.../* @__PURE__ */ new Set([...watchKeys, ...taskKeys])].sort();
8728
+ },
8706
8729
  async publish(event) {
8707
8730
  const teamId = await resolveResourceEventTeamId();
8708
8731
  if (!teamId) {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-WOIALVN2.js";
4
- import "./chunk-4DZ62L36.js";
3
+ } from "./chunk-E3OBGRHN.js";
4
+ import "./chunk-EENQGEIP.js";
5
5
  import "./chunk-CEMMLV5L.js";
6
6
  import "./chunk-N7TMSOZH.js";
7
7
  import "./chunk-DWPN6SCH.js";
8
8
  import "./chunk-TXKUKMVO.js";
9
- import "./chunk-UQP54CXZ.js";
9
+ import "./chunk-LZBPGX5A.js";
10
10
  import "./chunk-PEQXYSSE.js";
11
- import "./chunk-BZD4ADQH.js";
11
+ import "./chunk-W46NIB5H.js";
12
12
  export {
13
13
  pluginCatalogRuntime
14
14
  };
@@ -40,5 +40,7 @@ export declare function completeAgentInvocation(args: {
40
40
  status: "blocked" | "failed";
41
41
  nowMs?: number;
42
42
  }): Promise<AgentInvocation | undefined>;
43
- /** Return whether an invocation already owns its immutable terminal result. */
44
- export declare function isTerminalAgentInvocation(invocation: AgentInvocation): boolean;
43
+ /** Return whether an agent invocation has finished. */
44
+ export declare function isTerminalAgentInvocation(invocation: AgentInvocation): invocation is Extract<AgentInvocation, {
45
+ status: "blocked" | "completed" | "failed";
46
+ }>;
@@ -20,9 +20,7 @@ export declare function createAndEnqueueAgentInvocation(input: CreateAgentInvoca
20
20
  /** Resolve invocation execution from mailbox input or durable active state. */
21
21
  export declare function resolveAgentInvocationId(context: ConversationWorkerContext): Promise<string | undefined>;
22
22
  /** Build the invocation consumer that advances work through the shared runner. */
23
- export declare function createAgentInvocationWorker(options: {
24
- agentRunner: AgentRunner;
25
- }): (context: ConversationWorkerContext, invocationId: string) => Promise<ConversationWorkerResult>;
23
+ export declare function createAgentInvocationWorker(agentRunner: AgentRunner): (context: ConversationWorkerContext, invocationId: string) => Promise<ConversationWorkerResult>;
26
24
  /** Route invocation-backed work before falling through to existing consumers. */
27
25
  export declare function routeAgentInvocationWork(options: {
28
26
  fallbackWorker: (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
@@ -1,6 +1,6 @@
1
1
  import type { SlackAdapter } from "@chat-adapter/slack";
2
2
  import type { Message } from "chat";
3
- import { type AssistantLifecycleEvent } from "@/chat/runtime/slack-runtime";
3
+ import { type AssistantLifecycleEvent } from "@/chat/providers/slack/runtime";
4
4
  import type { JuniorRuntimeServiceOverrides } from "@/chat/app/services";
5
5
  export interface CreateSlackRuntimeOptions {
6
6
  getSlackAdapter: () => SlackAdapter;
@@ -14,6 +14,6 @@ export declare function createSlackRuntime(options: CreateSlackRuntimeOptions):
14
14
  }) => Promise<import("../agent-dispatch/types").DispatchTurnResult>;
15
15
  handleAssistantContextChanged: (event: AssistantLifecycleEvent) => Promise<void>;
16
16
  handleAssistantThreadStarted: (event: AssistantLifecycleEvent) => Promise<void>;
17
- handleNewMention: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/runtime/slack-runtime").SlackTurnOptions) => Promise<void>;
18
- handleSubscribedMessage: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/runtime/slack-runtime").SlackTurnOptions) => Promise<void>;
17
+ handleNewMention: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/providers/slack/runtime").SlackTurnOptions) => Promise<void>;
18
+ handleSubscribedMessage: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/providers/slack/runtime").SlackTurnOptions) => Promise<void>;
19
19
  };
@@ -2,19 +2,19 @@ import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/
2
2
  import { type ConversationMemoryDeps, type ConversationMemoryService } from "@/chat/services/conversation-memory";
3
3
  import { type ContextCompactor, type ContextCompactorDeps } from "@/chat/services/context-compaction";
4
4
  import { type SubscribedReplyPolicy, type SubscribedReplyPolicyDeps } from "@/chat/services/subscribed-reply-policy";
5
- import type { ReplyExecutorServices } from "@/chat/runtime/reply-executor";
5
+ import type { SlackTurnServices } from "@/chat/providers/slack/turn";
6
6
  import { type VisionContextDeps, type VisionContextService } from "@/chat/slack/vision-context";
7
7
  export interface JuniorRuntimeServices {
8
8
  conversationMemory: ConversationMemoryService;
9
9
  contextCompactor: ContextCompactor;
10
- replyExecutor: ReplyExecutorServices;
10
+ replyExecutor: SlackTurnServices;
11
11
  subscribedReplyPolicy: SubscribedReplyPolicy;
12
12
  visionContext: VisionContextService;
13
13
  }
14
14
  export interface JuniorRuntimeServiceOverrides {
15
15
  conversationMemory?: Partial<ConversationMemoryDeps>;
16
16
  contextCompactor?: Partial<ContextCompactorDeps>;
17
- replyExecutor?: Partial<ReplyExecutorServices>;
17
+ replyExecutor?: Partial<SlackTurnServices>;
18
18
  subscribedReplyPolicy?: Partial<SubscribedReplyPolicyDeps>;
19
19
  sandbox?: {
20
20
  tracePropagation?: SandboxEgressTracePropagationConfig;
@@ -0,0 +1,3 @@
1
+ import type { CodeChangePublisher } from "@sentry/junior-plugin-api";
2
+ /** Connect a plugin to Junior's code records. */
3
+ export declare function createCodeChangePublisher(provider: string): CodeChangePublisher;
@@ -0,0 +1,9 @@
1
+ import { type CodeChangeInput } from "@sentry/junior-plugin-api";
2
+ import type { JuniorDatabase } from "@/db/db";
3
+ /** Record the latest details for one code change created by Junior. */
4
+ export declare function recordCodeChange(db: JuniorDatabase, provider: string, input: CodeChangeInput): Promise<void>;
5
+ /** Add conversation links to an existing code change. */
6
+ export declare function associateCodeChangeConversations(db: JuniorDatabase, provider: string, input: {
7
+ conversationIds: string[];
8
+ providerId: string;
9
+ }): Promise<void>;
@@ -17,5 +17,15 @@ export declare function eventTaskBelongsToUser(task: EventTask, user: User): boo
17
17
  export declare function listEventTasksCreatedBy(db: JuniorDatabase, user: User, limit: number): Promise<EventTask[]>;
18
18
  /** List event tasks whose current Slack destination is public. */
19
19
  export declare function listPublicEventTasksForTeams(db: JuniorDatabase, teamIds: string[], limit: number): Promise<EventTask[]>;
20
+ /**
21
+ * Collect match keys from event tasks for these identifiers and event types.
22
+ * Does not evaluate match values — only reports keys that filters use.
23
+ */
24
+ export declare function collectEventTaskMatchKeys(db: JuniorDatabase, input: {
25
+ eventTypes: string[];
26
+ identifiers: string[];
27
+ namespace: string;
28
+ teamId: string;
29
+ }): Promise<string[]>;
20
30
  /** Find every task matching one normalized resource event. */
21
31
  export declare function findMatchingEventTasks(db: JuniorDatabase, event: ResourceEvent, teamId: string): Promise<EventTask[]>;
@@ -1,6 +1,6 @@
1
1
  import type { SlackAdapter } from "@chat-adapter/slack";
2
2
  import { type StateAdapter } from "chat";
3
- import type { SlackTurnRuntime } from "@/chat/runtime/slack-runtime";
3
+ import type { SlackTurnRuntime } from "@/chat/providers/slack/runtime";
4
4
  import type { ConversationStore } from "@/chat/conversations/store";
5
5
  import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
6
6
  import type { UserTokenStore } from "@/chat/credentials/user-token-store";
@@ -61,6 +61,11 @@ export declare function getPluginTools(context: ToolRuntimeContext, sandbox?: Pl
61
61
  /** Collect route handlers exposed by plugins for app-level mounting. */
62
62
  export declare function getPluginRoutes(options: {
63
63
  resourceEvents: {
64
+ neededMatchKeys?(input: {
65
+ eventTypes: string[];
66
+ identifiers: string[];
67
+ namespace: string;
68
+ }): Promise<string[]>;
64
69
  publish(event: ResourceEvent): Promise<void>;
65
70
  };
66
71
  }): PluginRouteRegistration[];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Slack event runtime.
2
+ * Slack provider runtime.
3
3
  *
4
4
  * This module owns inbound Slack routing decisions for mentions, subscribed
5
5
  * messages, assistant lifecycle events, and retryable turn pauses. It should
@@ -93,7 +93,7 @@ export interface SlackTurnRuntimeDependencies<TPreparedState> {
93
93
  thread: Thread;
94
94
  }) => Promise<void>;
95
95
  prepareTurnState: (args: PrepareTurnStateInput) => Promise<TPreparedState>;
96
- replyToThread: (thread: Thread, message: Message, options: {
96
+ executeSlackTurn: (thread: Thread, message: Message, options: {
97
97
  beforeFirstResponsePost?: () => Promise<void>;
98
98
  conversationId?: string;
99
99
  destination: Destination;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Slack reply execution boundary.
2
+ * Add Slack provider behavior around one native agent Turn.
3
3
  *
4
- * This module bridges prepared Slack thread state into the agent runner
5
- * and commits the resulting Slack-visible delivery/state updates. It is where
6
- * queued messages, compaction, status updates, and Slack posting meet; agent
7
- * internals stay behind the runner seam.
4
+ * This module prepares Slack input and owns Slack status, delivery, and saved
5
+ * Slack state. Native execution concerns that remain here must move behind a
6
+ * provider-neutral runtime contract. Agent execution stays behind
7
+ * `AgentRunner`.
8
8
  */
9
9
  import type { Message, Thread } from "chat";
10
10
  import type { SlackAdapter } from "@chat-adapter/slack";
@@ -17,7 +17,7 @@ import { lookupSlackUser } from "@/chat/slack/user";
17
17
  import type { PausedTurnRequest } from "@/chat/task-execution/turn-wake";
18
18
  import type { ConversationTurnLifecycle } from "@/chat/conversations/turn-lifecycle";
19
19
  import type { DispatchTurnContext, DispatchTurnResult } from "@/chat/agent-dispatch/types";
20
- export interface ReplyExecutorServices {
20
+ export interface SlackTurnServices {
21
21
  agentRunner: AgentRunner;
22
22
  contextCompactor: ContextCompactor;
23
23
  getPausedTurnRequest: (args: {
@@ -32,7 +32,7 @@ export interface ReplyExecutorServices {
32
32
  sessionId: string;
33
33
  }) => Promise<void>;
34
34
  }
35
- interface ReplyExecutorDeps {
35
+ interface SlackTurnDeps {
36
36
  getSlackAdapter: () => SlackAdapter;
37
37
  resolveUserAttachments: (attachments: Message["attachments"] | undefined, context: {
38
38
  threadId?: string;
@@ -48,9 +48,10 @@ interface ReplyExecutorDeps {
48
48
  promptText?: string;
49
49
  }>>;
50
50
  prepareTurnState: (args: PrepareTurnStateInput) => Promise<PreparedTurnState>;
51
- services: ReplyExecutorServices;
51
+ services: SlackTurnServices;
52
52
  }
53
- export declare function createReplyToThread(deps: ReplyExecutorDeps): (thread: Thread, message: Message, options: {
53
+ /** Build the Slack caller that prepares input and delivers output for a Turn. */
54
+ export declare function createSlackTurn(deps: SlackTurnDeps): (thread: Thread, message: Message, options: {
54
55
  beforeFirstResponsePost?: () => Promise<void>;
55
56
  conversationId?: string;
56
57
  destination: Destination;
@@ -65,6 +65,18 @@ export declare function cancelSubscriptions(input: {
65
65
  nowMs?: number;
66
66
  state?: StateAdapter;
67
67
  }): Promise<void>;
68
+ /**
69
+ * Collect match keys from active watches for these identifiers and event types.
70
+ * Does not evaluate match values — only reports keys that filters use.
71
+ */
72
+ export declare function collectResourceEventMatchKeys(input: {
73
+ eventTypes: string[];
74
+ identifiers: string[];
75
+ namespace: string;
76
+ nowMs?: number;
77
+ state?: StateAdapter;
78
+ teamId: string;
79
+ }): Promise<string[]>;
68
80
  /** Find active subscriptions interested in a normalized resource event. */
69
81
  export declare function findMatchingResourceEventSubscriptions(input: {
70
82
  data?: ResourceEventData;
@@ -0,0 +1,30 @@
1
+ import type { AgentRun } from "@/chat/agent/types";
2
+ import type { CompleteConversationTurnInput, FailConversationTurnInput } from "@/chat/conversations/turn-lifecycle";
3
+ import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
4
+ import type { AgentRunner } from "@/chat/runtime/agent-runner";
5
+ import type { AgentRunResult } from "@/chat/services/turn-result";
6
+ type SavedTurnResult = {
7
+ finishedAtMs?: number;
8
+ outcome: CompleteConversationTurnInput["outcome"];
9
+ } | {
10
+ finishedAtMs?: number;
11
+ failureCode: FailConversationTurnInput["failureCode"];
12
+ outcome: "failed";
13
+ };
14
+ type TurnExecutionOutcome = Exclude<AgentRunOutcome, {
15
+ status: "completed";
16
+ }> | {
17
+ status: "completed";
18
+ };
19
+ /** An error thrown while the agent advances a Run. */
20
+ export declare class AgentRunError extends Error {
21
+ constructor(cause: unknown);
22
+ }
23
+ /**
24
+ * Run the agent and finish the Turn after the caller saves its result.
25
+ *
26
+ * A paused Run, or a Run waiting for authorization, leaves the Turn open. A
27
+ * save error also leaves the Turn open so the worker can retry or recover it.
28
+ */
29
+ export declare function executeTurn(agentRunner: AgentRunner, run: AgentRun, saveResult: (result: AgentRunResult) => Promise<SavedTurnResult>): Promise<TurnExecutionOutcome>;
30
+ export {};