@sentry/junior 0.307.1 → 0.309.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 (84) hide show
  1. package/dist/{actor-D2iXzvlN.js → actor-BsBdxDXQ.js} +0 -1
  2. package/dist/{adapter-context-HrBTD8rJ.js → adapter-context-1YUbMpD3.js} +2 -2
  3. package/dist/{admin-B78_KmfR.js → admin-u30A8TcD.js} +2 -2
  4. package/dist/{agent-runner-DxivxUYd.js → agent-runner-sJLhgPQV.js} +93 -90
  5. package/dist/api/schema.d.ts +1 -1
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.d.ts +4 -2
  8. package/dist/api.js +416 -272
  9. package/dist/{app-EZur8cVC.d.ts → app-B_7Wn0en.d.ts} +6 -7
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +73 -193
  12. package/dist/{background-compaction-queue-HlljT9ql.js → background-compaction-queue-CUJXVKG3.js} +4 -4
  13. package/dist/{briefs-DR8mp-TK.js → briefs-BHi70IR5.js} +3 -3
  14. package/dist/{catalog-runtime-Se9idiDR.js → catalog-runtime-Chc_IP2o.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +10 -10
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +5 -5
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{config-DY5c1E0l.js → config-BIyIdTtA.js} +52 -93
  23. package/dist/{continue-in-slack-DNkrrWuQ.js → continue-in-slack-BQJBfiQh.js} +6 -6
  24. package/dist/{conversation--f85g4zL.js → conversation-CzrLhdHG.js} +6 -1
  25. package/dist/{conversation-feed-BNs9KiqC.js → conversation-feed-B9e3_gxz.js} +1 -1
  26. package/dist/{conversation-privacy-CVj9vSrP.js → conversation-privacy-CkTW29hd.js} +1 -1
  27. package/dist/{conversation-turn-CkzrIfJ2.js → conversation-turn-CZaYQUum.js} +19 -20
  28. package/dist/{credential-sync-B9CIkgOT.js → credential-sync-58m_CyIJ.js} +31 -23
  29. package/dist/{db-C41UgdBj.d.ts → db-B4Hjxr-u.d.ts} +2 -2
  30. package/dist/{db-C21CyyTE.js → db-CFUpEZi9.js} +11 -9
  31. package/dist/{executor-DfNoVVGd.js → executor-DXL0O0MV.js} +4 -3
  32. package/dist/fan-out-Cod-yEHG.js +10 -0
  33. package/dist/{connections-C-SqzubG.js → html-CaBu2VbT.js} +146 -11
  34. package/dist/{install-lYZs8UCL.js → install-DhTBUUov.js} +2 -2
  35. package/dist/instrumentation.js +2 -2
  36. package/dist/{lineage-BJTSY53A.js → lineage-CxtOI2_p.js} +2 -2
  37. package/dist/{logging-DjW7LjgJ.js → logging-BNUovdcX.js} +1 -1
  38. package/dist/{message-BPPZpdoZ.js → message-DcUsS2vg.js} +8 -8
  39. package/dist/{model-input-DKqiLFGa.js → model-input-o3rEqgwM.js} +15 -10
  40. package/dist/nitro.d.ts +1 -1
  41. package/dist/nitro.js +4 -4
  42. package/dist/{oauth-callback-server-OJP8Y4Ca.js → oauth-callback-server-1Fizd1EM.js} +2 -2
  43. package/dist/{oauth-relay-KwDz41Z3.js → oauth-relay-DOwngqdM.js} +1 -1
  44. package/dist/{package-discovery-x4AvVhMj.js → package-discovery-DD9vencX.js} +0 -1
  45. package/dist/{projection-D47mlszd.js → projection-Ce4pmhKP.js} +108 -125
  46. package/dist/{prompt-DuWH_YIb.js → prompt-DEqjDVMs.js} +25 -14
  47. package/dist/{registry-yht0oxq6.js → registry-CNE4ZBnG.js} +3 -3
  48. package/dist/{resolve-gZ-hVMYl.js → resolve-qbPg-aC-.js} +3 -3
  49. package/dist/{result-CP99Ok0_.js → result-ZGnDzcsb.js} +12 -13
  50. package/dist/{runner-eVlnUkY7.js → runner-eGIxpAMf.js} +10 -10
  51. package/dist/{sandbox-egress-signals-DZL_0lnG.js → sandbox-egress-signals-DMFB1kCp.js} +1 -1
  52. package/dist/{schedule-BG1tEbRF.js → schedule-Cire6NU7.js} +1 -1
  53. package/dist/{schema-D4jdesIu.js → schema-CfIey9Ao.js} +65 -28
  54. package/dist/{schema-CRXcj4fj.d.ts → schema-DriSvB40.d.ts} +43 -43
  55. package/dist/{service-account-tI3LBg2_.js → service-account-B1VXCTqg.js} +3 -3
  56. package/dist/{service-account-CZneZHh7.js → service-account-Cw_LWZ4-.js} +7 -8
  57. package/dist/{session-stop-D3S7mSkX.js → session-stop-P2XdTiwr.js} +191 -187
  58. package/dist/{skills-Bm6uSO9V.js → skills-Zg8-vrje.js} +25 -29
  59. package/dist/{slack-conversation-unfurl-BeBvg3xU.js → slack-conversation-unfurl-DA51qH0c.js} +18 -15
  60. package/dist/{spawn-vhMAmLuh.js → spawn-DBi4-zD8.js} +6 -6
  61. package/dist/{state-3Yiy2FvP.js → state-C-Ftk23K.js} +4 -4
  62. package/dist/{stop-Bh53GUoX.js → stop-D9xideLM.js} +175 -134
  63. package/dist/{store-BZJdHYR7.js → store-BjIXA0Al.js} +5 -5
  64. package/dist/{task-queue-BEl5G38v.js → task-queue-D0_qbnpo.js} +7 -4
  65. package/dist/{task-runner-C6Bujc6h.js → task-runner-DQMq4XY0.js} +10 -11
  66. package/dist/{thread-context-DxMQGGd_.js → thread-context-D0i1e-5O.js} +13 -11
  67. package/dist/{turn-session-routing-CmQY0T60.js → turn-session-routing-C0l68I_O.js} +4 -4
  68. package/dist/{turn-user-message-Dfbr3Ud9.js → turn-user-message-nBVvOXjs.js} +14 -5
  69. package/dist/{queue-CbEHUO0l.d.ts → types-fnU7Xs__.d.ts} +3 -1
  70. package/dist/{users-6rSdqXXk.js → users-DdjMjbmM.js} +1 -1
  71. package/dist/{validation--hsjOLRL.js → validation-CRbvRPvu.js} +1 -1
  72. package/dist/{version-9iMT25Hq.js → version-BYdVs12p.js} +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/{viewer-De1vmuEA.js → viewer-DudYrQGj.js} +7 -5
  75. package/dist/{warmup-C0IblNtf.js → warmup-DN9OHN1-.js} +136 -78
  76. package/dist/{worker-CiyRr2q7.js → worker-C9ZfJXmV.js} +8 -8
  77. package/migrations/0121_people_list_metric_index.sql +1 -0
  78. package/migrations/0122_automation_rollout_repair.sql +56 -0
  79. package/migrations/0123_cache_warming_history_reset.sql +10 -0
  80. package/migrations/meta/0121_snapshot.json +5481 -0
  81. package/migrations/meta/0122_snapshot.json +5481 -0
  82. package/migrations/meta/0123_snapshot.json +5481 -0
  83. package/migrations/meta/_journal.json +21 -0
  84. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
- import { a as getConversationStore } from "./db-C21CyyTE.js";
2
- import { p as logException } from "./logging-DjW7LjgJ.js";
3
- import "./background-compaction-queue-HlljT9ql.js";
4
- import { At as hasRunnableConversationWork, Bt as releaseInboundMessage, Dt as getConversationWorkState$1, Et as getConversation$1, Gt as stopConversationWork$1, Ht as requestConversationWork$1, Kt as takeDeferredConversationMove, Lt as recordAttemptFailure$1, Nt as listActiveConversationIds$1, Ot as getConversationWorkStates$1, Pt as markConversationWorkEnqueued$1, Rt as recordConversationRetry$1, St as deadLetterAttempt$1, Tt as dropPendingMessages$1, Ut as startConversationWork$1, Vt as requestAnotherSlice$1, Wt as steerWebPendingMessages$1, _t as clearConsumedConversationWake$1, bt as completeConversationWork$1, dt as appendExclusiveInboundMessage, ft as appendInboundMessage, gt as claimInboundMessage$1, ht as checkInConversationWork$1, mt as cancelHumanFacingPendingMessages$1, pt as beginConversationResume$1, ut as ackMessages$1, vt as clearExpiredConversationLease$1, wt as drainConversationMailbox$1, yt as completeConversationStop$1, zt as releaseConversationWork$1 } from "./projection-D47mlszd.js";
1
+ import { a as getConversationStore } from "./db-CFUpEZi9.js";
2
+ import { p as logException } from "./logging-BNUovdcX.js";
3
+ import "./background-compaction-queue-CUJXVKG3.js";
4
+ import { At as hasRunnableConversationWork, Bt as releaseInboundMessage, Dt as getConversationWorkState$1, Et as getConversation$1, Gt as stopConversationWork$1, Ht as requestConversationWork$1, Kt as takeDeferredConversationMove, Lt as recordAttemptFailure$1, Nt as listActiveConversationIds$1, Ot as getConversationWorkStates$1, Pt as markConversationWorkEnqueued$1, Rt as recordConversationRetry$1, St as deadLetterAttempt$1, Tt as dropPendingMessages$1, Ut as startConversationWork$1, Vt as requestAnotherSlice$1, Wt as steerWebPendingMessages$1, _t as clearConsumedConversationWake$1, bt as completeConversationWork$1, dt as appendExclusiveInboundMessage, ft as appendInboundMessage, gt as claimInboundMessage$1, ht as checkInConversationWork$1, mt as cancelHumanFacingPendingMessages$1, pt as beginConversationResume$1, ut as ackMessages$1, vt as clearExpiredConversationLease$1, wt as drainConversationMailbox$1, yt as completeConversationStop$1, zt as releaseConversationWork$1 } from "./projection-Ce4pmhKP.js";
5
5
  // src/chat/task-execution/store.ts
6
6
  function metadataStore(options) {
7
7
  return options.conversationStore ?? getConversationStore();
@@ -304,7 +304,7 @@ async function runDeferredMove(args) {
304
304
  const move = await takeDeferredConversationMove(args);
305
305
  if (move === void 0) return;
306
306
  try {
307
- const { continueDeferredSlackClick } = await import("./slack-conversation-unfurl-BeBvg3xU.js").then((n) => n.r);
307
+ const { continueDeferredSlackClick } = await import("./slack-conversation-unfurl-DA51qH0c.js").then((n) => n.r);
308
308
  await continueDeferredSlackClick(move, args.getSlackAdapter);
309
309
  } catch (error) {
310
310
  logException(error, "slack.continue_here.deferred.failed", { "gen_ai.conversation.id": args.conversationId });
@@ -1,6 +1,8 @@
1
- import { h as logWarn, m as logInfo, p as logException } from "./logging-DjW7LjgJ.js";
2
- import { i as getChatConfig } from "./config-DY5c1E0l.js";
1
+ import { h as logWarn, m as logInfo, p as logException } from "./logging-BNUovdcX.js";
2
+ import { i as getChatConfig } from "./config-BIyIdTtA.js";
3
+ import "./fan-out-Cod-yEHG.js";
3
4
  import * as z from "zod";
5
+ import pLimit from "p-limit";
4
6
  import { AsyncLocalStorage } from "node:async_hooks";
5
7
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
6
8
  import { QueueClient, handleCallback, registerDevConsumer } from "@vercel/queue";
@@ -90,7 +92,8 @@ async function startWorker(consumers) {
90
92
  });
91
93
  return { close: async () => {
92
94
  try {
93
- const failures = (await Promise.allSettled(workers.map((worker) => worker.close()))).flatMap((result) => result.status === "rejected" ? [result.reason] : []);
95
+ const limit = pLimit(8);
96
+ const failures = (await Promise.allSettled(workers.map((worker) => limit(() => worker.close())))).flatMap((result) => result.status === "rejected" ? [result.reason] : []);
94
97
  if (failures.length > 0) throw new AggregateError(failures, "BullMQ workers did not close");
95
98
  } finally {
96
99
  await connection.quit();
@@ -396,7 +399,7 @@ function pluginTaskCallback() {
396
399
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
397
400
  onRejected: logPluginTaskQueueMessageRejected,
398
401
  run: async (message) => {
399
- const { processPluginTask } = await import("./task-runner-C6Bujc6h.js").then((n) => n.r);
402
+ const { processPluginTask } = await import("./task-runner-DQMq4XY0.js").then((n) => n.r);
400
403
  await processPluginTask(message);
401
404
  },
402
405
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ha as createPluginModelCostRecorder, Ln as coreTaskRegistrations, Mi as createPluginState, Nn as getPlugins, Oa as createPluginEmbedder, Qn as getPiMessageRole, Ua as createPluginLogger, Yo as getDispatchRecord, at as getTurnRecord, cr as isToolResultMessage, dr as stripRuntimeTurnContext, eo as createPluginConversationEvents, ka as createPluginModel, lr as normalizeToolNameFromResult, rr as instructionTextForProjection, sr as isToolResultError, ul as createPluginCache, v as hydrateConversationMessages } from "./projection-D47mlszd.js";
3
- import { $ as getStateAdapter, a as getConversationStore, o as getDb } from "./db-C21CyyTE.js";
4
- import { E as withSpan } from "./logging-DjW7LjgJ.js";
5
- import { a as getPersistedThreadState, c as coerceThreadConversationState, t as resolveConversationRouting } from "./turn-session-routing-CmQY0T60.js";
6
- import { i as readActorIdentity } from "./viewer-De1vmuEA.js";
7
- import { v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
2
+ import { Aa as createPluginModel, Ln as coreTaskRegistrations, Ni as createPluginState, Nn as getPlugins, Qn as getPiMessageRole, Ua as createPluginModelCostRecorder, Wa as createPluginLogger, Xo as getDispatchRecord, at as getTurnRecord, cr as isToolResultMessage, dr as stripRuntimeTurnContext, fl as createPluginCache, ka as createPluginEmbedder, lr as normalizeToolNameFromResult, rr as instructionTextForProjection, sr as isToolResultError, to as createPluginConversationEvents, v as hydrateConversationMessages } from "./projection-Ce4pmhKP.js";
3
+ import { a as getConversationStore, et as getStateAdapter, o as getDb } from "./db-CFUpEZi9.js";
4
+ import { E as withSpan } from "./logging-BNUovdcX.js";
5
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, t as resolveConversationRouting } from "./turn-session-routing-C0l68I_O.js";
6
+ import { i as readActorIdentity } from "./viewer-DudYrQGj.js";
7
+ import { v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
8
8
  import { m as sameActorIdentity } from "./history-N7IVbUom.js";
9
- import { i as pluginTaskParamsSchema, r as pluginTaskId } from "./task-queue-BEl5G38v.js";
10
- import pLimit from "p-limit";
9
+ import { i as pluginTaskParamsSchema, r as pluginTaskId } from "./task-queue-D0_qbnpo.js";
10
+ import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
11
11
  import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
12
12
  // src/chat/plugins/task-runner.ts
13
13
  /**
@@ -264,10 +264,9 @@ async function scheduleSessionCompletedPluginTasks(params, send) {
264
264
  params: coreParams,
265
265
  plugin: plugin.manifest.name
266
266
  }));
267
- const limit = pLimit(PLUGIN_MESSAGE_SEND_CONCURRENCY);
268
- await Promise.all(messages.map((message) => limit(async () => {
267
+ await mapBounded(messages, async (message) => {
269
268
  await send(message);
270
- })));
269
+ }, PLUGIN_MESSAGE_SEND_CONCURRENCY);
271
270
  }
272
271
  /**
273
272
  * Execute one parsed plugin task request in a `plugin.task` span. The span
@@ -1,10 +1,11 @@
1
- import { J as clearPendingAuth, Po as listConversationAnnotations, k as markConversationMessage, v as hydrateConversationMessages, w as buildConversationContext } from "./projection-D47mlszd.js";
2
- import { K as isRecord, b as setSpanAttributes } from "./logging-DjW7LjgJ.js";
3
- import { o as getDb, r as getConversationEventStore } from "./db-C21CyyTE.js";
4
- import { J as readMessageCardRefs, X as resolveMessageCards, Y as removedCardSchema } from "./conversation--f85g4zL.js";
5
- import { S as listChildMessages, m as markTurnCompleted, n as getTurnUserMessageId, p as markTurnClosed, x as isAgentInvocationResult } from "./turn-user-message-Dfbr3Ud9.js";
6
- import { _ as getConversationWorkState } from "./store-BZJdHYR7.js";
7
- import { a as getPersistedThreadState, c as coerceThreadConversationState, s as persistThreadStateById } from "./turn-session-routing-CmQY0T60.js";
1
+ import { Fo as listConversationAnnotations, J as clearPendingAuth, k as markConversationMessage, v as hydrateConversationMessages, w as buildConversationContext } from "./projection-Ce4pmhKP.js";
2
+ import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
3
+ import { K as isRecord, b as setSpanAttributes } from "./logging-BNUovdcX.js";
4
+ import { o as getDb, r as getConversationEventStore } from "./db-CFUpEZi9.js";
5
+ import { J as readMessageCardRefs, X as resolveMessageCards, Y as removedCardSchema } from "./conversation-CzrLhdHG.js";
6
+ import { S as listChildMessages, m as markTurnCompleted, n as getTurnUserMessageId, p as markTurnClosed, x as isAgentInvocationResult } from "./turn-user-message-nBVvOXjs.js";
7
+ import { _ as getConversationWorkState } from "./store-BjIXA0Al.js";
8
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, s as persistThreadStateById } from "./turn-session-routing-C0l68I_O.js";
8
9
  // src/chat/conversations/pending-cards.ts
9
10
  /**
10
11
  * Add the cards that tool results selected since the last visible assistant
@@ -47,11 +48,12 @@ async function selectChildResultCards(conversationId, inputMessageIds, selection
47
48
  const events = getConversationEventStore();
48
49
  const execution = (await getConversationWorkState({ conversationId }))?.execution;
49
50
  const messages = await listChildMessages(inputMessageIds, execution?.messageSenders ?? {});
50
- for (const message of messages.reverse()) {
51
- const { conversationId: childConversationId, turnId } = message.sender;
52
- const terminal = await events.loadByIdempotencyKey(childConversationId, `turn:${turnId}:terminal`);
51
+ messages.reverse();
52
+ const terminals = await mapBounded(messages, ({ sender }) => events.loadByIdempotencyKey(sender.conversationId, `turn:${sender.turnId}:terminal`));
53
+ for (const [index, message] of messages.entries()) {
54
+ const terminal = terminals[index];
53
55
  if (!terminal && isAgentInvocationResult(message)) continue;
54
- await selectTurnCards(childConversationId, selection, terminal?.seq);
56
+ await selectTurnCards(message.sender.conversationId, selection, terminal?.seq);
55
57
  }
56
58
  }
57
59
  /** Select undelivered cards and load their latest saved facts. */
@@ -1,6 +1,6 @@
1
- import { Ko as getDispatchConversationId, Yo as getDispatchRecord, b as persistConversationMessages, dl as createDurableLocationConfigurationService, sl as JUNIOR_THREAD_STATE_TTL_MS } from "./projection-D47mlszd.js";
2
- import { J as toOptionalString, K as isRecord, q as toOptionalNumber } from "./logging-DjW7LjgJ.js";
3
- import { $ as getStateAdapter, o as getDb } from "./db-C21CyyTE.js";
1
+ import { Xo as getDispatchRecord, b as persistConversationMessages, ll as JUNIOR_THREAD_STATE_TTL_MS, pl as createDurableLocationConfigurationService, qo as getDispatchConversationId } from "./projection-Ce4pmhKP.js";
2
+ import { J as toOptionalString, K as isRecord, q as toOptionalNumber } from "./logging-BNUovdcX.js";
3
+ import { et as getStateAdapter, o as getDb } from "./db-CFUpEZi9.js";
4
4
  // src/chat/state/conversation.ts
5
5
  function defaultConversationState() {
6
6
  return {
@@ -202,7 +202,7 @@ function slackSourceForDestination(args) {
202
202
  * Reads parent Conversations when this Conversation has no Destination.
203
203
  */
204
204
  async function resolveConversationRouting(args) {
205
- const conversationStore = args.conversationStore ?? (await import("./db-C21CyyTE.js").then((n) => n.n)).getConversationStore();
205
+ const conversationStore = args.conversationStore ?? (await import("./db-CFUpEZi9.js").then((n) => n.n)).getConversationStore();
206
206
  const chain = await loadConversationChain(args.conversationId, conversationStore);
207
207
  let destination;
208
208
  let source;
@@ -1,7 +1,7 @@
1
- import { qt as readInboundMessageSender } from "./projection-D47mlszd.js";
2
- import { v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
3
- import { r as getConversationEventStore, s as getSqlExecutor } from "./db-C21CyyTE.js";
4
- import { y as juniorAgentInvocations } from "./executor-DfNoVVGd.js";
1
+ import { qt as readInboundMessageSender } from "./projection-Ce4pmhKP.js";
2
+ import { v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
3
+ import { r as getConversationEventStore, s as getSqlExecutor } from "./db-CFUpEZi9.js";
4
+ import { y as juniorAgentInvocations } from "./executor-DXL0O0MV.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { inArray } from "drizzle-orm";
7
7
  // src/chat/state/turn-id.ts
@@ -97,6 +97,15 @@ async function readChildMessageSender(message) {
97
97
  return readInboundMessageSender(message) ?? (await readLegacyChildMessageSenders([message.inboundMessageId])).get(message.inboundMessageId);
98
98
  }
99
99
  /**
100
+ * Read who sent each child reply or result, in message order. Messages
101
+ * without stored sender fields share one legacy read.
102
+ */
103
+ async function readChildMessageSenders(messages) {
104
+ const stored = messages.map((message) => readInboundMessageSender(message));
105
+ const legacy = await readLegacyChildMessageSenders(messages.flatMap((message, index) => stored[index] ? [] : [message.inboundMessageId]));
106
+ return messages.map((message, index) => stored[index] ?? legacy.get(message.inboundMessageId));
107
+ }
108
+ /**
100
109
  * List the child replies and results among the ids that reached one
101
110
  * mailbox, oldest first, with the sender fields that the mailbox keeps.
102
111
  */
@@ -352,4 +361,4 @@ function getTurnUserReplyAttachmentContext(message) {
352
361
  ...!imagesHydrated && imageAttachmentCount > 0 ? { omittedImageAttachmentCount: imageAttachmentCount } : void 0
353
362
  };
354
363
  }
355
- export { getAgentInvocationResultMessageId as A, ownAgentInvocation as C, getAgentInvocationIdForMessage as D, getAgentInvocationIdForEvents as E, getTurnReplyKey as F, getUnnamedAgentConversationId as I, buildDeterministicAssistantMessageId as L, getAgentReplyMessageId as M, getChildAgentLockName as N, getAgentInvocationIdForResult as O, getNamedAgentConversationId as P, buildDeterministicTurnId as R, listChildMessages as S, getAgentInvocationId as T, ConversationTurnLifecycleService as _, ConversationTurnBoundaryError as a, hasAgentInvocationReply as b, TurnInputDeferredError as c, isTurnInputCommitLostError as d, isTurnInputDeferredError as f, startActiveTurn as g, markTurnFailed as h, getTurnUserSlackMessageTs as i, getAgentInvocationTurnId as j, getAgentInvocationMessageId as k, getConversationTurnBoundaryError as l, markTurnCompleted as m, getTurnUserMessageId as n, CooperativeTurnYieldError as o, markTurnClosed as p, getTurnUserReplyAttachmentContext as r, TurnInputCommitLostError as s, getTurnUserMessage as t, isCooperativeTurnYieldError as u, getTurnLifecycle as v, readChildMessageSender as w, isAgentInvocationResult as x, childMessageSenderMetadata as y };
364
+ export { getAgentInvocationMessageId as A, ownAgentInvocation as C, getAgentInvocationIdForEvents as D, getAgentInvocationId as E, getNamedAgentConversationId as F, getTurnReplyKey as I, getUnnamedAgentConversationId as L, getAgentInvocationTurnId as M, getAgentReplyMessageId as N, getAgentInvocationIdForMessage as O, getChildAgentLockName as P, buildDeterministicAssistantMessageId as R, listChildMessages as S, readChildMessageSenders as T, ConversationTurnLifecycleService as _, ConversationTurnBoundaryError as a, hasAgentInvocationReply as b, TurnInputDeferredError as c, isTurnInputCommitLostError as d, isTurnInputDeferredError as f, startActiveTurn as g, markTurnFailed as h, getTurnUserSlackMessageTs as i, getAgentInvocationResultMessageId as j, getAgentInvocationIdForResult as k, getConversationTurnBoundaryError as l, markTurnCompleted as m, getTurnUserMessageId as n, CooperativeTurnYieldError as o, markTurnClosed as p, getTurnUserReplyAttachmentContext as r, TurnInputCommitLostError as s, getTurnUserMessage as t, isCooperativeTurnYieldError as u, getTurnLifecycle as v, readChildMessageSender as w, isAgentInvocationResult as x, childMessageSenderMetadata as y, buildDeterministicTurnId as z };
@@ -20,4 +20,6 @@ interface ConversationQueueSendResult {
20
20
  interface ConversationWorkQueue {
21
21
  send(message: ConversationQueueMessage, options?: ConversationQueueSendOptions): Promise<ConversationQueueSendResult | void>;
22
22
  }
23
- export { ConversationWorkQueue as n, ConversationQueueMessage as t };
23
+ /** Callback to schedule background work that must finish before the function exits. */
24
+ type WaitUntilFn = (task: Promise<unknown> | (() => Promise<unknown>)) => void;
25
+ export { ConversationQueueMessage as n, ConversationWorkQueue as r, WaitUntilFn as t };
@@ -1,4 +1,4 @@
1
- import { bs as SlackActionError, js as withSlackRetries, ws as getSlackClient } from "./projection-D47mlszd.js";
1
+ import { Ms as withSlackRetries, Ts as getSlackClient, xs as SlackActionError } from "./projection-Ce4pmhKP.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/slack/users.ts
4
4
  const profileFieldsSchema = z.object({ fields: z.record(z.string(), z.object({
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Se9idiDR.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Chc_IP2o.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.307.1";
2
+ var version = "0.309.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-9iMT25Hq.js";
1
+ export { t as JUNIOR_VERSION } from "./version-BYdVs12p.js";
@@ -1,9 +1,9 @@
1
- import { F as findActorIdentityId, J as clearCachedUser, Y as readCachedUserByEmail, o as getDb } from "./db-C21CyyTE.js";
2
- import { B as juniorUsers, z as juniorIdentities } from "./executor-DfNoVVGd.js";
3
- import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER } from "./logging-DjW7LjgJ.js";
1
+ import { F as findActorIdentityId, J as clearCachedUser, Y as readCachedUserByEmail, o as getDb } from "./db-CFUpEZi9.js";
2
+ import { B as juniorUsers, z as juniorIdentities } from "./executor-DXL0O0MV.js";
3
+ import { G as normalizeIdentityEmail, U as GOOGLE_IDENTITY_PROVIDER } from "./logging-BNUovdcX.js";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
- import { and, asc, eq, inArray, isNotNull } from "drizzle-orm";
6
5
  import { identitySchema, userSchema } from "@sentry/junior-plugin-api";
6
+ import { and, asc, eq, inArray, isNotNull } from "drizzle-orm";
7
7
  // src/chat/identities/avatar.ts
8
8
  /**
9
9
  * Profile photos of people, saved on their native Slack and Google
@@ -180,7 +180,9 @@ async function setUserAdminFromSql(db, email, isAdmin) {
180
180
  /** List every Junior admin by primary email. */
181
181
  async function listAdminUsersFromSql(db) {
182
182
  const rows = await db.select().from(juniorUsers).where(eq(juniorUsers.isAdmin, true)).orderBy(asc(juniorUsers.primaryEmailNormalized));
183
- return await Promise.all(rows.map((row) => readUserById(db, row)));
183
+ if (rows.length === 0) return [];
184
+ const identityRows = await db.select().from(juniorIdentities).where(and(inArray(juniorIdentities.userId, rows.map((row) => row.id)), eq(juniorIdentities.kind, "user"))).orderBy(asc(juniorIdentities.provider), asc(juniorIdentities.providerTenantId), asc(juniorIdentities.providerSubjectId));
185
+ return rows.map((row) => userFromRows(row, identityRows.filter((identity) => identity.userId === row.id)));
184
186
  }
185
187
  /** Resolve the stored identity and linked user for one runtime actor. */
186
188
  async function readActorIdentityFromSql(db, actor) {