@sentry/junior 0.313.0 → 0.314.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 (108) hide show
  1. package/dist/{adapter-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
  2. package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
  3. package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
  4. package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
  5. package/dist/agent-update-cS7Z9mnG.js +26 -0
  6. package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
  7. package/dist/api/schema.d.ts +2 -2
  8. package/dist/api/schema.js +6 -6
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.js +334 -100
  11. package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
  12. package/dist/app.d.ts +2 -2
  13. package/dist/app.js +80 -169
  14. package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
  15. package/dist/callback-C8SdXCwr.js +68 -0
  16. package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
  17. package/dist/{channel-access-mt7K6dPh.js → channel-access-BOL29BG3.js} +6 -6
  18. package/dist/child-message--2G3Ft26.js +19 -0
  19. package/dist/cli/chat.js +18 -21
  20. package/dist/cli/check.js +4 -4
  21. package/dist/cli/main.js +2 -2
  22. package/dist/cli/plugins.js +5 -5
  23. package/dist/cli/snapshot-create.js +5 -5
  24. package/dist/cli/upgrade.d.ts +1 -1
  25. package/dist/cli/upgrade.js +23 -4
  26. package/dist/{config-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
  27. package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
  28. package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
  29. package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
  30. package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
  31. package/dist/create-CrNt4Ewu.js +212 -0
  32. package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
  33. package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
  34. package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
  35. package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
  36. package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
  37. package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
  38. package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
  39. package/dist/instrumentation.js +2 -2
  40. package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
  41. package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
  42. package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
  43. package/dist/markers-DUP8aBOp.js +323 -0
  44. package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
  45. package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
  46. package/dist/{model-input-BhPJYdSV.js → model-input-0osF3pBS.js} +3 -3
  47. package/dist/nitro.d.ts +2 -4
  48. package/dist/nitro.js +340 -13
  49. package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
  50. package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
  51. package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
  52. package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
  53. package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
  54. package/dist/result-D090hxr5.js +402 -0
  55. package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
  56. package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
  57. package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
  58. package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
  59. package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
  60. package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
  61. package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
  62. package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
  63. package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
  64. package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
  65. package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
  66. package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
  67. package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
  68. package/dist/turn-session-routing-CZTRU8IY.js +116 -0
  69. package/dist/turn-wake-Bzq1Efrm.js +154 -0
  70. package/dist/user-customization-B27StpVQ.js +9 -0
  71. package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
  72. package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
  73. package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
  76. package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
  77. package/migrations/0160_money_micro_usd_repair.sql +99 -0
  78. package/migrations/0161_agent_config_backfill.sql +34 -0
  79. package/migrations/0162_inbox_item_deliveries.sql +15 -0
  80. package/migrations/0163_pg_trgm.sql +2 -0
  81. package/migrations/0164_search_indexes.sql +4 -0
  82. package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
  83. package/migrations/0166_memory_prefix_index.sql +1 -0
  84. package/migrations/0167_todo_search_indexes.sql +2 -0
  85. package/migrations/0168_todo_inbox_items.sql +4 -0
  86. package/migrations/0169_drop_code_urls.sql +2 -0
  87. package/migrations/meta/0160_snapshot.json +6515 -0
  88. package/migrations/meta/0161_snapshot.json +6278 -0
  89. package/migrations/meta/0162_snapshot.json +6404 -0
  90. package/migrations/meta/0163_snapshot.json +6404 -0
  91. package/migrations/meta/0164_snapshot.json +6466 -0
  92. package/migrations/meta/0165_snapshot.json +6466 -0
  93. package/migrations/meta/0166_snapshot.json +6494 -0
  94. package/migrations/meta/0167_snapshot.json +6525 -0
  95. package/migrations/meta/0168_snapshot.json +6525 -0
  96. package/migrations/meta/0169_snapshot.json +6513 -0
  97. package/migrations/meta/_journal.json +70 -0
  98. package/package.json +9 -18
  99. package/skills/design-automation-skill/SKILL.md +2 -3
  100. package/dist/actor-BsBdxDXQ.js +0 -208
  101. package/dist/conversation-privacy-BrMiDN61.js +0 -189
  102. package/dist/executor-CgWyWfYz.js +0 -1858
  103. package/dist/fan-out-Cod-yEHG.js +0 -10
  104. package/dist/ingest-B0AggUEC.js +0 -7931
  105. package/dist/request-deadline-BUiRYQYj.js +0 -24
  106. package/dist/service-account-o15pZWcJ.js +0 -931
  107. package/dist/state-BTawTCme.js +0 -161
  108. package/dist/statuses-BKwqCPhj.js +0 -69
package/dist/api.js CHANGED
@@ -1,35 +1,31 @@
1
- import { A as readEnabledProviders, M as saveEnabledProviders, N as cacheKeyPrefix, P as createCache, gt as getAttachmentStorage, j as readServedProviders, n as botConfig, z as withLock } from "./config-CWbwKj0j.js";
2
- import { $i as AutomationConflictError, A as deletePushSubscription, Aa as ownerConversationId, Ai as getDashboardSettingsLink, An as workspaceRepoCheckoutPath, B as contentVersionHeaders, Bt as listWorkspaces, D as readWebPushConfig, Ea as inboxItemsNeedingUserVersionQuery, F as isPausedBySlack, Ga as unsnoozeInboxRow, Ha as settleInboxSnoozes, Ht as updateWorkspace, Ia as clearInboxWakeReasons, It as createWorkspace, Jn as createPluginAnnotations, Jo as eventWatchUnavailable, Jt as create, Ka as getEventCatalog, Lt as deleteWorkspace, M as readNotificationSchedule, N as saveNotificationSchedule, O as sendPushNotificationToUser, On as SANDBOX_RUNTIME, P as savePushSubscription, R as REVALIDATED_READ_PATHS, Ra as inboxItemInRow, Rt as getWorkspace, Sa as countInboxItemsNeedingUserBySubject, T as apiRoutePrefix, Ua as snoozeInboxItems, Ut as WorkspaceValidationError, V as revalidateContent, Va as readViewerInboxSnoozes, Vt as listWorkspacesByRepository, Wa as snoozeTimerTrigger, Wo as automationEventCatalog, Xr as postSlackMessage, Yn as listConversationAnnotations, Yt as hash, ai as escapeSlackMrkdwnText, as as createPluginCache, cs as completeText, da as readAutomationTitlesByConversationId, g as getRegistrations, go as listWatches, h as getPlugins, j as listPushSubscriptions, ja as searchInboxItems, k as resolveNotificationTimezone, ka as listWaitingConversations, ki as getDashboardPersonLink, oi as formatSlackLink, r as createUserTokenStore, so as cancelWatch, wa as getInboxItem, wi as getDashboardConversationLink, wr as createPluginLogger, z as contentVersion, za as inboxItemSnoozedBy } from "./credentialed-Dyv8b-lu.js";
3
- import { Bt as readViewerAvatarUrl, Fn as nextDetailVersion, G as microUsdToUsd, Gt as identityAvatarUrl, J as conversationRangeColumns, Jt as readUserAvatarUrls, Nt as findUserByEmail, Q as conversationTurnFailedSql, St as isOnlyAssignee, Tn as rootVisibleToViewer, Ut as updateViewerDisplayName, Vt as resolveViewerUser, W as microUsdSql, X as conversationIsActiveSql, Y as conversationUsageCostExpr, Z as conversationStatusSql, _n as createConversationAccessReader, a as getConversationStore, b as loadConversationSlackTenantIds, bn as readableSlackTeamId, bt as inboxItemVisibleTo, ft as inboxItemForUser, o as getDb, q as conversationAggregateColumns, qt as readAvatarFetch, s as getSqlExecutor, st as canActOnInboxItem, tt as conversationKindFromRow, ut as canUserReadInboxItem, vn as readConversationAccessFromSql, vt as inboxItemReaderForUser, w as withConversationMutationLock, wt as itemNeedsUser, yt as inboxItemReaderForUserInConversation } from "./db-PwSRzWWn.js";
4
- import { E as withSpan, _ as runBestEffort, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-DNt-qOIO.js";
5
- import { An as deleteViewerTask, Bn as readViewerAutomations, En as activateViewerAutomationVersion, Et as throwApiError, In as readViewerAutomationExecutions, Kn as AutomationEditError, Ln as readViewerAutomationRuns, Nn as updateViewerAutomation, Pn as ViewerTaskNotFoundError, Rn as readViewerAutomationSummary, St as inviteToConversation, Tt as jsonResponse, br as connectedState, bt as listOwnedWatches, dt as reportConversationRead, er as SAVINGS_NAMESPACE, fr as readStats, gr as breakerStates, jn as readViewerAutomationEdit, kn as changeViewerAutomationLifecycle, ur as savingsTotals, wt as emptyResponse, yr as closeBreaker, zn as readViewerAutomationVersions } from "./warmup-D5hzqTcp.js";
6
- import { A as automationVersionActivateSchema, C as automationRunListSchema, D as automationSchedulePreviewSchema, E as automationScheduleIntentSchema, G as conversationDetailReportSchema, H as conversationAttachmentQuerySchema, I as CONVERSATION_DETAIL_VERSION_HEADER, J as conversationEventsQuerySchema, L as CONVERSATION_VERSION_HEADER, Lt as ScheduleIntentError, M as automationVersionParamsSchema, O as automationSummarySchema, R as acceptedConversationMessageSchema, Rt as compileScheduleIntent, S as automationParamsSchema, Tt as MAX_ATTACHMENT_BYTES, V as conversationAttachmentParamsSchema, W as conversationDetailQuerySchema, Y as conversationParamsSchema, _ as automationLifecycleSchema, _t as conversationReadPositionSchema, b as automationListQuerySchema, d as automationEditSchema, f as automationEventCatalogSchema, gt as renameConversationResponseSchema, ht as renameConversationBodySchema, it as createConversationMessageBodySchema, j as automationVersionListSchema, k as automationUpdateSchema, l as apiErrorSchema, n as INPUT_IMAGE_TYPES, p as automationExecutionListSchema, q as conversationEventPageSchema, r as detectImageMediaType, rt as createConversationBodySchema, s as notificationScheduleSchema, sn as automationTaskText, t as INLINE_VIDEO_TYPES, u as automationEditErrorSchema, y as automationListPageSchema } from "./media-B0pZJ0bG.js";
7
- import { $t as conversationStatsReportSchema, A as cacheHealthQuerySchema, At as codePersonReportSchema, B as serviceAccountParamsSchema, Bt as todoStatusBodySchema, C as inboxSnoozeResourceQuerySchema, D as inboxSnoozeWakesClearSchema, E as inboxSnoozeSubjectSchema, Et as codeChangeSearchReportSchema, F as cacheWarmingSavingsRefillResponseSchema, G as personalTokenListSchema, Gt as conversationChildAgentsReportSchema, H as startServiceAccountSignInResponseSchema, Ht as conversationWatchesReportSchema, I as cacheWarmingSavingsReportSchema, It as personCodeQuerySchema, J as revokePersonalTokenResponseSchema, Kt as continueConversationInSlackBodySchema, L as closeCacheWarmingBreakerResponseSchema, Lt as conversationTodoSchema, M as cacheWarmingBreakerListSchema, Mt as codeRepositoryQuerySchema, N as cacheWarmingBreakerParamsSchema, Nt as codeRepositoryReportSchema, O as gatewayProvidersSchema, P as cacheWarmingSavingsQuerySchema, Q as avatarParamsSchema, Qt as objectLinksReportSchema, R as disconnectServiceAccountResponseSchema, Rt as conversationTodosReportSchema, S as inboxSnoozeCreateSchema, St as startConnectionResponseSchema, T as inboxSnoozeSchema, Tt as codeChangeSearchQuerySchema, U as createPersonalTokenBodySchema, Ut as watchParamsSchema, W as createdPersonalTokenSchema, X as actorDirectoryReportSchema, Xt as attachObjectLinkResponseSchema, Yt as attachObjectLinkBodySchema, Z as actorProfileReportSchema, Zt as objectLinksQuerySchema, _ as inboxItemListSchema, _t as testNotificationResponseSchema, a as statsReportSchema, an as conversationCatchUpSchema, at as leadSchema, b as inboxItemWaitingConversationsSchema, c as workspaceBodySchema, cn as createAttachmentUploadBodySchema, ct as locationDirectoryReportSchema, dt as activityHours$2, et as peopleSearchQuerySchema, f as workspaceSchema, ft as activitySixHours$1, g as inboxItemListQuerySchema, gt as pushSubscriptionDeleteBodySchema, h as inboxItemCountSchema, ht as pushSubscriptionBodySchema, in as conversationCatchUpBodySchema, it as personalSpendReportSchema, j as cacheHealthReportSchema, jt as codeRepositoryParamsSchema, k as updateGatewayProvidersBodySchema, kt as codeOverviewReportSchema, l as workspaceListSchema, ln as forkConversationBodySchema, lt as locationParamsSchema, m as inboxItemCountQuerySchema, mt as notificationSettingsSchema, n as versionsQuerySchema, nn as conversationDeliveryBodySchema, nt as personCardReportSchema, on as attachmentUploadParamsSchema, p as inboxItemActionSchema, q as personalTokenParamsSchema, qt as continueConversationInSlackResponseSchema, r as versionsSchema, rn as conversationDeliveryResponseSchema, rt as personParamsSchema, s as deleteWorkspaceResponseSchema, sn as attachmentUploadSchema, st as locationDetailReportSchema, tn as conversationOutlineSchema, tt as peopleSearchReportSchema, u as workspaceParamsSchema, un as forkConversationResponseSchema, ut as activityDays$1, v as inboxItemParamsSchema, vt as connectionListSchema, w as inboxSnoozeResourceSchema, xt as disconnectConnectionResponseSchema, y as inboxItemSchema, yt as connectionParamsSchema, z as serviceAccountListSchema, zt as todoParamsSchema } from "./schema-DojR2uCL.js";
8
- import { C as conversationUnchangedDetailWithMailboxSchema, D as pluginOperationalReportFeedSchema, E as healthReportSchema, I as skillReportsSchema, M as pluginsSchema, N as runtimeInfoReportSchema, P as skillDetailReportSchema, S as conversationPendingMessagesReportSchema, T as steerConversationPendingMessagesResponseSchema, a as conversationInviteResponseSchema, d as reorderPinnedConversationsResponseSchema, i as conversationInviteBodySchema, n as conversationFeedSchema, t as conversationFeedQuerySchema, u as reorderPinnedConversationsBodySchema, v as conversationDetailWithMailboxReportSchema, w as steerConversationPendingMessagesBodySchema } from "./conversation-feed-BEXLD3Me.js";
9
- import { At as parseEmail, Ot as isAllowedDomain, Pn as addConversationNote, Rn as isExperimentalFeatureEnabled, Tn as setTodoStatusByUser, i as listChildAgents, vn as readUserCustomization, wn as listTodos, yn as saveUserCustomization } from "./ingest-B0AggUEC.js";
10
- import { S as readSlackAttachmentSource, f as webActorFromUser, g as createAttachmentUpload, m as AttachmentUploadError, o as acceptsWebMessages, r as getLeadConversation, v as writeAttachmentUpload } from "./start-conversation-DbVujrwO.js";
11
- import { A as apiOperationHandler, C as cancelQueuedMessagesOperation, D as setConversationSubscriptionOperation, Dt as getProductionSlackAdapter, E as setConversationAutoArchiveOperation, G as resolveMentions, Gt as conversationRecordJoins, Jt as readFirstHumanMessageTexts, K as InboxItemActionError, O as stopConversationOperation, S as archiveDoneConversationsOperation, St as guardedFetch, T as pinConversationOperation, W as requireConversationPendingMessages, Wt as resolvePersonLink, Xt as IMAGE_WIDTHS, Y as readInboxItemForUser, Yt as createViewerMcp, Zt as decodeImageId, _ as createConversationForViewer, _t as readLinkObjectType, a as listedConversation, bt as resolveObjectLinks, c as readConversationAuxiliaryCostsFromSql, d as conversationVersionsQuery, et as DEFAULT_USER_SETTINGS, f as readConversationDetailEtag, ft as startSavingsRefill, g as appendConversationMessageForViewer, gt as OBJECT_LINK_TTL_MS, h as readConversationEvents, ht as readHealthReport, i as encodePageCursor, k as reorderPinnedConversations, l as childAgentTotalsReport, lt as scheduleInboxSnoozeTimer, m as keepQuickQuestionForViewer, n as readConversationFeed, nt as updateUserSettings, o as notLeadConversation, p as forkConversationForViewer, q as actOnInboxItem, qt as conversationSummaryFromStoredConversation, r as decodePageCursor, s as readConversationDetail, t as conversationFeedVersionQuery, tt as readUserSettings, u as readConversationTreeMetricsFromSql, ut as readSavingsRefill, v as requireWebMessageConversation, vt as readObjectLinkTypes, x as archiveConversationOperation, xt as viewerCanViewPluginLink, yt as resolveObjectLinkNow } from "./list-DyIyReSV.js";
12
- import { a as readConversationEventPage, i as transcriptEntriesFromReportEvents } from "./task-runner--Ke8KSMf.js";
13
- import { D as readAttachmentContent, E as AttachmentDownloadError, O as previewOriginBelongsTo, S as canPauseConversationDelivery, T as resumeConversationDelivery, f as createSlackInboxItemShow, w as pauseConversationDelivery } from "./agent-runner-B5y9MsT-.js";
14
- import { t as runWithSlackInstallation } from "./adapter-context-CVsHoVSf.js";
15
- import { A as juniorConversationMetrics, F as codeChangeSearchDocument, G as slackPersonSearchDocument, H as juniorConversations, I as codeRepositorySearchDocument, K as juniorUsers, L as juniorCodeChanges, M as juniorConversationEvents, N as juniorApiTokens, R as juniorCodeRepositories, U as juniorIdentities, W as slackPersonPredicate, b as juniorAgentBindings, h as juniorInboxItems, p as juniorInboxItemConversations, q as juniorDestinations, x as juniorAgentInvocations } from "./executor-CgWyWfYz.js";
16
- import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-CxyFzdlF.js";
17
- import { f as parseSlackTeamId, u as parseSlackChannelId } from "./actor-BsBdxDXQ.js";
18
- import { i as readLiveAttachment } from "./store-CjXrp-Up.js";
1
+ import { A as readEnabledProviders, M as saveEnabledProviders, N as cacheKeyPrefix, P as createCache, gt as mapBounded, j as readServedProviders, n as botConfig, vt as getAttachmentStorage, z as withLock } from "./config-BIfHKNXN.js";
2
+ import { $ as rankSearchMatches, $t as updateWorkspace, D as readWebPushConfig, Ds as completeText, Eo as cancelWatch, F as saveNotificationSchedule, Fo as listWatches, G as revalidateContent, Ga as ownerConversationId, H as REVALIDATED_READ_PATHS, I as savePushSubscription, Ia as countInboxItemsNeedingUserBySubject, J as parseTypedQuery, Jt as deleteWorkspace, K as memoryDb, Ka as searchInboxItems, M as deletePushSubscription, N as listPushSubscriptions, O as sendPushNotificationToUser, P as readNotificationSchedule, Q as prefixRank, Qt as listWorkspacesByRepository, R as isPausedBySlack, Ra as getInboxItem, Ri as getDashboardConversationLink, Rr as createPluginLogger, T as apiRoutePrefix, Ta as readAutomationTitlesByConversationId, U as contentVersion, Ui as getDashboardPersonLink, Un as createPluginEmbedder, Va as inboxItemsNeedingUserVersionQuery, Vn as workspaceRepoCheckoutPath, W as contentVersionHeaders, Wi as getDashboardSettingsLink, X as fuzzyRank, Y as fuzzyMatch, Yt as getWorkspace, Z as prefixMatch, Zt as listWorkspaces, an as create, bi as formatSlackLink, co as snoozeInboxItems, cr as createPluginAnnotations, do as getEventCatalog, en as WorkspaceValidationError, et as scoredSearchMatches, g as getRegistrations, h as getPlugins, io as inboxItemSnoozedBy, j as resolveNotificationTimezone, lo as snoozeTimerTrigger, lr as listConversationAnnotations, ls as automationEventCatalog, on as hash, oo as readViewerInboxSnoozes, pa as AutomationConflictError, ps as eventWatchUnavailable, q as searchTypedMemories, qt as createWorkspace, r as createUserTokenStore, ro as inboxItemInRow, so as settleInboxSnoozes, to as clearInboxWakeReasons, ui as postSlackMessage, uo as unsnoozeInboxRow, ws as createPluginCache, yi as escapeSlackMrkdwnText, zn as SANDBOX_RUNTIME } from "./credentialed-dWRA3-oJ.js";
3
+ import { $ as microUsdSql, Ar as juniorConversationEvents, Bn as rootVisibleToViewer, Br as juniorConversations, Ct as canUserReadInboxItem, Fr as juniorCodeChanges, Gr as juniorDestinations, Hr as slackPersonPredicate, Ir as juniorCodeRepositories, It as isOnlyAssignee, Mn as readConversationAccessFromSql, Mt as inboxItemReaderForUserInConversation, Nr as codeChangeSearchDocument, Nt as inboxItemTodo, Pn as readableSlackTeamId, Pr as codeRepositorySearchDocument, Pt as inboxItemVisibleTo, Rt as itemNeedsUser, Sr as juniorAgentBindings, Tt as inboxItemForUser, Ur as slackPersonSearchDocument, Vr as juniorIdentities, Wr as juniorUsers, _r as automationSearchDocument, a as getDb, an as identityAvatarUrl, ar as todoSearchDocument, at as conversationUsageCostExpr, bt as canActOnInboxItem, cn as readUserAvatarUrls, ct as conversationTurnFailedSql, dt as conversationKindFromRow, en as readViewerAvatarUrl, et as microUsdToUsd, fi as parseSlackChannelId, fr as juniorInboxItemConversations, gr as automationFuzzyTitle, hr as juniorInboxItems, i as getConversationStore, ir as todoFuzzyTitle, it as conversationRangeColumns, jn as createConversationAccessReader, jr as juniorApiTokens, jt as inboxItemReaderForUser, kr as juniorConversationMetrics, lr as inboxItemFuzzyTitle, mi as parseSlackTeamId, nt as usdToMicroUsdUnbiased, o as getSqlExecutor, ot as conversationIsActiveSql, qt as findUserByEmail, rn as updateViewerDisplayName, rr as juniorTodos, rt as conversationAggregateColumns, sn as readAvatarFetch, st as conversationStatusSql, tn as resolveViewerUser, ur as inboxItemSearchDocument, vr as juniorAutomations, x as loadConversationSlackTenantIds } from "./db-BTmLKZrp.js";
4
+ import { C as logInfo, E as runBestEffort, F as withSpan, O as setSentryUser, S as logException, w as logWarn } from "./conversation-privacy-DtZhI91r.js";
5
+ import { Ar as addStats, Br as connectedState, Ht as jsonResponse, Ir as breakerStates, Jn as readViewerAutomationEdit, Kn as changeViewerAutomationLifecycle, Mr as readStats, Pt as listOwnedWatches, Qn as collectionRowTitle, Tt as reportConversationRead, Un as activateViewerAutomationVersion, Ut as throwApiError, Vt as emptyResponse, Xn as updateViewerAutomation, Zn as ViewerTaskNotFoundError, _r as viewerAutomationCollection, er as readViewerAutomationExecutions, ir as readViewerAutomations, kr as savingsTotals, nr as readViewerAutomationSummary, qn as deleteViewerTask, rr as readViewerAutomationVersions, tr as readViewerAutomationRuns, ur as AutomationEditError, yr as SAVINGS_NAMESPACE, zr as closeBreaker, zt as inviteToConversation } from "./warmup-CCOuIwAS.js";
6
+ import { A as automationVersionActivateSchema, C as automationRunListSchema, D as automationSchedulePreviewSchema, E as automationScheduleIntentSchema, G as conversationDetailReportSchema, H as conversationAttachmentQuerySchema, I as CONVERSATION_DETAIL_VERSION_HEADER, J as conversationEventsQuerySchema, L as CONVERSATION_VERSION_HEADER, Lt as ScheduleIntentError, M as automationVersionParamsSchema, O as automationSummarySchema, R as acceptedConversationMessageSchema, Rt as compileScheduleIntent, S as automationParamsSchema, Tt as MAX_ATTACHMENT_BYTES, V as conversationAttachmentParamsSchema, W as conversationDetailQuerySchema, Y as conversationParamsSchema, _ as automationLifecycleSchema, _t as conversationReadPositionSchema, b as automationListQuerySchema, d as automationEditSchema, f as automationEventCatalogSchema, fn as automationTaskText, it as createConversationMessageBodySchema, j as automationVersionListSchema, k as automationUpdateSchema, l as apiErrorSchema, n as INPUT_IMAGE_TYPES, p as automationExecutionListSchema, q as conversationEventPageSchema, r as detectImageMediaType, rt as createConversationBodySchema, s as notificationScheduleSchema, t as INLINE_VIDEO_TYPES, u as automationEditErrorSchema, y as automationListPageSchema } from "./media-FYM-Bl3H.js";
7
+ import { $ as actorProfileReportSchema, $t as objectLinksQuerySchema, A as cacheHealthQuerySchema, B as serviceAccountParamsSchema, Bt as conversationTodosReportSchema, C as inboxSnoozeResourceQuerySchema, Ct as disconnectConnectionResponseSchema, D as inboxSnoozeWakesClearSchema, Dt as codeChangeSearchQuerySchema, E as inboxSnoozeSubjectSchema, F as cacheWarmingSavingsRefillResponseSchema, Ft as codeRepositoryReportSchema, G as createPersonalTokenBodySchema, Gt as watchParamsSchema, H as startServiceAccountSignInResponseSchema, Ht as todoStatusBodySchema, I as cacheWarmingSavingsReportSchema, Jt as continueConversationInSlackBodySchema, K as createdPersonalTokenSchema, L as closeCacheWarmingBreakerResponseSchema, M as cacheWarmingBreakerListSchema, Mt as codePersonReportSchema, N as cacheWarmingBreakerParamsSchema, Nt as codeRepositoryParamsSchema, O as gatewayProvidersSchema, Ot as codeChangeSearchReportSchema, P as cacheWarmingSavingsQuerySchema, Pt as codeRepositoryQuerySchema, Q as actorDirectoryReportSchema, Qt as attachObjectLinkResponseSchema, R as disconnectServiceAccountResponseSchema, Rt as personCodeQuerySchema, S as inboxSnoozeCreateSchema, T as inboxSnoozeSchema, U as searchQuerySchema, Vt as todoParamsSchema, W as searchReportSchema, Wt as conversationWatchesReportSchema, X as revokePersonalTokenResponseSchema, Y as personalTokenParamsSchema, Yt as continueConversationInSlackResponseSchema, Zt as attachObjectLinkBodySchema, _ as inboxItemListSchema, _t as pushSubscriptionBodySchema, a as statsReportSchema, an as conversationDeliveryResponseSchema, at as personParamsSchema, b as inboxItemWaitingConversationsSchema, bt as connectionListSchema, c as workspaceBodySchema, cn as attachmentUploadParamsSchema, dn as forkConversationBodySchema, dt as locationParamsSchema, en as objectLinksReportSchema, et as avatarParamsSchema, f as workspaceSchema, fn as forkConversationResponseSchema, ft as activityDays$1, g as inboxItemListQuerySchema, gt as notificationSettingsSchema, h as inboxItemCountSchema, in as conversationDeliveryBodySchema, it as personCardReportSchema, j as cacheHealthReportSchema, jt as codeOverviewReportSchema, k as updateGatewayProvidersBodySchema, l as workspaceListSchema, ln as attachmentUploadSchema, lt as locationDetailReportSchema, m as inboxItemCountQuerySchema, mt as activitySixHours$1, n as versionsQuerySchema, nt as peopleSearchQuerySchema, on as conversationCatchUpBodySchema, ot as personalSpendReportSchema, p as inboxItemActionSchema, pt as activityHours$2, q as personalTokenListSchema, qt as conversationChildAgentsReportSchema, r as versionsSchema, rn as conversationOutlineSchema, rt as peopleSearchReportSchema, s as deleteWorkspaceResponseSchema, sn as conversationCatchUpSchema, st as leadSchema, tn as conversationStatsReportSchema, u as workspaceParamsSchema, un as createAttachmentUploadBodySchema, ut as locationDirectoryReportSchema, v as inboxItemParamsSchema, vt as pushSubscriptionDeleteBodySchema, w as inboxSnoozeResourceSchema, wt as startConnectionResponseSchema, xt as connectionParamsSchema, y as inboxItemSchema, yt as testNotificationResponseSchema, z as serviceAccountListSchema, zt as conversationTodoSchema } from "./schema-7gW9vBpJ.js";
8
+ import { C as conversationUnchangedDetailWithMailboxSchema, D as pluginOperationalReportFeedSchema, E as healthReportSchema, I as skillReportsSchema, M as pluginsSchema, N as runtimeInfoReportSchema, P as skillDetailReportSchema, S as conversationPendingMessagesReportSchema, T as steerConversationPendingMessagesResponseSchema, a as conversationInviteResponseSchema, d as reorderPinnedConversationsResponseSchema, i as conversationInviteBodySchema, n as conversationFeedSchema, t as conversationFeedQuerySchema, u as reorderPinnedConversationsBodySchema, v as conversationDetailWithMailboxReportSchema, w as steerConversationPendingMessagesBodySchema } from "./conversation-feed-DdFQuQDR.js";
9
+ import { En as addConversationNote, Fr as createPluginEgress, Mn as isExperimentalFeatureEnabled, V as parseEmail, Yt as steerWebPendingMessages, _n as setTodoStatusByUser, gn as listTodos, ln as readUserCustomization, un as saveUserCustomization, z as isAllowedDomain } from "./mailbox-turn-DL3Lvsm0.js";
10
+ import { S as readSlackAttachmentSource, f as webActorFromUser, g as createAttachmentUpload, m as AttachmentUploadError, o as acceptsWebMessages, r as getLeadConversation, v as writeAttachmentUpload } from "./start-conversation-a4NXH4X9.js";
11
+ import { $t as decodeImageId, A as stopConversationOperation, C as archiveDoneConversationsOperation, Ct as viewerCanViewPluginLink, D as renameConversationOperation, E as pinConversationOperation, J as InboxItemActionError, K as requireConversationPendingMessages, Kt as resolvePersonLink, M as apiOperationHandler, O as setConversationAutoArchiveOperation, Qt as IMAGE_WIDTHS, S as archiveConversationOperation, St as resolveObjectLinks, Xt as readFirstHumanMessageTexts, Y as actOnInboxItem, Yt as conversationSummaryFromStoredConversation, Z as readInboxItemForUser, Zt as createViewerMcp, _ as appendConversationMessageForViewer, _t as readHealthReport, a as listWaitingConversations, bt as readObjectLinkTypes, c as readConversationDetail, d as readConversationTreeMetricsFromSql, dt as scheduleInboxSnoozeTimer, f as conversationVersionsQuery, ft as readSavingsRefill, g as readConversationEvents, h as keepQuickQuestionForViewer, i as encodePageCursor, it as updateUserSettings, j as reorderPinnedConversations, k as setConversationSubscriptionOperation, kt as getProductionSlackAdapter, l as readConversationAuxiliaryCostsFromSql, m as forkConversationForViewer, mt as startSavingsRefill, n as readConversationFeed, nt as DEFAULT_USER_SETTINGS, o as listedConversation, p as readConversationDetailEtag, q as resolveMentions, qt as conversationRecordJoins, r as decodePageCursor, rt as readUserSettings, s as notLeadConversation, t as conversationFeedVersionQuery, u as childAgentTotalsReport, v as createConversationForViewer, vt as OBJECT_LINK_TTL_MS, w as cancelQueuedMessagesOperation, wt as guardedFetch, xt as resolveObjectLinkNow, y as requireWebMessageConversation, yt as readLinkObjectType } from "./list-C5400AlJ.js";
12
+ import { a as codeChangeUrl, c as readConversationEventPage, d as readConversationLastEventSeq, i as transcriptEntriesFromReportEvents, o as codeRepositoryUrl, p as reportParentAgentInput, s as linkedCodeProviders } from "./task-runner-C-pXsgHM.js";
13
+ import { A as canPauseConversationDelivery, F as readAttachmentContent, I as previewOriginBelongsTo, M as pauseConversationDelivery, N as resumeConversationDelivery, P as AttachmentDownloadError, f as createInboxItemShow, p as pushConversationInboxItemsNow } from "./agent-runner-qZU5TR8i.js";
14
+ import { t as runWithSlackInstallation } from "./adapter-context-B4BrJZuS.js";
15
+ import { a as listChildAgents } from "./markers-DUP8aBOp.js";
16
+ import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-fnmD2Ifb.js";
17
+ import { i as readLiveAttachment } from "./store-BuhF1QDm.js";
19
18
  import { u as sentry_exports } from "./sentry-CPbZjomA.js";
20
- import { i as webActorUserIds } from "./state-BTawTCme.js";
21
- import { H as steerWebPendingMessages, Lt as createPluginEgress } from "./turn-membership-DTR3SaKD.js";
22
- import { i as getStateAdapter } from "./adapter-CYAvJzZS.js";
19
+ import { K as credentialContextForActor, M as webActorUserIds, a as finishServiceAccountSignIn, i as disconnectServiceAccount, l as serviceAccountPlugins, o as getServiceAccountStatus, u as startServiceAccountSignIn } from "./registry-D6kS6xYH.js";
20
+ import { i as getStateAdapter } from "./adapter-JARQvoLw.js";
23
21
  import { a as fillUtcSixHours, c as trailingUtcDayWindow, d as utcHourKey, i as fillUtcHours, l as trailingUtcHourWindow, n as HOUR_MS$3, o as startOfUtcHour, r as fillUtcDays, s as sumUtcHoursIntoSixHours, t as DAY_MS$3, u as trailingUtcSixHourWindow } from "./reporting-window-C4dbzDiR.js";
24
- import { g as isOpenTodoStatus, u as userCustomizationSchema } from "./statuses-BKwqCPhj.js";
25
- import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-DidUcRhI.js";
26
- import { p as credentialContextForActor } from "./registry-POH4bZC4.js";
27
- import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
28
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-o15pZWcJ.js";
29
- import { n as pluginCatalogRuntime } from "./catalog-runtime-kkE3hvCX.js";
30
- import { o as getSandboxResources } from "./install-2urLLXNt.js";
31
- import { t as getCachedSnapshot } from "./resolve-CWtBNSKP.js";
32
- import { t as getVercelConversationWorkQueue } from "./vercel-queue-q4z8w5QO.js";
22
+ import { y as isOpenTodoStatus } from "./history-CneKY7_V.js";
23
+ import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-B8rBt7F4.js";
24
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BLKtnUL3.js";
25
+ import { n as userCustomizationSchema } from "./user-customization-B27StpVQ.js";
26
+ import { o as getSandboxResources } from "./install-OtFboxOM.js";
27
+ import { t as getCachedSnapshot } from "./resolve-D8CPJcNK.js";
28
+ import { t as getVercelConversationWorkQueue } from "./vercel-queue-nL0Hq3hr.js";
33
29
  import { Hono } from "hono";
34
30
  import * as z from "zod";
35
31
  import path from "node:path";
@@ -263,7 +259,8 @@ async function postSlackDetachNotice(args) {
263
259
  /**
264
260
  * Detach a root from its Location, or attach it again. Only a participant
265
261
  * can change it, the same as rename. A mention in the Location attaches it
266
- * again too. Each detach tells the Slack thread once.
262
+ * again too. Each detach tells the Slack thread once. Each change pushes
263
+ * the open items of the Conversation without the Slack card wait.
267
264
  */
268
265
  async function setConversationDeliveryForViewer(viewer, conversationId, body) {
269
266
  const conversation = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant ? await getConversationStore().get({ conversationId }) : void 0;
@@ -281,39 +278,10 @@ async function setConversationDeliveryForViewer(viewer, conversationId, body) {
281
278
  location
282
279
  })
283
280
  }), "conversation.detach_notice.failed", { "app.conversation.id": conversationId });
284
- } else await resumeConversationDelivery(conversationId);
281
+ if (detached) await pushConversationInboxItemsNow(conversationId);
282
+ } else if (await resumeConversationDelivery(conversationId)) await pushConversationInboxItemsNow(conversationId);
285
283
  return { paused: body.paused };
