@sentry/junior 0.257.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 (101) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/{admin-DgIkm6Vy.js → admin-My1SLGVO.js} +2 -3
  3. package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-BJ_5mlRH.js} +69 -109
  4. package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
  5. package/dist/{agent-runner-D7OboVb3.js → agent-runner-DGsFQw72.js} +261 -458
  6. package/dist/api/schema.d.ts +414 -448
  7. package/dist/api/schema.js +5 -5
  8. package/dist/api.d.ts +2 -12
  9. package/dist/api.js +94 -158
  10. package/dist/{app-BsU5QNBd.d.ts → app-PX2H1PxU.d.ts} +21 -44
  11. package/dist/app.d.ts +3 -3
  12. package/dist/app.js +204 -321
  13. package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-H1M-91oF.js} +3 -5
  14. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  15. package/dist/{briefs-oLOldnDM.js → briefs-vYoK85rJ.js} +8 -11
  16. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  17. package/dist/{catalog-runtime-CZzhGQ7F.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-D8HnkOQX.js → client-DbyHuMFU.js} +9 -16
  37. package/dist/{config-CJRnWK9H.js → config-_WO_AjCB.js} +18 -15
  38. package/dist/{connections-ClYrKzpX.js → connections-ag_1JOhB.js} +14 -19
  39. package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
  40. package/dist/{conversation-privacy-C8b1nphZ.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-BXfohNmJ.js → credential-sync-B-CPX_ag.js} +23 -28
  43. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  44. package/dist/{executor-Do0THDRR.js → executor-RvG6kVe1.js} +30 -52
  45. package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
  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-BN_BiBXF.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-B6SV9uVa.js → job-queue-DVe37it2.js} +6 -12
  52. package/dist/{logging-CWxiIuCF.js → logging-DsHONhVm.js} +7 -12
  53. package/dist/{message-TUOdbSBW.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-Dj5UJODo.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-s_QFribU.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-h-72wM78.js → profile-DpYjfKke.js} +16 -28
  67. package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
  68. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  69. package/dist/{registry-sLTr-sV9.js → registry-Du566MtJ.js} +16 -29
  70. package/dist/{resolve-ncQPZROQ.js → resolve-ClCIgh8E.js} +7 -12
  71. package/dist/{result-C883vngT.js → result-BBbKA61B.js} +13 -17
  72. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  73. package/dist/{runner-CzYImdOF.js → runner-CCuqFSqx.js} +12 -13
  74. package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
  75. package/dist/{schema-Dy69D4Ge.js → schema-DrMh3NtR.js} +15 -26
  76. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  77. package/dist/{session-stop-CQjKd4a2.js → session-stop-CIoFiwwe.js} +23 -33
  78. package/dist/{skills-C22SLruK.js → skills-DyQBLIrK.js} +9 -9
  79. package/dist/{spawn-DY9CLXDL.js → spawn-Dqfeo7XP.js} +4 -5
  80. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  81. package/dist/{store-DXFIQy-G.js → store-DJLwq4x8.js} +13 -15
  82. package/dist/{task-queue-B17vV0La.js → task-queue-BzW4MaWU.js} +5 -7
  83. package/dist/{task-runner-DUjvzYXj.js → task-runner-D3qJh4fK.js} +22 -26
  84. package/dist/{tasks-D_WIJtvO.js → tasks-CEXKTASS.js} +62 -78
  85. package/dist/{thread-state-Ch4yuCqG.js → thread-state-W3f6kAtz.js} +13 -19
  86. package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-CWx7aNIh.js} +16 -22
  87. package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-C9JFst7-.js} +2 -3
  88. package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-CUxtfpr7.js} +2 -3
  89. package/dist/{validation-CXYxaNYx.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-BcdZy2zg.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-DSZXygMU.js → viewer-CGvvRqKp.js} +26 -57
  97. package/dist/{web-input-B9Bv0_lR.js → web-input-Keb5GRWj.js} +98 -155
  98. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  99. package/dist/{work-nAfDSUFP.js → work-DRcsJ3hV.js} +14 -16
  100. package/dist/{worker-vGXZ6XFT.js → worker-Cjo-QqPq.js} +7 -8
  101. package/package.json +7 -6
