@sentry/junior 0.256.0 → 0.257.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 (68) hide show
  1. package/dist/{admin-BhucwVfy.js → admin-DgIkm6Vy.js} +1 -1
  2. package/dist/{agent-hooks-DlSK8PQQ.js → agent-hooks-BjtTzvru.js} +13 -13
  3. package/dist/{agent-invocations-BY60iNw-.js → agent-invocations-Bdu3ROfo.js} +2 -1
  4. package/dist/{agent-runner-C6_cd61V.js → agent-runner-D7OboVb3.js} +41 -33
  5. package/dist/api/schema.d.ts +41 -1
  6. package/dist/api/schema.js +2 -2
  7. package/dist/api.js +121 -33
  8. package/dist/{app-B0gT1Slp.d.ts → app-BsU5QNBd.d.ts} +7 -1
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +587 -210
  11. package/dist/{assistant-reply-yn5G-YEG.js → assistant-reply-CbTPebzL.js} +1 -1
  12. package/dist/{briefs-U6Bi3IYw.js → briefs-oLOldnDM.js} +4 -4
  13. package/dist/{catalog-runtime-DF5OWqCc.js → catalog-runtime-CZzhGQ7F.js} +1 -1
  14. package/dist/cli/chat.js +16 -16
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +2 -2
  17. package/dist/cli/plugins.js +4 -4
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.js +3 -3
  20. package/dist/{client-BVrAp-pq.js → client-D8HnkOQX.js} +2 -2
  21. package/dist/{config-DdBiDanf.js → config-CJRnWK9H.js} +2 -2
  22. package/dist/{connections-CG04HdpC.js → connections-ClYrKzpX.js} +16 -11
  23. package/dist/{conversation-T18Xlkx9.js → conversation-CKNLYBJt.js} +3 -2
  24. package/dist/{conversation-privacy-CpSYOWnP.js → conversation-privacy-C8b1nphZ.js} +1 -1
  25. package/dist/{credential-sync-DKWNdcgm.js → credential-sync-BXfohNmJ.js} +82 -40
  26. package/dist/{executor-BroK9oKy.js → executor-Do0THDRR.js} +33 -23
  27. package/dist/{experimental-Qn9rKLgx.js → experimental-CQIvMUO7.js} +1 -0
  28. package/dist/{images-D0VZ5nv0.js → images-BN_BiBXF.js} +3 -3
  29. package/dist/instrumentation.js +2 -2
  30. package/dist/{job-queue-BbGg3gvu.js → job-queue-B6SV9uVa.js} +1 -1
  31. package/dist/{logging-tPQeUe2i.js → logging-CWxiIuCF.js} +50 -15
  32. package/dist/{message-DdPGRYQP.js → message-TUOdbSBW.js} +3 -3
  33. package/dist/nitro.d.ts +1 -1
  34. package/dist/nitro.js +3 -3
  35. package/dist/{oauth-callback-server-B-2errCX.js → oauth-callback-server-Dj5UJODo.js} +2 -2
  36. package/dist/{pending-auth-DT3MRVW8.js → pending-auth-s_QFribU.js} +3 -3
  37. package/dist/{profile-Bb1zCVGP.js → profile-h-72wM78.js} +4 -4
  38. package/dist/{prompt-C04mP1hu.js → prompt-DyoEj9c2.js} +1 -1
  39. package/dist/{registry-CsNavQ_Z.js → registry-sLTr-sV9.js} +43 -3
  40. package/dist/{resolve-B6ZZ9duG.js → resolve-ncQPZROQ.js} +2 -2
  41. package/dist/{result-j9nS0se-.js → result-C883vngT.js} +7 -7
  42. package/dist/{runner-Y331DoZ5.js → runner-CzYImdOF.js} +10 -10
  43. package/dist/{sandbox-egress-signals-BUfjEdHY.js → sandbox-egress-signals-CZbMINHI.js} +1 -1
  44. package/dist/{schema-BBgv0MNf.js → schema-Dy69D4Ge.js} +4 -3
  45. package/dist/{session-stop-q-6GNHx6.js → session-stop-CQjKd4a2.js} +46 -20
  46. package/dist/{skills-CyvTsR9M.js → skills-C22SLruK.js} +2 -2
  47. package/dist/{spawn-Do5mX3d_.js → spawn-DY9CLXDL.js} +2 -2
  48. package/dist/{store-D2It0ozF.js → store-DXFIQy-G.js} +6 -6
  49. package/dist/{task-queue-ZMk9bLRT.js → task-queue-B17vV0La.js} +3 -3
  50. package/dist/{task-runner-cIGU5VwJ.js → task-runner-DUjvzYXj.js} +11 -11
  51. package/dist/{tasks-CODtRzvX.js → tasks-D_WIJtvO.js} +25 -10
  52. package/dist/{thread-state-BPkwVmvK.js → thread-state-Ch4yuCqG.js} +7 -7
  53. package/dist/{turn-failure-response-ChmMeKar.js → turn-failure-response-C5nBKC4S.js} +8 -8
  54. package/dist/{turn-lifecycle-BUP7ZOVa.js → turn-lifecycle-CO-ylUmV.js} +1 -1
  55. package/dist/{turn-session-routing-BcWM3PLm.js → turn-session-routing-B3LWooK5.js} +1 -1
  56. package/dist/{validation-DCd69-cP.js → validation-CXYxaNYx.js} +1 -1
  57. package/dist/{version-DBc4Qt_P.js → version-BcdZy2zg.js} +1 -1
  58. package/dist/version.js +1 -1
  59. package/dist/{viewer-C-9nFKYr.js → viewer-DSZXygMU.js} +53 -5
  60. package/dist/{web-input-Cv42P3ni.js → web-input-B9Bv0_lR.js} +73 -75
  61. package/dist/{work-6UmVQq1V.js → work-nAfDSUFP.js} +9 -9
  62. package/dist/{worker-DAoBZuZn.js → worker-vGXZ6XFT.js} +5 -5
  63. package/migrations/0059_automation_run_version.sql +2 -0
  64. package/migrations/0060_identity_signed_in_at.sql +1 -0
  65. package/migrations/meta/0059_snapshot.json +3619 -0
  66. package/migrations/meta/0060_snapshot.json +3465 -0
  67. package/migrations/meta/_journal.json +15 -1
  68. package/package.json +5 -4