286
284
  }
287
- // src/chat/conversations/sql/title.ts
288
- /**
289
- * Replace one Conversation's title. Returns the stored title, or undefined
290
- * when the Conversation does not exist.
291
- *
292
- * recordActivity reads the title and writes it back under the mutation lock,
293
- * so this write takes the same lock. A concurrent Turn cannot restore the old
294
- * title.
295
- */
296
- async function setConversationTitle(executor, conversationId, title) {
297
- return await withConversationMutationLock(executor, conversationId, async () => {
298
- const [row] = await executor.db().update(juniorConversations).set({
299
- detailVersion: nextDetailVersion,
300
- title
301
- }).where(eq(juniorConversations.conversationId, conversationId)).returning({ title: juniorConversations.title });
302
- return row?.title ?? void 0;
303
- });
304
- }
305
- // src/api/conversations/rename.ts
306
- /**
307
- * Rename one conversation. The title is shared, so only a participant can
308
- * change it, the same as pin and archive. Automatic titles are set once, so a
309
- * later Turn keeps this title.
310
- */
311
- async function renameConversation(viewer, conversationId, body) {
312
- if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
313
- const title = await setConversationTitle(getSqlExecutor(), conversationId, body.title);
314
- if (!title) throwApiError(404, "Conversation not found.");
315
- return { title };
316
- }
317
285
  // src/api/conversations/child-agents.ts