package/dist/api.js CHANGED
@@ -1,27 +1,27 @@
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
- import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-BTtLaeWy.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
- import { d as contextProvenance } from "./history-9pO1Zd4Y.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
- import { t as getFirstRunAtMs } from "./cadence-D00SCzT1.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
- 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, 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";
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,7 @@ function decodeConversationCursor(args) {
891
877
  return;
892
878
  }
893
879
  }
894
- //#endregion
895
- //#region src/api/conversations/message-mentions.ts
880
+ // src/api/conversations/message-mentions.ts
896
881
  const SLACK_USER_MENTION_RE = /<@([UW][A-Z0-9]+)(?:\|[^<>]*)?>/g;
897
882
  function mentionedSlackUserIds(text) {
898
883
  if (!text) return [];
@@ -968,8 +953,7 @@ async function attachMessageMentions(executor, conversationId, events) {
968
953
  } : event;
969
954
  });
970
955
  }
971
- //#endregion
972
- //#region src/api/conversations/shared.ts
956
+ // src/api/conversations/shared.ts
973
957
  /** Format a Slack destination without exposing private channel names. */
974
958
  function slackStatsLocationLabel(input) {
975
959
  const channelId = input.channel;
@@ -991,8 +975,7 @@ function surfaceFallbackLabel(surface) {
991
975
  if (surface === "internal") return "Internal";
992
976
  return "Conversation";
993
977
  }
994
- //#endregion
995
- //#region src/api/conversations/projection.ts
978
+ // src/api/conversations/projection.ts
996
979
  const PRIVATE_CONVERSATION_LABEL = "Private Conversation";
997
980
  function privateConversationLabel(slackConversation) {
998
981
  if (!slackConversation) return PRIVATE_CONVERSATION_LABEL;
@@ -1122,8 +1105,7 @@ function conversationSummaryFromStoredConversation(args) {
1122
1105
  ...args.locationId && !channelNameRedacted ? { locationId: args.locationId } : void 0
1123
1106
  };
1124
1107
  }
1125
- //#endregion
1126
- //#region src/chat/plugins/unfinished-work.ts
1108
+ // src/chat/plugins/unfinished-work.ts
1127
1109
  /**
1128
1110
  * Return assigned and unfinished plugin work for the candidate conversations.
1129
1111
  * Feed Priority combines these signals with conversation activity on the host.
@@ -1177,8 +1159,7 @@ async function listConversationWork(conversationIds) {
1177
1159
  unfinishedIds: conversationIds.filter((conversationId) => unfinished.has(conversationId))
1178
1160
  };
1179
1161
  }
1180
- //#endregion
1181
- //#region src/api/conversations/priority.ts
1162
+ // src/api/conversations/priority.ts
1182
1163
  /** Conversations with no known work leave Priority after this idle window. */
1183
1164
  const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
1184
1165
  /** Unfinished work leaves Priority after this idle window. */
@@ -1204,8 +1185,7 @@ function isConversationPriority(conversation, nowMs) {
1204
1185
  }
1205
1186
  return nowMs - lastSeenAt <= UNASSIGNED_PRIORITY_WINDOW_MS;
1206
1187
  }
1207
- //#endregion
1208
- //#region src/api/conversations/user-message-activity.ts
1188
+ // src/api/conversations/user-message-activity.ts
1209
1189
  /** Read the latest true user message time for each selected conversation. */
1210
1190
  async function readLastUserMessageAtByConversation(db, conversationIds) {
1211
1191
  if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
@@ -1218,8 +1198,7 @@ async function readLastUserMessageAtByConversation(db, conversationIds) {
1218
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);
1219
1199
  return new Map(rows.map((row) => [row.conversationId, new Date(row.lastUserMessageAt).toISOString()]));
1220
1200
  }
1221
- //#endregion
1222
- //#region src/api/conversations/activity-preview.ts
1201
+ // src/api/conversations/activity-preview.ts
1223
1202
  /** Read one recent assistant message, or the latest user message, for each conversation. */
