@sentry/junior 0.259.0 → 0.261.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 (72) hide show
  1. package/dist/{adapter-Bn0gFVSF.js → adapter-Bx_1B2De.js} +1 -1
  2. package/dist/{admin-C8xz2f10.js → admin-BAbbVgVc.js} +1 -1
  3. package/dist/{agent-hooks-B00FaKdP.js → agent-hooks-ghyZZQqB.js} +721 -704
  4. package/dist/{agent-runner-CPSd7rKm.js → agent-runner-g110-xgg.js} +688 -2223
  5. package/dist/api/schema.d.ts +210 -54
  6. package/dist/api/schema.js +3 -3
  7. package/dist/api.js +161 -73
  8. package/dist/{app-Bbxrehjf.d.ts → app-VCiPQ65Q.d.ts} +6 -1
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +36 -35
  11. package/dist/{assistant-reply-CqthTerd.js → assistant-reply-CQcMaWNL.js} +1 -1
  12. package/dist/{automation-DWBFBenG.js → automation-DrpcA-SX.js} +3 -0
  13. package/dist/{briefs-DNYbQ9cD.js → briefs-CKcfrIQL.js} +4 -4
  14. package/dist/{catalog-runtime-B8SuFPGb.js → catalog-runtime-cd60vzAB.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/init.js +1 -1
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{client-BZdxgKyL.js → client-2i0JJpoC.js} +2 -2
  23. package/dist/{config-Deqpfpg9.js → config-C9qM41O0.js} +2 -2
  24. package/dist/{connections-9gJkfS85.js → connections-DrtTrwkp.js} +10 -10
  25. package/dist/{conversation-DjN3mlog.js → conversation-CvuKJ3tA.js} +108 -155
  26. package/dist/{conversation-privacy-CFhNKxp-.js → conversation-privacy-1iTiFX1O.js} +1 -1
  27. package/dist/{credential-sync-BABGymK3.js → credential-sync-wKNQ1dYc.js} +14 -15
  28. package/dist/{executor-Bb3eQb8q.js → executor-Rimyj8HZ.js} +3 -2
  29. package/dist/{images-BbSdVHC6.js → images-D1JggcVY.js} +3 -3
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-vdGU-5ge.js → job-queue-BjQdSqA3.js} +1 -1
  32. package/dist/{logging-BStXN56b.js → logging-BLTa7R7f.js} +1 -1
  33. package/dist/{message-DRf6m4uO.js → message-DAeP5WWW.js} +3 -3
  34. package/dist/nitro.d.ts +1 -1
  35. package/dist/nitro.js +3 -3
  36. package/dist/{oauth-callback-server-JmOgLcGl.js → oauth-callback-server-BAy1hhF1.js} +2 -2
  37. package/dist/{profile-qBM6B_-V.js → profile-CthM2qFM.js} +24 -24
  38. package/dist/{prompt-xgpyMtg7.js → prompt-DeVax2qO.js} +1 -1
  39. package/dist/{registry-B_M_x_iS.js → registry-BnSaArNb.js} +1 -1
  40. package/dist/{resolve-BzpuLh8c.js → resolve-B5eLRl0v.js} +9 -5
  41. package/dist/{result-DEZH_AnZ.js → result-Cvm0GZCv.js} +9 -14
  42. package/dist/{runner-BqQlG10t.js → runner-D-pUzHbU.js} +11 -11
  43. package/dist/{sandbox-egress-signals-DCq3WLs5.js → sandbox-egress-signals-mvwGV7rl.js} +1 -1
  44. package/dist/{schema-CF9HqNRY.js → schema-OzL8Zw4H.js} +68 -3
  45. package/dist/{service-account-BzhW7kXu.js → service-account-Ch1uIpnR.js} +3 -3
  46. package/dist/{service-account-BqTBkyD7.js → service-account-DWxvpSfd.js} +3 -3
  47. package/dist/{session-stop-CV65ZlU3.js → session-stop-Boj_zpTa.js} +180 -22
  48. package/dist/{skills-CiWS5_Ub.js → skills-BpdYCfFt.js} +2 -2
  49. package/dist/{spawn-BSAQ7UQZ.js → spawn-h1DJMQTf.js} +2 -2
  50. package/dist/{store-B1GES4gC.js → store-B6KqcdCQ.js} +6 -6
  51. package/dist/{task-queue-BAeGEMjJ.js → task-queue-BaDwKSYv.js} +3 -3
  52. package/dist/{task-runner-BlGhcQPi.js → task-runner-BAX5li9a.js} +10 -10
  53. package/dist/{tasks-DieKX3d4.js → tasks-uCfmlWga.js} +4170 -1606
  54. package/dist/thread-state-BJHVIz8G.js +184 -0
  55. package/dist/{turn-failure-response-DQljogGJ.js → turn-failure-response-CCC76P6-.js} +8 -9
  56. package/dist/{turn-lifecycle-BLgrkV_L.js → turn-lifecycle-pHSESVR9.js} +1 -1
  57. package/dist/{turn-session-routing-BlajheOU.js → turn-session-routing-BIKJZaiw.js} +1 -1
  58. package/dist/{validation-23d7K9tX.js → validation-B9KL_5Wc.js} +1 -1
  59. package/dist/{version-B_XumRx-.js → version-CN9BXMW_.js} +1 -1
  60. package/dist/version.js +1 -1
  61. package/dist/{viewer-B2_ABsYi.js → viewer-C5xFaYVi.js} +19 -10
  62. package/dist/{web-input-BZDyxpzR.js → web-input-D6eqfXYd.js} +38 -34
  63. package/dist/{work-D3QKiV0O.js → work-C-ecZAme.js} +9 -10
  64. package/dist/{worker-C8mUjYf9.js → worker-BpYDqiOf.js} +5 -5
  65. package/migrations/0061_workspace_vcpus.sql +1 -0
  66. package/migrations/meta/0061_snapshot.json +3471 -0
  67. package/migrations/meta/_journal.json +7 -0
  68. package/package.json +10 -10
  69. package/dist/experimental-BNK1l1jv.js +0 -49
  70. package/dist/oauth-authorization-djQn5Nhy.js +0 -97
  71. package/dist/pending-auth-rG5U_QS1.js +0 -442
  72. package/dist/thread-state-DpSWS4Rr.js +0 -426
