@sentry/junior 0.316.0 → 0.318.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.
- package/dist/{admin-QYiDMnsu.js → admin-UOHix_5P.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-DeYymwh2.js} +13494 -13135
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-DH8bx7jU.js} +5 -5
- package/dist/api/schema.d.ts +600 -130
- package/dist/api/schema.js +6 -6
- package/dist/api.js +228 -214
- package/dist/{app-BhvzRD__.d.ts → app-DKAOuaoC.d.ts} +33 -18
- package/dist/app.d.ts +1 -1
- package/dist/app.js +193 -177
- package/dist/{thread-context-fiMNylbg.js → auth-pause-state-f9hJM_zO.js} +6 -59
- package/dist/catalog-runtime-BfdAnztW.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-Bref7aPI.js → channel-access-A0de5lRv.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-D3Wd7f5n.js} +6 -5
- package/dist/{child-message--2G3Ft26.js → child-message-peFWLcCZ.js} +2 -6
- package/dist/cli/chat.js +38 -30
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +4 -2
- package/dist/cli/upgrade.js +5 -3
- package/dist/context-BKF_5zzI.js +1833 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-YxwMQVeR.js} +3 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed-Cj7IuBtM.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-Cr_dNW1p.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-Bru4w_FD.js} +196 -80
- package/dist/{create-DUJBXr6E.js → create-Btl1y1rq.js} +12 -11
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-DTarZ63K.js} +20 -15
- package/dist/{db-DhzvUY23.js → db-of6e3sGt.js} +20724 -27256
- package/dist/{deployment-BhvrhQeh.js → deployment-C0qXa0FD.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-C_QL_bMQ.js} +304 -56
- package/dist/{html-B_12WjKT.js → html-9_pS9SjY.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-B2XEvpif.js} +392 -26
- package/dist/{lineage-D3AZAJVe.js → lineage-nh4z9iQN.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-HRP3TIRl.js} +238 -550
- package/dist/{logging-B8KEJegM.js → logging-BnOG0qz2.js} +4 -50
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-Byrry9o1.js} +4807 -7102
- package/dist/{list-mkB_GU8R.js → markers-CTTtJqYn.js} +171 -124
- package/dist/{message-B5fKDYzz.js → message-BRUuLgrY.js} +13 -24
- package/dist/{model-input-CuMWy37l.js → model-input-CFC62mf-.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +21 -7
- package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CjnnUr4o.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-BvHFH0fV.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-iHw1uu32.js +4657 -0
- package/dist/{transcript-CCi7323k.js → prompt-DEkStuxG.js} +92 -98
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-Cl7Labpe.js +3279 -0
- package/dist/reports-C1d9azyV.js +195 -0
- package/dist/{resolve-D5JVvv6A.js → resolve-DC6zBuDV.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-DxewDuXb.js} +27 -118
- package/dist/run-conversation-Cz2ubZK-.js +337 -0
- package/dist/{runner-BzAES5W3.js → runner-99YxVN_r.js} +10 -18
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-CgoX5CTI.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-BTojNBr5.js} +48 -86
- package/dist/sender-actors-77zTQbSG.js +84 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-YDCPSByj.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-CleC0Hze.js} +6 -5
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-BNQLC12R.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-DuZfodPa.js} +5 -5
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-Ci6Ck4gk.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-BJ9Up3bG.js} +30 -53
- package/dist/topics-BoCkoPJJ.js +21 -0
- package/dist/turn-membership-VT7XZh-L.js +856 -0
- package/dist/{turn-wake-BjDW7x-5.js → turn-wake-C7HeLHAM.js} +3 -4
- package/dist/{media-BebquhET.js → types-DCzTAA63.js} +629 -593
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-Cb9c1k9q.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-BiUmWPhy.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-VEXiEcZu.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-ChWYQdhm.js} +5 -4
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
- package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
- package/package.json +5 -5
- package/dist/people-CUtFApfL.js +0 -81
- package/dist/start-conversation-B-LIqqNi.js +0 -162
- package/dist/turn-session-routing-D15orfwy.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
package/dist/api.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { A as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { a as transcriptEntriesFromReportEvents,
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-
|
|
14
|
-
import { o as
|
|
1
|
+
import { d as readLiveAttachment, o as readSlackAttachmentSource, y as getAttachmentStorage } from "./turn-membership-VT7XZh-L.js";
|
|
2
|
+
import { $c as snoozeTimerTrigger, $d as juniorConversationParticipants, Aa as AutomationConflictError, Ac as inboxItemTitle, B as conversationRangeColumns, Bc as readAvatarFetch, Bd as questionSearchDocument, Bt as setTodoStatusByUser, Cl as rankSearchMatches, Cs as listPushSubscriptions, Ct as getPlugins, Dd as listedConversation, Ds as isPausedBySlack, Du as completeText, Er as readableSlackTeamId, Es as savePushSubscription, Fc as subjectKindPlugin, Fd as juniorTodos, Fu as readServedProviders, G as conversationTurnFailedSql, Gc as clearInboxWakeReasons, Gs as findUserByEmail, H as conversationIsActiveSql, Hd as automationFuzzyTitle, Hi as createPluginEmbedder, Ic as subjectTodo, Id as todoFuzzyTitle, Iu as saveEnabledProviders, J as conversationKindFromRow, Jc as inboxItemSnoozedBy, Jd as juniorInboxItemConversations, Jo as subjectKey, Ka as microUsdSql, Kd as inboxItemFuzzyTitle, Ko as codeChangeSubjectProvider, Ld as todoSearchDocument, Lu as cacheKeyPrefix, Mc as INBOX_SUBJECT_KINDS, Mi as formatSlackLink, Nc as questionLinks, Nr as getVercelConversationWorkQueue, Od as notLeadConversation, Ot as apiRoutePrefix, Pc as subjectKindLabel, Pu as readEnabledProviders, Q as canActOnInboxItem, Qc as snoozeInboxItems, Qo as canPauseConversationDelivery, Qs as updateViewerDisplayName, Rc as identityAvatarUrl, Rd as juniorQuestions, Rn as createInboxItemShow, Ru as createCache, Sf as juniorDestinations, Sl as prefixRank, Sr as createConversationAccessReader, Ss as deletePushSubscription, Tc as searchInboxItems, Td as rootSpaceIdSql, Ts as saveNotificationSchedule, Ua as readAutomationTitlesByConversationId, Ud as automationSearchDocument, V as conversationUsageCostExpr, Vc as readUserAvatarUrls, Vd as juniorAutomationRuns, W as conversationStatusSql, Wd as juniorAutomations, Xc as readViewerInboxSnoozes, Xo as codeRepositoryUrl, Xr as runWithSlackInstallation, Xs as resolveViewerUser, Ya as usdToMicroUsdUnbiased, Yd as juniorInboxItems, Yo as codeChangeUrl, Ys as readViewerAvatarUrl, Zc as settleInboxSnoozes, Zd as juniorAgentBindings, Zl as eventWatchUnavailable, Zo as linkedCodeProviders, _l as searchTypedMemories, a as getDb, al as getDashboardSettingsLink, at as inboxItemForUser, bc as getInboxItem, bf as slackPersonSearchDocument, bl as fuzzyRank, cf as codeChangeSearchDocument, dc as countInboxItemsNeedingUserBySubject, df as juniorCodeRepositories, dt as inboxItemVisibleTo, ea as createPluginCache, el as unsnoozeInboxRow, es as pauseConversationDelivery, et as canAnswerInboxItem, fc as inboxItemsNeedingUserVersionQuery, fl as REVALIDATED_READ_PATHS, fs as isPublicConversation, gl as memoryDb, gs as resolveNotificationTimezone, gt as itemNeedsUser, hf as juniorConversations, hl as revalidateContent, hs as sendPushNotificationToUser, i as getConversationStore, if as juniorConversationEvents, il as getDashboardPersonLink, is as listConversationAnnotations, jc as itemQuestion, ji as escapeSlackMrkdwnText, jr as rootVisibleToViewer, kc as inboxItemRequest, kd as topLevelConversation, lf as codeRepositorySearchDocument, lt as inboxItemReaderForUser, ml as contentVersionHeaders, mn as steerWebPendingMessages, ms as readWebPushConfig, mt as isOnlyAssignee, nt as canUserReadInboxItem, o as getSqlExecutor, of as juniorApiTokens, pc as listWaitingConversations, pl as contentVersion, pt as isInboxItemForEveryone, qa as microUsdToUsd, qc as inboxItemInRow, qd as inboxItemSearchDocument, ql as automationEventCatalog, qo as readSubjectLinks, rf as juniorConversationMetrics, rs as createPluginAnnotations, so as getEventCatalog, tl as getDashboardConversationLink, ts as resumeConversationDelivery, uf as juniorCodeChanges, ut as inboxItemReaderForUserInConversation, vf as juniorIdentities, vl as parseTypedQuery, w as loadConversationSlackTenantIds, wc as ownerConversationId, wi as postSlackMessage, wl as scoredSearchMatches, wo as cancelWatch, wr as readConversationAccessFromSql, ws as readNotificationSchedule, wt as getRegistrations, xf as juniorUsers, xl as prefixMatch, yf as slackPersonPredicate, yl as fuzzyMatch, z as conversationAggregateColumns, zd as questionFuzzyTitle, zn as pushConversationInboxItemsNow, zt as listTodos } from "./db-of6e3sGt.js";
|
|
3
|
+
import { T as withSpan, f as logException, g as runBestEffort, m as logWarn, p as logInfo, v as setSentryUser } from "./logging-BnOG0qz2.js";
|
|
4
|
+
import { $t as AutomationEditError, Bt as deleteViewerTask, Et as throwApiError, G as reportConversationRead, Gt as collectionRowTitle, H as stopArchivedWork, Jt as readViewerAutomationRuns, Q as listOwnedWatches, Rt as activateViewerAutomationVersion, Tt as jsonResponse, Ut as updateViewerAutomation, V as setConversationArchive, Vt as readViewerAutomationEdit, Wt as ViewerTaskNotFoundError, Xt as readViewerAutomationVersions, Yt as readViewerAutomationSummary, Zt as readViewerAutomations, _t as createAttachmentUpload, at as readSpace, dn as addStats, fn as readStats, h as previewOriginBelongsTo, hn as connectedState, ht as AttachmentUploadError, in as SAVINGS_NAMESPACE, it as listSpaces, m as readAttachmentContent, mn as closeBreaker, nt as getSpaceLead, ot as updateSpace, p as AttachmentDownloadError, pn as breakerStates, pt as webActorFromUser, qt as readViewerAutomationExecutions, rn as viewerAutomationCollection, rt as createSpace, st as acceptsWebMessages, un as savingsTotals, wt as emptyResponse, xt as inviteToConversation, yt as writeAttachmentUpload, zt as changeViewerAutomationLifecycle } from "./agent-runner-DeYymwh2.js";
|
|
5
|
+
import { At as spaceListQuerySchema, B as conversationDetailQuerySchema, C as automationScheduleIntentSchema, D as automationVersionActivateSchema, E as automationUpdateSchema, G as conversationParamsSchema, It as updateSpaceBodySchema, Kt as MAX_ATTACHMENT_BYTES, L as conversationAttachmentParamsSchema, Ln as apiErrorSchema, Mt as spaceParamsSchema, N as CONVERSATION_DETAIL_VERSION_HEADER, O as automationVersionListSchema, On as automationTaskText, Ot as archiveSpaceBodySchema, P as CONVERSATION_VERSION_HEADER, Pt as spaceSchema, R as conversationAttachmentQuerySchema, Rt as conversationReadPositionSchema, T as automationSummarySchema, U as conversationEventPageSchema, V as conversationDetailReportSchema, W as conversationEventsQuerySchema, _ as automationListQuerySchema, an as compileScheduleIntent, b as automationRunListSchema, c as automationEditSchema, fn as inboxItemQuestion, g as automationListPageSchema, in as ScheduleIntentError, jn as notificationScheduleSchema, jt as spaceListSchema, k as automationVersionParamsSchema, kt as createSpaceBodySchema, l as automationEventCatalogSchema, m as automationLifecycleSchema, o as isOpenTodoStatus, s as automationEditErrorSchema, u as automationExecutionListSchema, w as automationSchedulePreviewSchema, y as automationParamsSchema } from "./types-DCzTAA63.js";
|
|
6
|
+
import { $ as userSearchQuerySchema, $t as conversationChildAgentsReportSchema, A as cacheHealthQuerySchema, At as startConnectionResponseSchema, B as serviceAccountParamsSchema, Bt as codeRepositoryQuerySchema, C as inboxSnoozeResourceQuerySchema, Ct as pushSubscriptionBodySchema, D as inboxSnoozeWakesClearSchema, Dt as connectionParamsSchema, E as inboxSnoozeSubjectSchema, Et as connectionListSchema, F as cacheWarmingSavingsRefillResponseSchema, G as createPersonalTokenBodySchema, Gt as conversationTodoSchema, H as startServiceAccountSignInResponseSchema, I as cacheWarmingSavingsReportSchema, Jt as todoStatusBodySchema, K as createdPersonalTokenSchema, Kt as conversationTodosReportSchema, L as closeCacheWarmingBreakerResponseSchema, Lt as codeOverviewReportSchema, M as cacheWarmingBreakerListSchema, N as cacheWarmingBreakerParamsSchema, Nt as codeChangeSearchQuerySchema, O as gatewayProvidersSchema, P as cacheWarmingSavingsQuerySchema, Pt as codeChangeSearchReportSchema, R as disconnectServiceAccountResponseSchema, Rt as codePersonReportSchema, S as inboxSnoozeCreateSchema, St as notificationSettingsSchema, T as inboxSnoozeSchema, Tt as testNotificationResponseSchema, U as searchQuerySchema, Vt as codeRepositoryReportSchema, W as searchReportSchema, Wt as personCodeQuerySchema, X as revokePersonalTokenResponseSchema, Xt as conversationWatchesReportSchema, Y as personalTokenParamsSchema, Zt as watchParamsSchema, _ as inboxItemListSchema, _n as acceptedConversationMessageSchema, _t as locationParamsSchema, a as statsReportSchema, an as objectLinksQuerySchema, at as avatarParamsSchema, b as inboxItemWaitingConversationsSchema, bn as forkConversationBodySchema, bt as activitySixHours$1, c as workspaceBodySchema, ct as peopleSearchReportSchema, dn as conversationDeliveryResponseSchema, dt as personalSpendReportSchema, en as continueConversationInSlackBodySchema, et as userSearchReportSchema, f as workspaceSchema, fn as conversationCatchUpBodySchema, g as inboxItemListQuerySchema, gn as createAttachmentUploadBodySchema, gt as locationDirectoryReportSchema, h as inboxItemCountSchema, hn as attachmentUploadSchema, ht as locationDetailReportSchema, in as attachObjectLinkResponseSchema, it as actorProfileReportSchema, j as cacheHealthReportSchema, k as updateGatewayProvidersBodySchema, kt as disconnectConnectionResponseSchema, l as workspaceListSchema, ln as conversationOutlineSchema, lt as personCardReportSchema, m as inboxItemCountQuerySchema, mn as attachmentUploadParamsSchema, n as versionsQuerySchema, on as objectLinksReportSchema, p as inboxItemActionSchema, pn as conversationCatchUpSchema, pt as spaceConfigurationSchema, q as personalTokenListSchema, qt as todoParamsSchema, r as versionsSchema, rn as attachObjectLinkBodySchema, rt as actorDirectoryReportSchema, s as deleteWorkspaceResponseSchema, sn as conversationStatsReportSchema, st as peopleSearchQuerySchema, tn as continueConversationInSlackResponseSchema, u as workspaceParamsSchema, un as conversationDeliveryBodySchema, ut as personParamsSchema, v as inboxItemParamsSchema, vn as createConversationBodySchema, vt as activityDays$1, w as inboxSnoozeResourceSchema, wt as pushSubscriptionDeleteBodySchema, xn as forkConversationResponseSchema, y as inboxItemSchema, yn as createConversationMessageBodySchema, yt as activityHours$2, z as serviceAccountListSchema, zt as codeRepositoryParamsSchema } from "./schema-BTojNBr5.js";
|
|
7
|
+
import { A as conversationUnchangedDetailWithMailboxSchema, B as runtimeInfoReportSchema, M as steerConversationPendingMessagesResponseSchema, N as healthReportSchema, P as pluginOperationalReportFeedSchema, T as conversationDetailWithMailboxReportSchema, U as skillReportsSchema, V as skillDetailReportSchema, _ as reorderPinnedConversationsBodySchema, a as conversationInviteResponseSchema, i as conversationInviteBodySchema, j as steerConversationPendingMessagesBodySchema, k as conversationPendingMessagesReportSchema, n as conversationFeedSchema, t as conversationFeedQuerySchema, v as reorderPinnedConversationsResponseSchema, z as pluginsSchema } from "./conversation-feed-Cj7IuBtM.js";
|
|
8
|
+
import { Ht as createWorkspace, Jt as listWorkspacesByRepository, L as isAllowedDomain, Lt as readUserCustomization, Qt as workspaceRepoCheckoutPath, Rt as saveUserCustomization, Ut as deleteWorkspace, Wt as getWorkspace, Xt as WorkspaceValidationError, Yt as updateWorkspace, qt as listWorkspaces, rn as isExperimentalFeatureEnabled, tr as createPluginEgress, z as parseEmail, zt as addConversationNote } from "./mailbox-turn-Byrry9o1.js";
|
|
9
|
+
import { A as setConversationSubscriptionOperation, C as cancelQueuedMessagesOperation, Ct as resolveObjectLinkNow, D as renameConversationOperation, E as pinConversationOperation, Et as guardedFetch, Gt as resolvePersonLink, J as resolveMentions, Jt as readFirstHumanMessageTexts, M as reorderPinnedConversations, N as apiOperationHandler, O as setConversationAutoArchiveOperation, Q as readInboxItemForUser, S as archiveDoneConversationsOperation, St as readObjectLinkTypes, T as leaveConversationOperation, Tt as viewerCanViewPluginLink, X as actOnInboxItem, Xt as IMAGE_WIDTHS, Y as InboxItemActionError, Yt as createViewerMcp, Zt as decodeImageId, _ as createConversationForViewer, a as resolveInboxItemSubjects, at as updateUserSettings, bt as OBJECT_LINK_TTL_MS, c as readConversationAuxiliaryCostsFromSql, d as conversationVersionsQuery, f as readConversationDetailEtag, g as appendConversationMessageForViewer, gt as startSavingsRefill, h as readConversationEvents, i as encodePageCursor, it as readUserSettings, j as stopConversationOperation, jt as getProductionSlackAdapter, k as setConversationSpaceOperation, l as childAgentTotalsReport, m as keepQuickQuestionForViewer, mt as readSavingsRefill, n as readConversationFeed, o as readConversationDetail, p as forkConversationForViewer, pt as scheduleInboxSnoozeTimer, q as requireConversationPendingMessages, qt as conversationSummaryFromStoredConversation, r as decodePageCursor, rt as DEFAULT_USER_SETTINGS, s as readConversationTreeStates, t as conversationFeedVersionQuery, u as readConversationTreeMetricsFromSql, v as requireWebMessageConversation, wt as resolveObjectLinks, x as archiveConversationOperation, xt as readLinkObjectType, yt as readHealthReport } from "./list-HRP3TIRl.js";
|
|
10
|
+
import { a as transcriptEntriesFromReportEvents, d as reportParentAgentInput, o as readConversationEventPage } from "./task-runner-BJ9Up3bG.js";
|
|
11
|
+
import { E as parseSlackChannelId, L as botConfig, O as parseSlackTeamId, R as getChatConfig, T as withLock, n as credentialContextForActor, y as getStateAdapter } from "./context-BKF_5zzI.js";
|
|
12
|
+
import { i as listChildAgents } from "./markers-CTTtJqYn.js";
|
|
13
|
+
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-YxwMQVeR.js";
|
|
14
|
+
import { a as INPUT_IMAGE_TYPES, i as INLINE_VIDEO_TYPES, n as userCustomizationSchema, o as detectImageMediaType } from "./user-customization-CvfuY9Eo.js";
|
|
15
15
|
import { u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
16
|
-
import {
|
|
17
|
-
import { a as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
16
|
+
import { N as webActorUserIds, a as disconnectServiceAccount, d as startServiceAccountSignIn, o as finishServiceAccountSignIn, s as getServiceAccountStatus, u as serviceAccountPlugins } from "./registry-Cl7Labpe.js";
|
|
17
|
+
import { a as fillUtcDays, c as startOfUtcHour, d as trailingUtcHourWindow, f as trailingUtcSixHourWindow, i as HOUR_MS$3, l as sumUtcHoursIntoSixHours, o as fillUtcHours, p as utcHourKey, r as DAY_MS$3, s as fillUtcSixHours, u as trailingUtcDayWindow } from "./agent-status-BA5x3Xtp.js";
|
|
18
|
+
import { A as createUserTokenStore, n as hash, t as create, u as SANDBOX_RUNTIME } from "./profile-iHw1uu32.js";
|
|
19
|
+
import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-9_pS9SjY.js";
|
|
20
|
+
import { G as mapBounded, h as createPluginLogger } from "./prompt-DEkStuxG.js";
|
|
21
|
+
import { F as listSpaceConfiguration } from "./job-runner-B2XEvpif.js";
|
|
22
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
|
|
23
|
+
import { o as getSandboxResources, t as getCachedSnapshot } from "./resolve-DC6zBuDV.js";
|
|
22
24
|
import { Hono } from "hono";
|
|
23
25
|
import * as z from "zod";
|
|
24
26
|
import path from "node:path";
|
|
25
|
-
import {
|
|
26
|
-
import { normalizeEventIdentifier, objectPresentation, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
27
|
-
import { and, asc, count as count$1, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
27
|
+
import { and, asc, count as count$1, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, like, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
28
28
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
29
|
+
import { normalizeEventIdentifier, objectPresentation, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
30
|
+
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
29
31
|
import fs from "node:fs/promises";
|
|
30
32
|
import { readFileSync } from "node:fs";
|
|
31
33
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -288,12 +290,17 @@ async function requireConversationChildAgents(conversationId, options = {}) {
|
|
|
288
290
|
const [accessByConversation, children] = await Promise.all([readConversationAccessFromSql(db, [conversationId], options.viewer), listChildAgents(conversationId)]);
|
|
289
291
|
const canExposePayload = accessByConversation.get(conversationId)?.canViewPrivateContent ?? false;
|
|
290
292
|
const childIds = children.map((agent) => agent.childConversationId);
|
|
291
|
-
const [metricsByChild, auxiliaryCostsByChild] = await Promise.all([
|
|
293
|
+
const [metricsByChild, auxiliaryCostsByChild, treeByChild] = await Promise.all([
|
|
294
|
+
readConversationTreeMetricsFromSql(db, childIds),
|
|
295
|
+
readConversationAuxiliaryCostsFromSql(db, childIds),
|
|
296
|
+
readConversationTreeStates(db, childIds, options.viewer?.id)
|
|
297
|
+
]);
|
|
292
298
|
return {
|
|
293
299
|
agents: children.map((agent) => {
|
|
294
300
|
const metrics = metricsByChild.get(agent.childConversationId);
|
|
295
301
|
const auxiliaryCosts = auxiliaryCostsByChild.get(agent.childConversationId);
|
|
296
302
|
const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
|
|
303
|
+
const tree = treeByChild.get(agent.childConversationId);
|
|
297
304
|
return {
|
|
298
305
|
conversationId: agent.childConversationId,
|
|
299
306
|
cumulativeDurationMs: metrics?.durationMs ?? 0,
|
|
@@ -302,13 +309,14 @@ async function requireConversationChildAgents(conversationId, options = {}) {
|
|
|
302
309
|
...childAgentTotals ? { childAgentTotals } : void 0,
|
|
303
310
|
archivedAt: agent.archivedAtMs !== void 0 ? new Date(agent.archivedAtMs).toISOString() : null,
|
|
304
311
|
kind: agent.kind,
|
|
312
|
+
...agent.lastResult ? { lastResult: agent.lastResult } : void 0,
|
|
305
313
|
status: agent.status,
|
|
314
|
+
treeState: tree?.treeState ?? "done",
|
|
306
315
|
updatedAt: new Date(agent.updatedAtMs).toISOString(),
|
|
316
|
+
watching: tree?.watching ?? false,
|
|
307
317
|
...canExposePayload ? {
|
|
308
318
|
...agent.agentName ? { name: agent.agentName } : void 0,
|
|
309
|
-
|
|
310
|
-
...agent.title ? { title: agent.title } : void 0,
|
|
311
|
-
...agent.errorMessage ? { error: agent.errorMessage } : void 0
|
|
319
|
+
title: agent.title ?? null
|
|
312
320
|
} : { redacted: true }
|
|
313
321
|
};
|
|
314
322
|
}),
|
|
@@ -1447,7 +1455,7 @@ async function readConversationStatsFromSql() {
|
|
|
1447
1455
|
/** Load aggregate conversation stats from durable SQL records. */
|
|
1448
1456
|
const readConversationStats = createCachedReport({
|
|
1449
1457
|
freshMs: 3e5,
|
|
1450
|
-
keepMs:
|
|
1458
|
+
keepMs: 6048e5,
|
|
1451
1459
|
key: "conversation-stats",
|
|
1452
1460
|
read: readConversationStatsFromSql,
|
|
1453
1461
|
refreshFailedEvent: "conversation_stats.refresh.failed",
|
|
@@ -1555,7 +1563,7 @@ async function requireConversationTodos(conversationId, options = {}) {
|
|
|
1555
1563
|
/**
|
|
1556
1564
|
* Set the status of one To-do for a person. The To-dos are shared, so only
|
|
1557
1565
|
* a Participant can change them, the same as the title. The agent sees the
|
|
1558
|
-
* change in a
|
|
1566
|
+
* change in a To-do delta on its next Turn.
|
|
1559
1567
|
*/
|
|
1560
1568
|
async function setConversationTodoStatus(viewer, conversationId, todoId, body) {
|
|
1561
1569
|
const conversationAccess = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId);
|
|
@@ -2480,7 +2488,7 @@ function emptyActor(actor) {
|
|
|
2480
2488
|
};
|
|
2481
2489
|
}
|
|
2482
2490
|
function topLevelWhere() {
|
|
2483
|
-
return
|
|
2491
|
+
return topLevelConversation();
|
|
2484
2492
|
}
|
|
2485
2493
|
function publicLocationWhere(locationId) {
|
|
2486
2494
|
return and(topLevelWhere(), locationId === DASHBOARD_LOCATION_ID ? eq(juniorDestinations.provider, "local") : and(eq(juniorDestinations.id, locationId), ne(juniorDestinations.provider, "local")), isPublicConversation(juniorConversations));
|
|
@@ -2991,18 +2999,30 @@ async function spaceResponse(viewerUserId, spaceId, init) {
|
|
|
2991
2999
|
return jsonResponse(spaceSchema, spaceReport(await requireSpace(viewerUserId, spaceId)), init);
|
|
2992
3000
|
}
|
|
2993
3001
|
// src/api/spaces/archive.ts
|
|
2994
|
-
/**
|
|
3002
|
+
/**
|
|
3003
|
+
* Create the route that archives or restores a Space. A Space is its Lead,
|
|
3004
|
+
* so this archives or restores the Lead's tree, as for any root, and an
|
|
3005
|
+
* archive stops the tree's running work.
|
|
3006
|
+
*/
|
|
2995
3007
|
function createSpaceArchiveRoutes(options) {
|
|
2996
3008
|
const app = new Hono();
|
|
2997
3009
|
app.patch("/:spaceId/archive", requireViewer, spaceParamsValidator, validateRequest("json", archiveSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
2998
3010
|
const viewerUserId = context.get("viewer").id;
|
|
2999
3011
|
const { spaceId } = context.req.valid("param");
|
|
3000
|
-
|
|
3001
|
-
await
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3012
|
+
const { archived } = context.req.valid("json");
|
|
3013
|
+
const space = await requireMemberSpace(viewerUserId, spaceId);
|
|
3014
|
+
const lead = await getSpaceLead(spaceId);
|
|
3015
|
+
if (archived !== (space.archivedAt !== null)) await setConversationArchive(archived ? {
|
|
3016
|
+
applyToChildren: true,
|
|
3017
|
+
archived: true,
|
|
3018
|
+
conversationId: lead.conversationId
|
|
3019
|
+
} : {
|
|
3020
|
+
applyToChildren: true,
|
|
3021
|
+
archived: false,
|
|
3022
|
+
conversationId: lead.conversationId,
|
|
3023
|
+
userId: viewerUserId
|
|
3005
3024
|
});
|
|
3025
|
+
if (archived) await stopArchivedWork(lead.conversationId, options.queue);
|
|
3006
3026
|
return await spaceResponse(viewerUserId, spaceId);
|
|
3007
3027
|
});
|
|
3008
3028
|
return app;
|
|
@@ -3026,80 +3046,6 @@ function createSpaceConfigurationRoutes() {
|
|
|
3026
3046
|
});
|
|
3027
3047
|
return app;
|
|
3028
3048
|
}
|
|
3029
|
-
// src/api/spaces/lead.ts
|
|
3030
|
-
/**
|
|
3031
|
-
* Create the route that finds a Space's Lead. A member's first read creates
|
|
3032
|
-
* it. Anyone who reads the Space reads its Lead, which is public like the
|
|
3033
|
-
* Space.
|
|
3034
|
-
*/
|
|
3035
|
-
function createSpaceLeadRoutes() {
|
|
3036
|
-
const app = new Hono();
|
|
3037
|
-
app.get("/:spaceId/lead", requireViewer, spaceParamsValidator, async (context) => {
|
|
3038
|
-
const viewer = context.get("viewer");
|
|
3039
|
-
const space = await requireSpace(viewer.id, context.req.valid("param").spaceId);
|
|
3040
|
-
const lead = space.viewerIsMember ? await getSpaceLead({
|
|
3041
|
-
member: viewer,
|
|
3042
|
-
space
|
|
3043
|
-
}) : await readSpaceLead(space.id);
|
|
3044
|
-
if (!lead) throwApiError(404, "This Space has no Lead yet.");
|
|
3045
|
-
const lastSeq = await readConversationLastEventSeq(getSqlExecutor(), lead.conversationId);
|
|
3046
|
-
const watches = await listWatches({ conversationId: lead.conversationId });
|
|
3047
|
-
const watchedConversationIds = [...new Set(watches.filter((watch) => watch.namespace === "junior" && isAgentResourceType(watch.resourceType)).map((watch) => watch.identifier))];
|
|
3048
|
-
return jsonResponse(leadSchema, {
|
|
3049
|
-
conversationId: lead.conversationId,
|
|
3050
|
-
lastSeq,
|
|
3051
|
-
watchedConversationIds
|
|
3052
|
-
}, { headers: { "cache-control": "private, no-store" } });
|
|
3053
|
-
});
|
|
3054
|
-
return app;
|
|
3055
|
-
}
|
|
3056
|
-
// src/api/spaces/members.ts
|
|
3057
|
-
/**
|
|
3058
|
-
* Create the routes that list a Space's members, add a member, and join or
|
|
3059
|
-
* leave it.
|
|
3060
|
-
*/
|
|
3061
|
-
function createSpaceMemberRoutes() {
|
|
3062
|
-
const app = new Hono();
|
|
3063
|
-
app.get("/:spaceId/members", requireViewer, spaceParamsValidator, async (context) => {
|
|
3064
|
-
const { spaceId } = context.req.valid("param");
|
|
3065
|
-
await requireSpace(context.get("viewer").id, spaceId);
|
|
3066
|
-
const members = await listSpaceMembers(spaceId);
|
|
3067
|
-
return jsonResponse(spaceMemberListSchema, { members: members.map((member) => ({
|
|
3068
|
-
...member,
|
|
3069
|
-
joinedAt: member.joinedAt.toISOString()
|
|
3070
|
-
})) });
|
|
3071
|
-
});
|
|
3072
|
-
app.post("/:spaceId/members", requireViewer, spaceParamsValidator, validateRequest("json", addSpaceMemberBodySchema, "Invalid request body."), async (context) => {
|
|
3073
|
-
const viewerUserId = context.get("viewer").id;
|
|
3074
|
-
const { spaceId } = context.req.valid("param");
|
|
3075
|
-
await requireMemberSpace(viewerUserId, spaceId);
|
|
3076
|
-
const email = normalizeIdentityEmail(context.req.valid("json").email);
|
|
3077
|
-
const person = email ? await readCachedUserByEmail(getDb(), email) : void 0;
|
|
3078
|
-
if (!person) throwApiError(404, "No person has that email.");
|
|
3079
|
-
await joinSpace(spaceId, person.user.id);
|
|
3080
|
-
return await spaceResponse(viewerUserId, spaceId);
|
|
3081
|
-
});
|
|
3082
|
-
app.put("/:spaceId/members/me", requireViewer, spaceParamsValidator, async (context) => {
|
|
3083
|
-
const viewerUserId = context.get("viewer").id;
|
|
3084
|
-
const { spaceId } = context.req.valid("param");
|
|
3085
|
-
await requireSpace(viewerUserId, spaceId);
|
|
3086
|
-
await joinSpace(spaceId, viewerUserId);
|
|
3087
|
-
return await spaceResponse(viewerUserId, spaceId);
|
|
3088
|
-
});
|
|
3089
|
-
app.delete("/:spaceId/members/me", requireViewer, spaceParamsValidator, async (context) => {
|
|
3090
|
-
const viewerUserId = context.get("viewer").id;
|
|
3091
|
-
const { spaceId } = context.req.valid("param");
|
|
3092
|
-
const space = await requireSpace(viewerUserId, spaceId);
|
|
3093
|
-
if (await leaveSpace(spaceId, viewerUserId) === "last_member") throwApiError(409, "The last member can't leave a private Space.");
|
|
3094
|
-
if (space.visibility === "private") return jsonResponse(spaceSchema, {
|
|
3095
|
-
...spaceReport(space),
|
|
3096
|
-
memberCount: space.memberCount - 1,
|
|
3097
|
-
viewerIsMember: false
|
|
3098
|
-
});
|
|
3099
|
-
return await spaceResponse(viewerUserId, spaceId);
|
|
3100
|
-
});
|
|
3101
|
-
return app;
|
|
3102
|
-
}
|
|
3103
3049
|
// src/api/spaces/state.ts
|
|
3104
3050
|
/**
|
|
3105
3051
|
* The most Conversations of the listed Spaces that one read rolls up, newest
|
|
@@ -3108,6 +3054,7 @@ function createSpaceMemberRoutes() {
|
|
|
3108
3054
|
* nothing.
|
|
3109
3055
|
*/
|
|
3110
3056
|
const SPACE_STATE_CONVERSATION_LIMIT = 200;
|
|
3057
|
+
const spaceLead = alias(juniorConversations, "state_space_lead");
|
|
3111
3058
|
const TREE_STATE_ORDER = [
|
|
3112
3059
|
"needs_you",
|
|
3113
3060
|
"working",
|
|
@@ -3122,11 +3069,12 @@ const TREE_STATE_ORDER = [
|
|
|
3122
3069
|
*/
|
|
3123
3070
|
async function readSpaceStates(db, spaceIds, viewerUserId) {
|
|
3124
3071
|
if (spaceIds.length === 0) return /* @__PURE__ */ new Map();
|
|
3072
|
+
const leads = db.select({ id: spaceLead.conversationId }).from(spaceLead).where(and(eq(spaceLead.kind, "lead"), inArray(spaceLead.spaceId, [...spaceIds])));
|
|
3125
3073
|
const roots = await db.select({
|
|
3126
3074
|
conversationId: juniorConversations.conversationId,
|
|
3127
|
-
spaceId: juniorConversations
|
|
3075
|
+
spaceId: rootSpaceIdSql(juniorConversations),
|
|
3128
3076
|
latestTurnFailed: conversationTurnFailedSql(juniorConversations)
|
|
3129
|
-
}).from(juniorConversations).where(and(inArray(juniorConversations.
|
|
3077
|
+
}).from(juniorConversations).where(and(or(inArray(juniorConversations.conversationId, leads), inArray(juniorConversations.parentConversationId, leads)), isNull(juniorConversations.archivedAt), isNull(juniorConversations.quickQuestionAt), rootVisibleToViewer(viewerUserId))).orderBy(desc(juniorConversations.lastActivityAt)).limit(SPACE_STATE_CONVERSATION_LIMIT);
|
|
3130
3078
|
const trees = await readConversationTreeStates(db, roots.map((root) => root.conversationId), viewerUserId);
|
|
3131
3079
|
const states = new Map(spaceIds.map((spaceId) => [spaceId, {
|
|
3132
3080
|
latestTurnFailed: false,
|
|
@@ -3157,7 +3105,7 @@ function createSpaceRoutes() {
|
|
|
3157
3105
|
app.post("/", requireViewer, validateRequest("json", createSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
3158
3106
|
const body = context.req.valid("json");
|
|
3159
3107
|
const space = await createSpace({
|
|
3160
|
-
|
|
3108
|
+
creator: context.get("viewer"),
|
|
3161
3109
|
name: body.name,
|
|
3162
3110
|
description: body.description ?? null,
|
|
3163
3111
|
visibility: body.visibility
|
|
@@ -3583,7 +3531,7 @@ async function readPeoplePluginReports(args) {
|
|
|
3583
3531
|
reports: [],
|
|
3584
3532
|
source: "plugins"
|
|
3585
3533
|
});
|
|
3586
|
-
const { getPluginProfileReports } = await import("./
|
|
3534
|
+
const { getPluginProfileReports } = await import("./reports-C1d9azyV.js");
|
|
3587
3535
|
return pluginOperationalReportFeedSchema.parse({
|
|
3588
3536
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3589
3537
|
reports: await getPluginProfileReports({
|
|
@@ -3939,7 +3887,7 @@ async function readUserSearchFromSql(args) {
|
|
|
3939
3887
|
const { target } = args;
|
|
3940
3888
|
const db = getDb();
|
|
3941
3889
|
const slack = alias(juniorIdentities, "user_search_slack");
|
|
3942
|
-
const slackJoin = and(eq(slack.userId, juniorUsers.id), slackPersonPredicate(slack)
|
|
3890
|
+
const slackJoin = and(eq(slack.userId, juniorUsers.id), slackPersonPredicate(slack));
|
|
3943
3891
|
const name = sql`lower(coalesce(${juniorUsers.displayName}, ${slack.displayName}, ''))`;
|
|
3944
3892
|
const handle = sql`lower(coalesce(${slack.handle}, ''))`;
|
|
3945
3893
|
const email = juniorUsers.primaryEmailNormalized;
|
|
@@ -3947,22 +3895,19 @@ async function readUserSearchFromSql(args) {
|
|
|
3947
3895
|
const exact = sql`(${name} = ${whole} or ${handle} = ${whole} or ${email} = ${whole} or split_part(${email}, '@', 1) = ${whole})`;
|
|
3948
3896
|
const prefix = sql`(starts_with(${name}, ${whole}) or starts_with(${handle}, ${whole}) or starts_with(${email}, ${whole}) or strpos(' ' || ${name}, ' ' || ${whole}) > 0)`;
|
|
3949
3897
|
const rank = sql`case when ${exact} then 0 when ${prefix} then 1 else 2 end`;
|
|
3950
|
-
const
|
|
3898
|
+
const matches = db.selectDistinctOn([juniorUsers.id], {
|
|
3951
3899
|
email: juniorUsers.primaryEmail,
|
|
3952
3900
|
emailNormalized: email,
|
|
3953
3901
|
fullName: sql`coalesce(${juniorUsers.displayName}, ${slack.displayName})`.as("full_name"),
|
|
3954
3902
|
rank: rank.as("rank"),
|
|
3955
|
-
slackUserId: slack.providerSubjectId,
|
|
3956
3903
|
slackUserName: slack.handle,
|
|
3957
3904
|
sortName: name.as("sort_name"),
|
|
3958
3905
|
userId: juniorUsers.id
|
|
3959
|
-
}).from(juniorUsers);
|
|
3960
|
-
const matches = (target.kind === "conversation" ? base.innerJoin(slack, slackJoin) : base.leftJoin(slack, slackJoin)).where(and(...terms.map((term) => sql`strpos(${document}, ${term}) > 0`))).orderBy(juniorUsers.id, asc(rank), asc(slack.id)).as("user_search_matches");
|
|
3906
|
+
}).from(juniorUsers).leftJoin(slack, slackJoin).where(and(...terms.map((term) => sql`strpos(${document}, ${term}) > 0`))).orderBy(juniorUsers.id, asc(rank), asc(slack.id)).as("user_search_matches");
|
|
3961
3907
|
const rows = await db.select({
|
|
3962
3908
|
email: matches.email,
|
|
3963
3909
|
fullName: matches.fullName,
|
|
3964
3910
|
isMember: memberSql(db, target, matches.userId).as("is_member"),
|
|
3965
|
-
slackUserId: matches.slackUserId,
|
|
3966
3911
|
slackUserName: matches.slackUserName,
|
|
3967
3912
|
userId: matches.userId
|
|
3968
3913
|
}).from(matches).orderBy(asc(matches.rank), asc(matches.sortName), asc(matches.emailNormalized), asc(matches.userId)).limit(args.limit);
|
|
@@ -3975,26 +3920,24 @@ async function readUserSearchFromSql(args) {
|
|
|
3975
3920
|
userId: row.userId,
|
|
3976
3921
|
...fullName ? { fullName } : void 0,
|
|
3977
3922
|
...row.slackUserName ? { slackUserName: row.slackUserName } : void 0,
|
|
3978
|
-
...target.kind === "conversation" && row.slackUserId ? { slackUserId: row.slackUserId } : void 0,
|
|
3979
3923
|
...avatarUrl ? { avatarUrl } : void 0,
|
|
3980
3924
|
...row.isMember ? { isMember: true } : void 0
|
|
3981
3925
|
};
|
|
3982
3926
|
});
|
|
3983
3927
|
}
|
|
3984
|
-
/** SQL: the User is already a
|
|
3928
|
+
/** SQL: the User is already a Participant of the root. */
|
|
3985
3929
|
function memberSql(db, target, userId) {
|
|
3986
|
-
if (target.kind === "space") return sql`${exists(db.select({ userId: juniorSpaceMembers.userId }).from(juniorSpaceMembers).where(and(eq(juniorSpaceMembers.spaceId, target.spaceId), eq(juniorSpaceMembers.userId, userId))))}`;
|
|
3987
3930
|
const participants = juniorConversationParticipants;
|
|
3988
3931
|
return sql`${exists(db.select({ userId: participants.userId }).from(participants).where(and(eq(participants.rootConversationId, target.rootConversationId), eq(participants.userId, userId))))}`;
|
|
3989
3932
|
}
|
|
3990
3933
|
// src/api/people/user-search.ts
|
|
3991
3934
|
/**
|
|
3992
|
-
* Find Users to add to a
|
|
3993
|
-
* to read it, so who is a
|
|
3994
|
-
* missing. The Users are those of this install, which is
|
|
3995
|
-
*
|
|
3996
|
-
*
|
|
3997
|
-
* them
|
|
3935
|
+
* Find Users to add to a Conversation, such as a Space's Lead. The viewer
|
|
3936
|
+
* must be able to read it, so who is a Participant does not leak;
|
|
3937
|
+
* otherwise it looks missing. The Users are those of this install, which is
|
|
3938
|
+
* the tenant of every dashboard Conversation, with or without a Slack
|
|
3939
|
+
* account. Whether the viewer may add them stays with the route that adds
|
|
3940
|
+
* them.
|
|
3998
3941
|
*/
|
|
3999
3942
|
async function searchUsersForViewer(viewer, query) {
|
|
4000
3943
|
return await readUserSearchFromSql({
|
|
@@ -4004,21 +3947,10 @@ async function searchUsersForViewer(viewer, query) {
|
|
|
4004
3947
|
});
|
|
4005
3948
|
}
|
|
4006
3949
|
async function readUserSearchTarget(viewer, query) {
|
|
4007
|
-
|
|
4008
|
-
await requireSpace(viewer.id, query.spaceId);
|
|
4009
|
-
return {
|
|
4010
|
-
kind: "space",
|
|
4011
|
-
spaceId: query.spaceId
|
|
4012
|
-
};
|
|
4013
|
-
}
|
|
4014
|
-
const conversationId = query.conversationId;
|
|
3950
|
+
const { conversationId } = query;
|
|
4015
3951
|
const access = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId);
|
|
4016
3952
|
if (!access?.canViewPrivateContent || !access.rootConversationId) throwApiError(404, "Conversation not found.");
|
|
4017
|
-
return {
|
|
4018
|
-
kind: "conversation",
|
|
4019
|
-
rootConversationId: access.rootConversationId,
|
|
4020
|
-
slackTeamId: readableSlackTeamId(access)
|
|
4021
|
-
};
|
|
3953
|
+
return { rootConversationId: access.rootConversationId };
|
|
4022
3954
|
}
|
|
4023
3955
|
// src/api/people/routes.ts
|
|
4024
3956
|
/** Create the HTTP routes owned by the People API. */
|
|
@@ -4213,33 +4145,63 @@ async function searchAutomationsForViewer(viewer, query, limit) {
|
|
|
4213
4145
|
}]);
|
|
4214
4146
|
}
|
|
4215
4147
|
// src/chat/inbox-items/search.ts
|
|
4148
|
+
function codeChangeSubjectKinds() {
|
|
4149
|
+
return getPlugins().flatMap((plugin) => (plugin.inboxSubjects ?? []).flatMap((subject) => {
|
|
4150
|
+
const kind = `${plugin.manifest.name}:${subject.kind}`;
|
|
4151
|
+
return codeChangeSubjectProvider(kind) ? [kind] : [];
|
|
4152
|
+
}));
|
|
4153
|
+
}
|
|
4154
|
+
function subjectCodeChange(item, change) {
|
|
4155
|
+
return and(eq(change.providerId, item.subjectId), eq(change.provider, sql`split_part(${item.subjectKind}, ':', 1)`));
|
|
4156
|
+
}
|
|
4157
|
+
function subjectQuestion(item, question) {
|
|
4158
|
+
return and(eq(item.subjectKind, INBOX_SUBJECT_KINDS.question), eq(question.id, item.subjectId));
|
|
4159
|
+
}
|
|
4216
4160
|
/**
|
|
4217
4161
|
* Find the items of the viewer's own Inbox, open and closed, as the Inbox
|
|
4218
4162
|
* shows them. A word of the title or body starts with each word of the
|
|
4219
|
-
* query, or the title is close to the query despite a typo.
|
|
4163
|
+
* query, or the title is close to the query despite a typo. A question
|
|
4164
|
+
* item matches on its question's title and body. An item whose subject is
|
|
4165
|
+
* a code change also matches on the code change's title. Open items come
|
|
4220
4166
|
* first, each group best match first. Reads the GIN indexes
|
|
4221
|
-
* `junior_inbox_items_search_idx
|
|
4167
|
+
* `junior_inbox_items_search_idx`, `junior_inbox_items_title_trgm_idx`,
|
|
4168
|
+
* `junior_questions_search_idx`, `junior_questions_title_trgm_idx`, and
|
|
4169
|
+
* `junior_code_changes_search_idx`.
|
|
4222
4170
|
*/
|
|
4223
4171
|
async function searchInboxItemsForUser(viewer, query, limit) {
|
|
4224
4172
|
const db = getDb();
|
|
4225
4173
|
const items = juniorInboxItems;
|
|
4226
|
-
const
|
|
4174
|
+
const visible = and(inboxItemVisibleTo(inboxItemReaderForUser(viewer)), inboxItemForUser(viewer.id));
|
|
4175
|
+
const ownMatches = db.select({ id: items.id }).from(items).where(and(or(prefixMatch(inboxItemSearchDocument(items), query), fuzzyMatch(inboxItemFuzzyTitle(items), query)), visible)).orderBy(desc(items.updatedAt), desc(items.id)).limit(200);
|
|
4176
|
+
const questionMatches = db.select({ id: items.id }).from(juniorQuestions).innerJoin(items, subjectQuestion(items, juniorQuestions)).where(and(or(prefixMatch(questionSearchDocument(juniorQuestions), query), fuzzyMatch(questionFuzzyTitle(juniorQuestions), query)), visible)).orderBy(desc(items.updatedAt), desc(items.id)).limit(200);
|
|
4177
|
+
const kinds = codeChangeSubjectKinds();
|
|
4178
|
+
const subjectMatches = db.select({ id: items.id }).from(juniorCodeChanges).innerJoin(items, subjectCodeChange(items, juniorCodeChanges)).where(and(prefixMatch(codeChangeSearchDocument(juniorCodeChanges), query), inArray(items.subjectKind, kinds), visible)).orderBy(desc(items.updatedAt), desc(items.id)).limit(200);
|
|
4179
|
+
const candidates = (kinds.length ? union(ownMatches, questionMatches, subjectMatches) : union(ownMatches, questionMatches)).as("inbox_item_candidates");
|
|
4227
4180
|
const item = alias(juniorInboxItems, "inbox_item");
|
|
4228
|
-
const
|
|
4229
|
-
const
|
|
4181
|
+
const question = alias(juniorQuestions, "inbox_item_question");
|
|
4182
|
+
const change = alias(juniorCodeChanges, "inbox_item_change");
|
|
4183
|
+
const document = sql`coalesce(${questionSearchDocument(question)}, ${inboxItemSearchDocument(item)})`;
|
|
4184
|
+
const changeDocument = codeChangeSearchDocument(change);
|
|
4185
|
+
const title = sql`coalesce(${questionFuzzyTitle(question)}, ${inboxItemFuzzyTitle(item)})`;
|
|
4230
4186
|
const rows = await db.select({
|
|
4187
|
+
changeLexical: prefixRank(changeDocument, query),
|
|
4188
|
+
changeMatched: prefixMatch(changeDocument, query),
|
|
4231
4189
|
fuzzy: fuzzyRank(title, query),
|
|
4232
4190
|
fuzzyMatched: fuzzyMatch(title, query),
|
|
4233
4191
|
id: item.id,
|
|
4234
4192
|
lexical: prefixRank(document, query),
|
|
4235
4193
|
lexicalMatched: prefixMatch(document, query),
|
|
4236
4194
|
status: item.status,
|
|
4237
|
-
title: item.title,
|
|
4195
|
+
title: sql`coalesce(${question.title}, ${item.title}, '')`,
|
|
4238
4196
|
updatedAt: item.updatedAt
|
|
4239
|
-
}).from(candidates).innerJoin(item, eq(item.id, candidates.id));
|
|
4197
|
+
}).from(candidates).innerJoin(item, eq(item.id, candidates.id)).leftJoin(question, subjectQuestion(item, question)).leftJoin(change, and(subjectCodeChange(item, change), kinds.length ? inArray(item.subjectKind, kinds) : sql`false`));
|
|
4240
4198
|
const ranked = rankSearchMatches(scoredSearchMatches(rows, {
|
|
4241
4199
|
fuzzy: (row) => row.fuzzyMatched ? Number(row.fuzzy) : void 0,
|
|
4242
|
-
lexical: (row) =>
|
|
4200
|
+
lexical: (row) => {
|
|
4201
|
+
const own = row.lexicalMatched ? Number(row.lexical) : void 0;
|
|
4202
|
+
const subject = row.changeMatched ? Number(row.changeLexical) : void 0;
|
|
4203
|
+
return own === void 0 || subject === void 0 ? own ?? subject : Math.max(own, subject);
|
|
4204
|
+
}
|
|
4243
4205
|
}), {
|
|
4244
4206
|
key: (row) => row.id,
|
|
4245
4207
|
tiebreak: (left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || right.id.localeCompare(left.id)
|
|
@@ -4421,11 +4383,13 @@ function createSearchRoutes() {
|
|
|
4421
4383
|
/**
|
|
4422
4384
|
* Public URL of the OAuth callback for one plugin's service account.
|
|
4423
4385
|
*
|
|
4424
|
-
* It uses the request origin unless
|
|
4386
|
+
* It uses the request origin unless a base URL is configured, so the
|
|
4425
4387
|
* provider sends the Admin back to the dashboard session that started it.
|
|
4388
|
+
* The Vercel URL is not used here: it can name another host than the one
|
|
4389
|
+
* the Admin signed in on.
|
|
4426
4390
|
*/
|
|
4427
4391
|
function callbackUrl(request, provider) {
|
|
4428
|
-
const base =
|
|
4392
|
+
const base = getChatConfig().deployment.configuredBaseUrl ?? new URL(request.url).origin;
|
|
4429
4393
|
return new URL(`api/service-accounts/${encodeURIComponent(provider)}/callback`, base.endsWith("/") ? base : `${base}/`).toString();
|
|
4430
4394
|
}
|
|
4431
4395
|
function requirePlugin(provider) {
|
|
@@ -5180,59 +5144,64 @@ function newestInGroup(group) {
|
|
|
5180
5144
|
const candidateColumns = {
|
|
5181
5145
|
createdAt: juniorInboxItems.createdAt,
|
|
5182
5146
|
id: juniorInboxItems.id,
|
|
5183
|
-
|
|
5184
|
-
subjectUrl: juniorInboxItems.subjectUrl,
|
|
5185
|
-
title: juniorInboxItems.title
|
|
5147
|
+
title: inboxItemTitle.as("title")
|
|
5186
5148
|
};
|
|
5187
5149
|
/**
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
5190
|
-
*
|
|
5191
|
-
*
|
|
5192
|
-
|
|
5150
|
+
* The outside object that a plugin item is about, which related work
|
|
5151
|
+
* matches: its subject id, such as a pull request. A question's related
|
|
5152
|
+
* links show on its card, but they relate it to no other item. Other core
|
|
5153
|
+
* kinds relate to nothing by object.
|
|
5154
|
+
*/
|
|
5155
|
+
function relatedObjects(item) {
|
|
5156
|
+
return subjectKindPlugin(item.subject.kind) ? [item.subject.id] : [];
|
|
5157
|
+
}
|
|
5158
|
+
/**
|
|
5159
|
+
* Read the related work of each open item in a page: the other open plugin
|
|
5160
|
+
* items that the reader can see about the same object
|
|
5161
|
+
* (`relatedObjects`), or in one of the Conversations that the item links,
|
|
5162
|
+
* and the linked Conversations when the viewer can see them. The reads
|
|
5163
|
+
* cover the whole page at once, so the query count does not grow with the
|
|
5164
|
+
* page.
|
|
5193
5165
|
*/
|
|
5194
5166
|
async function readRelatedReviewWork(db, reader, viewer, items) {
|
|
5195
5167
|
const open = items.filter((item) => item.status === "open");
|
|
5196
|
-
const
|
|
5197
|
-
const subjectUrls = [...new Set(open.flatMap((item) => item.subject?.url ?? []))];
|
|
5168
|
+
const objects = [...new Set(open.flatMap(relatedObjects))];
|
|
5198
5169
|
const linkIds = [...new Set(open.flatMap(linkedWork))];
|
|
5199
|
-
const
|
|
5170
|
+
const objectRanks = db.select({
|
|
5200
5171
|
...candidateColumns,
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
}).from(juniorInboxItems).where(and(openVisible(reader),
|
|
5172
|
+
subjectId: juniorInboxItems.subjectId,
|
|
5173
|
+
rank: newestInGroup(juniorInboxItems.subjectId).as("object_rank")
|
|
5174
|
+
}).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(openVisible(reader), like(juniorInboxItems.subjectKind, "%:%"), inArray(juniorInboxItems.subjectId, objects))).as("object_ranks");
|
|
5204
5175
|
const linkRanks = db.select({
|
|
5205
5176
|
...candidateColumns,
|
|
5206
5177
|
conversationId: juniorInboxItemConversations.conversationId,
|
|
5207
5178
|
rank: newestInGroup(juniorInboxItemConversations.conversationId).as("link_rank")
|
|
5208
|
-
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).where(and(inArray(juniorInboxItemConversations.conversationId, linkIds), openVisible(reader))).as("link_ranks");
|
|
5209
|
-
const [
|
|
5210
|
-
|
|
5211
|
-
createdAt:
|
|
5212
|
-
id:
|
|
5213
|
-
subjectId:
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
}).from(subjectRanks).where(or(...subjectIds.length > 0 ? [and(inArray(subjectRanks.subjectId, subjectIds), lte(subjectRanks.idRank, RELATED_CANDIDATE_LIMIT))] : [], ...subjectUrls.length > 0 ? [and(inArray(subjectRanks.subjectUrl, subjectUrls), lte(subjectRanks.urlRank, RELATED_CANDIDATE_LIMIT))] : [])) : [],
|
|
5179
|
+
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).leftJoin(juniorQuestions, itemQuestion).where(and(inArray(juniorInboxItemConversations.conversationId, linkIds), openVisible(reader))).as("link_ranks");
|
|
5180
|
+
const [byObject, byLink, access] = await Promise.all([
|
|
5181
|
+
objects.length > 0 ? db.select({
|
|
5182
|
+
createdAt: objectRanks.createdAt,
|
|
5183
|
+
id: objectRanks.id,
|
|
5184
|
+
subjectId: objectRanks.subjectId,
|
|
5185
|
+
title: objectRanks.title
|
|
5186
|
+
}).from(objectRanks).where(lte(objectRanks.rank, RELATED_CANDIDATE_LIMIT)) : [],
|
|
5217
5187
|
linkIds.length > 0 ? db.select({
|
|
5218
5188
|
conversationId: linkRanks.conversationId,
|
|
5219
5189
|
createdAt: linkRanks.createdAt,
|
|
5220
5190
|
id: linkRanks.id,
|
|
5221
|
-
subjectId: linkRanks.subjectId,
|
|
5222
|
-
subjectUrl: linkRanks.subjectUrl,
|
|
5223
5191
|
title: linkRanks.title
|
|
5224
5192
|
}).from(linkRanks).where(lte(linkRanks.rank, RELATED_CANDIDATE_LIMIT)) : [],
|
|
5225
5193
|
readConversationAccessFromSql(db, linkIds, viewer)
|
|
5226
5194
|
]);
|
|
5227
5195
|
const related = /* @__PURE__ */ new Map();
|
|
5228
5196
|
for (const item of open) {
|
|
5229
|
-
const
|
|
5197
|
+
const about = new Set(relatedObjects(item));
|
|
5198
|
+
const work = new Set(linkedWork(item));
|
|
5230
5199
|
const matches = /* @__PURE__ */ new Map();
|
|
5231
|
-
for (const candidate of
|
|
5232
|
-
for (const candidate of byLink) if (
|
|
5200
|
+
for (const candidate of byObject) if (about.has(candidate.subjectId)) matches.set(candidate.id, candidate);
|
|
5201
|
+
for (const candidate of byLink) if (work.has(candidate.conversationId)) matches.set(candidate.id, candidate);
|
|
5233
5202
|
matches.delete(item.id);
|
|
5234
5203
|
related.set(item.id, {
|
|
5235
|
-
conversationIds:
|
|
5204
|
+
conversationIds: linkedWork(item).filter((id) => access.get(id)?.canViewPrivateContent === true),
|
|
5236
5205
|
items: [...matches.values()].sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime() || b.id.localeCompare(a.id)).slice(0, RELATED_ITEM_LIMIT).map(({ id, title }) => ({
|
|
5237
5206
|
id,
|
|
5238
5207
|
title
|
|
@@ -5310,20 +5279,46 @@ async function visibleRowItems(user, root, inboxItemId) {
|
|
|
5310
5279
|
const item = await getInboxItem(getDb(), inboxItemId);
|
|
5311
5280
|
const owner = item && ownerConversationId(item);
|
|
5312
5281
|
const inRow = root === void 0 || (item ? await rootConversationIds([...item.conversationIds, ...owner ? [owner] : []]) : []).includes(root);
|
|
5313
|
-
if (item?.status === "open" && inRow && await canUserReadInboxItem(item, user))
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5282
|
+
if (item?.status === "open" && inRow && await canUserReadInboxItem(item, user)) {
|
|
5283
|
+
const links = await readSubjectLinks(getDb(), [item]);
|
|
5284
|
+
return [{
|
|
5285
|
+
canAct: canActOnInboxItem(item, user.id),
|
|
5286
|
+
id: item.id,
|
|
5287
|
+
subjectUrl: snoozeLink(item, links)
|
|
5288
|
+
}];
|
|
5289
|
+
}
|
|
5318
5290
|
return [];
|
|
5319
5291
|
}
|
|
5320
5292
|
if (!root) return [];
|
|
5321
5293
|
const reader = await inboxItemReaderForUserInConversation(user, root);
|
|
5322
|
-
|
|
5294
|
+
const rows = await getDb().select({
|
|
5323
5295
|
canAct: sql`${inboxItemForUser(user.id)}`,
|
|
5324
5296
|
id: juniorInboxItems.id,
|
|
5325
|
-
|
|
5326
|
-
|
|
5297
|
+
request: inboxItemRequest,
|
|
5298
|
+
subjectId: juniorInboxItems.subjectId,
|
|
5299
|
+
subjectKind: juniorInboxItems.subjectKind
|
|
5300
|
+
}).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(eq(juniorInboxItems.status, "open"), inboxItemVisibleTo(reader), inboxItemInRow(root)));
|
|
5301
|
+
const items = rows.map((row) => ({
|
|
5302
|
+
request: row.request,
|
|
5303
|
+
subject: {
|
|
5304
|
+
id: row.subjectId,
|
|
5305
|
+
kind: row.subjectKind
|
|
5306
|
+
}
|
|
5307
|
+
}));
|
|
5308
|
+
const links = await readSubjectLinks(getDb(), items);
|
|
5309
|
+
return rows.map((row, index) => ({
|
|
5310
|
+
canAct: row.canAct,
|
|
5311
|
+
id: row.id,
|
|
5312
|
+
subjectUrl: snoozeLink(items[index], links)
|
|
5313
|
+
}));
|
|
5314
|
+
}
|
|
5315
|
+
/**
|
|
5316
|
+
* Return the link that a snooze of the item waits on by default. A
|
|
5317
|
+
* question's subject has no link, so it waits on what its first related
|
|
5318
|
+
* link names, such as a pull request. That does not decide its card.
|
|
5319
|
+
*/
|
|
5320
|
+
function snoozeLink(item, links) {
|
|
5321
|
+
return links.get(subjectKey(item.subject)) ?? questionLinks(item)[0];
|
|
5327
5322
|
}
|
|
5328
5323
|
/**
|
|
5329
5324
|
* Read the resource of each page that the triggers name. The viewer must
|
|
@@ -5495,7 +5490,7 @@ async function readInboxItemMentions(executor, items) {
|
|
|
5495
5490
|
texts: [
|
|
5496
5491
|
item.title,
|
|
5497
5492
|
item.body,
|
|
5498
|
-
item.request?.question
|
|
5493
|
+
inboxItemQuestion(item.request)?.question
|
|
5499
5494
|
]
|
|
5500
5495
|
})));
|
|
5501
5496
|
}
|
|
@@ -5547,11 +5542,21 @@ const ERROR_STATUS = {
|
|
|
5547
5542
|
invalid: 400,
|
|
5548
5543
|
not_found: 404
|
|
5549
5544
|
};
|
|
5550
|
-
function subjectPayload(
|
|
5551
|
-
const
|
|
5552
|
-
const
|
|
5545
|
+
function subjectPayload(item, views, viewer) {
|
|
5546
|
+
const { subject } = item;
|
|
5547
|
+
const view = views.get(subjectKey(subject));
|
|
5548
|
+
const url = view?.url;
|
|
5549
|
+
const object = view?.object;
|
|
5550
|
+
const label = subjectKindLabel(subject.kind, getPlugins(), object, viewer);
|
|
5551
|
+
const objectType = url && readLinkObjectType(url);
|
|
5552
|
+
const snoozeUrl = url ?? questionLinks(item)[0];
|
|
5553
|
+
const resource = snoozeUrl && snoozeSubjectResource(getEventCatalog(), snoozeUrl);
|
|
5553
5554
|
return {
|
|
5554
|
-
|
|
5555
|
+
id: subject.id,
|
|
5556
|
+
kind: subject.kind,
|
|
5557
|
+
...label ? { label } : void 0,
|
|
5558
|
+
...url ? { url } : void 0,
|
|
5559
|
+
...object ? { object } : void 0,
|
|
5555
5560
|
...objectType ? { objectType } : void 0,
|
|
5556
5561
|
...resource ? { resource: {
|
|
5557
5562
|
events: [...resource.events],
|
|
@@ -5572,10 +5577,11 @@ function wakePayload(reason) {
|
|
|
5572
5577
|
};
|
|
5573
5578
|
}
|
|
5574
5579
|
/** Build the API payload of one Inbox item for its viewer. */
|
|
5575
|
-
function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
5580
|
+
function inboxItemPayload(item, viewer, roots, mentions, related, wake, views) {
|
|
5576
5581
|
const conversationId = ownerConversationId(item);
|
|
5577
5582
|
const root = conversationId ? roots.get(conversationId) : void 0;
|
|
5578
|
-
const todo =
|
|
5583
|
+
const todo = subjectTodo(item.subject);
|
|
5584
|
+
const question = inboxItemQuestion(item.request);
|
|
5579
5585
|
return {
|
|
5580
5586
|
...root ? { addedByLabel: root.label } : void 0,
|
|
5581
5587
|
assignedToEveryone: isInboxItemForEveryone(item),
|
|
@@ -5590,43 +5596,44 @@ function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
|
5590
5596
|
kind: item.kind,
|
|
5591
5597
|
owner: item.owner,
|
|
5592
5598
|
status: item.status,
|
|
5599
|
+
subject: subjectPayload(item, views, viewer),
|
|
5593
5600
|
title: item.title,
|
|
5594
5601
|
updatedAt: item.updatedAt.toISOString(),
|
|
5595
5602
|
visibility: item.visibility,
|
|
5596
5603
|
...conversationId ? { rootConversationId: root?.rootConversationId ?? conversationId } : void 0,
|
|
5597
5604
|
...item.answer ? { answer: item.answer } : void 0,
|
|
5598
5605
|
...item.addedByTurnId ? { addedByTurnId: item.addedByTurnId } : void 0,
|
|
5599
|
-
...item.
|
|
5606
|
+
...item.addedByAutomationId ? { automationId: item.addedByAutomationId } : void 0,
|
|
5600
5607
|
...item.closeReason ? { closeReason: item.closeReason } : void 0,
|
|
5601
5608
|
...item.closedAt ? { closedAt: item.closedAt.toISOString() } : void 0,
|
|
5602
5609
|
...item.closedBy ? { closedBy: item.closedBy } : void 0,
|
|
5603
5610
|
...mentions.length > 0 ? { mentions: [...mentions] } : void 0,
|
|
5604
5611
|
...related && (related.items.length > 0 || related.conversationIds.length > 0) ? { related } : void 0,
|
|
5605
|
-
...item.
|
|
5606
|
-
...item.request ? { request: item.request } : void 0,
|
|
5607
|
-
...item.subject ? { subject: subjectPayload(item.subject) } : void 0,
|
|
5612
|
+
...item.request && (question || item.request.related?.length) ? { request: question ?? item.request } : void 0,
|
|
5608
5613
|
...todo ? { todoId: todo.id } : void 0,
|
|
5609
5614
|
...wake ? { wake: wakePayload(wake) } : void 0
|
|
5610
5615
|
};
|
|
5611
5616
|
}
|
|
5612
5617
|
/**
|
|
5613
5618
|
* Build the payloads of a page of items, with the root of each one, the
|
|
5614
|
-
* people they mention, and the related work and
|
|
5615
|
-
* ones. Each read covers the page, and the reads
|
|
5619
|
+
* people they mention, the card of each subject, and the related work and
|
|
5620
|
+
* wake reason of the open ones. Each read covers the page, and the reads
|
|
5621
|
+
* run at once.
|
|
5616
5622
|
*/
|
|
5617
5623
|
async function inboxItemPayloads(items, viewer, reader) {
|
|
5618
5624
|
const db = getDb();
|
|
5619
|
-
const [roots, mentions, related, snoozes] = await Promise.all([
|
|
5625
|
+
const [roots, mentions, related, snoozes, views] = await Promise.all([
|
|
5620
5626
|
readItemRoots(db, items, viewer),
|
|
5621
5627
|
readInboxItemMentions(getSqlExecutor(), items),
|
|
5622
5628
|
readRelatedReviewWork(db, reader, viewer, items),
|
|
5623
5629
|
readViewerInboxSnoozes(db, {
|
|
5624
5630
|
inboxItemIds: items.filter((item) => item.status === "open").map((item) => item.id),
|
|
5625
5631
|
userId: viewer.id
|
|
5626
|
-
})
|
|
5632
|
+
}),
|
|
5633
|
+
resolveInboxItemSubjects(viewer, items)
|
|
5627
5634
|
]);
|
|
5628
5635
|
return items.map((item, index) => {
|
|
5629
|
-
const payload = inboxItemPayload(item, viewer, roots, mentions[index], related.get(item.id), snoozes.wakeReasons.get(item.id));
|
|
5636
|
+
const payload = inboxItemPayload(item, viewer, roots, mentions[index], related.get(item.id), snoozes.wakeReasons.get(item.id), views);
|
|
5630
5637
|
return snoozes.snoozed.has(item.id) ? {
|
|
5631
5638
|
...payload,
|
|
5632
5639
|
snoozedByViewer: true
|
|
@@ -5706,6 +5713,10 @@ function createInboxItemRoutes(services) {
|
|
|
5706
5713
|
const query = context.req.valid("query");
|
|
5707
5714
|
const db = getDb();
|
|
5708
5715
|
const [subjects, snoozed] = await Promise.all([countInboxItemsNeedingUserBySubject(db, viewer.id), query.include.includes("snoozed") ? countViewerSnoozes(viewer) : 0]);
|
|
5716
|
+
const links = await readSubjectLinks(db, subjects.map((subject) => ({ subject: {
|
|
5717
|
+
id: subject.subjectId,
|
|
5718
|
+
kind: subject.subjectKind
|
|
5719
|
+
} })));
|
|
5709
5720
|
let automations = 0;
|
|
5710
5721
|
const linkTypes = readObjectLinkTypes();
|
|
5711
5722
|
let codeChanges = 0;
|
|
@@ -5717,7 +5728,12 @@ function createInboxItemRoutes(services) {
|
|
|
5717
5728
|
needsViewer += subject.total;
|
|
5718
5729
|
decisions += subject.decisions;
|
|
5719
5730
|
todos += subject.todos;
|
|
5720
|
-
|
|
5731
|
+
const key = {
|
|
5732
|
+
id: subject.subjectId,
|
|
5733
|
+
kind: subject.subjectKind
|
|
5734
|
+
};
|
|
5735
|
+
const url = links.get(subjectKey(key));
|
|
5736
|
+
if (codeChangeSubjectProvider(key.kind) || url && readLinkObjectType(url, linkTypes) === "code_change") codeChanges += subject.total;
|
|
5721
5737
|
}
|
|
5722
5738
|
return jsonResponse(inboxItemCountSchema, {
|
|
5723
5739
|
...query.include.includes("automations") ? { automations } : void 0,
|
|
@@ -5966,7 +5982,7 @@ function readDescriptionText(home) {
|
|
|
5966
5982
|
}
|
|
5967
5983
|
/** Read discovered skills for runtime diagnostics and the Automation editor. */
|
|
5968
5984
|
async function readSkillReports() {
|
|
5969
|
-
const { discoverSkills } = await import("./skills-
|
|
5985
|
+
const { discoverSkills } = await import("./skills-CleC0Hze.js").then((n) => n.s);
|
|
5970
5986
|
const skills = await discoverSkills();
|
|
5971
5987
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
5972
5988
|
name: skill.name,
|
|
@@ -5980,7 +5996,7 @@ async function readSkillReports() {
|
|
|
5980
5996
|
* what the skill tells Junior. Returns null when no skill has that name.
|
|
5981
5997
|
*/
|
|
5982
5998
|
async function readSkillDetailReport(name) {
|
|
5983
|
-
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-
|
|
5999
|
+
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-CleC0Hze.js").then((n) => n.s);
|
|
5984
6000
|
const skill = findSkillByName(name, await discoverSkills());
|
|
5985
6001
|
if (!skill) return null;
|
|
5986
6002
|
const parsed = parseSkillFile(await fs.readFile(path.join(skill.skillPath, "SKILL.md"), "utf8"), skill.name);
|
|
@@ -5995,7 +6011,7 @@ async function readSkillDetailReport(name) {
|
|
|
5995
6011
|
}
|
|
5996
6012
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
5997
6013
|
async function readPlugins() {
|
|
5998
|
-
const { pluginCatalogRuntime } = await import("./
|
|
6014
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-BfdAnztW.js").then((n) => n.t);
|
|
5999
6015
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
6000
6016
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
6001
6017
|
description: plugin.manifest.description,
|
|
@@ -6006,8 +6022,8 @@ async function readPlugins() {
|
|
|
6006
6022
|
/** Read authenticated runtime discovery data. */
|
|
6007
6023
|
async function readRuntimeInfoReport() {
|
|
6008
6024
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
6009
|
-
import("./package-discovery-
|
|
6010
|
-
import("./
|
|
6025
|
+
import("./package-discovery-DD9vencX.js").then((n) => n.r),
|
|
6026
|
+
import("./catalog-runtime-BfdAnztW.js").then((n) => n.t),
|
|
6011
6027
|
readPlugins(),
|
|
6012
6028
|
readSkillReports()
|
|
6013
6029
|
]);
|
|
@@ -6024,7 +6040,7 @@ async function readRuntimeInfoReport() {
|
|
|
6024
6040
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
6025
6041
|
async function readPluginOperationalReportFeed() {
|
|
6026
6042
|
const nowMs = Date.now();
|
|
6027
|
-
const { getPluginOperationalReports } = await import("./
|
|
6043
|
+
const { getPluginOperationalReports } = await import("./reports-C1d9azyV.js");
|
|
6028
6044
|
return pluginOperationalReportFeedSchema.parse({
|
|
6029
6045
|
source: "plugins",
|
|
6030
6046
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -6074,9 +6090,7 @@ function createJuniorApi(options = {}) {
|
|
|
6074
6090
|
app.route("/api/search", createSearchRoutes());
|
|
6075
6091
|
app.route("/api/spaces", createSpaceRoutes());
|
|
6076
6092
|
app.route("/api/spaces", createSpaceArchiveRoutes({ queue }));
|
|
6077
|
-
app.route("/api/spaces", createSpaceMemberRoutes());
|
|
6078
6093
|
app.route("/api/spaces", createSpaceConfigurationRoutes());
|
|
6079
|
-
app.route("/api/spaces", createSpaceLeadRoutes());
|
|
6080
6094
|
app.route("/api/user-pages", createUserPageRoutes());
|
|
6081
6095
|
app.route("/api/user-customization", createUserCustomizationRoutes());
|
|
6082
6096
|
app.route("/api/automations", createAutomationRoutes());
|