1224
1203
  async function readConversationActivityPreviews(db, conversationIds) {
1225
1204
  if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
@@ -1238,8 +1217,7 @@ async function readConversationActivityPreviews(db, conversationIds) {
1238
1217
  text: row.text
1239
1218
  }]));
1240
1219
  }
1241
- //#endregion
1242
- //#region src/api/conversations/participants.ts
1220
+ // src/api/conversations/participants.ts
1243
1221
  const identityColumns = {
1244
1222
  displayName: juniorIdentities.displayName,
1245
1223
  email: juniorIdentities.email,
@@ -1293,8 +1271,7 @@ async function readConversationParticipants(db, conversationIds) {
1293
1271
  for (const row of eventRows.sort((left, right) => left.seq - right.seq)) add(row.conversationId, row);
1294
1272
  return new Map([...ordered].map(([conversationId, group]) => [conversationId, group.identities]));
1295
1273
  }
1296
- //#endregion
1297
- //#region src/api/conversations/list.ts
1274
+ // src/api/conversations/list.ts
1298
1275
  const CONVERSATION_FEED_LIMIT = 50;
1299
1276
  function conversationFeedMembershipFilter(status, filter) {
1300
1277
  if (!filter) return status === "archived" ? sql`false` : void 0;
@@ -1506,8 +1483,7 @@ async function readConversationFeedFromSql(options = {}) {
1506
1483
  async function readConversationFeed(options = {}) {
1507
1484
  return conversationFeedSchema.parse(await readConversationFeedFromSql(options));
1508
1485
  }
1509
- //#endregion
1510
- //#region src/api/conversations/fork.ts
1486
+ // src/api/conversations/fork.ts
1511
1487
  /** Fork a Conversation that the viewer can read into a new root they own. */
1512
1488
  async function forkConversationForViewer(viewer, sourceConversationId, body) {
1513
1489
  if (!(await readConversationAccessFromSql(getDb(), [sourceConversationId], viewer)).get(sourceConversationId)?.canViewPrivateContent) throwApiError(403, "You do not have access to this conversation.");
@@ -1559,8 +1535,7 @@ async function readConversationForks(conversationId, viewer) {
1559
1535
  }
1560
1536
  return result;
1561
1537
  }
1562
- //#endregion
1563
- //#region src/api/conversations/agent-tree.ts
1538
+ // src/api/conversations/agent-tree.ts
1564
1539
  /** Bound the parent chain that one agent tree reads. */
1565
1540
  const MAX_AGENT_TREE_DEPTH = 16;
1566
1541
  const CHILD_LABEL = "Subagent";
@@ -1606,8 +1581,7 @@ async function readConversationAgentTree(conversationId, viewer) {
1606
1581
  };
1607
1582
  }));
1608
1583
  }
1609
- //#endregion
1610
- //#region src/api/conversations/detail.ts
1584
+ // src/api/conversations/detail.ts
1611
1585
  /** Project stored metadata and a bounded event page into a signed history cursor. */
1612
1586
  function projectConversationDetail(args) {
1613
1587
  const { conversation } = args;
@@ -1717,8 +1691,7 @@ async function readConversationDetail(conversationId, options = {}) {
1717
1691
  ...agentTree ? { agentTree } : void 0
1718
1692
  });
1719
1693
  }
1720
- //#endregion
1721
- //#region src/api/conversations/event-list.ts
1694
+ // src/api/conversations/event-list.ts
1722
1695
  /** Read one bounded page of reporting events before a signed cursor. */
1723
1696
  async function readConversationEvents(conversationId, beforeValue, options = {}) {
1724
1697
  const record = await readConversationRecordFromSql(conversationId);
@@ -1749,8 +1722,7 @@ async function readConversationEvents(conversationId, beforeValue, options = {})
1749
1722
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
1750
1723
  });
1751
1724
  }
1752
- //#endregion
1753
- //#region src/api/conversations/cancel-pending-messages.ts
1725
+ // src/api/conversations/cancel-pending-messages.ts
1754
1726
  /** Cancel accepted human-facing mailbox rows for one conversation participant. */