318
286
  /**
319
287
  * Load the direct child agents of one Conversation, or throw a standard API
@@ -672,7 +640,7 @@ async function readConversationOutline(conversationId, options = {}) {
672
640
  seq: row.seq,
673
641
  text,
674
642
  ...row.authorIdentityId && row.authorIdentityId !== "system" ? { actorIdentityId: row.authorIdentityId } : void 0,
675
- ...row.agentInvocationId ? { agentInvocationId: row.agentInvocationId } : void 0
643
+ ...reportParentAgentInput(row)
676
644
  }];
677
645
  });
678
646
  let itemIndex = -1;
@@ -699,7 +667,9 @@ function readMessages(conversationId, role, ...filters) {
699
667
  return getDb().select({
700
668
  agentInvocationId: sql`${payload}->'meta'->>'agentInvocationId'`,
701
669
  authorIdentityId: sql`coalesce(${payload}->>'authorIdentityId', ${juniorConversationEvents.actorIdentityId})`,
670
+ authorUserId: sql`${payload}->'meta'->'author'->>'userId'`,
702
671
  createdAt: juniorConversationEvents.createdAt,
672
+ messageId: sql`${payload}->>'messageId'`,
703
673
  seq: juniorConversationEvents.seq,
704
674
  text: sql`coalesce(left(${payload}->>'text', ${200}), '')`
705
675
  }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), sql`${juniorConversationEvents.type} = 'message'`, sql`${payload}->>'role' = ${role}`, ...filters)).orderBy(asc(juniorConversationEvents.seq));
@@ -1419,7 +1389,7 @@ function createConversationRoutes(options) {
1419
1389
  app.patch("/:conversationId/delivery", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationDeliveryBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationDeliveryResponseSchema, await setConversationDeliveryForViewer(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
1420
1390
  app.patch("/:conversationId/subscription", requireViewer, apiOperationHandler(setConversationSubscriptionOperation, options));
1421
1391
  app.post("/:conversationId/invites", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationInviteBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationInviteResponseSchema, await inviteToConversation(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
1422
- app.patch("/:conversationId/title", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", renameConversationBodySchema, "Invalid request body."), async (context) => jsonResponse(renameConversationResponseSchema, await renameConversation(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
1392
+ app.patch("/:conversationId/title", requireViewer, apiOperationHandler(renameConversationOperation, options));
1423
1393
  app.post("/:conversationId/annotations", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", attachObjectLinkBodySchema, "Invalid request body."), async (context) => jsonResponse(attachObjectLinkResponseSchema, await attachObjectLink(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json").url)));
1424
1394
  app.put("/:conversationId/read-position", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationReadPositionSchema, "Invalid request body."), async (context) => {
1425
1395
  const viewer = context.get("viewer");
@@ -1734,8 +1704,7 @@ const codeChangeReportColumns = {
1734
1704
  provider: juniorCodeChanges.provider,
1735
1705
  repository: juniorCodeRepositories.name,
1736
1706
  state: juniorCodeChanges.state,
1737
- title: juniorCodeChanges.title,
1738
- url: juniorCodeChanges.url
1707
+ title: juniorCodeChanges.title
1739
1708
  };
1740
1709
  /** Convert one code change row to its report shape. */