package/dist/api.js CHANGED
@@ -1,30 +1,30 @@
1
- import { It as createUserTokenStore, K as listChildAgents, L as editEventAutomation, O as parseSlackThreadId, P as editScheduledAutomation, R as AutomationEditError, T as readLiveAttachment, V as resolveTaskOutcomes, bt as conversationSubtreeColumns, g as readStats, ot as getChildAgentLabel, yt as conversationSubtree, z as eventAutomationTriggerAvailable } from "./agent-runner-CPSd7rKm.js";
2
- import { p as escapeXml } from "./client-BZdxgKyL.js";
3
- import { f as logException, m as logWarn, p as logInfo } from "./logging-BStXN56b.js";
1
+ import { D as AutomationConflictError, E as sameDefinitionValue, L as loadTurnProjection, O as automationRevision, S as automationDefinition, T as readAutomationVersion, a as saveScheduledAutomation, bn as createUserTokenStore, k as requireAutomationRevision, rr as piMessageFromHistoryItem, v as saveEventAutomation, y as setEventAutomationStatus } from "./tasks-uCfmlWga.js";
2
+ import { p as escapeXml } from "./client-2i0JJpoC.js";
3
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-BLTa7R7f.js";
4
4
  import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-tlxzqaRe.js";
5
- import { C as addAgentTurnUsage, D as hasAgentTurnUsage, E as agentTurnUsageSchema, O as resolveRootConversationId, S as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as loadConversationSlackTenantId, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, v as locationFromRow } from "./viewer-B2_ABsYi.js";
5
+ import { C as addAgentTurnUsage, D as hasAgentTurnUsage, E as agentTurnUsageSchema, O as resolveRootConversationId, S as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as loadConversationSlackTenantIds, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, v as locationFromRow } from "./viewer-C5xFaYVi.js";
6
6
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
7
- import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Bb3eQb8q.js";
7
+ import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Rimyj8HZ.js";
8
8
  import { d as contextProvenance } from "./history-AY8rs-FR.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B8SuFPGb.js";