1755
1727
  async function cancelConversationPendingMessagesForViewer(viewer, conversationId, body = {}) {
1756
1728
  if (!await getConversationStore().get({ conversationId })) throwApiError(404, "Conversation not found.");
@@ -1775,8 +1747,7 @@ async function cancelConversationPendingMessagesForViewer(viewer, conversationId
1775
1747
  throwApiError(500, "Unable to cancel queued messages.", error);
1776
1748
  }
1777
1749
  }
1778
- //#endregion
1779
- //#region src/api/conversations/pending-messages.ts
1750
+ // src/api/conversations/pending-messages.ts
1780
1751
  const slackMailboxAuthorSchema = z.object({
1781
1752
  userId: z.string(),
1782
1753
  userName: z.string().optional(),
@@ -1902,8 +1873,7 @@ async function requireConversationPendingMessages(conversationId, options = {})
1902
1873
  if (!report) throwApiError(404, "Conversation not found.");
1903
1874
  return report;
1904
1875
  }
1905
- //#endregion
1906
- //#region src/api/conversations/metric-buckets.ts
1876
+ // src/api/conversations/metric-buckets.ts
1907
1877
  /** Sum all Conversation metrics into UTC day or hour buckets. */
1908
1878
  async function readConversationMetricBuckets(db, options) {
1909
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')`;
@@ -1913,8 +1883,7 @@ async function readConversationMetricBuckets(db, options) {
1913
1883
  value: sql`sum(${juniorConversationMetrics.value})::double precision`
1914
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));
1915
1885
  }
1916
- //#endregion
1917
- //#region src/api/conversations/stats.query.ts
1886
+ // src/api/conversations/stats.query.ts
1918
1887
  const treeConversation$1 = alias(juniorConversations, "stats_tree_conversation");
1919
1888
  const treeAggregateColumns$1 = conversationAggregateColumns({
1920
1889
  metrics: treeConversation$1,
@@ -2253,14 +2222,12 @@ async function readConversationStatsFromSql() {
2253
2222
  windowStart: start.toISOString()
2254
2223
  };
2255
2224
  }
2256
- //#endregion
2257
- //#region src/api/conversations/stats.ts
2225
+ // src/api/conversations/stats.ts
2258
2226
  /** Load aggregate conversation stats directly from durable SQL records. */
2259
2227
  async function readConversationStats() {
2260
2228
  return conversationStatsReportSchema.parse(await readConversationStatsFromSql());
2261
2229
  }
2262
- //#endregion
2263
- //#region src/api/conversations/stop.ts
2230
+ // src/api/conversations/stop.ts
2264
2231
  /**
2265
2232
  * Stop the active Turn for one conversation participant.
2266
2233
  *
@@ -2312,8 +2279,7 @@ function viewerWebMessages(messages, viewer) {
2312
2279
  }] : [];
2313
2280
  });
2314
2281
  }
2315
- //#endregion
2316
- //#region src/api/conversations/routes.ts
2282
+ // src/api/conversations/routes.ts
2317
2283
  /** Create the HTTP routes owned by the conversations API. */
2318
2284
  function createConversationRoutes(options) {
2319
2285
  const app = new Hono();
@@ -2413,8 +2379,7 @@ function createConversationRoutes(options) {
2413
2379
  });
2414
2380
  return app;
2415
2381
  }
2416
- //#endregion
2417
- //#region src/api/code/overview.ts
2382
+ // src/api/code/overview.ts
2418
2383
  const DAY_MS = 864e5;
2419
2384
  const WINDOW_DAYS = 30;
2420
2385
  /**
@@ -2833,8 +2798,7 @@ async function readPersonCodeOverview(args) {
2833
2798
  windowStart: windows.windowStart.toISOString()
2834
2799
  });
2835
2800
  }
2836
- //#endregion
2837
- //#region src/api/code/repository.ts
2801
+ // src/api/code/repository.ts
2838
2802
  /** Most recent code changes listed on one repository page. */
2839
2803
  const REPOSITORY_CHANGE_LIMIT = 100;
