@sentry/junior 0.316.0 → 0.317.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-CAugg87B.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
- package/dist/api/schema.d.ts +558 -102
- package/dist/api/schema.js +6 -6
- package/dist/api.js +230 -213
- package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +167 -122
- package/dist/catalog-runtime-DfSpJZdY.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-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- 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 +5 -2
- package/dist/cli/upgrade.js +5 -3
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
- package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
- package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
- package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
- package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
- package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
- package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-CuMWy37l.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-CCi7323k.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
- package/dist/{thread-context-fiMNylbg.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.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/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,30 +1,32 @@
|
|
|
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 { t as
|
|
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-CENFf3kI.js";
|
|
2
|
+
import { $o as pauseConversationDelivery, Ad as todoFuzzyTitle, As as listPushSubscriptions, B as conversationIsActiveSql, Ba as microUsdToUsd, Bc as questionLinks, Bd as inboxItemFuzzyTitle, Bl as memoryDb, Bo as credentialContextForActor, Ca as AutomationConflictError, Cd as topLevelConversation, Cl as getDashboardConversationLink, Dc as getInboxItem, Dl as getDashboardSettingsLink, Ei as formatSlackLink, El as getDashboardPersonLink, Et as apiRoutePrefix, Fd as juniorAutomationRuns, Gc as identityAvatarUrl, Gd as juniorAgentBindings, Gl as prefixMatch, Go as codeChangeSubjectProvider, H as conversationStatusSql, Ha as usdToMicroUsdUnbiased, Hc as subjectKindPlugin, Hd as juniorInboxItemConversations, Hl as parseTypedQuery, Ia as readAutomationTitlesByConversationId, Ic as inboxItemRequest, Id as automationFuzzyTitle, Ii as createPluginEmbedder, Il as REVALIDATED_READ_PATHS, In as createInboxItemShow, Jc as readUserAvatarUrls, Ji as createPluginCache, Jl as scoredSearchMatches, Jo as codeChangeUrl, K as conversationKindFromRow, Kl as prefixRank, Ko as readSubjectLinks, Ku as getStateAdapter, L as conversationAggregateColumns, Lc as inboxItemTitle, Ld as automationSearchDocument, Ll as contentVersion, Ln as pushConversationInboxItemsNow, Lt as listTodos, Mc as searchInboxItems, Md as juniorQuestions, Ms as saveNotificationSchedule, Nd as questionFuzzyTitle, Ns as savePushSubscription, Pd as questionSearchDocument, Ps as isPausedBySlack, Pu as completeText, Q as canAnswerInboxItem, Qc as clearInboxWakeReasons, Qd as juniorConversationEvents, Qs as findUserByEmail, R as conversationRangeColumns, Rc as itemQuestion, Rd as juniorAutomations, Rl as contentVersionHeaders, Rt as setTodoStatusByUser, Sd as notLeadConversation, Sr as readConversationAccessFromSql, St as getRegistrations, Ti as escapeSlackMrkdwnText, U as conversationTurnFailedSql, Uc as subjectTodo, Ud as juniorInboxItems, Ul as fuzzyMatch, Vc as subjectKindLabel, Vd as inboxItemSearchDocument, Vl as searchTypedMemories, Wl as fuzzyRank, Wr as runWithSlackInstallation, X as canActOnInboxItem, Xo as linkedCodeProviders, Yo as codeRepositoryUrl, Zd as juniorConversationMetrics, Zo as canPauseConversationDelivery, _o as cancelWatch, a as getDb, ac as updateViewerDisplayName, af as juniorCodeRepositories, al as snoozeInboxItems, bc as listWaitingConversations, br as createConversationAccessReader, cd as parseSlackChannelId, cs as isPublicConversation, ct as inboxItemReaderForUserInConversation, dt as isInboxItemForEveryone, ef as juniorApiTokens, el as inboxItemInRow, eo as getEventCatalog, es as resumeConversationDelivery, et as canUserReadInboxItem, ff as juniorIdentities, fn as steerWebPendingMessages, ft as isOnlyAssignee, gf as juniorDestinations, gs as resolveNotificationTimezone, hf as juniorUsers, hs as sendPushNotificationToUser, i as getConversationStore, if as juniorCodeChanges, il as settleInboxSnoozes, jc as ownerConversationId, jd as todoSearchDocument, jr as getVercelConversationWorkQueue, js as readNotificationSchedule, kd as juniorTodos, kr as rootVisibleToViewer, ks as deletePushSubscription, lf as juniorConversations, ll as automationEventCatalog, lt as inboxItemVisibleTo, mf as slackPersonSearchDocument, ms as readWebPushConfig, mt as itemNeedsUser, nc as readViewerAvatarUrl, nf as codeChangeSearchDocument, ns as createPluginAnnotations, o as getSqlExecutor, ol as snoozeTimerTrigger, pf as slackPersonPredicate, pl as eventWatchUnavailable, qc as readAvatarFetch, qd as juniorConversationParticipants, ql as rankSearchMatches, qo as subjectKey, rc as resolveViewerUser, rf as codeRepositorySearchDocument, rl as readViewerInboxSnoozes, rs as listConversationAnnotations, rt as inboxItemForUser, sl as unsnoozeInboxRow, st as inboxItemReaderForUser, tl as inboxItemSnoozedBy, ud as parseSlackTeamId, vc as countInboxItemsNeedingUserBySubject, vi as postSlackMessage, w as loadConversationSlackTenantIds, wr as readableSlackTeamId, xd as listedConversation, xt as getPlugins, yc as inboxItemsNeedingUserVersionQuery, yd as rootSpaceIdSql, z as conversationUsageCostExpr, za as microUsdSql, zc as INBOX_SUBJECT_KINDS, zl as revalidateContent } from "./db-BFmyYZtJ.js";
|
|
3
|
+
import { E as withSpan, _ as runBestEffort, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging--smS7XRK.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, ct as acceptsWebMessages, 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, mt as webActorFromUser, nt as getSpaceLead, ot as updateSpace, p as AttachmentDownloadError, pn as breakerStates, qt as readViewerAutomationExecutions, rn as viewerAutomationCollection, rt as createSpace, st as writeLegacySpaceArchive, un as savingsTotals, wt as emptyResponse, xt as inviteToConversation, yt as writeAttachmentUpload, zt as changeViewerAutomationLifecycle } from "./agent-runner-AjrEV6Qe.js";
|
|
5
|
+
import { At as spaceListQuerySchema, B as conversationDetailQuerySchema, C as automationScheduleIntentSchema, D as automationVersionActivateSchema, E as automationUpdateSchema, Fn as automationTaskText, G as conversationParamsSchema, It as updateSpaceBodySchema, Kt as MAX_ATTACHMENT_BYTES, L as conversationAttachmentParamsSchema, Mt as spaceParamsSchema, N as CONVERSATION_DETAIL_VERSION_HEADER, O as automationVersionListSchema, Ot as archiveSpaceBodySchema, P as CONVERSATION_VERSION_HEADER, Pt as spaceSchema, R as conversationAttachmentQuerySchema, Rn as notificationScheduleSchema, Rt as conversationReadPositionSchema, T as automationSummarySchema, U as conversationEventPageSchema, V as conversationDetailReportSchema, W as conversationEventsQuerySchema, Wn as apiErrorSchema, _ as automationListQuerySchema, an as compileScheduleIntent, b as automationRunListSchema, c as automationEditSchema, fn as inboxItemQuestion, g as automationListPageSchema, in as ScheduleIntentError, 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-C4iC-IMC.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-DfqrHACA.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--9S0_PXL.js";
|
|
8
|
+
import { Bt as deleteWorkspace, Ft as saveUserCustomization, Gt as listWorkspacesByRepository, It as addConversationNote, Kt as updateWorkspace, L as isAllowedDomain, Pt as readUserCustomization, Vt as getWorkspace, Wt as listWorkspaces, Yt as workspaceRepoCheckoutPath, qt as WorkspaceValidationError, rr as createPluginEgress, tn as isExperimentalFeatureEnabled, z as parseEmail, zt as createWorkspace } from "./mailbox-turn-uSXhUFc9.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-Bxvg5wXf.js";
|
|
10
|
+
import { a as transcriptEntriesFromReportEvents, d as reportParentAgentInput, o as readConversationEventPage } from "./task-runner-C9Yc2_ae.js";
|
|
11
|
+
import { D as saveEnabledProviders, E as readServedProviders, O as cacheKeyPrefix, P as withLock, T as readEnabledProviders, k as createCache, n as getChatConfig, t as botConfig } from "./config-CHQ8X251.js";
|
|
12
|
+
import { a as listChildAgents } from "./parent-result-Ck1rFYRQ.js";
|
|
13
|
+
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-D-FZ8Fin.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-iXMT5Jmh.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-BQ-iBDsZ.js";
|
|
19
|
+
import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-B3VKTGbJ.js";
|
|
20
|
+
import { L as mapBounded, h as createPluginLogger } from "./prompt-Dv7gkpD6.js";
|
|
21
|
+
import { F as listSpaceConfiguration } from "./job-runner-A1lCkybD.js";
|
|
22
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
|
|
23
|
+
import { o as getSandboxResources, t as getCachedSnapshot } from "./resolve-tony4ibz.js";
|
|
22
24
|
import { Hono } from "hono";
|
|
23
25
|
import * as z from "zod";
|
|
24
26
|
import path from "node:path";
|
|
25
27
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
26
28
|
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";
|
|
29
|
+
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
30
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
29
31
|
import fs from "node:fs/promises";
|
|
30
32
|
import { readFileSync } from "node:fs";
|
|
@@ -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,33 @@ 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
|
-
|
|
3005
|
-
|
|
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)) {
|
|
3016
|
+
const result = await setConversationArchive(archived ? {
|
|
3017
|
+
applyToChildren: true,
|
|
3018
|
+
archived: true,
|
|
3019
|
+
conversationId: lead.conversationId
|
|
3020
|
+
} : {
|
|
3021
|
+
applyToChildren: true,
|
|
3022
|
+
archived: false,
|
|
3023
|
+
conversationId: lead.conversationId,
|
|
3024
|
+
userId: viewerUserId
|
|
3025
|
+
});
|
|
3026
|
+
await writeLegacySpaceArchive(spaceId, result.status === "archived" ? new Date(result.archivedAt) : null);
|
|
3027
|
+
}
|
|
3028
|
+
if (archived) await stopArchivedWork(lead.conversationId, options.queue);
|
|
3006
3029
|
return await spaceResponse(viewerUserId, spaceId);
|
|
3007
3030
|
});
|
|
3008
3031
|
return app;
|
|
@@ -3026,80 +3049,6 @@ function createSpaceConfigurationRoutes() {
|
|
|
3026
3049
|
});
|
|
3027
3050
|
return app;
|
|
3028
3051
|
}
|
|
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
3052
|
// src/api/spaces/state.ts
|
|
3104
3053
|
/**
|
|
3105
3054
|
* The most Conversations of the listed Spaces that one read rolls up, newest
|
|
@@ -3108,6 +3057,7 @@ function createSpaceMemberRoutes() {
|
|
|
3108
3057
|
* nothing.
|
|
3109
3058
|
*/
|
|
3110
3059
|
const SPACE_STATE_CONVERSATION_LIMIT = 200;
|
|
3060
|
+
const spaceLead = alias(juniorConversations, "state_space_lead");
|
|
3111
3061
|
const TREE_STATE_ORDER = [
|
|
3112
3062
|
"needs_you",
|
|
3113
3063
|
"working",
|
|
@@ -3122,11 +3072,12 @@ const TREE_STATE_ORDER = [
|
|
|
3122
3072
|
*/
|
|
3123
3073
|
async function readSpaceStates(db, spaceIds, viewerUserId) {
|
|
3124
3074
|
if (spaceIds.length === 0) return /* @__PURE__ */ new Map();
|
|
3075
|
+
const leads = db.select({ id: spaceLead.conversationId }).from(spaceLead).where(and(eq(spaceLead.kind, "lead"), inArray(spaceLead.spaceId, [...spaceIds])));
|
|
3125
3076
|
const roots = await db.select({
|
|
3126
3077
|
conversationId: juniorConversations.conversationId,
|
|
3127
|
-
spaceId: juniorConversations
|
|
3078
|
+
spaceId: rootSpaceIdSql(juniorConversations),
|
|
3128
3079
|
latestTurnFailed: conversationTurnFailedSql(juniorConversations)
|
|
3129
|
-
}).from(juniorConversations).where(and(inArray(juniorConversations.
|
|
3080
|
+
}).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
3081
|
const trees = await readConversationTreeStates(db, roots.map((root) => root.conversationId), viewerUserId);
|
|
3131
3082
|
const states = new Map(spaceIds.map((spaceId) => [spaceId, {
|
|
3132
3083
|
latestTurnFailed: false,
|
|
@@ -3157,7 +3108,7 @@ function createSpaceRoutes() {
|
|
|
3157
3108
|
app.post("/", requireViewer, validateRequest("json", createSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
3158
3109
|
const body = context.req.valid("json");
|
|
3159
3110
|
const space = await createSpace({
|
|
3160
|
-
|
|
3111
|
+
creator: context.get("viewer"),
|
|
3161
3112
|
name: body.name,
|
|
3162
3113
|
description: body.description ?? null,
|
|
3163
3114
|
visibility: body.visibility
|
|
@@ -3583,7 +3534,7 @@ async function readPeoplePluginReports(args) {
|
|
|
3583
3534
|
reports: [],
|
|
3584
3535
|
source: "plugins"
|
|
3585
3536
|
});
|
|
3586
|
-
const { getPluginProfileReports } = await import("./
|
|
3537
|
+
const { getPluginProfileReports } = await import("./reports-WKHfGTsU.js");
|
|
3587
3538
|
return pluginOperationalReportFeedSchema.parse({
|
|
3588
3539
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3589
3540
|
reports: await getPluginProfileReports({
|
|
@@ -3939,7 +3890,7 @@ async function readUserSearchFromSql(args) {
|
|
|
3939
3890
|
const { target } = args;
|
|
3940
3891
|
const db = getDb();
|
|
3941
3892
|
const slack = alias(juniorIdentities, "user_search_slack");
|
|
3942
|
-
const slackJoin = and(eq(slack.userId, juniorUsers.id), slackPersonPredicate(slack)
|
|
3893
|
+
const slackJoin = and(eq(slack.userId, juniorUsers.id), slackPersonPredicate(slack));
|
|
3943
3894
|
const name = sql`lower(coalesce(${juniorUsers.displayName}, ${slack.displayName}, ''))`;
|
|
3944
3895
|
const handle = sql`lower(coalesce(${slack.handle}, ''))`;
|
|
3945
3896
|
const email = juniorUsers.primaryEmailNormalized;
|
|
@@ -3947,22 +3898,19 @@ async function readUserSearchFromSql(args) {
|
|
|
3947
3898
|
const exact = sql`(${name} = ${whole} or ${handle} = ${whole} or ${email} = ${whole} or split_part(${email}, '@', 1) = ${whole})`;
|
|
3948
3899
|
const prefix = sql`(starts_with(${name}, ${whole}) or starts_with(${handle}, ${whole}) or starts_with(${email}, ${whole}) or strpos(' ' || ${name}, ' ' || ${whole}) > 0)`;
|
|
3949
3900
|
const rank = sql`case when ${exact} then 0 when ${prefix} then 1 else 2 end`;
|
|
3950
|
-
const
|
|
3901
|
+
const matches = db.selectDistinctOn([juniorUsers.id], {
|
|
3951
3902
|
email: juniorUsers.primaryEmail,
|
|
3952
3903
|
emailNormalized: email,
|
|
3953
3904
|
fullName: sql`coalesce(${juniorUsers.displayName}, ${slack.displayName})`.as("full_name"),
|
|
3954
3905
|
rank: rank.as("rank"),
|
|
3955
|
-
slackUserId: slack.providerSubjectId,
|
|
3956
3906
|
slackUserName: slack.handle,
|
|
3957
3907
|
sortName: name.as("sort_name"),
|
|
3958
3908
|
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");
|
|
3909
|
+
}).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
3910
|
const rows = await db.select({
|
|
3962
3911
|
email: matches.email,
|
|
3963
3912
|
fullName: matches.fullName,
|
|
3964
3913
|
isMember: memberSql(db, target, matches.userId).as("is_member"),
|
|
3965
|
-
slackUserId: matches.slackUserId,
|
|
3966
3914
|
slackUserName: matches.slackUserName,
|
|
3967
3915
|
userId: matches.userId
|
|
3968
3916
|
}).from(matches).orderBy(asc(matches.rank), asc(matches.sortName), asc(matches.emailNormalized), asc(matches.userId)).limit(args.limit);
|
|
@@ -3975,26 +3923,24 @@ async function readUserSearchFromSql(args) {
|
|
|
3975
3923
|
userId: row.userId,
|
|
3976
3924
|
...fullName ? { fullName } : void 0,
|
|
3977
3925
|
...row.slackUserName ? { slackUserName: row.slackUserName } : void 0,
|
|
3978
|
-
...target.kind === "conversation" && row.slackUserId ? { slackUserId: row.slackUserId } : void 0,
|
|
3979
3926
|
...avatarUrl ? { avatarUrl } : void 0,
|
|
3980
3927
|
...row.isMember ? { isMember: true } : void 0
|
|
3981
3928
|
};
|
|
3982
3929
|
});
|
|
3983
3930
|
}
|
|
3984
|
-
/** SQL: the User is already a
|
|
3931
|
+
/** SQL: the User is already a Participant of the root. */
|
|
3985
3932
|
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
3933
|
const participants = juniorConversationParticipants;
|
|
3988
3934
|
return sql`${exists(db.select({ userId: participants.userId }).from(participants).where(and(eq(participants.rootConversationId, target.rootConversationId), eq(participants.userId, userId))))}`;
|
|
3989
3935
|
}
|
|
3990
3936
|
// src/api/people/user-search.ts
|
|
3991
3937
|
/**
|
|
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
|
|
3938
|
+
* Find Users to add to a Conversation, such as a Space's Lead. The viewer
|
|
3939
|
+
* must be able to read it, so who is a Participant does not leak;
|
|
3940
|
+
* otherwise it looks missing. The Users are those of this install, which is
|
|
3941
|
+
* the tenant of every dashboard Conversation, with or without a Slack
|
|
3942
|
+
* account. Whether the viewer may add them stays with the route that adds
|
|
3943
|
+
* them.
|
|
3998
3944
|
*/
|
|
3999
3945
|
async function searchUsersForViewer(viewer, query) {
|
|
4000
3946
|
return await readUserSearchFromSql({
|
|
@@ -4004,21 +3950,10 @@ async function searchUsersForViewer(viewer, query) {
|
|
|
4004
3950
|
});
|
|
4005
3951
|
}
|
|
4006
3952
|
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;
|
|
3953
|
+
const { conversationId } = query;
|
|
4015
3954
|
const access = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId);
|
|
4016
3955
|
if (!access?.canViewPrivateContent || !access.rootConversationId) throwApiError(404, "Conversation not found.");
|
|
4017
|
-
return {
|
|
4018
|
-
kind: "conversation",
|
|
4019
|
-
rootConversationId: access.rootConversationId,
|
|
4020
|
-
slackTeamId: readableSlackTeamId(access)
|
|
4021
|
-
};
|
|
3956
|
+
return { rootConversationId: access.rootConversationId };
|
|
4022
3957
|
}
|
|
4023
3958
|
// src/api/people/routes.ts
|
|
4024
3959
|
/** Create the HTTP routes owned by the People API. */
|
|
@@ -4213,33 +4148,63 @@ async function searchAutomationsForViewer(viewer, query, limit) {
|
|
|
4213
4148
|
}]);
|
|
4214
4149
|
}
|
|
4215
4150
|
// src/chat/inbox-items/search.ts
|
|
4151
|
+
function codeChangeSubjectKinds() {
|
|
4152
|
+
return getPlugins().flatMap((plugin) => (plugin.inboxSubjects ?? []).flatMap((subject) => {
|
|
4153
|
+
const kind = `${plugin.manifest.name}:${subject.kind}`;
|
|
4154
|
+
return codeChangeSubjectProvider(kind) ? [kind] : [];
|
|
4155
|
+
}));
|
|
4156
|
+
}
|
|
4157
|
+
function subjectCodeChange(item, change) {
|
|
4158
|
+
return and(eq(change.providerId, item.subjectId), eq(change.provider, sql`split_part(${item.subjectKind}, ':', 1)`));
|
|
4159
|
+
}
|
|
4160
|
+
function subjectQuestion(item, question) {
|
|
4161
|
+
return and(eq(item.subjectKind, INBOX_SUBJECT_KINDS.question), eq(question.id, item.subjectId));
|
|
4162
|
+
}
|
|
4216
4163
|
/**
|
|
4217
4164
|
* Find the items of the viewer's own Inbox, open and closed, as the Inbox
|
|
4218
4165
|
* 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.
|
|
4166
|
+
* query, or the title is close to the query despite a typo. A question
|
|
4167
|
+
* item matches on its question's title and body. An item whose subject is
|
|
4168
|
+
* a code change also matches on the code change's title. Open items come
|
|
4220
4169
|
* first, each group best match first. Reads the GIN indexes
|
|
4221
|
-
* `junior_inbox_items_search_idx
|
|
4170
|
+
* `junior_inbox_items_search_idx`, `junior_inbox_items_title_trgm_idx`,
|
|
4171
|
+
* `junior_questions_search_idx`, `junior_questions_title_trgm_idx`, and
|
|
4172
|
+
* `junior_code_changes_search_idx`.
|
|
4222
4173
|
*/
|
|
4223
4174
|
async function searchInboxItemsForUser(viewer, query, limit) {
|
|
4224
4175
|
const db = getDb();
|
|
4225
4176
|
const items = juniorInboxItems;
|
|
4226
|
-
const
|
|
4177
|
+
const visible = and(inboxItemVisibleTo(inboxItemReaderForUser(viewer)), inboxItemForUser(viewer.id));
|
|
4178
|
+
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);
|
|
4179
|
+
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);
|
|
4180
|
+
const kinds = codeChangeSubjectKinds();
|
|
4181
|
+
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);
|
|
4182
|
+
const candidates = (kinds.length ? union(ownMatches, questionMatches, subjectMatches) : union(ownMatches, questionMatches)).as("inbox_item_candidates");
|
|
4227
4183
|
const item = alias(juniorInboxItems, "inbox_item");
|
|
4228
|
-
const
|
|
4229
|
-
const
|
|
4184
|
+
const question = alias(juniorQuestions, "inbox_item_question");
|
|
4185
|
+
const change = alias(juniorCodeChanges, "inbox_item_change");
|
|
4186
|
+
const document = sql`coalesce(${questionSearchDocument(question)}, ${inboxItemSearchDocument(item)})`;
|
|
4187
|
+
const changeDocument = codeChangeSearchDocument(change);
|
|
4188
|
+
const title = sql`coalesce(${questionFuzzyTitle(question)}, ${inboxItemFuzzyTitle(item)})`;
|
|
4230
4189
|
const rows = await db.select({
|
|
4190
|
+
changeLexical: prefixRank(changeDocument, query),
|
|
4191
|
+
changeMatched: prefixMatch(changeDocument, query),
|
|
4231
4192
|
fuzzy: fuzzyRank(title, query),
|
|
4232
4193
|
fuzzyMatched: fuzzyMatch(title, query),
|
|
4233
4194
|
id: item.id,
|
|
4234
4195
|
lexical: prefixRank(document, query),
|
|
4235
4196
|
lexicalMatched: prefixMatch(document, query),
|
|
4236
4197
|
status: item.status,
|
|
4237
|
-
title: item.title,
|
|
4198
|
+
title: sql`coalesce(${question.title}, ${item.title}, '')`,
|
|
4238
4199
|
updatedAt: item.updatedAt
|
|
4239
|
-
}).from(candidates).innerJoin(item, eq(item.id, candidates.id));
|
|
4200
|
+
}).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
4201
|
const ranked = rankSearchMatches(scoredSearchMatches(rows, {
|
|
4241
4202
|
fuzzy: (row) => row.fuzzyMatched ? Number(row.fuzzy) : void 0,
|
|
4242
|
-
lexical: (row) =>
|
|
4203
|
+
lexical: (row) => {
|
|
4204
|
+
const own = row.lexicalMatched ? Number(row.lexical) : void 0;
|
|
4205
|
+
const subject = row.changeMatched ? Number(row.changeLexical) : void 0;
|
|
4206
|
+
return own === void 0 || subject === void 0 ? own ?? subject : Math.max(own, subject);
|
|
4207
|
+
}
|
|
4243
4208
|
}), {
|
|
4244
4209
|
key: (row) => row.id,
|
|
4245
4210
|
tiebreak: (left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || right.id.localeCompare(left.id)
|
|
@@ -4421,11 +4386,13 @@ function createSearchRoutes() {
|
|
|
4421
4386
|
/**
|
|
4422
4387
|
* Public URL of the OAuth callback for one plugin's service account.
|
|
4423
4388
|
*
|
|
4424
|
-
* It uses the request origin unless
|
|
4389
|
+
* It uses the request origin unless a base URL is configured, so the
|
|
4425
4390
|
* provider sends the Admin back to the dashboard session that started it.
|
|
4391
|
+
* The Vercel URL is not used here: it can name another host than the one
|
|
4392
|
+
* the Admin signed in on.
|
|
4426
4393
|
*/
|
|
4427
4394
|
function callbackUrl(request, provider) {
|
|
4428
|
-
const base =
|
|
4395
|
+
const base = getChatConfig().deployment.configuredBaseUrl ?? new URL(request.url).origin;
|
|
4429
4396
|
return new URL(`api/service-accounts/${encodeURIComponent(provider)}/callback`, base.endsWith("/") ? base : `${base}/`).toString();
|
|
4430
4397
|
}
|
|
4431
4398
|
function requirePlugin(provider) {
|
|
@@ -5180,59 +5147,64 @@ function newestInGroup(group) {
|
|
|
5180
5147
|
const candidateColumns = {
|
|
5181
5148
|
createdAt: juniorInboxItems.createdAt,
|
|
5182
5149
|
id: juniorInboxItems.id,
|
|
5183
|
-
|
|
5184
|
-
subjectUrl: juniorInboxItems.subjectUrl,
|
|
5185
|
-
title: juniorInboxItems.title
|
|
5150
|
+
title: inboxItemTitle.as("title")
|
|
5186
5151
|
};
|
|
5187
5152
|
/**
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
5190
|
-
*
|
|
5191
|
-
*
|
|
5192
|
-
|
|
5153
|
+
* The outside object that a plugin item is about, which related work
|
|
5154
|
+
* matches: its subject id, such as a pull request. A question's related
|
|
5155
|
+
* links show on its card, but they relate it to no other item. Other core
|
|
5156
|
+
* kinds relate to nothing by object.
|
|
5157
|
+
*/
|
|
5158
|
+
function relatedObjects(item) {
|
|
5159
|
+
return subjectKindPlugin(item.subject.kind) ? [item.subject.id] : [];
|
|
5160
|
+
}
|
|
5161
|
+
/**
|
|
5162
|
+
* Read the related work of each open item in a page: the other open plugin
|
|
5163
|
+
* items that the reader can see about the same object
|
|
5164
|
+
* (`relatedObjects`), or in one of the Conversations that the item links,
|
|
5165
|
+
* and the linked Conversations when the viewer can see them. The reads
|
|
5166
|
+
* cover the whole page at once, so the query count does not grow with the
|
|
5167
|
+
* page.
|
|
5193
5168
|
*/
|
|
5194
5169
|
async function readRelatedReviewWork(db, reader, viewer, items) {
|
|
5195
5170
|
const open = items.filter((item) => item.status === "open");
|
|
5196
|
-
const
|
|
5197
|
-
const subjectUrls = [...new Set(open.flatMap((item) => item.subject?.url ?? []))];
|
|
5171
|
+
const objects = [...new Set(open.flatMap(relatedObjects))];
|
|
5198
5172
|
const linkIds = [...new Set(open.flatMap(linkedWork))];
|
|
5199
|
-
const
|
|
5173
|
+
const objectRanks = db.select({
|
|
5200
5174
|
...candidateColumns,
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
}).from(juniorInboxItems).where(and(openVisible(reader),
|
|
5175
|
+
subjectId: juniorInboxItems.subjectId,
|
|
5176
|
+
rank: newestInGroup(juniorInboxItems.subjectId).as("object_rank")
|
|
5177
|
+
}).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(openVisible(reader), like(juniorInboxItems.subjectKind, "%:%"), inArray(juniorInboxItems.subjectId, objects))).as("object_ranks");
|
|
5204
5178
|
const linkRanks = db.select({
|
|
5205
5179
|
...candidateColumns,
|
|
5206
5180
|
conversationId: juniorInboxItemConversations.conversationId,
|
|
5207
5181
|
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))] : [])) : [],
|
|
5182
|
+
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).leftJoin(juniorQuestions, itemQuestion).where(and(inArray(juniorInboxItemConversations.conversationId, linkIds), openVisible(reader))).as("link_ranks");
|
|
5183
|
+
const [byObject, byLink, access] = await Promise.all([
|
|
5184
|
+
objects.length > 0 ? db.select({
|
|
5185
|
+
createdAt: objectRanks.createdAt,
|
|
5186
|
+
id: objectRanks.id,
|
|
5187
|
+
subjectId: objectRanks.subjectId,
|
|
5188
|
+
title: objectRanks.title
|
|
5189
|
+
}).from(objectRanks).where(lte(objectRanks.rank, RELATED_CANDIDATE_LIMIT)) : [],
|
|
5217
5190
|
linkIds.length > 0 ? db.select({
|
|
5218
5191
|
conversationId: linkRanks.conversationId,
|
|
5219
5192
|
createdAt: linkRanks.createdAt,
|
|
5220
5193
|
id: linkRanks.id,
|
|
5221
|
-
subjectId: linkRanks.subjectId,
|
|
5222
|
-
subjectUrl: linkRanks.subjectUrl,
|
|
5223
5194
|
title: linkRanks.title
|
|
5224
5195
|
}).from(linkRanks).where(lte(linkRanks.rank, RELATED_CANDIDATE_LIMIT)) : [],
|
|
5225
5196
|
readConversationAccessFromSql(db, linkIds, viewer)
|
|
5226
5197
|
]);
|
|
5227
5198
|
const related = /* @__PURE__ */ new Map();
|
|
5228
5199
|
for (const item of open) {
|
|
5229
|
-
const
|
|
5200
|
+
const about = new Set(relatedObjects(item));
|
|
5201
|
+
const work = new Set(linkedWork(item));
|
|
5230
5202
|
const matches = /* @__PURE__ */ new Map();
|
|
5231
|
-
for (const candidate of
|
|
5232
|
-
for (const candidate of byLink) if (
|
|
5203
|
+
for (const candidate of byObject) if (about.has(candidate.subjectId)) matches.set(candidate.id, candidate);
|
|
5204
|
+
for (const candidate of byLink) if (work.has(candidate.conversationId)) matches.set(candidate.id, candidate);
|
|
5233
5205
|
matches.delete(item.id);
|
|
5234
5206
|
related.set(item.id, {
|
|
5235
|
-
conversationIds:
|
|
5207
|
+
conversationIds: linkedWork(item).filter((id) => access.get(id)?.canViewPrivateContent === true),
|
|
5236
5208
|
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
5209
|
id,
|
|
5238
5210
|
title
|
|
@@ -5310,20 +5282,46 @@ async function visibleRowItems(user, root, inboxItemId) {
|
|
|
5310
5282
|
const item = await getInboxItem(getDb(), inboxItemId);
|
|
5311
5283
|
const owner = item && ownerConversationId(item);
|
|
5312
5284
|
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
|
-
|
|
5285
|
+
if (item?.status === "open" && inRow && await canUserReadInboxItem(item, user)) {
|
|
5286
|
+
const links = await readSubjectLinks(getDb(), [item]);
|
|
5287
|
+
return [{
|
|
5288
|
+
canAct: canActOnInboxItem(item, user.id),
|
|
5289
|
+
id: item.id,
|
|
5290
|
+
subjectUrl: snoozeLink(item, links)
|
|
5291
|
+
}];
|
|
5292
|
+
}
|
|
5318
5293
|
return [];
|
|
5319
5294
|
}
|
|
5320
5295
|
if (!root) return [];
|
|
5321
5296
|
const reader = await inboxItemReaderForUserInConversation(user, root);
|
|
5322
|
-
|
|
5297
|
+
const rows = await getDb().select({
|
|
5323
5298
|
canAct: sql`${inboxItemForUser(user.id)}`,
|
|
5324
5299
|
id: juniorInboxItems.id,
|
|
5325
|
-
|
|
5326
|
-
|
|
5300
|
+
request: inboxItemRequest,
|
|
5301
|
+
subjectId: juniorInboxItems.subjectId,
|
|
5302
|
+
subjectKind: juniorInboxItems.subjectKind
|
|
5303
|
+
}).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(eq(juniorInboxItems.status, "open"), inboxItemVisibleTo(reader), inboxItemInRow(root)));
|
|
5304
|
+
const items = rows.map((row) => ({
|
|
5305
|
+
request: row.request,
|
|
5306
|
+
subject: {
|
|
5307
|
+
id: row.subjectId,
|
|
5308
|
+
kind: row.subjectKind
|
|
5309
|
+
}
|
|
5310
|
+
}));
|
|
5311
|
+
const links = await readSubjectLinks(getDb(), items);
|
|
5312
|
+
return rows.map((row, index) => ({
|
|
5313
|
+
canAct: row.canAct,
|
|
5314
|
+
id: row.id,
|
|
5315
|
+
subjectUrl: snoozeLink(items[index], links)
|
|
5316
|
+
}));
|
|
5317
|
+
}
|
|
5318
|
+
/**
|
|
5319
|
+
* Return the link that a snooze of the item waits on by default. A
|
|
5320
|
+
* question's subject has no link, so it waits on what its first related
|
|
5321
|
+
* link names, such as a pull request. That does not decide its card.
|
|
5322
|
+
*/
|
|
5323
|
+
function snoozeLink(item, links) {
|
|
5324
|
+
return links.get(subjectKey(item.subject)) ?? questionLinks(item)[0];
|
|
5327
5325
|
}
|
|
5328
5326
|
/**
|
|
5329
5327
|
* Read the resource of each page that the triggers name. The viewer must
|
|
@@ -5495,7 +5493,7 @@ async function readInboxItemMentions(executor, items) {
|
|
|
5495
5493
|
texts: [
|
|
5496
5494
|
item.title,
|
|
5497
5495
|
item.body,
|
|
5498
|
-
item.request?.question
|
|
5496
|
+
inboxItemQuestion(item.request)?.question
|
|
5499
5497
|
]
|
|
5500
5498
|
})));
|
|
5501
5499
|
}
|
|
@@ -5547,11 +5545,21 @@ const ERROR_STATUS = {
|
|
|
5547
5545
|
invalid: 400,
|
|
5548
5546
|
not_found: 404
|
|
5549
5547
|
};
|
|
5550
|
-
function subjectPayload(
|
|
5551
|
-
const
|
|
5552
|
-
const
|
|
5548
|
+
function subjectPayload(item, views, viewer) {
|
|
5549
|
+
const { subject } = item;
|
|
5550
|
+
const view = views.get(subjectKey(subject));
|
|
5551
|
+
const url = view?.url;
|
|
5552
|
+
const object = view?.object;
|
|
5553
|
+
const label = subjectKindLabel(subject.kind, getPlugins(), object, viewer);
|
|
5554
|
+
const objectType = url && readLinkObjectType(url);
|
|
5555
|
+
const snoozeUrl = url ?? questionLinks(item)[0];
|
|
5556
|
+
const resource = snoozeUrl && snoozeSubjectResource(getEventCatalog(), snoozeUrl);
|
|
5553
5557
|
return {
|
|
5554
|
-
|
|
5558
|
+
id: subject.id,
|
|
5559
|
+
kind: subject.kind,
|
|
5560
|
+
...label ? { label } : void 0,
|
|
5561
|
+
...url ? { url } : void 0,
|
|
5562
|
+
...object ? { object } : void 0,
|
|
5555
5563
|
...objectType ? { objectType } : void 0,
|
|
5556
5564
|
...resource ? { resource: {
|
|
5557
5565
|
events: [...resource.events],
|
|
@@ -5572,10 +5580,11 @@ function wakePayload(reason) {
|
|
|
5572
5580
|
};
|
|
5573
5581
|
}
|
|
5574
5582
|
/** Build the API payload of one Inbox item for its viewer. */
|
|
5575
|
-
function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
5583
|
+
function inboxItemPayload(item, viewer, roots, mentions, related, wake, views) {
|
|
5576
5584
|
const conversationId = ownerConversationId(item);
|
|
5577
5585
|
const root = conversationId ? roots.get(conversationId) : void 0;
|
|
5578
|
-
const todo =
|
|
5586
|
+
const todo = subjectTodo(item.subject);
|
|
5587
|
+
const question = inboxItemQuestion(item.request);
|
|
5579
5588
|
return {
|
|
5580
5589
|
...root ? { addedByLabel: root.label } : void 0,
|
|
5581
5590
|
assignedToEveryone: isInboxItemForEveryone(item),
|
|
@@ -5590,43 +5599,44 @@ function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
|
5590
5599
|
kind: item.kind,
|
|
5591
5600
|
owner: item.owner,
|
|
5592
5601
|
status: item.status,
|
|
5602
|
+
subject: subjectPayload(item, views, viewer),
|
|
5593
5603
|
title: item.title,
|
|
5594
5604
|
updatedAt: item.updatedAt.toISOString(),
|
|
5595
5605
|
visibility: item.visibility,
|
|
5596
5606
|
...conversationId ? { rootConversationId: root?.rootConversationId ?? conversationId } : void 0,
|
|
5597
5607
|
...item.answer ? { answer: item.answer } : void 0,
|
|
5598
5608
|
...item.addedByTurnId ? { addedByTurnId: item.addedByTurnId } : void 0,
|
|
5599
|
-
...item.
|
|
5609
|
+
...item.addedByAutomationId ? { automationId: item.addedByAutomationId } : void 0,
|
|
5600
5610
|
...item.closeReason ? { closeReason: item.closeReason } : void 0,
|
|
5601
5611
|
...item.closedAt ? { closedAt: item.closedAt.toISOString() } : void 0,
|
|
5602
5612
|
...item.closedBy ? { closedBy: item.closedBy } : void 0,
|
|
5603
5613
|
...mentions.length > 0 ? { mentions: [...mentions] } : void 0,
|
|
5604
5614
|
...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,
|
|
5615
|
+
...item.request && (question || item.request.related?.length) ? { request: question ?? item.request } : void 0,
|
|
5608
5616
|
...todo ? { todoId: todo.id } : void 0,
|
|
5609
5617
|
...wake ? { wake: wakePayload(wake) } : void 0
|
|
5610
5618
|
};
|
|
5611
5619
|
}
|
|
5612
5620
|
/**
|
|
5613
5621
|
* 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
|
|
5622
|
+
* people they mention, the card of each subject, and the related work and
|
|
5623
|
+
* wake reason of the open ones. Each read covers the page, and the reads
|
|
5624
|
+
* run at once.
|
|
5616
5625
|
*/
|
|
5617
5626
|
async function inboxItemPayloads(items, viewer, reader) {
|
|
5618
5627
|
const db = getDb();
|
|
5619
|
-
const [roots, mentions, related, snoozes] = await Promise.all([
|
|
5628
|
+
const [roots, mentions, related, snoozes, views] = await Promise.all([
|
|
5620
5629
|
readItemRoots(db, items, viewer),
|
|
5621
5630
|
readInboxItemMentions(getSqlExecutor(), items),
|
|
5622
5631
|
readRelatedReviewWork(db, reader, viewer, items),
|
|
5623
5632
|
readViewerInboxSnoozes(db, {
|
|
5624
5633
|
inboxItemIds: items.filter((item) => item.status === "open").map((item) => item.id),
|
|
5625
5634
|
userId: viewer.id
|
|
5626
|
-
})
|
|
5635
|
+
}),
|
|
5636
|
+
resolveInboxItemSubjects(viewer, items)
|
|
5627
5637
|
]);
|
|
5628
5638
|
return items.map((item, index) => {
|
|
5629
|
-
const payload = inboxItemPayload(item, viewer, roots, mentions[index], related.get(item.id), snoozes.wakeReasons.get(item.id));
|
|
5639
|
+
const payload = inboxItemPayload(item, viewer, roots, mentions[index], related.get(item.id), snoozes.wakeReasons.get(item.id), views);
|
|
5630
5640
|
return snoozes.snoozed.has(item.id) ? {
|
|
5631
5641
|
...payload,
|
|
5632
5642
|
snoozedByViewer: true
|
|
@@ -5706,6 +5716,10 @@ function createInboxItemRoutes(services) {
|
|
|
5706
5716
|
const query = context.req.valid("query");
|
|
5707
5717
|
const db = getDb();
|
|
5708
5718
|
const [subjects, snoozed] = await Promise.all([countInboxItemsNeedingUserBySubject(db, viewer.id), query.include.includes("snoozed") ? countViewerSnoozes(viewer) : 0]);
|
|
5719
|
+
const links = await readSubjectLinks(db, subjects.map((subject) => ({ subject: {
|
|
5720
|
+
id: subject.subjectId,
|
|
5721
|
+
kind: subject.subjectKind
|
|
5722
|
+
} })));
|
|
5709
5723
|
let automations = 0;
|
|
5710
5724
|
const linkTypes = readObjectLinkTypes();
|
|
5711
5725
|
let codeChanges = 0;
|
|
@@ -5717,7 +5731,12 @@ function createInboxItemRoutes(services) {
|
|
|
5717
5731
|
needsViewer += subject.total;
|
|
5718
5732
|
decisions += subject.decisions;
|
|
5719
5733
|
todos += subject.todos;
|
|
5720
|
-
|
|
5734
|
+
const key = {
|
|
5735
|
+
id: subject.subjectId,
|
|
5736
|
+
kind: subject.subjectKind
|
|
5737
|
+
};
|
|
5738
|
+
const url = links.get(subjectKey(key));
|
|
5739
|
+
if (codeChangeSubjectProvider(key.kind) || url && readLinkObjectType(url, linkTypes) === "code_change") codeChanges += subject.total;
|
|
5721
5740
|
}
|
|
5722
5741
|
return jsonResponse(inboxItemCountSchema, {
|
|
5723
5742
|
...query.include.includes("automations") ? { automations } : void 0,
|
|
@@ -5966,7 +5985,7 @@ function readDescriptionText(home) {
|
|
|
5966
5985
|
}
|
|
5967
5986
|
/** Read discovered skills for runtime diagnostics and the Automation editor. */
|
|
5968
5987
|
async function readSkillReports() {
|
|
5969
|
-
const { discoverSkills } = await import("./skills-
|
|
5988
|
+
const { discoverSkills } = await import("./skills-BCEU41zM.js").then((n) => n.s);
|
|
5970
5989
|
const skills = await discoverSkills();
|
|
5971
5990
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
5972
5991
|
name: skill.name,
|
|
@@ -5980,7 +5999,7 @@ async function readSkillReports() {
|
|
|
5980
5999
|
* what the skill tells Junior. Returns null when no skill has that name.
|
|
5981
6000
|
*/
|
|
5982
6001
|
async function readSkillDetailReport(name) {
|
|
5983
|
-
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-
|
|
6002
|
+
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-BCEU41zM.js").then((n) => n.s);
|
|
5984
6003
|
const skill = findSkillByName(name, await discoverSkills());
|
|
5985
6004
|
if (!skill) return null;
|
|
5986
6005
|
const parsed = parseSkillFile(await fs.readFile(path.join(skill.skillPath, "SKILL.md"), "utf8"), skill.name);
|
|
@@ -5995,7 +6014,7 @@ async function readSkillDetailReport(name) {
|
|
|
5995
6014
|
}
|
|
5996
6015
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
5997
6016
|
async function readPlugins() {
|
|
5998
|
-
const { pluginCatalogRuntime } = await import("./
|
|
6017
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-DfSpJZdY.js").then((n) => n.t);
|
|
5999
6018
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
6000
6019
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
6001
6020
|
description: plugin.manifest.description,
|
|
@@ -6006,8 +6025,8 @@ async function readPlugins() {
|
|
|
6006
6025
|
/** Read authenticated runtime discovery data. */
|
|
6007
6026
|
async function readRuntimeInfoReport() {
|
|
6008
6027
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
6009
|
-
import("./package-discovery-
|
|
6010
|
-
import("./
|
|
6028
|
+
import("./package-discovery-DD9vencX.js").then((n) => n.r),
|
|
6029
|
+
import("./catalog-runtime-DfSpJZdY.js").then((n) => n.t),
|
|
6011
6030
|
readPlugins(),
|
|
6012
6031
|
readSkillReports()
|
|
6013
6032
|
]);
|
|
@@ -6024,7 +6043,7 @@ async function readRuntimeInfoReport() {
|
|
|
6024
6043
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
6025
6044
|
async function readPluginOperationalReportFeed() {
|
|
6026
6045
|
const nowMs = Date.now();
|
|
6027
|
-
const { getPluginOperationalReports } = await import("./
|
|
6046
|
+
const { getPluginOperationalReports } = await import("./reports-WKHfGTsU.js");
|
|
6028
6047
|
return pluginOperationalReportFeedSchema.parse({
|
|
6029
6048
|
source: "plugins",
|
|
6030
6049
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -6074,9 +6093,7 @@ function createJuniorApi(options = {}) {
|
|
|
6074
6093
|
app.route("/api/search", createSearchRoutes());
|
|
6075
6094
|
app.route("/api/spaces", createSpaceRoutes());
|
|
6076
6095
|
app.route("/api/spaces", createSpaceArchiveRoutes({ queue }));
|
|
6077
|
-
app.route("/api/spaces", createSpaceMemberRoutes());
|
|
6078
6096
|
app.route("/api/spaces", createSpaceConfigurationRoutes());
|
|
6079
|
-
app.route("/api/spaces", createSpaceLeadRoutes());
|
|
6080
6097
|
app.route("/api/user-pages", createUserPageRoutes());
|
|
6081
6098
|
app.route("/api/user-customization", createUserCustomizationRoutes());
|
|
6082
6099
|
app.route("/api/automations", createAutomationRoutes());
|