10
- import { At as loadTurnProjection, D as AutomationConflictError, E as sameDefinitionValue, O as automationRevision, S as automationDefinition, T as readAutomationVersion, a as saveScheduledAutomation, k as requireAutomationRevision, pn as piMessageFromHistoryItem, v as saveEventAutomation, y as setEventAutomationStatus } from "./tasks-DieKX3d4.js";
11
- import { C as WorkspaceValidationError, Ct as readLatestConversationBrief, Ht as getSlackClient, Lt as lookupSlackUser, M as workspaceRepoCheckoutPath, Nt as listConversationAnnotations, O as SANDBOX_RUNTIME, Pt as listConversationAnnotationsById, S as updateWorkspace, Tt as buildSentryConversationUrl, _ as deleteWorkspace, _t as conversationHasParticipantEmail, b as listWorkspaces, bt as conversationNotArchivedForUser, ft as createPluginLogger, g as createWorkspace, gt as conversationArchivedForUser, ht as conversationArchivedForEmail, mt as conversationArchiveTimes, pt as readConversationAccessFromSql, qt as withSlackRetries, u as getPlugins, v as getWorkspace, vt as conversationHasParticipantUser, wt as readConversationEventPage, x as listWorkspacesByRepository, xt as viewerConversationMembership, yt as conversationNotArchivedForEmail } from "./agent-hooks-B00FaKdP.js";
12
- import { A as forkConversationBodySchema, F as readMessageAttachments, I as INPUT_IMAGE_TYPES, O as createConversationBodySchema, T as conversationStatsReportSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, j as forkConversationResponseSchema, k as createConversationMessageBodySchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-DjN3mlog.js";
13
- import { n as hash, t as create } from "./profile-qBM6B_-V.js";
14
- import { l as getEventCatalog, y as automationEventCatalog } from "./session-stop-CV65ZlU3.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-cd60vzAB.js";
10
+ import { F as AutomationEditError, I as eventAutomationTriggerAvailable, P as editEventAutomation, R as resolveTaskOutcomes, S as readLiveAttachment, T as parseSlackThreadId, U as listChildAgents, _t as conversationSubtreeColumns, gt as conversationSubtree, j as editScheduledAutomation, m as readStats, rt as getChildAgentLabel } from "./agent-runner-g110-xgg.js";
11
+ import { At as conversationIsMemberRoot, C as WorkspaceValidationError, Dt as conversationArchivedForEmail, Et as conversationArchiveTimes, Ft as readLatestConversationBrief, Gt as listConversationAnnotations, It as readConversationEventPage, Kt as listConversationAnnotationsById, Lt as buildSentryConversationUrl, M as workspaceRepoCheckoutPath, Mt as conversationNotArchivedForUser, Nt as viewerConversationMembership, O as SANDBOX_RUNTIME, Ot as conversationArchivedForUser, S as updateWorkspace, Tt as readConversationAccessFromSql, Yt as lookupSlackUser, _ as deleteWorkspace, b as listWorkspaces, ct as getSlackClient, g as createWorkspace, jt as conversationNotArchivedForEmail, kt as conversationHasParticipantUser, pt as withSlackRetries, u as getPlugins, v as getWorkspace, wt as createPluginLogger, x as listWorkspacesByRepository } from "./agent-hooks-ghyZZQqB.js";
15
12
  import { t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
16
- import { t as getCachedSnapshot } from "./resolve-BzpuLh8c.js";
17
- import { a as getVercelConversationWorkQueue } from "./job-queue-vdGU-5ge.js";
18
- import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-B1GES4gC.js";
19
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-BzhW7kXu.js";
20
- import { M as compileScheduleIntent, P as weekdaySchema, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, j as ScheduleIntentError, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-DWBFBenG.js";
13
+ import { A as forkConversationResponseSchema, B as readMessageAttachments, D as createConversationBodySchema, O as createConversationMessageBodySchema, V as INPUT_IMAGE_TYPES, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, k as forkConversationBodySchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-CvuKJ3tA.js";
14
+ import { n as hash, t as create } from "./profile-CthM2qFM.js";
15
+ import { d as getEventCatalog, x as automationEventCatalog } from "./session-stop-Boj_zpTa.js";
16
+ import { d as getSandboxResources, t as getCachedSnapshot } from "./resolve-B5eLRl0v.js";
17
+ import { a as getVercelConversationWorkQueue } from "./job-queue-BjQdSqA3.js";
18
+ import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-B6KqcdCQ.js";
19
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-Ch1uIpnR.js";
20
+ import { M as compileScheduleIntent, P as weekdaySchema, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, j as ScheduleIntentError, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-DrpcA-SX.js";
21
21
  import { C as skillReportsSchema, a as fillUtcHours, b as pluginsSchema, c as sumUtcHoursIntoSixHours, d as trailingUtcSixHourWindow, f as utcDayKey, h as pluginOperationalReportFeedSchema, i as fillUtcDays, l as trailingUtcDayWindow, m as healthReportSchema, n as DAY_MS$1, o as fillUtcSixHours, p as utcHourKey, r as HOUR_MS$1, s as startOfUtcHour, u as trailingUtcHourWindow, x as runtimeInfoReportSchema } from "./web-message-id-CJSUiksE.js";
22
- import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, k as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-BZDyxpzR.js";
23
- import { F as conversationAggregateColumns, I as conversationRangeColumns, M as readAutomationTitlesByConversationId, P as conversationActiveDaysColumn } from "./task-runner-BlGhcQPi.js";
24
- import { d as legacyWebMailboxMetadataSchema } from "./result-DEZH_AnZ.js";
25
- import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-9gJkfS85.js";
26
- import { t as decodeInputImages } from "./images-BbSdVHC6.js";
27
- import { A as activityHours$1, C as personParamsSchema, D as locationDirectoryReportSchema, E as locationDetailReportSchema, H as codePersonReportSchema, I as disconnectConnectionResponseSchema, J as stopConversationTurnResponseSchema, L as startConnectionResponseSchema, N as connectionListSchema, O as locationParamsSchema, P as connectionParamsSchema, S as actorProfileReportSchema, U as codeRepositoryParamsSchema, V as codeOverviewReportSchema, W as codeRepositoryReportSchema, Y as apiErrorSchema, _ as personalTokenListSchema, a as workspaceBodySchema, b as revokePersonalTokenResponseSchema, d as serviceAccountListSchema, f as serviceAccountParamsSchema, g as createdPersonalTokenSchema, h as createPersonalTokenBodySchema, i as deleteWorkspaceResponseSchema, j as activitySixHours$1, k as activityDays$1, l as workspaceSchema, m as startServiceAccountSignInResponseSchema, n as statsReportSchema, o as workspaceListSchema, q as conversationChildAgentsReportSchema, s as workspaceParamsSchema, u as disconnectServiceAccountResponseSchema, w as personalSpendReportSchema, x as actorDirectoryReportSchema, y as personalTokenParamsSchema } from "./schema-CF9HqNRY.js";
22
+ import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, k as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-D6eqfXYd.js";
23
+ import { F as conversationAggregateColumns, I as conversationRangeColumns, M as readAutomationTitlesByConversationId, P as conversationActiveDaysColumn } from "./task-runner-BAX5li9a.js";
24
+ import { d as legacyWebMailboxMetadataSchema } from "./result-Cvm0GZCv.js";
25
+ import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-DrtTrwkp.js";
26
+ import { t as decodeInputImages } from "./images-D1JggcVY.js";
27
+ import { A as activityHours$1, C as personParamsSchema, D as locationDirectoryReportSchema, E as locationDetailReportSchema, H as codePersonReportSchema, I as disconnectConnectionResponseSchema, J as stopConversationTurnResponseSchema, L as startConnectionResponseSchema, N as connectionListSchema, O as locationParamsSchema, P as connectionParamsSchema, S as actorProfileReportSchema, U as codeRepositoryParamsSchema, V as codeOverviewReportSchema, W as codeRepositoryReportSchema, X as apiErrorSchema, Y as conversationStatsReportSchema, _ as personalTokenListSchema, a as workspaceBodySchema, b as revokePersonalTokenResponseSchema, d as serviceAccountListSchema, f as serviceAccountParamsSchema, g as createdPersonalTokenSchema, h as createPersonalTokenBodySchema, i as deleteWorkspaceResponseSchema, j as activitySixHours$1, k as activityDays$1, l as workspaceSchema, m as startServiceAccountSignInResponseSchema, n as statsReportSchema, o as workspaceListSchema, q as conversationChildAgentsReportSchema, s as workspaceParamsSchema, u as disconnectServiceAccountResponseSchema, w as personalSpendReportSchema, x as actorDirectoryReportSchema, y as personalTokenParamsSchema } from "./schema-OzL8Zw4H.js";
28
28
  import { Hono } from "hono";
29
29
  import path from "node:path";
30
30
  import { z } from "zod";
@@ -887,22 +887,42 @@ function decodeConversationCursor(args) {
887
887
  return;
888
888
  }
889
889
  }
890
- // src/api/conversations/message-mentions.ts
890
+ // src/api/mentions.ts
891
891
  const SLACK_USER_MENTION_RE = /<@([UW][A-Z0-9]+)(?:\|[^<>]*)?>/g;
892
- function mentionedSlackUserIds(text) {
893
- if (!text) return [];
894
- return [...new Set([...text.matchAll(SLACK_USER_MENTION_RE)].map((m) => m[1]))];
892
+ function mentionedSlackUserIds(texts) {
893
+ const ids = texts.flatMap((text) => text ? [...text.matchAll(SLACK_USER_MENTION_RE)].map((m) => m[1]) : []);
894
+ return [...new Set(ids)];
895
895
  }
896
- function messageMentionText(data) {
897
- return [data.text, data.trustedSummary].filter(Boolean).join("\n");
896
+ /**
897
+ * Resolve the people that each source mentions, in source order. Every API
898
+ * that returns display text uses this, so the dashboard can show the same
899
+ * names and People links everywhere. It does one identity query per Slack
900
+ * workspace.
901
+ */
902
+ async function resolveMentions(executor, sources) {
903
+ const idsBySource = sources.map((source) => mentionedSlackUserIds(source.texts));
904
+ const idsByTenant = /* @__PURE__ */ new Map();
905
+ sources.forEach((source, index) => {
906
+ if (idsBySource[index].length === 0) return;
907
+ const ids = idsByTenant.get(source.tenantId) ?? /* @__PURE__ */ new Set();
908
+ for (const id of idsBySource[index]) ids.add(id);
909
+ idsByTenant.set(source.tenantId, ids);
910
+ });
911
+ const peopleByTenant = new Map(await Promise.all([...idsByTenant].map(async ([tenantId, ids]) => [tenantId, await readMentionedPeople(executor, tenantId, [...ids])])));
912
+ return sources.map((source, index) => {
913
+ const people = peopleByTenant.get(source.tenantId);
914
+ return idsBySource[index].flatMap((id) => {
915
+ const person = people?.get(id);
916
+ return person ? [person] : [];
917
+ });
918
+ });
898
919
  }
899
920
  /**
900
921
  * Read current names for mentioned Slack users. Known Junior identities come
901
922
  * first. The email is set only for a linked, verified Junior user, because
902
923
  * that email is the People profile route.
903
924
  */
904
- async function resolveSlackMentions(executor, conversationId, userIds) {
905
- const tenantId = await loadConversationSlackTenantId(executor, conversationId);
925
+ async function readMentionedPeople(executor, tenantId, userIds) {
906
926
  const rows = await executor.db().select({
907
927
  displayName: juniorIdentities.displayName,
908
928
  emailVerified: juniorIdentities.emailVerified,
@@ -942,26 +962,67 @@ async function resolveSlackMentions(executor, conversationId, userIds) {
942
962
  }
943
963
  return people;
944
964
  }
945
- /** Attach the people that each visible message mentions, resolved at read time. */
946
- async function attachMessageMentions(executor, conversationId, events) {
947
- const idsByIndex = events.map((event) => event.data.type === "message" && !event.data.redacted ? mentionedSlackUserIds(messageMentionText(event.data)) : []);
948
- const allIds = [...new Set(idsByIndex.flat())];
949
- if (allIds.length === 0) return events;
950
- const people = await resolveSlackMentions(executor, conversationId, allIds);
951
- return events.map((event, index) => {
952
- if (event.data.type !== "message") return event;
953
- const mentions = idsByIndex[index].flatMap((id) => {
954
- const person = people.get(id);
955
- return person ? [person] : [];
956
- });
957
- return mentions.length > 0 ? {
958
- ...event,
959
- data: {
960
- ...event.data,
961
- mentions
962
- }
963
- } : event;
965
+ // src/api/conversations/mentions.ts
966
+ /** Text in one event that the dashboard renders with mentions. */
967
+ function eventMentionTexts(data) {
968
+ switch (data.type) {
969
+ case "message": return data.redacted ? [] : [
970
+ data.text,
971
+ data.trustedSummary,
972
+ ...(data.events ?? []).map((event) => event.trustedSummary)
973
+ ];
974
+ case "assistant_message": return data.parts.map((part) => part.text);
975
+ case "compaction":
976
+ case "handoff": return [data.summary];
977
+ case "structured_event": return [data.presentation.preview, ...(data.presentation.details ?? []).map((detail) => detail.description)];
978
+ default: return [];
979
+ }
980
+ }
981
+ function briefMentionTexts(brief) {
982
+ return [
983
+ brief.summary,
984
+ brief.intent,
985
+ brief.outcome.text,
986
+ ...brief.decisions.flatMap((decision) => [decision.text, decision.by]),
987
+ ...brief.openDecisions.flatMap((decision) => [decision.text, decision.owner]),
988
+ ...brief.facts
989
+ ];
990
+ }
991
+ function withMentions(value, mentions) {
992
+ return mentions.length > 0 ? {
993
+ ...value,
994
+ mentions
995
+ } : value;
996
+ }
997
+ /**
998
+ * Attach the people that each event and the Brief of one conversation
999
+ * mention, resolved at read time.
1000
+ */
1001
+ async function attachConversationMentions(executor, conversationId, content) {
1002
+ const tenantId = (await loadConversationSlackTenantIds(executor, [conversationId])).get(conversationId);
1003
+ const sources = content.events.map((event) => ({
1004
+ tenantId,
1005
+ texts: eventMentionTexts(event.data)
1006
+ }));
1007
+ if (content.brief) sources.push({
1008
+ tenantId,
1009
+ texts: briefMentionTexts(content.brief)
964
1010
  });
1011
+ const mentions = await resolveMentions(executor, sources);
1012
+ return {
1013
+ briefMentions: content.brief ? mentions.at(-1) : [],
1014
+ events: content.events.map((event, index) => withMentions(event, mentions[index]))
1015
+ };
1016
+ }
1017
+ /** Attach the people that each activity preview mentions, resolved at read time. */
1018
+ async function attachActivityPreviewMentions(executor, previews) {
1019
+ const entries = [...previews];
1020
+ const tenants = await loadConversationSlackTenantIds(executor, entries.map(([conversationId]) => conversationId));
1021
+ const mentions = await resolveMentions(executor, entries.map(([conversationId, preview]) => ({
1022
+ tenantId: tenants.get(conversationId),
1023
+ texts: [preview.text]
1024
+ })));
1025
+ return new Map(entries.map(([conversationId, preview], index) => [conversationId, withMentions(preview, mentions[index])]));
965
1026
  }
966
1027
  // src/api/conversations/shared.ts
967
1028
  /** Format a Slack destination without exposing private channel names. */
@@ -1285,14 +1346,8 @@ async function readConversationParticipants(db, conversationIds) {
1285
1346
  const CONVERSATION_FEED_LIMIT = 50;
1286
1347
  function conversationFeedMembershipFilter(status, filter) {
1287
1348
  if (!filter) return status === "archived" ? sql`false` : void 0;
1288
- if (filter.kind === "viewer") return and(viewerConversationMembership({
1289
- actorMatch: eq(juniorIdentities.userId, filter.userId),
1290
- participantMatch: conversationHasParticipantUser(filter.userId)
1291
- }), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 : conversationNotArchivedForUser(filter.userId));
1292
- return and(viewerConversationMembership({
1293
- actorMatch: eq(juniorUsers.primaryEmailNormalized, filter.email),
1294
- participantMatch: conversationHasParticipantEmail(filter.email)
1295
- }), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
1349
+ if (filter.kind === "viewer") return and(conversationIsMemberRoot({ userId: filter.userId }), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 : conversationNotArchivedForUser(filter.userId));
1350
+ return and(conversationIsMemberRoot({ email: filter.email }), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
1296
1351
  }
1297
1352
  /**
1298
1353
  * Keep root conversations linked to one code repository. A code change can
@@ -1437,6 +1492,7 @@ async function readConversationFeedFromSql(options = {}) {
1437
1492
  readConversationActivityPreviews(db, conversationIds),
1438
1493
  readAutomationTitlesByConversationId(conversations)
1439
1494
  ]);
1495
+ const visibleActivityPreviews = await attachActivityPreviewMentions(getSqlExecutor(), new Map([...activityPreviewByConversation].filter(([conversationId]) => accessByConversation.get(conversationId)?.canViewPrivateContent)));
1440
1496
  const sidebarAnnotationsByConversation = await listConversationSidebarAnnotations(conversationIds, new Map(conversationIds.map((conversationId) => [conversationId, accessByConversation.get(conversationId)?.canViewPrivateContent ? annotationsByConversation.get(conversationId) ?? [] : []])));
1441
1497
  const assignedWork = new Set(conversationWork.assignedIds);
1442
1498
  const unfinishedWork = new Set(conversationWork.unfinishedIds);
@@ -1466,7 +1522,7 @@ async function readConversationFeedFromSql(options = {}) {
1466
1522
  ...unfinishedWork.has(conversation.conversationId) ? { unfinishedWork: true } : void 0
1467
1523
  };
1468
1524
  const annotations = access?.canViewPrivateContent ? annotationsByConversation.get(conversation.conversationId) ?? [] : [];
1469
- const activityPreview = access?.canViewPrivateContent ? activityPreviewByConversation.get(conversation.conversationId) : void 0;
1525
+ const activityPreview = visibleActivityPreviews.get(conversation.conversationId);
1470
1526
  const participants = access?.canViewPrivateContent ? participantsByConversation.get(conversation.conversationId) : void 0;
1471
1527
  return {
1472
1528
  ...summary,
@@ -1659,7 +1715,11 @@ async function readConversationDetailFromSql(conversationId, options) {
1659
1715
  conversationId,
1660
1716
  limit: options.limit
1661
1717
  }) : { events: [] };
1662
- const events = await attachMessageMentions(executor, conversationId, page.events);
1718
+ const brief = access?.canViewPrivateContent ? briefVersion?.content : void 0;
1719
+ const { briefMentions, events } = await attachConversationMentions(executor, conversationId, {
1720
+ ...brief ? { brief } : void 0,
1721
+ events: page.events
1722
+ });
1663
1723
  const metrics = metricsByConversation.get(conversationId);
1664
1724
  const auxiliaryCosts = auxiliaryCostsByConversation.get(conversationId);
1665
1725
  const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
@@ -1674,6 +1734,7 @@ async function readConversationDetailFromSql(conversationId, options) {
1674
1734
  ...childAgentTotals ? { childAgentTotals } : void 0,
1675
1735
  ...briefVersion ? { brief: {
1676
1736
  content: briefVersion.content,
1737
+ ...briefMentions.length > 0 ? { mentions: briefMentions } : void 0,
1677
1738
  updatedAt: briefVersion.createdAt.toISOString(),
1678
1739
  version: briefVersion.version
1679
1740
  } } : void 0,
@@ -1720,7 +1781,7 @@ async function readConversationEvents(conversationId, beforeValue, options = {})
1720
1781
  limit: options.limit ?? 500
1721
1782
  }) : { events: [] };
1722
1783
  return conversationEventPageSchema.parse({
1723
- events: await attachMessageMentions(getSqlExecutor(), conversationId, page.events),
1784
+ events: (await attachConversationMentions(getSqlExecutor(), conversationId, { events: page.events })).events,
1724
1785
  eventHistory: conversationEventHistory({
1725
1786
  canExposePayload,
1726
1787
  ...transcriptPurgedAtMs === void 0 ? void 0 : { transcriptPurgedAtMs }
@@ -1955,6 +2016,8 @@ function statsWindow(nowMs) {
1955
2016
  };
1956
2017
  }
1957
2018
  const HOUR_MS = 36e5;
2019
+ /** Keep 7d of hours so clients can roll 7d charts into 6h buckets. */
2020
+ const WINDOW_HOURS = 168;
1958
2021
  function applyMetricBuckets(rows, metrics) {
1959
2022
  const byDate = new Map(rows.map((row) => [row.date, {
1960
2023
  ...row,
@@ -2105,6 +2168,7 @@ function guardianStats(dayRows, hourRows, endMs) {
2105
2168
  }
2106
2169
  async function aggregateStats(db, start, end) {
2107
2170
  const where = statsWhere(start, end);
2171
+ const hourStart = trailingUtcHourWindow(end.getTime(), WINDOW_HOURS).start;
2108
2172
  const activityDate = sql`TO_CHAR(
2109
2173
  ${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
2110
2174
  'YYYY-MM-DD'
@@ -2140,7 +2204,7 @@ async function aggregateStats(db, start, end) {
2140
2204
  db.select({
2141
2205
  conversations: treeAggregateColumns$1.conversations,
2142
2206
  date: activityHour
2143
- }).from(juniorConversations).innerJoin(treeConversation$1, eq(treeConversation$1.rootConversationId, juniorConversations.conversationId)).where(where).groupBy(activityHour),
2207
+ }).from(juniorConversations).innerJoin(treeConversation$1, eq(treeConversation$1.rootConversationId, juniorConversations.conversationId)).where(statsWhere(hourStart, end)).groupBy(activityHour),
2144
2208
  readConversationMetricBuckets(db, {
2145
2209
  bucket: "day",
2146
2210
  start,
@@ -2148,7 +2212,7 @@ async function aggregateStats(db, start, end) {
2148
2212
  }),
2149
2213
  readConversationMetricBuckets(db, {
2150
2214
  bucket: "hour",
2151
- start,
2215
+ start: hourStart,
2152
2216
  end
2153
2217
  })
2154
2218
  ]);
@@ -2161,6 +2225,7 @@ async function aggregateStats(db, start, end) {
2161
2225
  };
2162
2226
  }
2163
2227
  async function aggregateGuardianStats(db, start, end) {
2228
+ const hourStart = trailingUtcHourWindow(end.getTime(), WINDOW_HOURS).start;
2164
2229
  const day = sql`TO_CHAR(
2165
2230
  ${juniorConversationEvents.createdAt} AT TIME ZONE 'UTC',
2166
2231
  'YYYY-MM-DD'
@@ -2182,14 +2247,14 @@ async function aggregateGuardianStats(db, start, end) {
2182
2247
  deny: sql`COUNT(*) FILTER (WHERE ${decision} = 'deny')::integer`,
2183
2248
  requests: sql`COUNT(*)::integer`
2184
2249
  };
2185
- const where = and(eq(juniorConversationEvents.type, "guardian_action_reviewed"), gte(juniorConversationEvents.createdAt, start), lte(juniorConversationEvents.createdAt, end));
2250
+ const where = (windowStart) => and(eq(juniorConversationEvents.type, "guardian_action_reviewed"), gte(juniorConversationEvents.createdAt, windowStart), lte(juniorConversationEvents.createdAt, end));
2186
2251
  const [dayRows, hourRows] = await Promise.all([db.select({
2187
2252
  ...selectColumns,
2188
2253
  date: day
2189
- }).from(juniorConversationEvents).where(where).groupBy(day), db.select({
2254
+ }).from(juniorConversationEvents).where(where(start)).groupBy(day), db.select({
2190
2255
  ...selectColumns,
2191
2256
  date: hour
2192
- }).from(juniorConversationEvents).where(where).groupBy(hour)]);
2257
+ }).from(juniorConversationEvents).where(where(hourStart)).groupBy(hour)]);
2193
2258
  return {
2194
2259
  dayRows,
2195
2260
  hourRows
@@ -3643,7 +3708,7 @@ async function readPeoplePluginReports(args) {
3643
3708
  reports: [],
3644
3709
  source: "plugins"
3645
3710
  });
3646
- const { getPluginProfileReports } = await import("./agent-hooks-B00FaKdP.js").then((n) => n.t);
3711
+ const { getPluginProfileReports } = await import("./agent-hooks-ghyZZQqB.js").then((n) => n.t);
3647
3712
  return pluginOperationalReportFeedSchema.parse({
3648
3713
  generatedAt: new Date(nowMs).toISOString(),
3649
3714
  reports: await getPluginProfileReports({
@@ -4404,6 +4469,18 @@ async function previewAutomationSchedule(user, id, intent) {
4404
4469
  throw error;
4405
4470
  }
4406
4471
  }
4472
+ // src/api/automations/mentions.ts
4473
+ /** Attach the people that each Automation instruction mentions, resolved at read time. */
4474
+ async function attachAutomationMentions(executor, automations) {
4475
+ const mentions = await resolveMentions(executor, automations.map((automation) => ({
4476
+ tenantId: automation.destination.teamId,
4477
+ texts: [automation.instruction]
4478
+ })));
4479
+ return automations.map((automation, index) => mentions[index].length > 0 ? {
4480
+ ...automation,
4481
+ mentions: mentions[index]
4482
+ } : automation);
4483
+ }
4407
4484
  // src/api/automations/routes.ts
4408
4485
  /** Translate expected edit failures; unexpected failures stay at the API boundary. */
4409
4486
  function editErrorResponse(error) {
@@ -4428,7 +4505,11 @@ function createAutomationRoutes() {
4428
4505
  app.get("/", requireViewer, validateRequest("query", automationListQuerySchema, "Invalid task list query."), async (context) => {
4429
4506
  const user = context.get("viewer");
4430
4507
  const query = context.req.valid("query");
4431
- return jsonResponse(automationListSchema, await readViewerAutomations(user, query));
4508
+ const list = await readViewerAutomations(user, query);
4509
+ return jsonResponse(automationListSchema, {
4510
+ ...list,
4511
+ automations: await attachAutomationMentions(getSqlExecutor(), list.automations)
4512
+ });
4432
4513
  });
4433
4514
  app.get("/event-catalog", requireViewer, () => {
4434
4515
  return jsonResponse(automationEventCatalogSchema, readAutomationEventCatalog());
@@ -4448,7 +4529,12 @@ function createAutomationRoutes() {
4448
4529
  const user = context.get("viewer");
4449
4530
  const params = context.req.valid("param");
4450
4531
  try {
4451
- return jsonResponse(automationExecutionListSchema, await readViewerAutomationExecutions(user, params.id));
4532
+ const list = await readViewerAutomationExecutions(user, params.id);
4533
+ const [automation] = await attachAutomationMentions(getSqlExecutor(), [list.automation]);
4534
+ return jsonResponse(automationExecutionListSchema, {
4535
+ ...list,
4536
+ automation
4537
+ });
4452
4538
  } catch (error) {
4453
4539
  if (error instanceof ViewerTaskNotFoundError) return jsonResponse(apiErrorSchema, { error: error.message }, { status: 404 });
4454
4540
  throw error;
@@ -4514,7 +4600,7 @@ function createAutomationRoutes() {
4514
4600
  });
4515
4601
  app.get("/:id", requireViewer, async (context) => {
4516
4602
  const automation = await readViewerAutomationSummary(context.get("viewer"), context.req.param("id"));
4517
- return automation ? jsonResponse(automationSummarySchema, automation) : jsonResponse(apiErrorSchema, { error: "Automation was not found." }, { status: 404 });
4603
+ return automation ? jsonResponse(automationSummarySchema, (await attachAutomationMentions(getSqlExecutor(), [automation]))[0]) : jsonResponse(apiErrorSchema, { error: "Automation was not found." }, { status: 404 });
4518
4604
  });
4519
4605
  app.delete("/:id", requireViewer, validateRequest("param", automationParamsSchema, "Invalid task."), async (context) => {
4520
4606
  const user = context.get("viewer");
@@ -4564,6 +4650,7 @@ function view(workspace) {
4564
4650
  id: workspace.id,
4565
4651
  name: workspace.name,
4566
4652
  setupScript: workspace.setupScript,
4653
+ vcpus: workspace.vcpus,
4567
4654
  repos: workspace.repos.map((repo) => ({
4568
4655
  provider: repo.provider,
4569
4656
  repo: repo.repo,
@@ -4589,6 +4676,7 @@ function createWorkspaceRoutes() {
4589
4676
  const [baselineSnapshot, workspaces] = await Promise.all([baselineSnapshotView(), listWorkspaces(getDb())]);
4590
4677
  return jsonResponse(workspaceListSchema, {
4591
4678
  baselineSnapshot,
4679
+ defaultVcpus: getSandboxResources()?.vcpus ?? null,
4592
4680
  workspaces: workspaces.map(view)
4593
4681
  });
4594
4682
  });
@@ -4651,7 +4739,7 @@ function readDescriptionText(home) {
4651
4739
  }
4652
4740
  /** Read discovered skill names for authenticated runtime diagnostics. */
4653
4741
  async function readSkillReports() {
4654
- const { discoverSkills } = await import("./skills-CiWS5_Ub.js").then((n) => n.o);
4742
+ const { discoverSkills } = await import("./skills-BpdYCfFt.js").then((n) => n.o);
4655
4743
  const skills = await discoverSkills();
4656
4744
  return skillReportsSchema.parse(skills.map((skill) => ({
4657
4745
  name: skill.name,
@@ -4660,7 +4748,7 @@ async function readSkillReports() {
4660
4748
  }
4661
4749
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4662
4750
  async function readPlugins() {
4663
- const { pluginCatalogRuntime } = await import("./catalog-runtime-B8SuFPGb.js").then((n) => n.t);
4751
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-cd60vzAB.js").then((n) => n.t);
4664
4752
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4665
4753
  configKeys: plugin.manifest.configKeys ?? [],
4666
4754
  description: plugin.manifest.description,
@@ -4672,7 +4760,7 @@ async function readPlugins() {
4672
4760
  async function readRuntimeInfoReport() {
4673
4761
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4674
4762
  import("./package-discovery-DJBompdd.js").then((n) => n.r),
4675
- import("./catalog-runtime-B8SuFPGb.js").then((n) => n.t),
4763
+ import("./catalog-runtime-cd60vzAB.js").then((n) => n.t),
4676
4764
  readPlugins(),
4677
4765
  readSkillReports()
4678
4766
  ]);
@@ -4689,7 +4777,7 @@ async function readRuntimeInfoReport() {
4689
4777
  /** Read sanitized operational summaries contributed by plugins. */
4690
4778
  async function readPluginOperationalReportFeed() {
4691
4779
  const nowMs = Date.now();
4692
- const { getPluginOperationalReports } = await import("./agent-hooks-B00FaKdP.js").then((n) => n.t);
4780
+ const { getPluginOperationalReports } = await import("./agent-hooks-ghyZZQqB.js").then((n) => n.t);
4693
4781
  return pluginOperationalReportFeedSchema.parse({
4694
4782
  source: "plugins",
4695
4783
  generatedAt: new Date(nowMs).toISOString(),
@@ -9,9 +9,9 @@ import "ai";
9
9
  import { z } from "zod";
10
10
  import { Destination, OwnedObjectAnnotation, PluginRegistration, Source, User } from "@sentry/junior-plugin-api";
11
11
  import "@earendil-works/pi-agent-core";
12
+ import { Sandbox } from "@vercel/sandbox";
12
13
  import "@earendil-works/pi-ai";
13
14
  import "@sinclair/typebox";
14
- import { Sandbox } from "@vercel/sandbox";
15
15
  import "@modelcontextprotocol/sdk/client/auth.js";
16
16
  import { Client } from "@modelcontextprotocol/sdk/client";
17
17
  import { Message, StateAdapter } from "chat";
@@ -251,6 +251,11 @@ interface JuniorAppOptions extends BotModelConfig {
251
251
  * `JUNIOR_CROSS_ACTOR_MID_RUN_MODE` or `follow_up`.
252
252
  */
253
253
  crossActorMidRunMode?: CrossActorMidRunMode;
254
+ /**
255
+ * Slack user IDs of bots that may start a Turn from a mention or DM. Bots
256
+ * have no profile email, so `allowedDomains` blocks them otherwise.
257
+ */
258
+ allowedBotUserIds?: string[];
254
259
  };
255
260
  /** Install-wide provider defaults. Unregistered `provider.key` entries warn at startup. */
256
261
  configDefaults?: Record<string, unknown>;
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-Bbxrehjf.js";
1
+ import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-VCiPQ65Q.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-B_0Cr0MO.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
4
4
  export { JUNIOR_VERSION, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type ModelProfileInput, createApp, defineJuniorPlugins };