@sentry/junior 0.256.0 → 0.258.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 (106) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/{admin-BhucwVfy.js → admin-My1SLGVO.js} +2 -3
  3. package/dist/{agent-hooks-DlSK8PQQ.js → agent-hooks-BJ_5mlRH.js} +71 -111
  4. package/dist/{agent-invocations-BY60iNw-.js → agent-invocations-Qfz7dWgU.js} +8 -13
  5. package/dist/{agent-runner-C6_cd61V.js → agent-runner-DGsFQw72.js} +278 -467
  6. package/dist/api/schema.d.ts +454 -448
  7. package/dist/api/schema.js +5 -5
  8. package/dist/api.d.ts +2 -12
  9. package/dist/api.js +189 -165
  10. package/dist/{app-B0gT1Slp.d.ts → app-PX2H1PxU.d.ts} +20 -37
  11. package/dist/app.d.ts +3 -3
  12. package/dist/app.js +565 -305
  13. package/dist/{assistant-reply-yn5G-YEG.js → assistant-reply-H1M-91oF.js} +3 -5
  14. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  15. package/dist/{briefs-U6Bi3IYw.js → briefs-vYoK85rJ.js} +8 -11
  16. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  17. package/dist/{catalog-runtime-DF5OWqCc.js → catalog-runtime-BN4DVxco.js} +3 -4
  18. package/dist/cli/chat.d.ts +2 -4
  19. package/dist/cli/chat.js +22 -24
  20. package/dist/cli/check.d.ts +1 -3
  21. package/dist/cli/check.js +4 -5
  22. package/dist/cli/env.d.ts +1 -3
  23. package/dist/cli/env.js +1 -2
  24. package/dist/cli/init.d.ts +1 -3
  25. package/dist/cli/init.js +3 -3
  26. package/dist/cli/main.d.ts +1 -3
  27. package/dist/cli/main.js +4 -5
  28. package/dist/cli/plugins.d.ts +2 -4
  29. package/dist/cli/plugins.js +7 -8
  30. package/dist/cli/run.d.ts +1 -2
  31. package/dist/cli/run.js +1 -2
  32. package/dist/cli/snapshot-create.d.ts +1 -3
  33. package/dist/cli/snapshot-create.js +4 -5
  34. package/dist/cli/upgrade.d.ts +3 -6
  35. package/dist/cli/upgrade.js +11 -17
  36. package/dist/{client-BVrAp-pq.js → client-DbyHuMFU.js} +9 -16
  37. package/dist/{config-DdBiDanf.js → config-_WO_AjCB.js} +18 -15
  38. package/dist/{connections-CG04HdpC.js → connections-ag_1JOhB.js} +21 -21
  39. package/dist/{conversation-T18Xlkx9.js → conversation-DjN3mlog.js} +11 -17
  40. package/dist/{conversation-privacy-CpSYOWnP.js → conversation-privacy-DHP_xnVj.js} +2 -3
  41. package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
  42. package/dist/{credential-sync-DKWNdcgm.js → credential-sync-B-CPX_ag.js} +89 -52
  43. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  44. package/dist/{executor-BroK9oKy.js → executor-RvG6kVe1.js} +58 -70
  45. package/dist/{experimental-Qn9rKLgx.js → experimental-BNK1l1jv.js} +2 -3
  46. package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
  47. package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
  48. package/dist/{images-D0VZ5nv0.js → images-C2J_bj2g.js} +5 -6
  49. package/dist/instrumentation.d.ts +1 -3
  50. package/dist/instrumentation.js +6 -8
  51. package/dist/{job-queue-BbGg3gvu.js → job-queue-DVe37it2.js} +6 -12
  52. package/dist/{logging-tPQeUe2i.js → logging-DsHONhVm.js} +54 -24
  53. package/dist/{message-DdPGRYQP.js → message-DyitL8no.js} +5 -6
  54. package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
  55. package/dist/nitro.d.ts +3 -5
  56. package/dist/nitro.js +12 -17
  57. package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
  58. package/dist/{oauth-callback-server-B-2errCX.js → oauth-callback-server-CDby-pCn.js} +3 -4
  59. package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
  60. package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
  61. package/dist/{pending-auth-DT3MRVW8.js → pending-auth-D8J1uJUS.js} +37 -28
  62. package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
  63. package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
  64. package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
  65. package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
  66. package/dist/{profile-Bb1zCVGP.js → profile-DpYjfKke.js} +16 -28
  67. package/dist/{prompt-C04mP1hu.js → prompt-xgpyMtg7.js} +5 -9
  68. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  69. package/dist/{registry-CsNavQ_Z.js → registry-Du566MtJ.js} +57 -30
  70. package/dist/{resolve-B6ZZ9duG.js → resolve-ClCIgh8E.js} +7 -12
  71. package/dist/{result-j9nS0se-.js → result-BBbKA61B.js} +13 -17
  72. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  73. package/dist/{runner-Y331DoZ5.js → runner-CCuqFSqx.js} +12 -13
  74. package/dist/{sandbox-egress-signals-BUfjEdHY.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
  75. package/dist/{schema-BBgv0MNf.js → schema-DrMh3NtR.js} +17 -27
  76. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  77. package/dist/{session-stop-q-6GNHx6.js → session-stop-CIoFiwwe.js} +57 -41
  78. package/dist/{skills-CyvTsR9M.js → skills-DyQBLIrK.js} +9 -9
  79. package/dist/{spawn-Do5mX3d_.js → spawn-Dqfeo7XP.js} +4 -5
  80. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  81. package/dist/{store-D2It0ozF.js → store-DJLwq4x8.js} +13 -15
  82. package/dist/{task-queue-ZMk9bLRT.js → task-queue-BzW4MaWU.js} +5 -7
  83. package/dist/{task-runner-cIGU5VwJ.js → task-runner-D3qJh4fK.js} +22 -26
  84. package/dist/{tasks-CODtRzvX.js → tasks-CEXKTASS.js} +78 -79
  85. package/dist/{thread-state-BPkwVmvK.js → thread-state-W3f6kAtz.js} +13 -19
  86. package/dist/{turn-failure-response-ChmMeKar.js → turn-failure-response-CWx7aNIh.js} +16 -22
  87. package/dist/{turn-lifecycle-BUP7ZOVa.js → turn-lifecycle-C9JFst7-.js} +2 -3
  88. package/dist/{turn-session-routing-BcWM3PLm.js → turn-session-routing-CUxtfpr7.js} +2 -3
  89. package/dist/{validation-DCd69-cP.js → validation-BHRxa5G4.js} +3 -4
  90. package/dist/vercel.d.ts +1 -3
  91. package/dist/vercel.js +1 -2
  92. package/dist/{version-DBc4Qt_P.js → version-C0U6rHg0.js} +3 -5
  93. package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
  94. package/dist/version.d.ts +1 -1
  95. package/dist/version.js +1 -2
  96. package/dist/{viewer-C-9nFKYr.js → viewer-CGvvRqKp.js} +61 -44
  97. package/dist/{web-input-Cv42P3ni.js → web-input-Keb5GRWj.js} +139 -198
  98. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  99. package/dist/{work-6UmVQq1V.js → work-DRcsJ3hV.js} +14 -16
  100. package/dist/{worker-DAoBZuZn.js → worker-Cjo-QqPq.js} +7 -8
  101. package/migrations/0059_automation_run_version.sql +2 -0
  102. package/migrations/0060_identity_signed_in_at.sql +1 -0
  103. package/migrations/meta/0059_snapshot.json +3619 -0
  104. package/migrations/meta/0060_snapshot.json +3465 -0
  105. package/migrations/meta/_journal.json +15 -1
  106. package/package.json +8 -6
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";
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";
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";
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";
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
- 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";
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-DGsFQw72.js";
2
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-DsHONhVm.js";
3
+ import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-tlxzqaRe.js";
4
+ 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-CGvvRqKp.js";
5
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.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-RvG6kVe1.js";
7
+ import { d as contextProvenance } from "./history-AY8rs-FR.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-CEXKTASS.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-BJ_5mlRH.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-DjN3mlog.js";
11
+ import { n as hash, t as create } from "./profile-DpYjfKke.js";
12
+ import { l as getEventCatalog, y as automationEventCatalog } from "./session-stop-CIoFiwwe.js";
13
+ import { t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
14
+ import { t as getCachedSnapshot } from "./resolve-ClCIgh8E.js";
15
+ import { a as getVercelConversationWorkQueue } from "./job-queue-DVe37it2.js";
16
+ import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-DJLwq4x8.js";
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-DWBFBenG.js";
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-CJSUiksE.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-Keb5GRWj.js";
20
+ import { F as conversationAggregateColumns, I as conversationRangeColumns, M as readAutomationTitlesByConversationId, P as conversationActiveDaysColumn } from "./task-runner-D3qJh4fK.js";
21
+ import { d as legacyWebMailboxMetadataSchema } from "./result-BBbKA61B.js";
22
+ import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection } from "./connections-ag_1JOhB.js";
23
+ import { t as decodeInputImages } from "./images-C2J_bj2g.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-DrMh3NtR.js";
25
25
  import { Hono } from "hono";
26
26
  import path from "node:path";
27
27
  import { z } from "zod";
@@ -34,7 +34,7 @@ import { HTTPException } from "hono/http-exception";
34
34
  import { bodyLimit } from "hono/body-limit";
35
35
  import { zValidator } from "@hono/zod-validator";
36
36
  import { createMiddleware } from "hono/factory";
37
- //#region src/api/http.ts
37
+ // src/api/http.ts
38
38
  const NO_STORE_HEADERS = { "cache-control": "no-store" };
39
39
  /** Build response init that keeps personalized API payloads out of shared caches. */
40
40
  function noStoreInit(init) {
@@ -62,23 +62,20 @@ function throwApiError(status, message, cause) {
62
62
  res: jsonResponse(apiErrorSchema, { error: message }, { status })
63
63
  });
64
64
  }