package/dist/api.js CHANGED
@@ -1,27 +1,27 @@
1
- import { K as listChildAgents, L as editEventAutomation, Lt as createUserTokenStore, 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-C6_cd61V.js";
2
- import { d as logException, f as logInfo, p as logWarn } from "./logging-tPQeUe2i.js";
1
+ import { K as listChildAgents, L as editEventAutomation, O as parseSlackThreadId, P as editScheduledAutomation, R as AutomationEditError, Rt as createUserTokenStore, T as readLiveAttachment, V as resolveTaskOutcomes, bt as conversationSubtreeColumns, g as readStats, ot as getChildAgentLabel, yt as conversationSubtree, z as eventAutomationTriggerAvailable } from "./agent-runner-D7OboVb3.js";
2
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-CWxiIuCF.js";
3
3
  import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-BTtLaeWy.js";
4
- import { E as resolveRootConversationId, T as hasAgentTurnUsage, _ as locationFromRow, b as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, w as agentTurnUsageSchema, x as addAgentTurnUsage } from "./viewer-C-9nFKYr.js";
5
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
6
- import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-BroK9oKy.js";
4
+ import { C as parseSessionSource, D as agentTurnUsageSchema, O as hasAgentTurnUsage, a as resolveViewerUser, d as getConversationStore, f as getDb, g as loadConversationSlackTenantId, h as withConversationEventLock, k as resolveRootConversationId, l as getConversationEventStore, p as getSqlExecutor, s as updateViewerDisplayName, t as findUserByEmail, w as addAgentTurnUsage, y as locationFromRow } from "./viewer-DSZXygMU.js";
5
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Bdu3ROfo.js";
6
+ import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Do0THDRR.js";
7
7
  import { d as contextProvenance } from "./history-9pO1Zd4Y.js";
8
- import { D as automationRevision, E as AutomationConflictError, O as requireAutomationRevision, S as automationDefinition, T as sameDefinitionValue, a as saveScheduledAutomation, fn as piMessageFromHistoryItem, kt as loadTurnProjection, v as saveEventAutomation, w as readAutomationVersion, y as setEventAutomationStatus } from "./tasks-CODtRzvX.js";
9
- 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-DlSK8PQQ.js";
10
- 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-T18Xlkx9.js";
11
- import { n as hash, t as create } from "./profile-Bb1zCVGP.js";
12
- import { l as getEventCatalog, v as automationEventCatalog } from "./session-stop-q-6GNHx6.js";
8
+ 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-D_WIJtvO.js";
9
+ 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-BjtTzvru.js";
10
+ 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-CKNLYBJt.js";
11
+ import { n as hash, t as create } from "./profile-h-72wM78.js";
12
+ import { l as getEventCatalog, y as automationEventCatalog } from "./session-stop-CQjKd4a2.js";
13
13
  import { t as getFirstRunAtMs } from "./cadence-D00SCzT1.js";
14
- import { t as getCachedSnapshot } from "./resolve-B6ZZ9duG.js";
15
- import { a as getVercelConversationWorkQueue } from "./job-queue-BbGg3gvu.js";
16
- import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-D2It0ozF.js";
14
+ import { t as getCachedSnapshot } from "./resolve-ncQPZROQ.js";
15
+ import { a as getVercelConversationWorkQueue } from "./job-queue-B6SV9uVa.js";
16
+ import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-DXFIQy-G.js";
17
17
  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-CHdlHVZP.js";
18
18
  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-xPI_EFSC.js";
19
- 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, j 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-Cv42P3ni.js";
20
- import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, j as readAutomationTitlesByConversationId } from "./task-runner-cIGU5VwJ.js";
21
- import { d as legacyWebMailboxMetadataSchema } from "./result-j9nS0se-.js";
22
- import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection } from "./connections-CG04HdpC.js";
23
- import { t as decodeInputImages } from "./images-D0VZ5nv0.js";
24
- import { C as locationParamsSchema, E as activitySixHours$1, H as conversationChildAgentsReportSchema, I as codeOverviewReportSchema, L as codePersonReportSchema, M as startConnectionResponseSchema, O as connectionListSchema, R as codeRepositoryParamsSchema, S as locationDirectoryReportSchema, T as activityHours$1, U as stopConversationTurnResponseSchema, W as apiErrorSchema, _ as actorProfileReportSchema, a as workspaceBodySchema, d as createdPersonalTokenSchema, f as personalTokenListSchema, g as actorDirectoryReportSchema, h as revokePersonalTokenResponseSchema, i as deleteWorkspaceResponseSchema, j as disconnectConnectionResponseSchema, k as connectionParamsSchema, l as workspaceSchema, m as personalTokenParamsSchema, n as statsReportSchema, o as workspaceListSchema, s as workspaceParamsSchema, u as createPersonalTokenBodySchema, v as personParamsSchema, w as activityDays$1, x as locationDetailReportSchema, y as personalSpendReportSchema, z as codeRepositoryReportSchema } from "./schema-BBgv0MNf.js";
19
+ 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-B9Bv0_lR.js";
20
+ import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, j as readAutomationTitlesByConversationId } from "./task-runner-DUjvzYXj.js";
21
+ import { d as legacyWebMailboxMetadataSchema } from "./result-C883vngT.js";
22
+ import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection } from "./connections-ClYrKzpX.js";
23
+ import { t as decodeInputImages } from "./images-BN_BiBXF.js";
24
+ import { C as locationParamsSchema, E as activitySixHours$1, H as conversationChildAgentsReportSchema, I as codeOverviewReportSchema, L as codePersonReportSchema, M as startConnectionResponseSchema, O as connectionListSchema, R as codeRepositoryParamsSchema, S as locationDirectoryReportSchema, T as activityHours$1, U as stopConversationTurnResponseSchema, W as apiErrorSchema, _ as actorProfileReportSchema, a as workspaceBodySchema, d as createdPersonalTokenSchema, f as personalTokenListSchema, g as actorDirectoryReportSchema, h as revokePersonalTokenResponseSchema, i as deleteWorkspaceResponseSchema, j as disconnectConnectionResponseSchema, k as connectionParamsSchema, l as workspaceSchema, m as personalTokenParamsSchema, n as statsReportSchema, o as workspaceListSchema, s as workspaceParamsSchema, u as createPersonalTokenBodySchema, v as personParamsSchema, w as activityDays$1, x as locationDetailReportSchema, y as personalSpendReportSchema, z as codeRepositoryReportSchema } from "./schema-Dy69D4Ge.js";
25
25
  import { Hono } from "hono";