2840
2804
  /**
@@ -2877,8 +2841,7 @@ async function readCodeRepository(repositoryId, nowMs = Date.now()) {
2877
2841
  workspaces
2878
2842
  });
2879
2843
  }
2880
- //#endregion
2881
- //#region src/api/code/routes.ts
2844
+ // src/api/code/routes.ts
2882
2845
  /** Create the code analytics API. */
2883
2846
  function createCodeRoutes() {
2884
2847
  const app = new Hono();
@@ -2891,8 +2854,7 @@ function createCodeRoutes() {
2891
2854
  });
2892
2855
  return app;
2893
2856
  }
2894
- //#endregion
2895
- //#region src/api/connections/routes.ts
2857
+ // src/api/connections/routes.ts
2896
2858
  /**
2897
2859
  * Create authenticated routes that list, connect, and disconnect the viewer's
2898
2860
  * plugin accounts. Connections belong to the viewer's web actor, which is the
@@ -2923,8 +2885,7 @@ function createConnectionRoutes() {
2923
2885
  });
2924
2886
  return app;
2925
2887
  }
2926
- //#endregion
2927
- //#region src/api/conversations/reporting.ts
2888
+ // src/api/conversations/reporting.ts
2928
2889
  /** Return the dashboard label for a conversation surface. */
2929
2890
  function surfaceLabel(surface) {
2930
2891
  if (surface === "scheduler") return "Scheduler";
@@ -2981,8 +2942,7 @@ function summaryFromRow(row, options = {}) {
2981
2942
  usage: options.metrics?.usage ?? row.usage ?? void 0
2982
2943
  });
2983
2944
  }
2984
- //#endregion
2985
- //#region src/api/locations/query.ts
2945
+ // src/api/locations/query.ts
2986
2946
  const RECENT_LIMIT$1 = 25;
2987
2947
  const ACTIVITY_DAYS$1 = 90;
2988
2948
  const treeConversation = alias(juniorConversations, "location_tree_conversation");
@@ -3299,21 +3259,18 @@ async function readLocationDetailFromSql(locationId, options = {}) {
3299
3259
  windowStart: activity[0] ? `${activity[0].date}T00:00:00.000Z` : end.toISOString()
3300
3260
  };
3301
3261
  }
3302
- //#endregion
3303
- //#region src/api/locations/detail.ts
3262
+ // src/api/locations/detail.ts
3304
3263
  /** Expose operational detail for one persisted public conversation location. */
3305
3264
  async function readLocationDetail(locationId, options = {}) {
3306
3265
  const report = await readLocationDetailFromSql(locationId, options);
3307
3266
  return report ? locationDetailReportSchema.parse(report) : void 0;
3308
3267
  }
3309
- //#endregion
3310
- //#region src/api/locations/list.ts
3268
+ // src/api/locations/list.ts
3311
3269
  /** Expose public conversation destinations as the dashboard's location index. */
3312
3270
  async function readLocationDirectory() {
3313
3271
  return locationDirectoryReportSchema.parse(await readLocationDirectoryFromSql());
3314
3272
  }
3315
- //#endregion
3316
- //#region src/api/locations/routes.ts
3273
+ // src/api/locations/routes.ts
3317
3274
  /** Create the HTTP routes owned by the locations API. */
3318
3275
  function createLocationRoutes() {
3319
3276
  const app = new Hono();
@@ -3327,8 +3284,7 @@ function createLocationRoutes() {
3327
3284
  });
3328
3285
  return app;
3329
3286
  }
3330
- //#endregion
3331
- //#region src/api/people/code.ts
3287
+ // src/api/people/code.ts
3332
3288
  /** Read person-scoped native code activity for one People profile. */
3333
3289
  async function readPeopleCode(email) {
3334
3290
  const subject = await findUserByEmail(email);
@@ -3454,8 +3410,7 @@ async function recentActorRows(email) {
3454
3410
  usage: juniorConversations.usage
3455
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);
3456
3412
  }