65
- //#endregion
66
- //#region src/api/validation.ts
65
+ // src/api/validation.ts
67
66
  /** Validate one request input and use Junior's stable JSON error contract. */
68
67
  function validateRequest(target, schema, message) {
69
68
  return zValidator(target, schema, (result) => {
70
69
  if (!result.success) throwApiError(400, message, result.error);
71
70
  });
72
71
  }
73
- //#endregion
74
- //#region src/api/viewer.ts
72
+ // src/api/viewer.ts
75
73
  /** Require a viewer and refine later Hono handlers to authenticated context. */
76
74
  const requireViewer = createMiddleware(async (context, next) => {
77
75
  if (!context.get("viewer")) throwApiError(401, "Authentication required.");
78
76
  await next();
79
77
  });
80
- //#endregion
81
- //#region src/api/conversations/archive.ts
78
+ // src/api/conversations/archive.ts
82
79
  async function setViewerArchive(args) {
83
80
  const executor = getSqlExecutor();
84
81
  return await executor.transaction(async () => {
@@ -133,8 +130,7 @@ async function archiveConversation(viewer, conversationId, body) {
133
130
  if (result.status === "missing") throwApiError(404, "Conversation not found.");
134
131
  throwApiError(409, "Conversation received new activity.");
135
132
  }
136
- //#endregion
137
- //#region src/chat/conversations/fork.ts
133
+ // src/chat/conversations/fork.ts
138
134
  /** Event key of the agent note that follows the copied events in a fork. */
139
135
  const FORK_NOTE_KEY = "fork:note";
140
136
  const forkNote = alias(juniorConversationEvents, "fork_note");
@@ -283,8 +279,7 @@ function hasUnfinishedToolCalls(messages) {
283
279
  } else if (message.role === "toolResult") pending.delete(message.toolCallId);
284
280
  return pending.size > 0;
285
281
  }
286
- //#endregion
287
- //#region src/api/conversations/auxiliary-costs.ts
282
+ // src/api/conversations/auxiliary-costs.ts
288
283
  function eventCost() {
289
284
  return sql`CASE
290
285
  WHEN ${juniorConversationEvents.type} = 'structured_event'
@@ -344,8 +339,7 @@ async function readConversationAuxiliaryCostsFromSql(db, conversationIds) {
344
339
  }
345
340
  return result;
346
341
  }
347
- //#endregion
348
- //#region src/api/conversations/usage.ts
342
+ // src/api/conversations/usage.ts
349
343
  const usage$1 = juniorConversations.usage;
350
344
  const componentFields = [
351
345
  "inputTokens",
@@ -455,8 +449,7 @@ function childAgentTotalsReport(metrics, auxiliaryCosts) {
455
449
  ...childAgents.usage ? { cumulativeUsage: childAgents.usage } : void 0
456
450
  };
457
451
  }
458
- //#endregion
459
- //#region src/api/conversations/child-agents.ts
452
+ // src/api/conversations/child-agents.ts
460
453
  /**
461
454
  * Load the direct child agents of one Conversation, or throw a standard API
462
455
  * not-found error. Viewers who cannot see private content get only the status,
@@ -494,8 +487,7 @@ async function requireConversationChildAgents(conversationId, options = {}) {
494
487
  conversationId
495
488
  });
496
489
  }
497
- //#endregion
498
- //#region src/api/conversations/attachments.ts
490
+ // src/api/conversations/attachments.ts
499
491
  function contentDisposition(filename, contentType) {
500
492
  return `${INPUT_IMAGE_TYPES.some((type) => type === contentType) ? "inline" : "attachment"}; filename="${filename.replace(/[^\x20-\x7e]|["\\]/g, "_")}"; filename*=UTF-8''${encodeURIComponent(filename)}`;