1741
1710
  function codeChangeReport({ additions, changedFiles, deletions, ...change }) {
@@ -1751,7 +1720,7 @@ function codeChangeReport({ additions, changedFiles, deletions, ...change }) {
1751
1720
  mergedAt: change.mergedAt?.toISOString(),
1752
1721
  openedAt: change.openedAt.toISOString(),
1753
1722
  title: change.title ?? void 0,
1754
- url: change.url ?? void 0
1723
+ url: codeChangeUrl(change)
1755
1724
  };
1756
1725
  }
1757
1726
  /** Read code activity created by Junior across installed code plugins. */
@@ -1771,8 +1740,7 @@ async function readCodeOverview(nowMs = Date.now()) {
1771
1740
  merged,
1772
1741
  name: repositories.name,
1773
1742
  open: sql`count(*) filter (where ${changes.state} = 'open')`.mapWith(Number),
1774
- provider: repositories.provider,
1775
- url: repositories.url
1743
+ provider: repositories.provider
1776
1744
  }).from(repositories).innerJoin(changes, eq(changes.repositoryId, repositories.id)).where(recent).groupBy(repositories.id).orderBy(desc(merged), desc(created), asc(repositories.name)).limit(25), db.select(codeChangeReportColumns).from(changes).innerJoin(repositories, eq(changes.repositoryId, repositories.id)).where(recent).orderBy(desc(changes.updatedAt)).limit(25)]);