3457
- //#endregion
3458
- //#region src/api/people/list.query.ts
3413
+ // src/api/people/list.query.ts
3459
3414
  const DIRECTORY_ACTIVITY_DAYS = 90;
3460
3415
  /** Day ranges need the prior equal period too (90d + prior 90d). */
3461
3416
  const DAY_METRIC_LOOKBACK = 180;
@@ -3663,14 +3618,12 @@ async function readPeopleListFromSql() {
3663
3618
  windowStart: start.toISOString()
3664
3619
  };
3665
3620
  }
3666
- //#endregion
3667
- //#region src/api/people/list.ts
3621
+ // src/api/people/list.ts
3668
3622
  /** Load the people list from verified user identities in SQL. */
3669
3623
  async function readPeopleList() {
3670
3624
  return actorDirectoryReportSchema.parse(await readPeopleListFromSql());
3671
3625
  }
3672
- //#endregion
3673
- //#region src/api/people/plugin-reports.ts
3626
+ // src/api/people/plugin-reports.ts
3674
3627
  /** Read sanitized person-scoped plugin reports for one profile subject. */
3675
3628
  async function readPeoplePluginReports(args) {
3676
3629
  const nowMs = Date.now();
@@ -3680,7 +3633,7 @@ async function readPeoplePluginReports(args) {
3680
3633
  reports: [],
3681
3634
  source: "plugins"
3682
3635
  });
3683
- const { getPluginProfileReports } = await import("./agent-hooks-BjtTzvru.js").then((n) => n.t);
3636
+ const { getPluginProfileReports } = await import("./agent-hooks-BJ_5mlRH.js").then((n) => n.t);
3684
3637
  return pluginOperationalReportFeedSchema.parse({
3685
3638
  generatedAt: new Date(nowMs).toISOString(),
3686
3639
  reports: await getPluginProfileReports({
@@ -3691,8 +3644,7 @@ async function readPeoplePluginReports(args) {
3691
3644
  source: "plugins"
3692
3645
  });
3693
3646
  }
3694
- //#endregion
3695
- //#region src/api/people/profile.query.ts
3647
+ // src/api/people/profile.query.ts
3696
3648
  function emptyProfile(email, nowMs) {
3697
3649
  const end = new Date(nowMs);
3698
3650
  end.setUTCHours(0, 0, 0, 0);
@@ -3862,14 +3814,12 @@ async function readPeopleProfileFromSql(email, options = {}) {
3862
3814
  windowStart: start.toISOString()
3863
3815
  };
3864
3816
  }
3865
- //#endregion
3866
- //#region src/api/people/profile.ts
3817
+ // src/api/people/profile.ts
3867
3818
  /** Load one person profile from verified user identities in SQL. */
3868
3819
  async function readPeopleProfile(email, options = {}) {
3869
3820
  return actorProfileReportSchema.parse(await readPeopleProfileFromSql(email, options));
3870
3821
  }
3871
- //#endregion
3872
- //#region src/api/people/spend.query.ts
3822
+ // src/api/people/spend.query.ts
3873
3823
  const SEVEN_DAY_OFFSET = 6;
3874
3824
  const THIRTY_DAY_OFFSET = 29;
3875
3825
  function addUsd(current, next) {
@@ -3919,8 +3869,7 @@ async function readPersonalSpendFromSql(email, nowMs = Date.now()) {
3919
3869
  windowStart: thirtyDayStart.toISOString()
3920
3870
  };
3921
3871
  }
3922
- //#endregion
3923
- //#region src/api/people/spend.ts
3872
+ // src/api/people/spend.ts
3924
3873
  const PERSONAL_SPEND_CACHE_TTL_MS = 3e5;
3925
3874
  /** Create an app-scoped personal-spend reader with a five-minute cache. */
3926
3875
  function createPersonalSpendReader() {
@@ -3945,8 +3894,7 @@ function createPersonalSpendReader() {
3945
3894
  }
3946
3895
  };
3947
3896
  }
3948
- //#endregion
3949
- //#region src/api/people/routes.ts
3897
+ // src/api/people/routes.ts
3950
3898
  /** Create the HTTP routes owned by the People API. */
3951
3899
  function createPeopleRoutes() {
3952
3900
  const app = new Hono();
@@ -3975,8 +3923,7 @@ function createPeopleRoutes() {
3975
3923
  });
3976
3924
  return app;
3977
3925
  }