501
493
  }
@@ -536,8 +528,7 @@ async function requireConversationAttachment(args) {
536
528
  if (!opened) throwApiError(404, "Attachment not found.");
537
529
  return opened;
538
530
  }
539
- //#endregion
540
- //#region src/api/conversations/create.ts
531
+ // src/api/conversations/create.ts
541
532
  /** Turn image validation failures into request errors before accepting work. */
542
533
  function parseImages(images) {
543
534
  try {
@@ -596,8 +587,7 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
596
587
  throwApiError(500, "Unable to append message.", error);
597
588
  }
598
589
  }
599
- //#endregion
600
- //#region src/chat/plugins/conversation-sidebar.ts
590
+ // src/chat/plugins/conversation-sidebar.ts
601
591
  /** Show native objects by default and let plugins select compact sidebar labels. */
602
592
  async function listConversationSidebarAnnotations(conversationIds, annotationsByConversation) {
603
593
  const candidates = new Set(conversationIds);
@@ -646,8 +636,7 @@ async function listConversationSidebarAnnotations(conversationIds, annotationsBy
646
636
  }
647
637
  return selected;
648
638
  }
649
- //#endregion
650
- //#region src/chat/slack/location-url.ts
639
+ // src/chat/slack/location-url.ts
651
640
  /** Parse a Slack workspace subdomain used in `https://{domain}.slack.com` URLs. */
652
641
  function parseSlackTeamDomain(value) {
653
642
  if (typeof value !== "string") return void 0;
@@ -674,8 +663,7 @@ function buildSlackLocationUrl(args) {
674
663
  url.searchParams.set("cid", channelId);
675
664
  return url.toString();
676
665
  }
677
- //#endregion
678
- //#region src/chat/slack/team-domain.ts
666
+ // src/chat/slack/team-domain.ts
679
667
  const TEAM_DOMAIN_CACHE_TTL_MS = 864e5;
680
668
  const TEAM_DOMAIN_NEGATIVE_CACHE_TTL_MS = 6e4;
681
669
  const teamDomainCache = /* @__PURE__ */ new Map();
@@ -746,8 +734,7 @@ async function resolveSlackTeamDomains(teamIds) {
746
734
  }));
747
735
  return new Map(resolved.filter((entry) => entry !== void 0));
748
736
  }
749
- //#endregion
750
- //#region src/chat/pi/sql-model-usage.ts
737
+ // src/chat/pi/sql-model-usage.ts
751
738
  /** SQL reporting adapter for usage stored on assistant history events. */
752
739
  const message = sql`${juniorConversationEvents.payload}`;
753
740
  const usage = sql`${message}->'usage'`;
@@ -851,8 +838,7 @@ async function readConversationModelUsageFromSql(executor, options) {
851
838
  }] : [];
852
839
  });
853
840
  }
854
- //#endregion
855
- //#region src/api/conversations/cursor.ts
841
+ // src/api/conversations/cursor.ts
856
842
  const CURSOR_CONTEXT = "junior-conversation-report-cursor";
857
843
  const conversationCursorPayloadSchema = z.object({
858
844
  conversationId: z.string().min(1),
@@ -891,8 +877,83 @@ function decodeConversationCursor(args) {
891
877
  return;
892
878
  }
893
879
  }
894
- //#endregion
895
- //#region src/api/conversations/shared.ts
880
+ // src/api/conversations/message-mentions.ts
881
+ const SLACK_USER_MENTION_RE = /<@([UW][A-Z0-9]+)(?:\|[^<>]*)?>/g;
882
+ function mentionedSlackUserIds(text) {
883
+ if (!text) return [];
884
+ return [...new Set([...text.matchAll(SLACK_USER_MENTION_RE)].map((m) => m[1]))];
885
+ }
886
+ function messageMentionText(data) {
887
+ return [data.text, data.trustedSummary].filter(Boolean).join("\n");
888
+ }
889
+ /**
890
+ * Read current names for mentioned Slack users. Known Junior identities come
891
+ * first. The email is set only for a linked, verified Junior user, because
892
+ * that email is the People profile route.
893
+ */
894
+ async function resolveSlackMentions(executor, conversationId, userIds) {
895
+ const tenantId = await loadConversationSlackTenantId(executor, conversationId);
896
+ const rows = await executor.db().select({
897
+ displayName: juniorIdentities.displayName,
898
+ emailVerified: juniorIdentities.emailVerified,
899
+ handle: juniorIdentities.handle,
900
+ providerSubjectId: juniorIdentities.providerSubjectId,
901
+ userDisplayName: juniorUsers.displayName,
902
+ userEmail: juniorUsers.primaryEmail
903
+ }).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));
904
+ const people = /* @__PURE__ */ new Map();
905
+ for (const row of rows) {
906
+ if (people.has(row.providerSubjectId)) continue;
907
+ const fullName = row.userDisplayName?.trim() || row.displayName?.trim();
908
+ const email = row.emailVerified ? row.userEmail?.trim() : void 0;
909
+ people.set(row.providerSubjectId, {
910
+ slackUserId: row.providerSubjectId,
911
+ ...fullName ? { fullName } : void 0,
912
+ ...row.handle ? { slackUserName: row.handle } : void 0,
913
+ ...email ? { email } : void 0
914
+ });
915
+ }
916
+ const unnamed = userIds.filter((id) => {
917
+ const person = people.get(id);
918
+ return !person?.fullName && !person?.slackUserName;
919
+ });
920
+ if (tenantId && unnamed.length > 0) {
921
+ const profiles = await Promise.all(unnamed.map((id) => lookupSlackUser(tenantId, id)));
922
+ unnamed.forEach((id, index) => {
923
+ const profile = profiles[index];
924
+ if (!profile?.fullName && !profile?.userName) return;
925
+ people.set(id, {
926
+ ...people.get(id),
927
+ slackUserId: id,
928
+ ...profile.fullName ? { fullName: profile.fullName } : void 0,
929
+ ...profile.userName ? { slackUserName: profile.userName } : void 0
930
+ });
931
+ });
932
+ }
933
+ return people;
934
+ }
935
+ /** Attach the people that each visible message mentions, resolved at read time. */
936
+ async function attachMessageMentions(executor, conversationId, events) {
937
+ const idsByIndex = events.map((event) => event.data.type === "message" && !event.data.redacted ? mentionedSlackUserIds(messageMentionText(event.data)) : []);
938
+ const allIds = [...new Set(idsByIndex.flat())];
939
+ if (allIds.length === 0) return events;
940
+ const people = await resolveSlackMentions(executor, conversationId, allIds);
941
+ return events.map((event, index) => {
942
+ if (event.data.type !== "message") return event;
943
+ const mentions = idsByIndex[index].flatMap((id) => {
944
+ const person = people.get(id);
945
+ return person ? [person] : [];
946
+ });
947
+ return mentions.length > 0 ? {
948
+ ...event,
949
+ data: {
950
+ ...event.data,
951
+ mentions
952
+ }
953
+ } : event;
954
+ });
955
+ }
956
+ // src/api/conversations/shared.ts
896
957
  /** Format a Slack destination without exposing private channel names. */