1777
1745
  const repositoryChanges = repositoryRows.length ? await db.select({
1778
1746
  conversationIds: changes.conversationIds,
@@ -1797,7 +1765,7 @@ async function readCodeOverview(nowMs = Date.now()) {
1797
1765
  ...repository,
1798
1766
  medianCostUsd: median(repositoryCosts.get(repository.id) ?? []),
1799
1767
  mergeRate: mergeRate(repository.merged, repository.closed),
1800
- url: repository.url ?? void 0
1768
+ url: codeRepositoryUrl(repository)
1801
1769
  })),
1802
1770
  summary: windows.summary,
1803
1771
  windowEnd: windows.windowEnd.toISOString(),
@@ -1884,8 +1852,7 @@ async function readCodeRepository(repositoryId, options = {}) {
1884
1852
  merged: countState("merged"),
1885
1853
  name: juniorCodeRepositories.name,
1886
1854
  open: countState("open"),
1887
- provider: juniorCodeRepositories.provider,
1888
- url: juniorCodeRepositories.url
1855
+ provider: juniorCodeRepositories.provider
1889
1856
  }).from(juniorCodeRepositories).leftJoin(juniorCodeChanges, eq(juniorCodeChanges.repositoryId, juniorCodeRepositories.id)).where(eq(juniorCodeRepositories.id, repositoryId)).groupBy(juniorCodeRepositories.id);
1890
1857
  if (!row) return void 0;
1891
1858
  const { closed, merged, open, ...repository } = row;
@@ -1913,7 +1880,7 @@ async function readCodeRepository(repositoryId, options = {}) {
1913
1880
  generatedAt: windows.windowEnd.toISOString(),
1914
1881
  repository: {
1915
1882
  ...repository,
1916
- url: repository.url ?? void 0
1883
+ url: codeRepositoryUrl(repository)
1917
1884
  },
1918
1885
  summary: windows.summary,
1919
1886
  windowEnd: windows.windowEnd.toISOString(),
@@ -1938,7 +1905,8 @@ const linked = alias(juniorConversations, "linked_conversation");
1938
1905
  async function readCodeChangeSearchFromSql(query, viewerUserId) {
1939
1906
  const number = /^#?(\d+)$/.exec(query.trim())?.[1];
1940
1907
  const terms = number ? [number] : (query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? []).slice(0, CODE_CHANGE_SEARCH_TERMS);
1941
- if (terms.length === 0) return [];
1908
+ const providers = linkedCodeProviders();
1909
+ if (terms.length === 0 || providers.length === 0) return [];
1942
1910
  const everyTerm = terms.map((term) => `${term}:*`).join(" & ");
1943
1911
  const anyTerm = terms.map((term) => `${term}:*`).join(" | ");
1944
1912
  const db = getDb();
@@ -1948,14 +1916,20 @@ async function readCodeChangeSearchFromSql(query, viewerUserId) {
1948
1916
  return (await db.select({
1949
1917
  draft: juniorCodeChanges.draft,
1950
1918
  number: juniorCodeChanges.number,
1919
+ provider: juniorCodeChanges.provider,
1951
1920
  repository: juniorCodeRepositories.name,
1952
1921
  state: juniorCodeChanges.state,
1953
- title: juniorCodeChanges.title,
1954
- url: juniorCodeChanges.url
1955
- }).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, juniorCodeChanges.repositoryId)).where(and(matches, isNotNull(juniorCodeChanges.url), visible)).orderBy(...number ? [desc(sql`${juniorCodeChanges.number}::text = ${number}`)] : [], desc(sql`coalesce(${juniorCodeChanges.lastActivityAt}, ${juniorCodeChanges.openedAt})`), asc(juniorCodeChanges.id)).limit(CODE_CHANGE_SEARCH_LIMIT)).flatMap((row) => row.url ? [{
1956
- ...row,
1957
- url: row.url
1958
- }] : []);
1922
+ title: juniorCodeChanges.title
1923
+ }).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, juniorCodeChanges.repositoryId)).where(and(matches, inArray(juniorCodeChanges.provider, providers), visible)).orderBy(...number ? [desc(sql`${juniorCodeChanges.number}::text = ${number}`)] : [], desc(sql`coalesce(${juniorCodeChanges.lastActivityAt}, ${juniorCodeChanges.openedAt})`), asc(juniorCodeChanges.id)).limit(CODE_CHANGE_SEARCH_LIMIT)).flatMap(({ provider, ...row }) => {
1924
+ const url = codeChangeUrl({
1925
+ ...row,
1926
+ provider
1927
+ });
1928
+ return url ? [{
1929
+ ...row,
1930
+ url
1931
+ }] : [];
1932
+ });
1959
1933
  }