26
26
  import path from "node:path";
27
27
  import { z } from "zod";
@@ -892,6 +892,83 @@ function decodeConversationCursor(args) {
892
892
  }
893
893
  }
894
894
  //#endregion
895
+ //#region src/api/conversations/message-mentions.ts
896
+ const SLACK_USER_MENTION_RE = /<@([UW][A-Z0-9]+)(?:\|[^<>]*)?>/g;
897
+ function mentionedSlackUserIds(text) {
898
+ if (!text) return [];
899
+ return [...new Set([...text.matchAll(SLACK_USER_MENTION_RE)].map((m) => m[1]))];
900
+ }
901
+ function messageMentionText(data) {
902
+ return [data.text, data.trustedSummary].filter(Boolean).join("\n");
903
+ }
904
+ /**
905
+ * Read current names for mentioned Slack users. Known Junior identities come
906
+ * first. The email is set only for a linked, verified Junior user, because
907
+ * that email is the People profile route.
908
+ */
909
+ async function resolveSlackMentions(executor, conversationId, userIds) {
910
+ const tenantId = await loadConversationSlackTenantId(executor, conversationId);
911
+ const rows = await executor.db().select({
912
+ displayName: juniorIdentities.displayName,
913
+ emailVerified: juniorIdentities.emailVerified,
914
+ handle: juniorIdentities.handle,
915
+ providerSubjectId: juniorIdentities.providerSubjectId,
916
+ userDisplayName: juniorUsers.displayName,
917
+ userEmail: juniorUsers.primaryEmail
918
+ }).from(juniorIdentities).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorIdentities.provider, "slack"), inArray(juniorIdentities.providerSubjectId, userIds), tenantId ? eq(juniorIdentities.providerTenantId, tenantId) : void 0));
919
+ const people = /* @__PURE__ */ new Map();
920
+ for (const row of rows) {
921
+ if (people.has(row.providerSubjectId)) continue;
922
+ const fullName = row.userDisplayName?.trim() || row.displayName?.trim();
923
+ const email = row.emailVerified ? row.userEmail?.trim() : void 0;
924
+ people.set(row.providerSubjectId, {
925
+ slackUserId: row.providerSubjectId,
926
+ ...fullName ? { fullName } : void 0,
927
+ ...row.handle ? { slackUserName: row.handle } : void 0,
928
+ ...email ? { email } : void 0
929
+ });
930
+ }
931
+ const unnamed = userIds.filter((id) => {
932
+ const person = people.get(id);
933
+ return !person?.fullName && !person?.slackUserName;
934
+ });
935
+ if (tenantId && unnamed.length > 0) {
936
+ const profiles = await Promise.all(unnamed.map((id) => lookupSlackUser(tenantId, id)));
937
+ unnamed.forEach((id, index) => {
938
+ const profile = profiles[index];
939
+ if (!profile?.fullName && !profile?.userName) return;
940
+ people.set(id, {
941
+ ...people.get(id),
942
+ slackUserId: id,
943
+ ...profile.fullName ? { fullName: profile.fullName } : void 0,
944
+ ...profile.userName ? { slackUserName: profile.userName } : void 0
945
+ });
946
+ });
947
+ }
948
+ return people;
949
+ }
950
+ /** Attach the people that each visible message mentions, resolved at read time. */
951
+ async function attachMessageMentions(executor, conversationId, events) {
952
+ const idsByIndex = events.map((event) => event.data.type === "message" && !event.data.redacted ? mentionedSlackUserIds(messageMentionText(event.data)) : []);
953
+ const allIds = [...new Set(idsByIndex.flat())];
954
+ if (allIds.length === 0) return events;
955
+ const people = await resolveSlackMentions(executor, conversationId, allIds);
956
+ return events.map((event, index) => {
957
+ if (event.data.type !== "message") return event;
958
+ const mentions = idsByIndex[index].flatMap((id) => {
959
+ const person = people.get(id);
960
+ return person ? [person] : [];
961
+ });
962
+ return mentions.length > 0 ? {
963
+ ...event,
964
+ data: {
965
+ ...event.data,
966
+ mentions
967
+ }
968
+ } : event;
969
+ });
970
+ }
971
+ //#endregion
895
972
  //#region src/api/conversations/shared.ts