897
958
  function slackStatsLocationLabel(input) {
898
959
  const channelId = input.channel;
@@ -914,8 +975,7 @@ function surfaceFallbackLabel(surface) {
914
975
  if (surface === "internal") return "Internal";
915
976
  return "Conversation";
916
977
  }
917
- //#endregion
918
- //#region src/api/conversations/projection.ts
978
+ // src/api/conversations/projection.ts
919
979
  const PRIVATE_CONVERSATION_LABEL = "Private Conversation";
920
980
  function privateConversationLabel(slackConversation) {
921
981
  if (!slackConversation) return PRIVATE_CONVERSATION_LABEL;
@@ -1045,8 +1105,7 @@ function conversationSummaryFromStoredConversation(args) {
1045
1105
  ...args.locationId && !channelNameRedacted ? { locationId: args.locationId } : void 0
1046
1106
  };
1047
1107
  }
1048
- //#endregion
1049
- //#region src/chat/plugins/unfinished-work.ts
1108
+ // src/chat/plugins/unfinished-work.ts
1050
1109
  /**
1051
1110
  * Return assigned and unfinished plugin work for the candidate conversations.
1052
1111
  * Feed Priority combines these signals with conversation activity on the host.
@@ -1100,8 +1159,7 @@ async function listConversationWork(conversationIds) {
1100
1159
  unfinishedIds: conversationIds.filter((conversationId) => unfinished.has(conversationId))
1101
1160
  };
1102
1161
  }
1103
- //#endregion
1104
- //#region src/api/conversations/priority.ts
1162
+ // src/api/conversations/priority.ts
1105
1163
  /** Conversations with no known work leave Priority after this idle window. */
1106
1164
  const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
1107
1165
  /** Unfinished work leaves Priority after this idle window. */
@@ -1127,8 +1185,7 @@ function isConversationPriority(conversation, nowMs) {
1127
1185
  }
1128
1186
  return nowMs - lastSeenAt <= UNASSIGNED_PRIORITY_WINDOW_MS;
1129
1187
  }
1130
- //#endregion
1131
- //#region src/api/conversations/user-message-activity.ts
1188
+ // src/api/conversations/user-message-activity.ts
1132
1189
  /** Read the latest true user message time for each selected conversation. */
1133
1190
  async function readLastUserMessageAtByConversation(db, conversationIds) {
1134
1191
  if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
@@ -1141,8 +1198,7 @@ async function readLastUserMessageAtByConversation(db, conversationIds) {
1141
1198
  }).from(juniorConversationEvents).where(and(inArray(juniorConversationEvents.conversationId, conversationIds), or(and(eq(juniorConversationEvents.type, "user_message"), eq(authority, "instruction"), sql`${actorPlatform} in ('slack', 'local', 'web')`), and(eq(juniorConversationEvents.type, "message"), eq(role, "user"), isNotNull(juniorConversationEvents.actorIdentityId))))).groupBy(juniorConversationEvents.conversationId);
1142
1199
  return new Map(rows.map((row) => [row.conversationId, new Date(row.lastUserMessageAt).toISOString()]));
1143
1200
  }
1144
- //#endregion
1145
- //#region src/api/conversations/activity-preview.ts
1201
+ // src/api/conversations/activity-preview.ts
1146
1202
  /** Read one recent assistant message, or the latest user message, for each conversation. */
1147
1203
  async function readConversationActivityPreviews(db, conversationIds) {
1148
1204
  if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
@@ -1161,8 +1217,7 @@ async function readConversationActivityPreviews(db, conversationIds) {
1161
1217
  text: row.text
1162
1218
  }]));
1163
1219
  }
1164
- //#endregion
1165
- //#region src/api/conversations/participants.ts
1220
+ // src/api/conversations/participants.ts
1166
1221
  const identityColumns = {
1167
1222
  displayName: juniorIdentities.displayName,
1168
1223
  email: juniorIdentities.email,
@@ -1216,8 +1271,7 @@ async function readConversationParticipants(db, conversationIds) {
1216
1271
  for (const row of eventRows.sort((left, right) => left.seq - right.seq)) add(row.conversationId, row);
1217
1272
  return new Map([...ordered].map(([conversationId, group]) => [conversationId, group.identities]));
1218
1273
  }
1219
- //#endregion
1220
- //#region src/api/conversations/list.ts
1274
+ // src/api/conversations/list.ts
1221
1275
  const CONVERSATION_FEED_LIMIT = 50;
1222
1276
  function conversationFeedMembershipFilter(status, filter) {
1223
1277
  if (!filter) return status === "archived" ? sql`false` : void 0;
@@ -1429,8 +1483,7 @@ async function readConversationFeedFromSql(options = {}) {
1429
1483
  async function readConversationFeed(options = {}) {
1430
1484
  return conversationFeedSchema.parse(await readConversationFeedFromSql(options));
1431
1485
  }
1432
- //#endregion
1433
- //#region src/api/conversations/fork.ts
1486
+ // src/api/conversations/fork.ts
1434
1487
  /** Fork a Conversation that the viewer can read into a new root they own. */
1435
1488
  async function forkConversationForViewer(viewer, sourceConversationId, body) {
1436
1489
  if (!(await readConversationAccessFromSql(getDb(), [sourceConversationId], viewer)).get(sourceConversationId)?.canViewPrivateContent) throwApiError(403, "You do not have access to this conversation.");
@@ -1482,8 +1535,7 @@ async function readConversationForks(conversationId, viewer) {
1482
1535
  }
1483
1536
  return result;
1484
1537
  }
1485
- //#endregion
1486
- //#region src/api/conversations/agent-tree.ts
1538
+ // src/api/conversations/agent-tree.ts
1487
1539
  /** Bound the parent chain that one agent tree reads. */
1488
1540
  const MAX_AGENT_TREE_DEPTH = 16;
1489
1541
  const CHILD_LABEL = "Subagent";
@@ -1529,8 +1581,7 @@ async function readConversationAgentTree(conversationId, viewer) {
1529
1581
  };
1530
1582
  }));
1531
1583
  }