1960
1934
  // src/api/code/routes.ts
1961
1935
  /** Create the code analytics API. */
@@ -2669,10 +2643,12 @@ function createLeadRoutes() {
2669
2643
  const app = new Hono();
2670
2644
  app.get("/", requireViewer, async (context) => {
2671
2645
  const lead = await getLeadConversation(context.get("viewer"));
2646
+ const lastSeq = await readConversationLastEventSeq(getSqlExecutor(), lead.conversationId);
2672
2647
  const watches = await listWatches({ conversationId: lead.conversationId });
2673
2648
  const watchedConversationIds = [...new Set(watches.filter((watch) => watch.namespace === "junior" && watch.resourceType === "conversation").map((watch) => watch.identifier))];
2674
2649
  return jsonResponse(leadSchema, {
2675
2650
  conversationId: lead.conversationId,
2651
+ lastSeq,
2676
2652
  watchedConversationIds
2677
2653
  }, { headers: { "cache-control": "private, no-store" } });
2678
2654
  });
@@ -3264,7 +3240,7 @@ async function readPeoplePluginReports(args) {
3264
3240
  reports: [],
3265
3241
  source: "plugins"
3266
3242
  });
3267
- const { getPluginProfileReports } = await import("./credentialed-Dyv8b-lu.js").then((n) => n.a);
3243
+ const { getPluginProfileReports } = await import("./credentialed-dWRA3-oJ.js").then((n) => n.a);
3268
3244
  return pluginOperationalReportFeedSchema.parse({
3269
3245
  generatedAt: new Date(nowMs).toISOString(),
3270
3246
  reports: await getPluginProfileReports({
@@ -3404,7 +3380,7 @@ async function readPeopleProfileFromSql(email, options = {}) {
3404
3380
  const channel = channelExpression(turnRoot);
3405
3381
  const hourWindow = trailingUtcHourWindow(nowMs, 168);
3406
3382
  const [totalsRows, dayRows, hourRows, locationRows, surfaceRows, recentRows] = await Promise.all([
3407
- getDb().select(personTotalColumns(roots)).from(roots).innerJoin(juniorUsers, eq(juniorUsers.id, roots.userId)).innerJoin(turnRoot, personRootJoin(roots)).groupBy(juniorUsers.id),
3383
+ getDb().select(personTotalColumns(roots)).from(roots).innerJoin(juniorUsers, eq(juniorUsers.id, roots.userId)).innerJoin(turnRoot, personRootJoin(roots)).where(eq(juniorUsers.primaryEmailNormalized, normalizedEmail)).groupBy(juniorUsers.id),
3408
3384
  rootBucketRows({
3409
3385
  email: normalizedEmail,
3410
3386
  since: start,
@@ -3736,6 +3712,263 @@ function createPersonalTokenRoutes() {
3736
3712
  });
3737
3713
  return app;
3738
3714
  }
3715
+ // src/chat/automations/search.ts
3716
+ const EXACT_ID_WEIGHT = 4;
3717
+ /**
3718
+ * Find the Automations that the viewer owns or that are shared to them, as
3719
+ * the Automations list shows them and with its titles. A word of the title, task, or event
3720
+ * trigger starts with each word of the query, the title is close to the
3721
+ * query despite a typo, or the query holds the Automation's id. Best match
3722
+ * first. Reads the GIN indexes `junior_automations_search_idx` and
3723
+ * `junior_automations_title_trgm_idx`.
3724
+ */
3725
+ async function searchAutomationsForViewer(viewer, query, limit) {
3726
+ const db = getDb();
3727
+ const collection = viewerAutomationCollection(viewer);
3728
+ const automation = alias(juniorAutomations, "search_automation");
3729
+ const candidates = db.select({
3730
+ activityAtMs: collection.activityAtMs,
3731
+ id: collection.id,
3732
+ kind: collection.kind,
3733
+ state: collection.state,
3734
+ task: collection.task,
3735
+ title: collection.title
3736
+ }).from(collection).innerJoin(automation, eq(automation.id, collection.id)).where(and(ne(automation.status, "deleted"), or(prefixMatch(automationSearchDocument(automation), query), fuzzyMatch(automationFuzzyTitle(automation), query), query.tokens.length > 0 ? inArray(automation.id, query.tokens) : void 0))).orderBy(desc(collection.activityAtMs), asc(collection.id)).limit(200).as("automation_candidates");
3737
+ const ranked = alias(juniorAutomations, "ranked_automation");
3738
+ const document = automationSearchDocument(ranked);
3739
+ const title = automationFuzzyTitle(ranked);
3740
+ const rows = await db.select({
3741
+ activityAtMs: candidates.activityAtMs,
3742
+ fuzzy: fuzzyRank(title, query),
3743
+ fuzzyMatched: fuzzyMatch(title, query),
3744
+ id: candidates.id,
3745
+ kind: candidates.kind,
3746
+ lexical: prefixRank(document, query),
3747
+ lexicalMatched: prefixMatch(document, query),
3748
+ state: candidates.state,
3749
+ task: candidates.task,
3750
+ title: candidates.title
3751
+ }).from(candidates).innerJoin(ranked, eq(ranked.id, candidates.id));
3752
+ return rankSearchMatches(scoredSearchMatches(rows, {
3753
+ exact: (row) => query.tokens.includes(row.id) ? 1 : void 0,
3754
+ fuzzy: (row) => row.fuzzyMatched ? Number(row.fuzzy) : void 0,
3755
+ lexical: (row) => row.lexicalMatched ? Number(row.lexical) : void 0
3756
+ }), {
3757
+ key: (row) => row.id,
3758
+ tiebreak: (left, right) => right.activityAtMs - left.activityAtMs || left.id.localeCompare(right.id),
3759
+ weights: { exact: EXACT_ID_WEIGHT }
3760
+ }).slice(0, limit).flatMap((row) => row.state === "deleted" ? [] : [{
3761
+ id: row.id,
3762
+ kind: row.kind,
3763
+ status: row.state,
3764
+ title: collectionRowTitle(row)
3765
+ }]);
3766
+ }
3767
+ // src/chat/inbox-items/search.ts
3768
+ /**
3769
+ * Find the items of the viewer's own Inbox, open and closed, as the Inbox
3770
+ * shows them. A word of the title or body starts with each word of the
3771
+ * query, or the title is close to the query despite a typo. Open items come
3772
+ * first, each group best match first. Reads the GIN indexes
3773
+ * `junior_inbox_items_search_idx` and `junior_inbox_items_title_trgm_idx`.
3774
+ */
3775
+ async function searchInboxItemsForUser(viewer, query, limit) {
3776
+ const db = getDb();
3777
+ const items = juniorInboxItems;
3778
+ const candidates = db.select({ id: items.id }).from(items).where(and(or(prefixMatch(inboxItemSearchDocument(items), query), fuzzyMatch(inboxItemFuzzyTitle(items), query)), inboxItemVisibleTo(inboxItemReaderForUser(viewer)), inboxItemForUser(viewer.id))).orderBy(desc(items.updatedAt), desc(items.id)).limit(200).as("inbox_item_candidates");
3779
+ const item = alias(juniorInboxItems, "inbox_item");
3780
+ const document = inboxItemSearchDocument(item);
3781
+ const title = inboxItemFuzzyTitle(item);
3782
+ const rows = await db.select({
3783
+ fuzzy: fuzzyRank(title, query),
3784
+ fuzzyMatched: fuzzyMatch(title, query),
3785
+ id: item.id,
3786
+ lexical: prefixRank(document, query),
3787
+ lexicalMatched: prefixMatch(document, query),
3788
+ status: item.status,
3789
+ title: item.title,
3790
+ updatedAt: item.updatedAt
3791
+ }).from(candidates).innerJoin(item, eq(item.id, candidates.id));
3792
+ const ranked = rankSearchMatches(scoredSearchMatches(rows, {
3793
+ fuzzy: (row) => row.fuzzyMatched ? Number(row.fuzzy) : void 0,
3794
+ lexical: (row) => row.lexicalMatched ? Number(row.lexical) : void 0
3795
+ }), {
3796
+ key: (row) => row.id,
3797
+ tiebreak: (left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || right.id.localeCompare(left.id)
3798
+ });
3799
+ return [...ranked.filter((row) => row.status === "open"), ...ranked.filter((row) => row.status !== "open")].slice(0, limit).map((row) => ({
3800
+ id: row.id,
3801
+ status: row.status,
3802
+ title: row.title
3803
+ }));
3804
+ }
3805
+ // src/chat/memory/search.ts
3806
+ const MEMORY_SEARCH_TITLE_CHARS = 120;
3807
+ const VECTOR_QUERY_MIN_CHARS = 3;
3808
+ const QUERY_EMBEDDING_TTL_MS = 6e5;
3809
+ const QUERY_EMBEDDING_KEY_PREFIX = "memory-search-embedding:v1";
3810
+ /** `junior_stats` counter of the embedding spend of typed memory search. */
3811
+ const EMBEDDING_COST_STAT = {
3812
+ metric: "embedding_cost_micro_usd",
3813
+ namespace: "search"
3814
+ };
3815
+ const cachedEmbeddingSchema = z.object({
3816
+ dimensions: z.number().int(),
3817
+ model: z.string(),
3818
+ provider: z.string(),
3819
+ vectors: z.array(z.array(z.number()))
3820
+ });
3821
+ function queryEmbeddingKey(model, input) {
3822
+ const hash = createHash("sha256").update(JSON.stringify([input.inputType ?? "", ...input.texts])).digest("hex");
3823
+ return `${QUERY_EMBEDDING_KEY_PREFIX}:${model}:${hash}`;
3824
+ }
3825
+ async function recordEmbeddingCost(model, costUsd) {
3826
+ await runBestEffort(() => addStats([{
3827
+ ...EMBEDDING_COST_STAT,
3828
+ count: usdToMicroUsdUnbiased(costUsd),
3829
+ name: model
3830
+ }]), "memory.search.embedding_cost_record_failed");
3831
+ }
3832
+ /**
3833
+ * Embed typed search text, and reuse the vector of the same text for a few
3834
+ * minutes, so a person who types it again makes no model call. A search has
3835
+ * no Conversation to bill, so each call adds its cost to a daily
3836
+ * `junior_stats` counter. The write runs with the vector query; `settled`
3837
+ * waits for it.
3838
+ */
3839
+ function cachedQueryEmbedder() {
3840
+ const embedder = createPluginEmbedder("memory");
3841
+ const costWrites = [];
3842
+ return {
3843
+ embedder: {
3844
+ model: embedder.model,
3845
+ provider: embedder.provider,
3846
+ async embedTexts(input) {
3847
+ const state = getStateAdapter();
3848
+ const key = queryEmbeddingKey(embedder.model, input);
3849
+ const cached = cachedEmbeddingSchema.safeParse(await state.get(key));
3850
+ if (cached.success) return cached.data;
3851
+ const result = await embedder.embedTexts(input);
3852
+ const { costUsd, ...embedding } = result;
3853
+ if (costUsd !== void 0) costWrites.push(recordEmbeddingCost(embedder.model, costUsd));
3854
+ await runBestEffort(() => state.set(key, embedding, QUERY_EMBEDDING_TTL_MS), "memory.search.embedding_cache_write_failed");
3855
+ return result;
3856
+ }
3857
+ },
3858
+ settled: async () => {
3859
+ await Promise.all(costWrites);
3860
+ }
3861
+ };
3862
+ }
3863
+ /**
3864
+ * Find the memories that the Memories page shows every User, active public
3865
+ * memory only, with the hybrid word and vector search of automatic recall.
3866
+ * Text of 3 or more characters is embedded once, from a short cache when it
3867
+ * was typed recently; when that fails, words alone match.
3868
+ */
3869
+ async function searchPublicMemories(text, limit) {
3870
+ const query = text.trim().length >= VECTOR_QUERY_MIN_CHARS ? cachedQueryEmbedder() : void 0;
3871
+ const memories = await searchTypedMemories({
3872
+ db: memoryDb(getDb()),
3873
+ embedder: query?.embedder,
3874
+ limit,
3875
+ nowMs: Date.now(),
3876
+ query: text
3877
+ });
3878
+ await query?.settled();
3879
+ return memories.map((memory) => ({
3880
+ id: memory.id,
3881
+ title: memory.content.slice(0, MEMORY_SEARCH_TITLE_CHARS)
3882
+ }));
3883
+ }
3884
+ // src/chat/todos/search.ts
3885
+ /**
3886
+ * Find the To-dos whose Conversation shows its private content to the
3887
+ * viewer: its root is public, or the viewer is a Participant of the root,
3888
+ * as `conversationAccessFromRows` decides. Other viewers see only redacted
3889
+ * To-dos, so a title match must not show that the To-do exists. A word of
3890
+ * the title starts with each word of the query, or the title is close to
3891
+ * the query despite a typo. Open To-dos come first, each group best match
3892
+ * first. Reads the GIN indexes `junior_todos_search_idx` and
3893
+ * `junior_todos_title_trgm_idx`.
3894
+ */
3895
+ async function searchTodosForViewer(viewer, query, limit) {
3896
+ const db = getDb();
3897
+ const todos = juniorTodos;
3898
+ const conversation = alias(juniorConversations, "todo_conversation");
3899
+ const candidates = db.select({
3900
+ conversationId: todos.conversationId,
3901
+ id: todos.id
3902
+ }).from(todos).innerJoin(conversation, eq(conversation.conversationId, todos.conversationId)).innerJoin(juniorConversations, and(eq(juniorConversations.conversationId, conversation.rootConversationId), eq(juniorConversations.rootConversationId, juniorConversations.conversationId), isNull(juniorConversations.parentConversationId))).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).where(and(or(prefixMatch(todoSearchDocument(todos), query), fuzzyMatch(todoFuzzyTitle(todos), query)), or(isNotNull(conversation.parentConversationId), eq(conversation.rootConversationId, conversation.conversationId)), rootVisibleToViewer(viewer.id))).orderBy(desc(todos.updatedAt), desc(todos.conversationId), desc(todos.id)).limit(200).as("todo_candidates");
3903
+ const todo = alias(juniorTodos, "todo");
3904
+ const document = todoSearchDocument(todo);
3905
+ const title = todoFuzzyTitle(todo);
3906
+ const rows = await db.select({
3907
+ conversationId: todo.conversationId,
3908
+ fuzzy: fuzzyRank(title, query),
3909
+ fuzzyMatched: fuzzyMatch(title, query),
3910
+ id: todo.id,
3911
+ lexical: prefixRank(document, query),
3912
+ lexicalMatched: prefixMatch(document, query),
3913
+ status: todo.status,
3914
+ title: todo.title,
3915
+ updatedAt: todo.updatedAt
3916
+ }).from(candidates).innerJoin(todo, and(eq(todo.conversationId, candidates.conversationId), eq(todo.id, candidates.id)));
3917
+ const ranked = rankSearchMatches(scoredSearchMatches(rows, {
3918
+ fuzzy: (row) => row.fuzzyMatched ? Number(row.fuzzy) : void 0,
3919
+ lexical: (row) => row.lexicalMatched ? Number(row.lexical) : void 0
3920
+ }), {
3921
+ key: (row) => `${row.conversationId}:${row.id}`,
3922
+ tiebreak: (left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || right.conversationId.localeCompare(left.conversationId) || right.id - left.id
3923
+ });
3924
+ return [...ranked.filter((row) => isOpenTodoStatus(row.status)), ...ranked.filter((row) => !isOpenTodoStatus(row.status))].slice(0, limit).map(({ conversationId, id, status, title }) => ({
3925
+ conversationId,
3926
+ id,
3927
+ status,
3928
+ title
3929
+ }));
3930
+ }
3931
+ // src/chat/omni-search/search.ts
3932
+ const OMNI_SEARCH_SOURCE_LIMIT = 8;
3933
+ /**
3934
+ * Search the named sources for text that a person types, as `viewer`. Each
3935
+ * source returns only what its own page shows the viewer, ranked by the
3936
+ * shared search ranking, and the sources read at once. Text with no letters
3937
+ * or digits matches nothing and reads nothing.
3938
+ */
3939
+ async function omniSearch(input) {
3940
+ const query = parseTypedQuery(input.text);
3941
+ const wants = (source) => input.sources.includes(source);
3942
+ const [automations, inboxItems, memories, todos] = await Promise.all([
3943
+ query && wants("automations") ? searchAutomationsForViewer(input.viewer, query, OMNI_SEARCH_SOURCE_LIMIT) : [],
3944
+ query && wants("inboxItems") ? searchInboxItemsForUser(input.viewer, query, OMNI_SEARCH_SOURCE_LIMIT) : [],
3945
+ query && wants("memories") ? searchPublicMemories(input.text, OMNI_SEARCH_SOURCE_LIMIT) : [],
3946
+ query && wants("todos") ? searchTodosForViewer(input.viewer, query, OMNI_SEARCH_SOURCE_LIMIT) : []
3947
+ ]);
3948
+ return {
3949
+ ...wants("automations") ? { automations } : void 0,
3950
+ ...wants("inboxItems") ? { inboxItems } : void 0,
3951
+ ...wants("memories") ? { memories } : void 0,
3952
+ ...wants("todos") ? { todos } : void 0
3953
+ };
3954
+ }
3955
+ // src/api/search/routes.ts
3956
+ /**
3957
+ * Create the search route that the command palette reads while a person
3958
+ * types: one request, one group for each named source.
3959
+ */
3960
+ function createSearchRoutes() {
3961
+ const app = new Hono();
3962
+ app.get("/", requireViewer, validateRequest("query", searchQuerySchema, "Invalid search query."), async (context) => {
3963
+ const { q, sources } = context.req.valid("query");
3964
+ return jsonResponse(searchReportSchema, await omniSearch({
3965
+ sources,
3966
+ text: q,
3967
+ viewer: context.get("viewer")
3968
+ }));
3969
+ });
3970
+ return app;
3971
+ }
3739
3972
  // src/api/service-accounts/routes.ts
3740
3973
  /**
3741
3974
  * Public URL of the OAuth callback for one plugin's service account.
@@ -4627,7 +4860,8 @@ async function rootConversationIds(conversationIds) {
4627
4860
  async function visibleRowItems(user, root, inboxItemId) {
4628
4861
  if (inboxItemId) {
4629
4862
  const item = await getInboxItem(getDb(), inboxItemId);
4630
- const inRow = root === void 0 || (item ? await rootConversationIds(item.conversationIds) : []).includes(root);
4863
+ const owner = item && ownerConversationId(item);
4864
+ const inRow = root === void 0 || (item ? await rootConversationIds([...item.conversationIds, ...owner ? [owner] : []]) : []).includes(root);
4631
4865
  if (item?.status === "open" && inRow && await canUserReadInboxItem(item, user)) return [{
4632
4866
  canAct: canActOnInboxItem(item, user.id),
4633
4867
  id: item.id,
@@ -4663,8 +4897,8 @@ async function namedResources(user, triggers) {
4663
4897
  /**
4664
4898
  * Aim each trigger at its named resource, or at the resource of the item's
4665
4899
  * subject. A viewer waits on the subject without a check, as the item
4666
- * already names it. A `resolve` dismisses the item, so it needs a viewer
4667
- * who can dismiss it. Returns undefined when a trigger does not apply to
4900
+ * already names it. A `resolve` closes the item, so it needs a viewer
4901
+ * who can close it. Returns undefined when a trigger does not apply to
4668
4902
  * the item.
4669
4903
  */
4670
4904
  function itemTriggers(item, triggers, named) {
@@ -4790,18 +5024,12 @@ async function readItemRoots(db, items, viewer) {
4790
5024
  }).from(juniorConversations).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(and(inArray(juniorConversations.conversationId, ids), isNotNull(juniorConversations.parentConversationId)));
4791
5025
  if (children.length === 0) return /* @__PURE__ */ new Map();
4792
5026
  const childIds = children.map((child) => child.conversationId);
4793
- const [access, invocations] = await Promise.all([readConversationAccessFromSql(db, childIds, viewer), db.selectDistinctOn([juniorAgentInvocations.childConversationId], {
4794
- agentName: juniorAgentInvocations.agentName,
4795
- childConversationId: juniorAgentInvocations.childConversationId,
4796
- title: juniorAgentInvocations.title
4797
- }).from(juniorAgentInvocations).where(inArray(juniorAgentInvocations.childConversationId, childIds)).orderBy(juniorAgentInvocations.childConversationId, sql`${juniorAgentInvocations.title} is null`, desc(juniorAgentInvocations.createdAt))]);
4798
- const invocationByChild = new Map(invocations.map((row) => [row.childConversationId, row]));
5027
+ const access = await readConversationAccessFromSql(db, childIds, viewer);
4799
5028
  return new Map(children.flatMap((child) => {
4800
5029
  const childAccess = access.get(child.conversationId);
4801
5030
  const rootConversationId = childAccess?.rootConversationId;
4802
5031
  if (!rootConversationId || !childAccess.canViewPrivateContent) return [];
4803
- const invocation = invocationByChild.get(child.conversationId);
4804
- const label = invocation?.title ?? invocation?.agentName ?? child.title ?? child.bindingName ?? kindLabel(child.kind);
5032
+ const label = child.title ?? child.bindingName ?? kindLabel(child.kind);
4805
5033
  return [[child.conversationId, {
4806
5034
  label,
4807
5035
  rootConversationId
@@ -4899,6 +5127,7 @@ function wakePayload(reason) {
4899
5127
  function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
4900
5128
  const conversationId = ownerConversationId(item);
4901
5129
  const root = conversationId ? roots.get(conversationId) : void 0;
5130
+ const todo = inboxItemTodo(item);
4902
5131
  return {
4903
5132
  ...root ? { addedByLabel: root.label } : void 0,
4904
5133
  assignedToEveryone: item.assignedToEveryone,
@@ -4926,6 +5155,7 @@ function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
4926
5155
  ...related && (related.items.length > 0 || related.conversationIds.length > 0) ? { related } : void 0,
4927
5156
  ...item.request ? { request: item.request } : void 0,
4928
5157
  ...item.subject ? { subject: subjectPayload(item.subject) } : void 0,
5158
+ ...todo ? { todoId: todo.id } : void 0,
4929
5159
  ...wake ? { wake: wakePayload(wake) } : void 0
4930
5160
  };
4931
5161
  }
@@ -5031,10 +5261,12 @@ function createInboxItemRoutes(services) {
5031
5261
  let codeChanges = 0;
5032
5262
  let decisions = 0;
5033
5263
  let needsViewer = 0;
5264
+ let todos = 0;
5034
5265
  for (const subject of subjects) {
5035
5266
  automations += subject.automations;
5036
5267
  needsViewer += subject.total;
5037
5268
  decisions += subject.decisions;
5269
+ todos += subject.todos;
5038
5270
  if (subject.subjectUrl && readLinkObjectType(subject.subjectUrl, linkTypes) === "code_change") codeChanges += subject.total;
5039
5271
  }
5040
5272
  return jsonResponse(inboxItemCountSchema, {
@@ -5042,7 +5274,8 @@ function createInboxItemRoutes(services) {
5042
5274
  codeChanges,
5043
5275
  decisions,
5044
5276
  needsViewer,
5045
- snoozed
5277
+ snoozed,
5278
+ todos
5046
5279
  });
5047
5280
  });
5048
5281
  app.get("/waiting-conversations", requireViewer, async (context) => {
@@ -5283,7 +5516,7 @@ function readDescriptionText(home) {
5283
5516
  }
5284
5517
  /** Read discovered skills for runtime diagnostics and the Automation editor. */
5285
5518
  async function readSkillReports() {
5286
- const { discoverSkills } = await import("./skills-B0jP4whm.js").then((n) => n.s);
5519
+ const { discoverSkills } = await import("./skills-CIosT6bS.js").then((n) => n.s);
5287
5520
  const skills = await discoverSkills();
5288
5521
  return skillReportsSchema.parse(skills.map((skill) => ({
5289
5522
  name: skill.name,
@@ -5297,7 +5530,7 @@ async function readSkillReports() {
5297
5530
  * what the skill tells Junior. Returns null when no skill has that name.
5298
5531
  */
5299
5532
  async function readSkillDetailReport(name) {
5300
- const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-B0jP4whm.js").then((n) => n.s);
5533
+ const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-CIosT6bS.js").then((n) => n.s);
5301
5534
  const skill = findSkillByName(name, await discoverSkills());
5302
5535
  if (!skill) return null;
5303
5536
  const parsed = parseSkillFile(await fs.readFile(path.join(skill.skillPath, "SKILL.md"), "utf8"), skill.name);
@@ -5312,7 +5545,7 @@ async function readSkillDetailReport(name) {
5312
5545
  }
5313
5546
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
5314
5547
  async function readPlugins() {
5315
- const { pluginCatalogRuntime } = await import("./catalog-runtime-kkE3hvCX.js").then((n) => n.t);
5548
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-BLKtnUL3.js").then((n) => n.t);
5316
5549
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
5317
5550
  configKeys: plugin.manifest.configKeys ?? [],
5318
5551
  description: plugin.manifest.description,
@@ -5324,7 +5557,7 @@ async function readPlugins() {
5324
5557
  async function readRuntimeInfoReport() {
5325
5558
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
5326
5559
  import("./package-discovery-DD9vencX.js").then((n) => n.r),
5327
- import("./catalog-runtime-kkE3hvCX.js").then((n) => n.t),
5560
+ import("./catalog-runtime-BLKtnUL3.js").then((n) => n.t),
5328
5561
  readPlugins(),
5329
5562
  readSkillReports()
5330
5563
  ]);
@@ -5341,7 +5574,7 @@ async function readRuntimeInfoReport() {
5341
5574
  /** Read sanitized operational summaries contributed by plugins. */
5342
5575
  async function readPluginOperationalReportFeed() {
5343
5576
  const nowMs = Date.now();
5344
- const { getPluginOperationalReports } = await import("./credentialed-Dyv8b-lu.js").then((n) => n.a);
5577
+ const { getPluginOperationalReports } = await import("./credentialed-dWRA3-oJ.js").then((n) => n.a);
5345
5578
  return pluginOperationalReportFeedSchema.parse({
5346
5579
  source: "plugins",
5347
5580
  generatedAt: new Date(nowMs).toISOString(),
@@ -5374,7 +5607,7 @@ function createJuniorApi(options = {}) {
5374
5607
  }));
5375
5608
  app.route("/api/inbox-items", createInboxItemRoutes({ delivery: {
5376
5609
  queue,
5377
- show: createSlackInboxItemShow(getProductionSlackAdapter)
5610
+ show: createInboxItemShow(getProductionSlackAdapter)
5378
5611
  } }));
5379
5612
  app.route("/api/inbox/snoozes", createInboxSnoozeRoutes());
5380
5613
  app.route("/api/code", createCodeRoutes());
@@ -5389,6 +5622,7 @@ function createJuniorApi(options = {}) {
5389
5622
  app.route("/api/objects", createObjectRoutes());
5390
5623
  app.route("/api/people", createPeopleRoutes({ waitUntil: waitUntil$1 }));
5391
5624
  app.route("/api/locations", createLocationRoutes());
5625
+ app.route("/api/search", createSearchRoutes());
5392
5626
  app.route("/api/user-pages", createUserPageRoutes());
5393
5627
  app.route("/api/user-customization", createUserCustomizationRoutes());
5394
5628
  app.route("/api/automations", createAutomationRoutes());