3978
- //#endregion
3979
- //#region src/personal-tokens/store.ts
3926
+ // src/personal-tokens/store.ts
3980
3927
  const TOKEN_PREFIX = "jr_pat_";
3981
3928
  const DEFAULT_TOKEN_LIFETIME_MS = 7776e6;
3982
3929
  function normalizeEmail(email) {
@@ -4037,8 +3984,7 @@ async function authenticatePersonalToken(token, now = /* @__PURE__ */ new Date()
4037
3984
  await getDb().update(juniorApiTokens).set({ lastUsedAt: now }).where(eq(juniorApiTokens.id, match.id));
4038
3985
  return match.ownerEmailNormalized;
4039
3986
  }
4040
- //#endregion
4041
- //#region src/api/personal-tokens/routes.ts
3987
+ // src/api/personal-tokens/routes.ts
4042
3988
  /** Create authenticated native personal-token list and action routes. */
4043
3989
  function createPersonalTokenRoutes() {
4044
3990
  const app = new Hono();
@@ -4065,8 +4011,7 @@ function createPersonalTokenRoutes() {
4065
4011
  });
4066
4012
  return app;
4067
4013
  }
4068
- //#endregion
4069
- //#region src/chat/plugins/user-pages.ts
4014
+ // src/chat/plugins/user-pages.ts
4070
4015
  /**
4071
4016
  * Runtime ownership for plugin user pages.
4072
4017
  *
@@ -4109,8 +4054,7 @@ async function readPluginUserPage(input) {
4109
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.`);
4110
4055
  return content;
4111
4056
  }
4112
- //#endregion
4113
- //#region src/api/user-pages/routes.ts
4057
+ // src/api/user-pages/routes.ts
4114
4058
  const userPageQuerySchema = z.object({
4115
4059
  cursor: z.preprocess((value) => value || void 0, pluginUserPageCursorSchema),
4116
4060
  filter: z.preprocess((value) => value || void 0, pluginUserPageFilterSchema),
@@ -4137,8 +4081,7 @@ function createUserPageRoutes() {
4137
4081
  });
4138
4082
  return app;
4139
4083
  }
4140
- //#endregion
4141
- //#region src/chat/automations/edit.ts
4084
+ // src/chat/automations/edit.ts
4142
4085
  /**
4143
4086
  * Web edits. Owners and public Destination readers can edit. Creator-only
4144
4087
  * rules still apply, and lifecycle actions stay creator-only.
@@ -4366,8 +4309,7 @@ async function changeViewerAutomationLifecycle(user, id, input) {
4366
4309
  task: await saveScheduledAutomation(getDb(), next, input.revision)
4367
4310
  }, true);
4368
4311
  }
4369
- //#endregion
4370
- //#region src/chat/automations/editor.ts
4312
+ // src/chat/automations/editor.ts
4371
4313
  /** Read-only editor support. Core owns schedules; plugins own Event choices. */
4372
4314
  /** Return only Event types that can start a durable Automation. */
4373
4315
  function readAutomationEventCatalog() {
@@ -4392,8 +4334,7 @@ async function previewAutomationSchedule(user, id, intent) {
4392
4334
  throw error;
4393
4335
  }
4394
4336
  }
4395
- //#endregion
4396
- //#region src/api/automations/routes.ts
4337
+ // src/api/automations/routes.ts
4397
4338
  /** Translate expected edit failures; unexpected failures stay at the API boundary. */
4398
4339
  function editErrorResponse(error) {
4399
4340
  if (error instanceof ViewerTaskNotFoundError) return jsonResponse(automationEditErrorSchema, {
@@ -4518,8 +4459,7 @@ function createAutomationRoutes() {
4518
4459
  });
4519
4460
  return app;
4520
4461
  }
4521
- //#endregion
4522
- //#region src/api/workspaces/routes.ts
4462
+ // src/api/workspaces/routes.ts
4523
4463
  function snapshotView(workspace) {
4524
4464
  const recorded = workspace.snapshot;
4525
4465
  if (!recorded) return null;
@@ -4615,8 +4555,7 @@ function createWorkspaceRoutes() {
4615
4555
  });
4616
4556
  return app;
4617
4557
  }