1532
- //#endregion
1533
- //#region src/api/conversations/detail.ts
1584
+ // src/api/conversations/detail.ts
1534
1585
  /** Project stored metadata and a bounded event page into a signed history cursor. */
1535
1586
  function projectConversationDetail(args) {
1536
1587
  const { conversation } = args;
@@ -1598,6 +1649,7 @@ async function readConversationDetailFromSql(conversationId, options) {
1598
1649
  conversationId,
1599
1650
  limit: options.limit
1600
1651
  }) : { events: [] };
1652
+ const events = await attachMessageMentions(executor, conversationId, page.events);
1601
1653
  const metrics = metricsByConversation.get(conversationId);
1602
1654
  const auxiliaryCosts = auxiliaryCostsByConversation.get(conversationId);
1603
1655
  const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
@@ -1616,7 +1668,7 @@ async function readConversationDetailFromSql(conversationId, options) {
1616
1668
  version: briefVersion.version
1617
1669
  } } : void 0,
1618
1670
  durationMs: metrics?.durationMs ?? record.durationMs,
1619
- events: page.events,
1671
+ events,
1620
1672
  modelUsage,
1621
1673
  participants: participantsByConversation.get(conversationId) ?? [],
1622
1674
  ...sourceTask ? { sourceTask } : void 0,
@@ -1639,8 +1691,7 @@ async function readConversationDetail(conversationId, options = {}) {
1639
1691
  ...agentTree ? { agentTree } : void 0
1640
1692
  });
1641
1693
  }
1642
- //#endregion
1643
- //#region src/api/conversations/event-list.ts
1694
+ // src/api/conversations/event-list.ts
1644
1695
  /** Read one bounded page of reporting events before a signed cursor. */
1645
1696
  async function readConversationEvents(conversationId, beforeValue, options = {}) {
1646
1697
  const record = await readConversationRecordFromSql(conversationId);
@@ -1659,7 +1710,7 @@ async function readConversationEvents(conversationId, beforeValue, options = {})
1659
1710
  limit: options.limit ?? 500
1660
1711
  }) : { events: [] };