896
973
  /** Format a Slack destination without exposing private channel names. */
897
974
  function slackStatsLocationLabel(input) {
@@ -1598,6 +1675,7 @@ async function readConversationDetailFromSql(conversationId, options) {
1598
1675
  conversationId,
1599
1676
  limit: options.limit
1600
1677
  }) : { events: [] };
1678
+ const events = await attachMessageMentions(executor, conversationId, page.events);
1601
1679
  const metrics = metricsByConversation.get(conversationId);
1602
1680
  const auxiliaryCosts = auxiliaryCostsByConversation.get(conversationId);
1603
1681
  const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
@@ -1616,7 +1694,7 @@ async function readConversationDetailFromSql(conversationId, options) {
1616
1694
  version: briefVersion.version
1617
1695
  } } : void 0,
1618
1696
  durationMs: metrics?.durationMs ?? record.durationMs,
1619
- events: page.events,
1697
+ events,
1620
1698
  modelUsage,
1621
1699
  participants: participantsByConversation.get(conversationId) ?? [],
1622
1700
  ...sourceTask ? { sourceTask } : void 0,
@@ -1659,7 +1737,7 @@ async function readConversationEvents(conversationId, beforeValue, options = {})
1659
1737
  limit: options.limit ?? 500
1660
1738
  }) : { events: [] };