4618
- //#endregion
4619
- //#region src/api/stats.ts
4558
+ // src/api/stats.ts
4620
4559
  /** Read the last 90 days of named daily counters. */
4621
4560
  async function readStatsReport() {
4622
4561
  const now = /* @__PURE__ */ new Date();
@@ -4632,8 +4571,7 @@ async function readStatsReport() {
4632
4571
  windowStart: start
4633
4572
  });
4634
4573
  }
4635
- //#endregion
4636
- //#region src/reporting.ts
4574
+ // src/reporting.ts
4637
4575
  function readDescriptionText(home) {
4638
4576
  try {
4639
4577
  return readFileSync(path.join(home, "DESCRIPTION.md"), "utf8").trim() || void 0;
@@ -4643,7 +4581,7 @@ function readDescriptionText(home) {
4643
4581
  }
4644
4582
  /** Read discovered skill names for authenticated runtime diagnostics. */
4645
4583
  async function readSkillReports() {
4646
- const { discoverSkills } = await import("./skills-C22SLruK.js").then((n) => n.o);
4584
+ const { discoverSkills } = await import("./skills-DyQBLIrK.js").then((n) => n.o);
4647
4585
  const skills = await discoverSkills();
4648
4586
  return skillReportsSchema.parse(skills.map((skill) => ({
4649
4587
  name: skill.name,
@@ -4652,7 +4590,7 @@ async function readSkillReports() {
4652
4590
  }
4653
4591
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4654
4592
  async function readPlugins() {
4655
- const { pluginCatalogRuntime } = await import("./catalog-runtime-CZzhGQ7F.js").then((n) => n.t);
4593
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-BN4DVxco.js").then((n) => n.t);
4656
4594
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4657
4595
  configKeys: plugin.manifest.configKeys ?? [],
4658
4596
  description: plugin.manifest.description,
@@ -4663,8 +4601,8 @@ async function readPlugins() {
4663
4601
  /** Read authenticated runtime discovery data. */
4664
4602
  async function readRuntimeInfoReport() {
4665
4603
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4666
- import("./package-discovery-BVvSnQBB.js").then((n) => n.r),
4667
- import("./catalog-runtime-CZzhGQ7F.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),
4668
4606
  readPlugins(),
4669
4607
  readSkillReports()
4670
4608
  ]);
@@ -4681,15 +4619,14 @@ async function readRuntimeInfoReport() {
4681
4619
  /** Read sanitized operational summaries contributed by plugins. */
4682
4620
  async function readPluginOperationalReportFeed() {
4683
4621
  const nowMs = Date.now();
4684
- const { getPluginOperationalReports } = await import("./agent-hooks-BjtTzvru.js").then((n) => n.t);
4622
+ const { getPluginOperationalReports } = await import("./agent-hooks-BJ_5mlRH.js").then((n) => n.t);
4685
4623
  return pluginOperationalReportFeedSchema.parse({
4686
4624
  source: "plugins",
4687
4625
  generatedAt: new Date(nowMs).toISOString(),
4688
4626
  reports: await getPluginOperationalReports(nowMs)
4689
4627
  });
4690
4628
  }
4691
- //#endregion
4692
- //#region src/api.ts
4629
+ // src/api.ts
4693
4630
  /** Create Junior's production REST API for authenticated dashboard consumers. */
4694
4631
  function createJuniorApi(options = {}) {
4695
4632
  const app = new Hono();
@@ -4722,5 +4659,4 @@ function createJuniorApi(options = {}) {
4722
4659
  });
4723
4660
  return app;
4724
4661
  }
4725
- //#endregion
4726
4662
  export { authenticatePersonalToken, createJuniorApi, jsonResponse, resolveViewerUser, updateViewerDisplayName };