1661
1712
  return conversationEventPageSchema.parse({
1662
- events: page.events,
1713
+ events: await attachMessageMentions(getSqlExecutor(), conversationId, page.events),
1663
1714
  eventHistory: conversationEventHistory({
1664
1715
  canExposePayload,
1665
1716
  ...transcriptPurgedAtMs === void 0 ? void 0 : { transcriptPurgedAtMs }
@@ -1671,8 +1722,7 @@ async function readConversationEvents(conversationId, beforeValue, options = {})
1671
1722
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
1672
1723
  });
1673
1724
  }
1674
- //#endregion
1675
- //#region src/api/conversations/cancel-pending-messages.ts
1725
+ // src/api/conversations/cancel-pending-messages.ts
1676
1726
  /** Cancel accepted human-facing mailbox rows for one conversation participant. */
1677
1727
  async function cancelConversationPendingMessagesForViewer(viewer, conversationId, body = {}) {
1678
1728
  if (!await getConversationStore().get({ conversationId })) throwApiError(404, "Conversation not found.");
@@ -1697,8 +1747,7 @@ async function cancelConversationPendingMessagesForViewer(viewer, conversationId
1697
1747
  throwApiError(500, "Unable to cancel queued messages.", error);
1698
1748
  }
1699
1749
  }
1700
- //#endregion
1701
- //#region src/api/conversations/pending-messages.ts
1750
+ // src/api/conversations/pending-messages.ts
1702
1751
  const slackMailboxAuthorSchema = z.object({
1703
1752
  userId: z.string(),
1704
1753
  userName: z.string().optional(),
@@ -1824,8 +1873,7 @@ async function requireConversationPendingMessages(conversationId, options = {})
1824
1873
  if (!report) throwApiError(404, "Conversation not found.");
1825
1874
  return report;
1826
1875
  }
1827
- //#endregion
1828
- //#region src/api/conversations/metric-buckets.ts
1876
+ // src/api/conversations/metric-buckets.ts
1829
1877
  /** Sum all Conversation metrics into UTC day or hour buckets. */
1830
1878
  async function readConversationMetricBuckets(db, options) {
1831
1879
  const date = options.bucket === "day" ? sql`to_char(${juniorConversationMetrics.occurredAt} at time zone 'UTC', 'YYYY-MM-DD')` : sql`to_char(${juniorConversationMetrics.occurredAt} at time zone 'UTC', 'YYYY-MM-DD"T"HH24')`;
@@ -1835,8 +1883,7 @@ async function readConversationMetricBuckets(db, options) {
1835
1883
  value: sql`sum(${juniorConversationMetrics.value})::double precision`
1836
1884
  }).from(juniorConversationMetrics).where(and(gte(juniorConversationMetrics.occurredAt, options.start), lte(juniorConversationMetrics.occurredAt, options.end))).groupBy(date, juniorConversationMetrics.metric).orderBy(asc(date), asc(juniorConversationMetrics.metric));
1837
1885
  }
1838
- //#endregion
1839
- //#region src/api/conversations/stats.query.ts
1886
+ // src/api/conversations/stats.query.ts
1840
1887
  const treeConversation$1 = alias(juniorConversations, "stats_tree_conversation");
1841
1888
  const treeAggregateColumns$1 = conversationAggregateColumns({
1842
1889
  metrics: treeConversation$1,
@@ -2175,14 +2222,12 @@ async function readConversationStatsFromSql() {
2175
2222
  windowStart: start.toISOString()
2176
2223
  };
2177
2224
  }
2178
- //#endregion
2179
- //#region src/api/conversations/stats.ts
2225
+ // src/api/conversations/stats.ts
2180
2226
  /** Load aggregate conversation stats directly from durable SQL records. */
2181
2227
  async function readConversationStats() {
2182
2228
  return conversationStatsReportSchema.parse(await readConversationStatsFromSql());
2183
2229
  }
2184
- //#endregion
2185
- //#region src/api/conversations/stop.ts
2230
+ // src/api/conversations/stop.ts
2186
2231
  /**
2187
2232
  * Stop the active Turn for one conversation participant.
2188
2233
  *
@@ -2234,8 +2279,7 @@ function viewerWebMessages(messages, viewer) {
2234
2279
  }] : [];
2235
2280
  });
2236
2281
  }
2237
- //#endregion
2238
- //#region src/api/conversations/routes.ts
2282
+ // src/api/conversations/routes.ts
2239
2283
  /** Create the HTTP routes owned by the conversations API. */
2240
2284
  function createConversationRoutes(options) {
2241
2285
  const app = new Hono();
@@ -2335,10 +2379,14 @@ function createConversationRoutes(options) {
2335
2379
  });
2336
2380
  return app;
2337
2381
  }
2338
- //#endregion
2339
- //#region src/api/code/overview.ts
2382
+ // src/api/code/overview.ts
2340
2383
  const DAY_MS = 864e5;
2341
2384
  const WINDOW_DAYS = 30;
2385
+ /**
2386
+ * Code changes listed on one People profile. Open changes sort first so a
2387
+ * stale open change is not cut off by newer completed changes.
2388
+ */
2389
+ const PERSON_CHANGE_LIMIT = 100;
2342
2390
  const summaryRowSchema = z.object({
2343
2391
  closed: z.number().int().nonnegative(),
2344
2392
  costUsd: z.number().nonnegative().nullable(),
@@ -2729,26 +2777,28 @@ async function readCodeOverview(nowMs = Date.now()) {
2729
2777
  });
2730
2778
  }
2731
2779
  /**
2732
- * Read person-scoped code activity linked through conversation actors on
2733
- * Junior-owned code changes.
2780
+ * Read person-scoped code activity and recent code changes linked through
2781
+ * conversation actors on Junior-owned code changes.
2734
2782
  */
2735
2783
  async function readPersonCodeOverview(args) {
2736
- const windows = await readCodeWindows({
2737
- nowMs: args.nowMs ?? Date.now(),
2784
+ const nowMs = args.nowMs ?? Date.now();
2785
+ const db = getDb();
2786
+ const [windows, changes] = await Promise.all([readCodeWindows({
2787
+ nowMs,
2738
2788
  userId: args.userId
2739
- });
2789
+ }), 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
2790
  return codePersonReportSchema.parse({
2741
2791
  activityDays: windows.activityDays,
2742
2792
  activityHours: windows.activityHours,
2743
2793
  activitySixHours: windows.activitySixHours,
2794
+ changes: changes.map(codeChangeReport),
2744
2795
  generatedAt: windows.windowEnd.toISOString(),
2745
2796
  summary: windows.summary,
2746
2797
  windowEnd: windows.windowEnd.toISOString(),
2747
2798
  windowStart: windows.windowStart.toISOString()
2748
2799
  });
2749
2800
  }
2750
- //#endregion
2751
- //#region src/api/code/repository.ts
2801
+ // src/api/code/repository.ts
2752
2802
  /** Most recent code changes listed on one repository page. */
2753
2803
  const REPOSITORY_CHANGE_LIMIT = 100;
2754
2804
  /**
@@ -2791,8 +2841,7 @@ async function readCodeRepository(repositoryId, nowMs = Date.now()) {
2791
2841
  workspaces
2792
2842
  });
2793
2843
  }
2794
- //#endregion
2795
- //#region src/api/code/routes.ts
2844
+ // src/api/code/routes.ts
2796
2845
  /** Create the code analytics API. */
2797
2846
  function createCodeRoutes() {
2798
2847
  const app = new Hono();
@@ -2805,8 +2854,7 @@ function createCodeRoutes() {
2805
2854
  });
2806
2855
  return app;
2807
2856
  }
2808
- //#endregion
2809
- //#region src/api/connections/routes.ts
2857
+ // src/api/connections/routes.ts
2810
2858
  /**
2811
2859
  * Create authenticated routes that list, connect, and disconnect the viewer's
2812
2860
  * plugin accounts. Connections belong to the viewer's web actor, which is the
@@ -2829,15 +2877,15 @@ function createConnectionRoutes() {
2829
2877
  app.delete("/:provider", requireViewer, validateRequest("param", connectionParamsSchema, "Invalid provider."), async (context) => {
2830
2878
  const { provider } = context.req.valid("param");
2831
2879
  if (!isConnectableProvider(provider)) throwApiError(404, "Connection not found.");
2832
- const actor = webActorFromEmail(context.get("viewer").email);
2833
- await disconnectConnection(actor.userId, provider, createUserTokenStore());
2880
+ const viewer = context.get("viewer");
2881
+ const actor = webActorFromEmail(viewer.email);
2882
+ await disconnectConnection(actor.userId, provider, createUserTokenStore(), viewer.id);
2834
2883
  logInfo("dashboard.credential.unlinked", { "app.credential.provider": provider });
2835
2884
  return jsonResponse(disconnectConnectionResponseSchema, { disconnected: true });
2836
2885
  });
2837
2886
  return app;
2838
2887
  }
2839
- //#endregion
2840
- //#region src/api/conversations/reporting.ts
2888
+ // src/api/conversations/reporting.ts
2841
2889
  /** Return the dashboard label for a conversation surface. */
2842
2890
  function surfaceLabel(surface) {
2843
2891
  if (surface === "scheduler") return "Scheduler";
@@ -2894,8 +2942,7 @@ function summaryFromRow(row, options = {}) {
2894
2942
  usage: options.metrics?.usage ?? row.usage ?? void 0
2895
2943
  });
2896
2944
  }
2897
- //#endregion
2898
- //#region src/api/locations/query.ts
2945
+ // src/api/locations/query.ts
2899
2946
  const RECENT_LIMIT$1 = 25;
2900
2947
  const ACTIVITY_DAYS$1 = 90;
2901
2948
  const treeConversation = alias(juniorConversations, "location_tree_conversation");
@@ -3212,21 +3259,18 @@ async function readLocationDetailFromSql(locationId, options = {}) {
3212
3259
  windowStart: activity[0] ? `${activity[0].date}T00:00:00.000Z` : end.toISOString()
3213
3260
  };
3214
3261
  }
3215
- //#endregion
3216
- //#region src/api/locations/detail.ts
3262
+ // src/api/locations/detail.ts
3217
3263
  /** Expose operational detail for one persisted public conversation location. */
3218
3264
  async function readLocationDetail(locationId, options = {}) {
3219
3265
  const report = await readLocationDetailFromSql(locationId, options);
3220
3266
  return report ? locationDetailReportSchema.parse(report) : void 0;
3221
3267
  }
3222
- //#endregion
3223
- //#region src/api/locations/list.ts
3268
+ // src/api/locations/list.ts
3224
3269
  /** Expose public conversation destinations as the dashboard's location index. */
3225
3270
  async function readLocationDirectory() {
3226
3271
  return locationDirectoryReportSchema.parse(await readLocationDirectoryFromSql());
3227
3272
  }
3228
- //#endregion
3229
- //#region src/api/locations/routes.ts
3273
+ // src/api/locations/routes.ts
3230
3274
  /** Create the HTTP routes owned by the locations API. */
3231
3275
  function createLocationRoutes() {
3232
3276
  const app = new Hono();
@@ -3240,8 +3284,7 @@ function createLocationRoutes() {
3240
3284
  });
3241
3285
  return app;
3242
3286
  }