1661
1739
  return conversationEventPageSchema.parse({
1662
- events: page.events,
1740
+ events: await attachMessageMentions(getSqlExecutor(), conversationId, page.events),
1663
1741
  eventHistory: conversationEventHistory({
1664
1742
  canExposePayload,
1665
1743
  ...transcriptPurgedAtMs === void 0 ? void 0 : { transcriptPurgedAtMs }
@@ -2339,6 +2417,11 @@ function createConversationRoutes(options) {
2339
2417
  //#region src/api/code/overview.ts
2340
2418
  const DAY_MS = 864e5;
2341
2419
  const WINDOW_DAYS = 30;
2420
+ /**
2421
+ * Code changes listed on one People profile. Open changes sort first so a
2422
+ * stale open change is not cut off by newer completed changes.
2423
+ */
2424
+ const PERSON_CHANGE_LIMIT = 100;
2342
2425
  const summaryRowSchema = z.object({
2343
2426
  closed: z.number().int().nonnegative(),
2344
2427
  costUsd: z.number().nonnegative().nullable(),
@@ -2729,18 +2812,21 @@ async function readCodeOverview(nowMs = Date.now()) {
2729
2812
  });
2730
2813
  }
2731
2814
  /**
2732
- * Read person-scoped code activity linked through conversation actors on
2733
- * Junior-owned code changes.
2815
+ * Read person-scoped code activity and recent code changes linked through
2816
+ * conversation actors on Junior-owned code changes.
2734
2817
  */
2735
2818
  async function readPersonCodeOverview(args) {
2736
- const windows = await readCodeWindows({
2737
- nowMs: args.nowMs ?? Date.now(),
2819
+ const nowMs = args.nowMs ?? Date.now();
2820
+ const db = getDb();
2821
+ const [windows, changes] = await Promise.all([readCodeWindows({
2822
+ nowMs,
2738
2823
  userId: args.userId
2739
- });
2824
+ }), db.select(codeChangeReportColumns).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeChanges.repositoryId, juniorCodeRepositories.id)).where(changeScopeFilter({ userId: args.userId })).orderBy(desc(sql`${juniorCodeChanges.state} = 'open'`), desc(juniorCodeChanges.updatedAt)).limit(PERSON_CHANGE_LIMIT)]);
2740
2825
  return codePersonReportSchema.parse({
2741
2826
  activityDays: windows.activityDays,
2742
2827
  activityHours: windows.activityHours,
2743
2828
  activitySixHours: windows.activitySixHours,
2829
+ changes: changes.map(codeChangeReport),
2744
2830
  generatedAt: windows.windowEnd.toISOString(),
2745
2831
  summary: windows.summary,
2746
2832
  windowEnd: windows.windowEnd.toISOString(),
@@ -2829,8 +2915,9 @@ function createConnectionRoutes() {
2829
2915
  app.delete("/:provider", requireViewer, validateRequest("param", connectionParamsSchema, "Invalid provider."), async (context) => {
2830
2916
  const { provider } = context.req.valid("param");
2831
2917
  if (!isConnectableProvider(provider)) throwApiError(404, "Connection not found.");
2832
- const actor = webActorFromEmail(context.get("viewer").email);
2833
- await disconnectConnection(actor.userId, provider, createUserTokenStore());
2918
+ const viewer = context.get("viewer");
2919
+ const actor = webActorFromEmail(viewer.email);
2920
+ await disconnectConnection(actor.userId, provider, createUserTokenStore(), viewer.id);
2834
2921
  logInfo("dashboard.credential.unlinked", { "app.credential.provider": provider });
2835
2922
  return jsonResponse(disconnectConnectionResponseSchema, { disconnected: true });
2836
2923
  });
@@ -3249,6 +3336,7 @@ async function readPeopleCode(email) {
3249
3336
  const now = /* @__PURE__ */ new Date();
3250
3337
  return codePersonReportSchema.parse({
3251
3338
  activityDays: [],
3339
+ changes: [],
3252
3340
  generatedAt: now.toISOString(),
3253
3341
  summary: {
3254
3342
  closed: 0,
@@ -3592,7 +3680,7 @@ async function readPeoplePluginReports(args) {
3592
3680
  reports: [],
3593
3681
  source: "plugins"
3594
3682
  });
3595
- const { getPluginProfileReports } = await import("./agent-hooks-DlSK8PQQ.js").then((n) => n.t);
3683
+ const { getPluginProfileReports } = await import("./agent-hooks-BjtTzvru.js").then((n) => n.t);
3596
3684
  return pluginOperationalReportFeedSchema.parse({
3597
3685
  generatedAt: new Date(nowMs).toISOString(),
3598
3686
  reports: await getPluginProfileReports({
@@ -4555,7 +4643,7 @@ function readDescriptionText(home) {
4555
4643
  }
4556
4644
  /** Read discovered skill names for authenticated runtime diagnostics. */
4557
4645
  async function readSkillReports() {
4558
- const { discoverSkills } = await import("./skills-CyvTsR9M.js").then((n) => n.o);
4646
+ const { discoverSkills } = await import("./skills-C22SLruK.js").then((n) => n.o);
4559
4647
  const skills = await discoverSkills();
4560
4648
  return skillReportsSchema.parse(skills.map((skill) => ({
4561
4649
  name: skill.name,
@@ -4564,7 +4652,7 @@ async function readSkillReports() {
4564
4652
  }
4565
4653
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4566
4654
  async function readPlugins() {
4567
- const { pluginCatalogRuntime } = await import("./catalog-runtime-DF5OWqCc.js").then((n) => n.t);
4655
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-CZzhGQ7F.js").then((n) => n.t);
4568
4656
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4569
4657
  configKeys: plugin.manifest.configKeys ?? [],
4570
4658
  description: plugin.manifest.description,
@@ -4576,7 +4664,7 @@ async function readPlugins() {
4576
4664
  async function readRuntimeInfoReport() {
4577
4665
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4578
4666
  import("./package-discovery-BVvSnQBB.js").then((n) => n.r),
4579
- import("./catalog-runtime-DF5OWqCc.js").then((n) => n.t),
4667
+ import("./catalog-runtime-CZzhGQ7F.js").then((n) => n.t),
4580
4668
  readPlugins(),
4581
4669
  readSkillReports()
4582
4670
  ]);
@@ -4593,7 +4681,7 @@ async function readRuntimeInfoReport() {
4593
4681
  /** Read sanitized operational summaries contributed by plugins. */
4594
4682
  async function readPluginOperationalReportFeed() {
4595
4683
  const nowMs = Date.now();
4596
- const { getPluginOperationalReports } = await import("./agent-hooks-DlSK8PQQ.js").then((n) => n.t);
4684
+ const { getPluginOperationalReports } = await import("./agent-hooks-BjtTzvru.js").then((n) => n.t);
4597
4685
  return pluginOperationalReportFeedSchema.parse({
4598
4686
  source: "plugins",
4599
4687
  generatedAt: new Date(nowMs).toISOString(),
@@ -79,7 +79,7 @@ interface RuntimeLimits {
79
79
  * Add new keys here as features graduate from private experiments; remove them
80
80
  * once they become stable defaults.
81
81
  */
82
- declare const EXPERIMENTAL_FEATURES: readonly ["operator-tools", "passive-routing", "subagents"];
82
+ declare const EXPERIMENTAL_FEATURES: readonly ["operator-tools", "passive-routing", "slack-sign-in", "subagents"];
83
83
  /** One known experimental feature name. */
84
84
  type ExperimentalFeature = (typeof EXPERIMENTAL_FEATURES)[number];
85
85
  /** App-level opt-ins for unstable product features. */
@@ -264,6 +264,12 @@ interface JuniorAppOptions extends BotModelConfig {
264
264
  * `JUNIOR_CROSS_ACTOR_MID_RUN_MODE` or `follow_up`.
265
265
  */
266
266
  crossActorMidRunMode?: CrossActorMidRunMode;
267
+ /**
268
+ * With `experimental["slack-sign-in"]`, how many days a Google sign-in,
269
+ * in Slack or the dashboard, lets a person use Junior in Slack.
270
+ * Defaults to 7.
271
+ */
272
+ signInMaxAgeDays?: number;
267
273
  };
268
274
  /** Install-wide provider defaults. Unregistered `provider.key` entries warn at startup. */
269
275
  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-B0gT1Slp.js";
1
+ import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-BsU5QNBd.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-CjfUP5gJ.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-CnXZ614E.js";
4
4
  export { JUNIOR_VERSION, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type ModelProfileInput, createApp, defineJuniorPlugins };