3243
- //#endregion
3244
- //#region src/api/people/code.ts
3287
+ // src/api/people/code.ts
3245
3288
  /** Read person-scoped native code activity for one People profile. */
3246
3289
  async function readPeopleCode(email) {
3247
3290
  const subject = await findUserByEmail(email);
@@ -3249,6 +3292,7 @@ async function readPeopleCode(email) {
3249
3292
  const now = /* @__PURE__ */ new Date();
3250
3293
  return codePersonReportSchema.parse({
3251
3294
  activityDays: [],
3295
+ changes: [],
3252
3296
  generatedAt: now.toISOString(),
3253
3297
  summary: {
3254
3298
  closed: 0,
@@ -3366,8 +3410,7 @@ async function recentActorRows(email) {
3366
3410
  usage: juniorConversations.usage
3367
3411
  }).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).where(verifiedActorWhere(email)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(25);
3368
3412
  }
3369
- //#endregion
3370
- //#region src/api/people/list.query.ts
3413
+ // src/api/people/list.query.ts
3371
3414
  const DIRECTORY_ACTIVITY_DAYS = 90;
3372
3415
  /** Day ranges need the prior equal period too (90d + prior 90d). */
3373
3416
  const DAY_METRIC_LOOKBACK = 180;
@@ -3575,14 +3618,12 @@ async function readPeopleListFromSql() {
3575
3618
  windowStart: start.toISOString()
3576
3619
  };
3577
3620
  }
3578
- //#endregion
3579
- //#region src/api/people/list.ts
3621
+ // src/api/people/list.ts
3580
3622
  /** Load the people list from verified user identities in SQL. */
3581
3623
  async function readPeopleList() {
3582
3624
  return actorDirectoryReportSchema.parse(await readPeopleListFromSql());
3583
3625
  }
3584
- //#endregion
3585
- //#region src/api/people/plugin-reports.ts
3626
+ // src/api/people/plugin-reports.ts
3586
3627
  /** Read sanitized person-scoped plugin reports for one profile subject. */
3587
3628
  async function readPeoplePluginReports(args) {
3588
3629
  const nowMs = Date.now();
@@ -3592,7 +3633,7 @@ async function readPeoplePluginReports(args) {
3592
3633
  reports: [],
3593
3634
  source: "plugins"
3594
3635
  });
3595
- const { getPluginProfileReports } = await import("./agent-hooks-DlSK8PQQ.js").then((n) => n.t);
3636
+ const { getPluginProfileReports } = await import("./agent-hooks-BJ_5mlRH.js").then((n) => n.t);
3596
3637
  return pluginOperationalReportFeedSchema.parse({
3597
3638
  generatedAt: new Date(nowMs).toISOString(),
3598
3639
  reports: await getPluginProfileReports({
@@ -3603,8 +3644,7 @@ async function readPeoplePluginReports(args) {
3603
3644
  source: "plugins"
3604
3645
  });
3605
3646
  }
3606
- //#endregion
3607
- //#region src/api/people/profile.query.ts
3647
+ // src/api/people/profile.query.ts
3608
3648
  function emptyProfile(email, nowMs) {
3609
3649
  const end = new Date(nowMs);
3610
3650
  end.setUTCHours(0, 0, 0, 0);
@@ -3774,14 +3814,12 @@ async function readPeopleProfileFromSql(email, options = {}) {
3774
3814
  windowStart: start.toISOString()
3775
3815
  };
3776
3816
  }
3777
- //#endregion
3778
- //#region src/api/people/profile.ts
3817
+ // src/api/people/profile.ts
3779
3818
  /** Load one person profile from verified user identities in SQL. */
3780
3819
  async function readPeopleProfile(email, options = {}) {
3781
3820
  return actorProfileReportSchema.parse(await readPeopleProfileFromSql(email, options));
3782
3821
  }
3783
- //#endregion
3784
- //#region src/api/people/spend.query.ts
3822
+ // src/api/people/spend.query.ts
3785
3823
  const SEVEN_DAY_OFFSET = 6;
3786
3824
  const THIRTY_DAY_OFFSET = 29;
3787
3825
  function addUsd(current, next) {
@@ -3831,8 +3869,7 @@ async function readPersonalSpendFromSql(email, nowMs = Date.now()) {
3831
3869
  windowStart: thirtyDayStart.toISOString()
3832
3870
  };
3833
3871
  }
3834
- //#endregion
3835
- //#region src/api/people/spend.ts
3872
+ // src/api/people/spend.ts
3836
3873
  const PERSONAL_SPEND_CACHE_TTL_MS = 3e5;
3837
3874
  /** Create an app-scoped personal-spend reader with a five-minute cache. */
3838
3875
  function createPersonalSpendReader() {
@@ -3857,8 +3894,7 @@ function createPersonalSpendReader() {
3857
3894
  }
3858
3895
  };
3859
3896
  }
3860
- //#endregion
3861
- //#region src/api/people/routes.ts
3897
+ // src/api/people/routes.ts
3862
3898
  /** Create the HTTP routes owned by the People API. */
3863
3899
  function createPeopleRoutes() {
3864
3900
  const app = new Hono();
@@ -3887,8 +3923,7 @@ function createPeopleRoutes() {
3887
3923
  });
3888
3924
  return app;
3889
3925
  }
3890
- //#endregion
3891
- //#region src/personal-tokens/store.ts
3926
+ // src/personal-tokens/store.ts
3892
3927
  const TOKEN_PREFIX = "jr_pat_";
3893
3928
  const DEFAULT_TOKEN_LIFETIME_MS = 7776e6;
3894
3929
  function normalizeEmail(email) {
@@ -3949,8 +3984,7 @@ async function authenticatePersonalToken(token, now = /* @__PURE__ */ new Date()
3949
3984
  await getDb().update(juniorApiTokens).set({ lastUsedAt: now }).where(eq(juniorApiTokens.id, match.id));
3950
3985
  return match.ownerEmailNormalized;
3951
3986
  }
3952
- //#endregion
3953
- //#region src/api/personal-tokens/routes.ts
3987
+ // src/api/personal-tokens/routes.ts
3954
3988
  /** Create authenticated native personal-token list and action routes. */
3955
3989
  function createPersonalTokenRoutes() {
3956
3990
  const app = new Hono();
@@ -3977,8 +4011,7 @@ function createPersonalTokenRoutes() {
3977
4011
  });
3978
4012
  return app;
3979
4013
  }
3980
- //#endregion
3981
- //#region src/chat/plugins/user-pages.ts
4014
+ // src/chat/plugins/user-pages.ts
3982
4015
  /**
3983
4016
  * Runtime ownership for plugin user pages.
3984
4017
  *
@@ -4021,8 +4054,7 @@ async function readPluginUserPage(input) {
4021
4054
  if (content.records.some((record) => record.actions?.some((action) => !actionBelongsToPlugin(action.href, plugin.manifest.name)))) throw new Error(`Plugin user page "${plugin.manifest.name}/${page.id}" returned an action outside its API namespace.`);
4022
4055
  return content;
4023
4056
  }
4024
- //#endregion
4025
- //#region src/api/user-pages/routes.ts
4057
+ // src/api/user-pages/routes.ts
4026
4058
  const userPageQuerySchema = z.object({
4027
4059
  cursor: z.preprocess((value) => value || void 0, pluginUserPageCursorSchema),
4028
4060
  filter: z.preprocess((value) => value || void 0, pluginUserPageFilterSchema),
@@ -4049,8 +4081,7 @@ function createUserPageRoutes() {
4049
4081
  });
4050
4082
  return app;
4051
4083
  }
4052
- //#endregion
4053
- //#region src/chat/automations/edit.ts
4084
+ // src/chat/automations/edit.ts
4054
4085
  /**
4055
4086
  * Web edits. Owners and public Destination readers can edit. Creator-only
4056
4087
  * rules still apply, and lifecycle actions stay creator-only.
@@ -4278,8 +4309,7 @@ async function changeViewerAutomationLifecycle(user, id, input) {
4278
4309
  task: await saveScheduledAutomation(getDb(), next, input.revision)
4279
4310
  }, true);
4280
4311
  }
4281
- //#endregion
4282
- //#region src/chat/automations/editor.ts
4312
+ // src/chat/automations/editor.ts
4283
4313
  /** Read-only editor support. Core owns schedules; plugins own Event choices. */
4284
4314
  /** Return only Event types that can start a durable Automation. */
4285
4315
  function readAutomationEventCatalog() {
@@ -4304,8 +4334,7 @@ async function previewAutomationSchedule(user, id, intent) {
4304
4334
  throw error;
4305
4335
  }
4306
4336
  }
4307
- //#endregion
4308
- //#region src/api/automations/routes.ts
4337
+ // src/api/automations/routes.ts
4309
4338
  /** Translate expected edit failures; unexpected failures stay at the API boundary. */
4310
4339
  function editErrorResponse(error) {
4311
4340
  if (error instanceof ViewerTaskNotFoundError) return jsonResponse(automationEditErrorSchema, {
@@ -4430,8 +4459,7 @@ function createAutomationRoutes() {
4430
4459
  });
4431
4460
  return app;
4432
4461
  }
4433
- //#endregion
4434
- //#region src/api/workspaces/routes.ts
4462
+ // src/api/workspaces/routes.ts
4435
4463
  function snapshotView(workspace) {
4436
4464
  const recorded = workspace.snapshot;
4437
4465
  if (!recorded) return null;
@@ -4527,8 +4555,7 @@ function createWorkspaceRoutes() {
4527
4555
  });
4528
4556
  return app;
4529
4557
  }
4530
- //#endregion
4531
- //#region src/api/stats.ts
4558
+ // src/api/stats.ts
4532
4559
  /** Read the last 90 days of named daily counters. */
4533
4560
  async function readStatsReport() {
4534
4561
  const now = /* @__PURE__ */ new Date();
@@ -4544,8 +4571,7 @@ async function readStatsReport() {
4544
4571
  windowStart: start
4545
4572
  });
4546
4573
  }
4547
- //#endregion
4548
- //#region src/reporting.ts
4574
+ // src/reporting.ts
4549
4575
  function readDescriptionText(home) {
4550
4576
  try {
4551
4577
  return readFileSync(path.join(home, "DESCRIPTION.md"), "utf8").trim() || void 0;
@@ -4555,7 +4581,7 @@ function readDescriptionText(home) {
4555
4581
  }
4556
4582
  /** Read discovered skill names for authenticated runtime diagnostics. */
4557
4583
  async function readSkillReports() {
4558
- const { discoverSkills } = await import("./skills-CyvTsR9M.js").then((n) => n.o);
4584
+ const { discoverSkills } = await import("./skills-DyQBLIrK.js").then((n) => n.o);
4559
4585
  const skills = await discoverSkills();
4560
4586
  return skillReportsSchema.parse(skills.map((skill) => ({
4561
4587
  name: skill.name,
@@ -4564,7 +4590,7 @@ async function readSkillReports() {
4564
4590
  }
4565
4591
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4566
4592
  async function readPlugins() {
4567
- const { pluginCatalogRuntime } = await import("./catalog-runtime-DF5OWqCc.js").then((n) => n.t);
4593
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-BN4DVxco.js").then((n) => n.t);
4568
4594
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4569
4595
  configKeys: plugin.manifest.configKeys ?? [],
4570
4596
  description: plugin.manifest.description,
@@ -4575,8 +4601,8 @@ async function readPlugins() {
4575
4601
  /** Read authenticated runtime discovery data. */
4576
4602
  async function readRuntimeInfoReport() {
4577
4603
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4578
- import("./package-discovery-BVvSnQBB.js").then((n) => n.r),
4579
- import("./catalog-runtime-DF5OWqCc.js").then((n) => n.t),
4604
+ import("./package-discovery-DJBompdd.js").then((n) => n.r),
4605
+ import("./catalog-runtime-BN4DVxco.js").then((n) => n.t),
4580
4606
  readPlugins(),
4581
4607
  readSkillReports()
4582
4608
  ]);
@@ -4593,15 +4619,14 @@ async function readRuntimeInfoReport() {
4593
4619
  /** Read sanitized operational summaries contributed by plugins. */
4594
4620
  async function readPluginOperationalReportFeed() {
4595
4621
  const nowMs = Date.now();
4596
- const { getPluginOperationalReports } = await import("./agent-hooks-DlSK8PQQ.js").then((n) => n.t);
4622
+ const { getPluginOperationalReports } = await import("./agent-hooks-BJ_5mlRH.js").then((n) => n.t);
4597
4623
  return pluginOperationalReportFeedSchema.parse({
4598
4624
  source: "plugins",
4599
4625
  generatedAt: new Date(nowMs).toISOString(),
4600
4626
  reports: await getPluginOperationalReports(nowMs)
4601
4627
  });
4602
4628
  }
4603
- //#endregion
4604
- //#region src/api.ts
4629
+ // src/api.ts
4605
4630
  /** Create Junior's production REST API for authenticated dashboard consumers. */
4606
4631
  function createJuniorApi(options = {}) {
4607
4632
  const app = new Hono();
@@ -4634,5 +4659,4 @@ function createJuniorApi(options = {}) {
4634
4659
  });
4635
4660
  return app;
4636
4661
  }
4637
- //#endregion
4638
4662
  export { authenticatePersonalToken, createJuniorApi, jsonResponse, resolveViewerUser, updateViewerDisplayName };