@sentry/junior 0.315.0 → 0.316.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/{adapter-context-BlSGE44V.js → adapter-context-Bref7aPI.js} +1 -1
- package/dist/{admin-5jUYY46p.js → admin-QYiDMnsu.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-Cr5Fhjf-.js} +2298 -1866
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-BY13DPSD.js} +10 -37
- package/dist/api/schema.d.ts +69 -20
- package/dist/api/schema.js +4 -4
- package/dist/api.js +202 -315
- package/dist/{app-D_bAXRDe.d.ts → app-BhvzRD__.d.ts} +18 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +34 -34
- package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-3dtlMku3.js} +3 -3
- package/dist/cli/chat.js +17 -17
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +2 -2
- package/dist/cli/upgrade.js +23 -3
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-DbQUFe_F.js} +3 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed-B84pMjHo.js} +8 -3
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-DzEpTIaf.js} +16 -109
- package/dist/{create-BOycVH9h.js → create-DUJBXr6E.js} +4 -5
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-JH_K9Adg.js} +9 -9
- package/dist/{db-DXTOYRzR.js → db-DhzvUY23.js} +343 -179
- package/dist/{deployment-CG3TchWh.js → deployment-BhvrhQeh.js} +1 -1
- package/dist/{engine-context-dyWlfNdD.js → engine-context-C9Nal48K.js} +9 -12
- package/dist/{html-CfXEwl_h.js → html-B_12WjKT.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-runner-CySgpi9v.js → job-runner-DO8nslyY.js} +17 -9
- package/dist/{lineage-tRTOcrsL.js → lineage-D3AZAJVe.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-B0zsb5Cp.js} +64 -182
- package/dist/{parent-result-Dg6P6roR.js → list-mkB_GU8R.js} +80 -108
- package/dist/{logging-czs0nqLC.js → logging-B8KEJegM.js} +1 -1
- package/dist/{media-Cr9pGkzr.js → media-BebquhET.js} +15 -3
- package/dist/{message-BTox2Cmb.js → message-B5fKDYzz.js} +8 -8
- package/dist/{model-input-IRGa98V7.js → model-input-CuMWy37l.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-B3Vvlydo.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-6ERrGPbA.js} +1 -1
- package/dist/{people-Cegp1Iwq.js → people-CUtFApfL.js} +2 -2
- package/dist/{proxy-path-Dc-0jXGi.js → proxy-path-BTmXDjfx.js} +1 -1
- package/dist/{resolve-BUFkmxkT.js → resolve-D5JVvv6A.js} +3 -3
- package/dist/{result-DfATzX77.js → result-CS_7mo8a.js} +30 -14
- package/dist/{runner-CmKP3inb.js → runner-BzAES5W3.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-Dwhk2Q5F.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-z5-wA6N4.js} +34 -13
- package/dist/{service-account-CxTX7nnR.js → service-account-D6AsAtc1.js} +1 -1
- package/dist/{mailbox-turn-79Nv1JXv.js → session-stop-DponjDUZ.js} +3075 -3092
- package/dist/{skills-BlHUDj7k.js → skills-DgJ9GBPR.js} +3 -3
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-Dq71EkhM.js} +6 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-BJWpdwhQ.js} +4 -4
- package/dist/{start-conversation-Uh8Sk1EF.js → start-conversation-B-LIqqNi.js} +2 -2
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-iIgpmslr.js} +6 -4
- package/dist/{task-runner-DcdQJd9e.js → task-runner-BJae4JwE.js} +23 -11
- package/dist/{thread-context-DF5uDcWN.js → thread-context-fiMNylbg.js} +5 -5
- package/dist/{transcript-BHhJVY0P.js → transcript-CCi7323k.js} +1 -1
- package/dist/{turn-session-routing-GtetHsdO.js → turn-session-routing-D15orfwy.js} +7 -7
- package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BjDW7x-5.js} +4 -4
- package/dist/{validation-CJyuOPD2.js → validation-D5WmmmhX.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-CBQoanXb.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-Cyb4kF17.js} +3 -3
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- package/package.json +5 -5
- package/skills/jr-rpc/SKILL.md +3 -5
- package/dist/direct-url-BYgYfuIy.js +0 -22
- package/dist/markers-CE0HMXWT.js +0 -67
package/dist/api.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { $ as getPlugins, $c as
|
|
2
|
-
import { E as withSpan, N as normalizeIdentityEmail, _ as runBestEffort, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-
|
|
3
|
-
import { A as pauseConversationDelivery,
|
|
4
|
-
import { A as automationVersionActivateSchema, At as spaceSchema, B as conversationAttachmentParamsSchema, C as automationRunListSchema, D as automationSchedulePreviewSchema, Dt as spaceListSchema, E as automationScheduleIntentSchema, Et as spaceListQuerySchema, Fn as automationTaskText, Ht as MAX_ATTACHMENT_BYTES, I as CONVERSATION_DETAIL_VERSION_HEADER, J as conversationParamsSchema, K as conversationEventPageSchema, L as CONVERSATION_VERSION_HEADER, M as automationVersionParamsSchema, Mt as updateSpaceBodySchema, O as automationSummarySchema, Ot as spaceParamsSchema, Pt as conversationReadPositionSchema, S as automationParamsSchema, Tt as createSpaceBodySchema, U as conversationDetailQuerySchema, V as conversationAttachmentQuerySchema, W as conversationDetailReportSchema, _ as automationLifecycleSchema, b as automationListQuerySchema, d as automationEditSchema, en as ScheduleIntentError, f as automationEventCatalogSchema, j as automationVersionListSchema, k as automationUpdateSchema, l as apiErrorSchema, mn as isOpenTodoStatus, n as INPUT_IMAGE_TYPES, p as automationExecutionListSchema, q as conversationEventsQuerySchema, r as detectImageMediaType, s as notificationScheduleSchema, t as INLINE_VIDEO_TYPES, tn as compileScheduleIntent, u as automationEditErrorSchema, wt as archiveSpaceBodySchema, y as automationListPageSchema } from "./media-
|
|
5
|
-
import { A as
|
|
6
|
-
import { A as
|
|
7
|
-
import {
|
|
8
|
-
import { C as joinSpace, D as readSpace, E as listSpaces, M as readLiveAttachment, O as updateSpace, S as createSpace, T as listSpaceMembers, _ as AttachmentUploadError, a as getSpaceLead, h as webActorFromUser, l as acceptsWebMessages, s as readSpaceLead, w as leaveSpace, x as writeAttachmentUpload, y as createAttachmentUpload } from "./turn-session-routing-
|
|
9
|
-
import { $
|
|
10
|
-
import { a as transcriptEntriesFromReportEvents, c as linkedCodeProviders, f as readConversationLastEventSeq, l as readConversationEventPage, m as reportParentAgentInput, o as codeChangeUrl, s as codeRepositoryUrl } from "./task-runner-
|
|
11
|
-
import { t as runWithSlackInstallation } from "./adapter-context-
|
|
12
|
-
import {
|
|
13
|
-
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-
|
|
14
|
-
import { o as readSlackAttachmentSource } from "./start-conversation-
|
|
1
|
+
import { $ as getPlugins, $c as updateViewerDisplayName, $i as getVercelConversationWorkQueue, $u as cancelWatch, Aa as createPluginCache, Ac as inboxItemTodo, Ap as getAttachmentStorage, At as memoryDb, Au as slackPersonPredicate, Cc as canUserReadInboxItem, Cf as parseSlackChannelId, Ci as createPluginEmbedder, Cl as createConversationAccessReader, Cs as conversationStatusSql, Ds as conversationKindFromRow, Dt as contentVersion, Du as juniorSpaceMembers, Eo as getDashboardSettingsLink, Et as REVALIDATED_READ_PATHS, Fl as rootVisibleToViewer, Fr as getServiceAccountStatus, Ft as prefixMatch, Gc as findUserByEmail, Gn as create, I as escapeSlackMrkdwnText, Ic as itemNeedsUser, In as listWorkspaces, It as prefixRank, Iu as getEventCatalog, Jl as todoFuzzyTitle, Js as ownerConversationId, Kn as hash, L as formatSlackLink, Ll as isPublicConversation, Ln as listWorkspacesByRepository, Lt as rankSearchMatches, Mn as createWorkspace, Mt as parseTypedQuery, Mu as juniorUsers, N as loadConversationSlackTenantIds, Nc as isInboxItemForEveryone, Nn as deleteWorkspace, Nr as disconnectServiceAccount, Nt as fuzzyMatch, Nu as juniorDestinations, Oc as inboxItemReaderForUser, Ol as readableSlackTeamId, Ot as contentVersionHeaders, Pc as isOnlyAssignee, Pf as botConfig, Pn as getWorkspace, Pr as finishServiceAccountSignIn, Pt as fuzzyRank, Ql as inboxItemSearchDocument, Rn as updateWorkspace, Rr as serviceAccountPlugins, Rt as scoredSearchMatches, Ss as conversationIsActiveSql, St as isPausedBySlack, Tf as parseSlackTeamId, Tl as readConversationAccessFromSql, To as getDashboardPersonLink, Tu as juniorConversations, Ud as eventWatchUnavailable, Vs as getInboxItem, Ws as inboxItemsNeedingUserVersionQuery, Xc as readViewerAvatarUrl, Yl as todoSearchDocument, Yo as AutomationConflictError, Ys as searchInboxItems, Yu as isAgentResourceType, Zc as resolveViewerUser, Zl as inboxItemFuzzyTitle, _l as readCachedUserByEmail, _t as listPushSubscriptions, a as getDb, ac as clearInboxWakeReasons, au as juniorAutomations, bo as getDashboardConversationLink, bs as conversationRangeColumns, bt as savePushSubscription, bu as juniorCodeChanges, cc as inboxItemSnoozedBy, cd as listWatches, cp as withLock, cu as juniorAgentBindings, dc as settleInboxSnoozes, dt as readWebPushConfig, ep as readEnabledProviders, et as getRegistrations, eu as juniorInboxItemConversations, fc as snoozeInboxItems, ft as sendPushNotificationToUser, gs as microUsdToUsd, gt as deletePushSubscription, gu as juniorApiTokens, hs as microUsdSql, ht as resolveNotificationTimezone, hu as juniorConversationEvents, i as getConversationStore, ii as webActorUserIds, il as readUserAvatarUrls, ip as createCache, iu as automationSearchDocument, jc as inboxItemVisibleTo, jr as pluginCatalogRuntime, jt as searchTypedMemories, ju as slackPersonSearchDocument, kc as inboxItemReaderForUserInConversation, kt as revalidateContent, ku as juniorIdentities, la as createPluginAnnotations, lt as apiRoutePrefix, mc as unsnoozeInboxRow, mu as juniorConversationMetrics, nf as getStateAdapter, no as postSlackMessage, np as saveEnabledProviders, nu as juniorInboxItems, o as getSqlExecutor, of as credentialContextForActor, ou as juniorAutomationRuns, pc as snoozeTimerTrigger, ql as juniorTodos, rl as readAvatarFetch, rp as cacheKeyPrefix, ru as automationFuzzyTitle, sc as inboxItemInRow, ss as readAutomationTitlesByConversationId, tl as identityAvatarUrl, tp as readServedProviders, ua as listConversationAnnotations, uc as readViewerInboxSnoozes, uu as juniorConversationParticipants, vs as usdToMicroUsdUnbiased, vt as readNotificationSchedule, vu as codeChangeSearchDocument, wc as inboxItemForUser, wr as createUserTokenStore, ws as conversationTurnFailedSql, xc as canAnswerInboxItem, xi as workspaceRepoCheckoutPath, xs as conversationUsageCostExpr, xu as juniorCodeRepositories, yc as canActOnInboxItem, yi as SANDBOX_RUNTIME, ys as conversationAggregateColumns, yt as saveNotificationSchedule, yu as codeRepositorySearchDocument, zd as automationEventCatalog, zi as completeText, zn as WorkspaceValidationError, zr as startServiceAccountSignIn, zs as countInboxItemsNeedingUserBySubject } from "./db-DhzvUY23.js";
|
|
2
|
+
import { E as withSpan, N as normalizeIdentityEmail, _ as runBestEffort, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-B8KEJegM.js";
|
|
3
|
+
import { A as pauseConversationDelivery, Dt as emptyResponse, Gt as readViewerAutomationExecutions, Ht as ViewerTaskNotFoundError, It as activateViewerAutomationVersion, Jt as readViewerAutomationVersions, Kt as readViewerAutomationRuns, Lt as changeViewerAutomationLifecycle, M as AttachmentDownloadError, N as readAttachmentContent, O as canPauseConversationDelivery, Ot as jsonResponse, P as previewOriginBelongsTo, Rt as deleteViewerTask, Ut as collectionRowTitle, Vt as updateViewerAutomation, Yt as readViewerAutomations, Zt as AutomationEditError, cn as savingsTotals, dn as breakerStates, dt as reportConversationRead, fn as closeBreaker, ht as listOwnedWatches, j as resumeConversationDelivery, kt as throwApiError, ln as addStats, nn as SAVINGS_NAMESPACE, p as createInboxItemShow, pn as connectedState, qt as readViewerAutomationSummary, tn as viewerAutomationCollection, un as readStats, wt as inviteToConversation, yt as setSpaceArchive, zt as readViewerAutomationEdit } from "./agent-runner-Cr5Fhjf-.js";
|
|
4
|
+
import { A as automationVersionActivateSchema, At as spaceSchema, B as conversationAttachmentParamsSchema, C as automationRunListSchema, D as automationSchedulePreviewSchema, Dt as spaceListSchema, E as automationScheduleIntentSchema, Et as spaceListQuerySchema, Fn as automationTaskText, Ht as MAX_ATTACHMENT_BYTES, I as CONVERSATION_DETAIL_VERSION_HEADER, J as conversationParamsSchema, K as conversationEventPageSchema, L as CONVERSATION_VERSION_HEADER, M as automationVersionParamsSchema, Mt as updateSpaceBodySchema, O as automationSummarySchema, Ot as spaceParamsSchema, Pt as conversationReadPositionSchema, S as automationParamsSchema, Tt as createSpaceBodySchema, U as conversationDetailQuerySchema, V as conversationAttachmentQuerySchema, W as conversationDetailReportSchema, _ as automationLifecycleSchema, b as automationListQuerySchema, d as automationEditSchema, en as ScheduleIntentError, f as automationEventCatalogSchema, j as automationVersionListSchema, k as automationUpdateSchema, l as apiErrorSchema, mn as isOpenTodoStatus, n as INPUT_IMAGE_TYPES, p as automationExecutionListSchema, q as conversationEventsQuerySchema, r as detectImageMediaType, s as notificationScheduleSchema, t as INLINE_VIDEO_TYPES, tn as compileScheduleIntent, u as automationEditErrorSchema, wt as archiveSpaceBodySchema, y as automationListPageSchema } from "./media-BebquhET.js";
|
|
5
|
+
import { $ as userSearchQuerySchema, A as cacheHealthQuerySchema, At as connectionListSchema, B as serviceAccountParamsSchema, C as inboxSnoozeResourceQuerySchema, Cn as createConversationMessageBodySchema, Ct as activityHours$2, D as inboxSnoozeWakesClearSchema, Dt as pushSubscriptionBodySchema, E as inboxSnoozeSubjectSchema, Et as notificationSettingsSchema, F as cacheWarmingSavingsRefillResponseSchema, G as createPersonalTokenBodySchema, Gt as codeRepositoryReportSchema, H as startServiceAccountSignInResponseSchema, Ht as codePersonReportSchema, I as cacheWarmingSavingsReportSchema, Jt as personCodeQuerySchema, K as createdPersonalTokenSchema, L as closeCacheWarmingBreakerResponseSchema, Lt as codeChangeSearchQuerySchema, M as cacheWarmingBreakerListSchema, N as cacheWarmingBreakerParamsSchema, Nt as disconnectConnectionResponseSchema, O as gatewayProvidersSchema, Ot as pushSubscriptionDeleteBodySchema, P as cacheWarmingSavingsQuerySchema, Pt as startConnectionResponseSchema, Qt as todoStatusBodySchema, R as disconnectServiceAccountResponseSchema, Rt as codeChangeSearchReportSchema, S as inboxSnoozeCreateSchema, Sn as createConversationBodySchema, St as activityDays$1, T as inboxSnoozeSchema, Tn as forkConversationResponseSchema, U as searchQuerySchema, Ut as codeRepositoryParamsSchema, Vt as codeOverviewReportSchema, W as searchReportSchema, Wt as codeRepositoryQuerySchema, X as revokePersonalTokenResponseSchema, Xt as conversationTodosReportSchema, Y as personalTokenParamsSchema, Yt as conversationTodoSchema, Zt as todoParamsSchema, _ as inboxItemListSchema, _n as conversationCatchUpSchema, _t as spaceConfigurationSchema, a as statsReportSchema, an as continueConversationInSlackResponseSchema, at as avatarParamsSchema, b as inboxItemWaitingConversationsSchema, bn as createAttachmentUploadBodySchema, bt as locationDirectoryReportSchema, c as workspaceBodySchema, cn as attachObjectLinkResponseSchema, ct as peopleSearchReportSchema, dn as conversationStatsReportSchema, dt as personalSpendReportSchema, en as conversationWatchesReportSchema, et as userSearchReportSchema, f as workspaceSchema, ft as addSpaceMemberBodySchema, g as inboxItemListQuerySchema, gn as conversationCatchUpBodySchema, h as inboxItemCountSchema, hn as conversationDeliveryResponseSchema, ht as leadSchema, in as continueConversationInSlackBodySchema, it as actorProfileReportSchema, j as cacheHealthReportSchema, jt as connectionParamsSchema, k as updateGatewayProvidersBodySchema, kt as testNotificationResponseSchema, l as workspaceListSchema, ln as objectLinksQuerySchema, lt as personCardReportSchema, m as inboxItemCountQuerySchema, mn as conversationDeliveryBodySchema, n as versionsQuerySchema, p as inboxItemActionSchema, pn as conversationOutlineSchema, pt as spaceMemberListSchema, q as personalTokenListSchema, r as versionsSchema, rn as conversationChildAgentsReportSchema, rt as actorDirectoryReportSchema, s as deleteWorkspaceResponseSchema, sn as attachObjectLinkBodySchema, st as peopleSearchQuerySchema, tn as watchParamsSchema, u as workspaceParamsSchema, un as objectLinksReportSchema, ut as personParamsSchema, v as inboxItemParamsSchema, vn as attachmentUploadParamsSchema, w as inboxSnoozeResourceSchema, wn as forkConversationBodySchema, wt as activitySixHours$1, xn as acceptedConversationMessageSchema, xt as locationParamsSchema, y as inboxItemSchema, yn as attachmentUploadSchema, yt as locationDetailReportSchema, z as serviceAccountListSchema } from "./schema-z5-wA6N4.js";
|
|
6
|
+
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-B84pMjHo.js";
|
|
7
|
+
import { Dt as listTodos, Ir as createPluginEgress, Mn as addConversationNote, Ot as setTodoStatusByUser, Pn as isExperimentalFeatureEnabled, St as saveUserCustomization, an as steerWebPendingMessages, gn as isAllowedDomain, kt as pushConversationInboxItemsNow, vn as parseEmail, xt as readUserCustomization } from "./session-stop-DponjDUZ.js";
|
|
8
|
+
import { C as joinSpace, D as readSpace, E as listSpaces, M as readLiveAttachment, O as updateSpace, S as createSpace, T as listSpaceMembers, _ as AttachmentUploadError, a as getSpaceLead, h as webActorFromUser, l as acceptsWebMessages, s as readSpaceLead, w as leaveSpace, x as writeAttachmentUpload, y as createAttachmentUpload } from "./turn-session-routing-D15orfwy.js";
|
|
9
|
+
import { $t as createViewerMcp, A as setConversationAutoArchiveOperation, C as archiveConversationOperation, Ct as readObjectLinkTypes, D as leaveConversationOperation, Dt as guardedFetch, Et as viewerCanViewPluginLink, F as apiOperationHandler, M as setConversationSubscriptionOperation, Mt as getProductionSlackAdapter, N as stopConversationOperation, O as pinConversationOperation, P as reorderPinnedConversations, Q as actOnInboxItem, Qt as readFirstHumanMessageTexts, St as readLinkObjectType, T as cancelQueuedMessagesOperation, Tt as resolveObjectLinks, X as resolveMentions, Y as requireConversationPendingMessages, Yt as resolvePersonLink, Z as InboxItemActionError, Zt as conversationSummaryFromStoredConversation, _ as readConversationEvents, _t as startSavingsRefill, a as listWaitingConversations, at as DEFAULT_USER_SETTINGS, b as requireWebMessageConversation, bt as readHealthReport, c as readConversationDetail, d as childAgentTotalsReport, en as IMAGE_WIDTHS, et as readInboxItemForUser, f as readConversationTreeMetricsFromSql, g as keepQuickQuestionForViewer, h as forkConversationForViewer, ht as readSavingsRefill, i as encodePageCursor, j as setConversationSpaceOperation, k as renameConversationOperation, l as readConversationTreeStates, m as readConversationDetailEtag, mt as scheduleInboxSnoozeTimer, n as readConversationFeed, o as listedConversation, ot as readUserSettings, p as conversationVersionsQuery, r as decodePageCursor, s as notLeadConversation, st as updateUserSettings, t as conversationFeedVersionQuery, tn as decodeImageId, u as readConversationAuxiliaryCostsFromSql, v as appendConversationMessageForViewer, w as archiveDoneConversationsOperation, wt as resolveObjectLinkNow, xt as OBJECT_LINK_TTL_MS, y as createConversationForViewer } from "./list-B0zsb5Cp.js";
|
|
10
|
+
import { a as transcriptEntriesFromReportEvents, c as linkedCodeProviders, f as readConversationLastEventSeq, l as readConversationEventPage, m as reportParentAgentInput, o as codeChangeUrl, s as codeRepositoryUrl } from "./task-runner-BJae4JwE.js";
|
|
11
|
+
import { t as runWithSlackInstallation } from "./adapter-context-Bref7aPI.js";
|
|
12
|
+
import { n as listChildAgents } from "./list-mkB_GU8R.js";
|
|
13
|
+
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-DbQUFe_F.js";
|
|
14
|
+
import { o as readSlackAttachmentSource } from "./start-conversation-B-LIqqNi.js";
|
|
15
15
|
import { u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
16
16
|
import { a as fillUtcSixHours, c as trailingUtcDayWindow, d as utcHourKey, i as fillUtcHours, l as trailingUtcHourWindow, n as HOUR_MS$3, o as startOfUtcHour, r as fillUtcDays, s as sumUtcHoursIntoSixHours, t as DAY_MS$3, u as trailingUtcSixHourWindow } from "./reporting-window-C4dbzDiR.js";
|
|
17
|
-
import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-
|
|
18
|
-
import { G as mapBounded, I as createPluginLogger } from "./transcript-
|
|
19
|
-
import { D as listSpaceConfiguration } from "./job-runner-
|
|
17
|
+
import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-B_12WjKT.js";
|
|
18
|
+
import { G as mapBounded, I as createPluginLogger } from "./transcript-CCi7323k.js";
|
|
19
|
+
import { D as listSpaceConfiguration } from "./job-runner-DO8nslyY.js";
|
|
20
20
|
import { n as userCustomizationSchema } from "./user-customization-B27StpVQ.js";
|
|
21
|
-
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-
|
|
22
|
-
import { t as readDirectDatabaseUrl } from "./direct-url-BYgYfuIy.js";
|
|
21
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-D5JVvv6A.js";
|
|
23
22
|
import { Hono } from "hono";
|
|
24
23
|
import * as z from "zod";
|
|
25
24
|
import path from "node:path";
|
|
@@ -29,8 +28,6 @@ import { and, asc, count as count$1, desc, eq, exists, gt, gte, inArray, isNotNu
|
|
|
29
28
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
30
29
|
import fs from "node:fs/promises";
|
|
31
30
|
import { readFileSync } from "node:fs";
|
|
32
|
-
import { Client } from "@neondatabase/serverless";
|
|
33
|
-
import pg from "pg";
|
|
34
31
|
import { HTTPException } from "hono/http-exception";
|
|
35
32
|
import { bodyLimit } from "hono/body-limit";
|
|
36
33
|
import { waitUntil } from "@vercel/functions";
|
|
@@ -657,7 +654,7 @@ async function readConversationOutline(conversationId, options = {}) {
|
|
|
657
654
|
}
|
|
658
655
|
/**
|
|
659
656
|
* Read the cut text of one role's messages in seq order. The
|
|
660
|
-
* `
|
|
657
|
+
* `message_role_seq_idx` index reads only these messages, in that order.
|
|
661
658
|
*/
|
|
662
659
|
function readMessages(conversationId, role, ...filters) {
|
|
663
660
|
return getDb().select({
|
|
@@ -889,7 +886,7 @@ function rootAggregateColumns(roots) {
|
|
|
889
886
|
active: sql`(count(*) FILTER (WHERE ${conversationIsActiveSql(turnRoot)}))::integer`,
|
|
890
887
|
conversations: sql`count(*)::integer`,
|
|
891
888
|
durationMs: sql`COALESCE(sum(${roots.durationMs}), 0)::double precision`,
|
|
892
|
-
failed: sql`(count(*) FILTER (WHERE ${
|
|
889
|
+
failed: sql`(count(*) FILTER (WHERE ${turnRoot.stoppedAt} IS NULL AND ${conversationTurnFailedSql(turnRoot)}))::integer`,
|
|
893
890
|
tokens: sql`sum(${roots.tokens})::double precision`
|
|
894
891
|
};
|
|
895
892
|
}
|
|
@@ -1638,6 +1635,7 @@ function createConversationRoutes(options) {
|
|
|
1638
1635
|
app.put("/:conversationId/space", requireViewer, apiOperationHandler(setConversationSpaceOperation, options));
|
|
1639
1636
|
app.patch("/:conversationId/pin", requireViewer, apiOperationHandler(pinConversationOperation, options));
|
|
1640
1637
|
app.patch("/:conversationId/delivery", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationDeliveryBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationDeliveryResponseSchema, await setConversationDeliveryForViewer(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
1638
|
+
app.post("/:conversationId/leave", requireViewer, apiOperationHandler(leaveConversationOperation, options));
|
|
1641
1639
|
app.patch("/:conversationId/subscription", requireViewer, apiOperationHandler(setConversationSubscriptionOperation, options));
|
|
1642
1640
|
app.post("/:conversationId/invites", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationInviteBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationInviteResponseSchema, await inviteToConversation(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
1643
1641
|
app.patch("/:conversationId/title", requireViewer, apiOperationHandler(renameConversationOperation, options));
|
|
@@ -2226,7 +2224,7 @@ async function readCodeChangeSearchFromSql(query, viewerUserId) {
|
|
|
2226
2224
|
const repositoryDocument = codeRepositorySearchDocument(juniorCodeRepositories);
|
|
2227
2225
|
const textMatch = (condition) => db.select({ id: matched.id }).from(matched).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, matched.repositoryId)).where(and(condition, terms.length > 1 ? sql`(${codeChangeSearchDocument(matched)} || ${repositoryDocument}) @@ to_tsquery('simple', ${everyTerm})` : void 0));
|
|
2228
2226
|
const matches = number ? and(sql`${changeDocument} @@ to_tsquery('simple', ${everyTerm})`, sql`${juniorCodeChanges.number}::text like ${`${number}%`}`) : inArray(juniorCodeChanges.id, union(textMatch(sql`${codeChangeSearchDocument(matched)} @@ to_tsquery('simple', ${anyTerm})`), textMatch(sql`${repositoryDocument} @@ to_tsquery('simple', ${anyTerm})`)));
|
|
2229
|
-
const visible = exists(db.select({ conversationId: juniorConversations.conversationId }).from(linked).innerJoin(juniorConversations, eq(juniorConversations.conversationId, sql`coalesce(${linked.rootConversationId}, ${linked.conversationId})`)).
|
|
2227
|
+
const visible = exists(db.select({ conversationId: juniorConversations.conversationId }).from(linked).innerJoin(juniorConversations, eq(juniorConversations.conversationId, sql`coalesce(${linked.rootConversationId}, ${linked.conversationId})`)).where(and(sql`${linked.conversationId} = any(${juniorCodeChanges.conversationIds})`, listedConversation(), rootVisibleToViewer(viewerUserId))));
|
|
2230
2228
|
return (await db.transaction(async (tx) => {
|
|
2231
2229
|
await tx.execute(sql`SELECT set_config('statement_timeout', ${String(CODE_CHANGE_SEARCH_TIMEOUT_MS)}, true)`);
|
|
2232
2230
|
return await tx.select({
|
|
@@ -2485,7 +2483,7 @@ function topLevelWhere() {
|
|
|
2485
2483
|
return isNull(juniorConversations.parentConversationId);
|
|
2486
2484
|
}
|
|
2487
2485
|
function publicLocationWhere(locationId) {
|
|
2488
|
-
return and(topLevelWhere(), locationId === DASHBOARD_LOCATION_ID ? eq(juniorDestinations.provider, "local") : and(eq(juniorDestinations.id, locationId), ne(juniorDestinations.provider, "local")),
|
|
2486
|
+
return and(topLevelWhere(), locationId === DASHBOARD_LOCATION_ID ? eq(juniorDestinations.provider, "local") : and(eq(juniorDestinations.id, locationId), ne(juniorDestinations.provider, "local")), isPublicConversation(juniorConversations));
|
|
2489
2487
|
}
|
|
2490
2488
|
function locationColumns() {
|
|
2491
2489
|
return {
|
|
@@ -2494,7 +2492,8 @@ function locationColumns() {
|
|
|
2494
2492
|
destinationKind: juniorDestinations.kind,
|
|
2495
2493
|
destinationProvider: juniorDestinations.provider,
|
|
2496
2494
|
destinationProviderId: juniorDestinations.providerDestinationId,
|
|
2497
|
-
destinationVisibility: juniorDestinations.visibility
|
|
2495
|
+
destinationVisibility: juniorDestinations.visibility,
|
|
2496
|
+
rootVisibility: juniorConversations.visibility
|
|
2498
2497
|
};
|
|
2499
2498
|
}
|
|
2500
2499
|
function locationGroupBy() {
|
|
@@ -2504,12 +2503,16 @@ function locationGroupBy() {
|
|
|
2504
2503
|
juniorDestinations.kind,
|
|
2505
2504
|
juniorDestinations.provider,
|
|
2506
2505
|
juniorDestinations.providerDestinationId,
|
|
2507
|
-
juniorDestinations.visibility
|
|
2506
|
+
juniorDestinations.visibility,
|
|
2507
|
+
juniorConversations.visibility
|
|
2508
2508
|
];
|
|
2509
2509
|
}
|
|
2510
|
-
/**
|
|
2510
|
+
/**
|
|
2511
|
+
* Admit only public roots at complete persisted-public destinations as named
|
|
2512
|
+
* locations.
|
|
2513
|
+
*/
|
|
2511
2514
|
function locationFromAggregate(row) {
|
|
2512
|
-
if (row.destinationVisibility !== "public" || !row.destinationId || !row.destinationProvider || !row.destinationProviderId || !row.destinationKind) return;
|
|
2515
|
+
if (row.rootVisibility !== "public" || row.destinationVisibility !== "public" || !row.destinationId || !row.destinationProvider || !row.destinationProviderId || !row.destinationKind) return;
|
|
2513
2516
|
const dashboard = row.destinationProvider === "local";
|
|
2514
2517
|
const location = {
|
|
2515
2518
|
...emptyMetrics(),
|
|
@@ -2561,15 +2564,15 @@ async function directoryActivityRows(db, start, hourStart) {
|
|
|
2561
2564
|
)`;
|
|
2562
2565
|
const select = {
|
|
2563
2566
|
conversations: sql`COUNT(*)::integer`,
|
|
2564
|
-
visibility:
|
|
2567
|
+
visibility: juniorConversations.visibility
|
|
2565
2568
|
};
|
|
2566
2569
|
const [dayRows, hourRows] = await Promise.all([db.select({
|
|
2567
2570
|
...select,
|
|
2568
2571
|
date: day
|
|
2569
|
-
}).from(juniorConversations).
|
|
2572
|
+
}).from(juniorConversations).where(and(topLevelWhere(), gte(juniorConversations.lastActivityAt, start))).groupBy(day, juniorConversations.visibility), db.select({
|
|
2570
2573
|
...select,
|
|
2571
2574
|
date: hour
|
|
2572
|
-
}).from(juniorConversations).
|
|
2575
|
+
}).from(juniorConversations).where(and(topLevelWhere(), gte(juniorConversations.lastActivityAt, hourStart))).groupBy(hour, juniorConversations.visibility)]);
|
|
2573
2576
|
return {
|
|
2574
2577
|
dayRows,
|
|
2575
2578
|
hourRows
|
|
@@ -3007,7 +3010,7 @@ function createSpaceArchiveRoutes(options) {
|
|
|
3007
3010
|
// src/api/spaces/configuration.ts
|
|
3008
3011
|
/**
|
|
3009
3012
|
* Create the route that reads a Space's configuration. Anyone who reads the
|
|
3010
|
-
* Space reads it. Junior changes it with its `
|
|
3013
|
+
* Space reads it. Junior changes it with its `setConfiguration` tool,
|
|
3011
3014
|
* when a member asks.
|
|
3012
3015
|
*/
|
|
3013
3016
|
function createSpaceConfigurationRoutes() {
|
|
@@ -3097,13 +3100,59 @@ function createSpaceMemberRoutes() {
|
|
|
3097
3100
|
});
|
|
3098
3101
|
return app;
|
|
3099
3102
|
}
|
|
3103
|
+
// src/api/spaces/state.ts
|
|
3104
|
+
/**
|
|
3105
|
+
* The most Conversations of the listed Spaces that one read rolls up, newest
|
|
3106
|
+
* activity first. The Lead archives finished work, so a Space has few
|
|
3107
|
+
* Conversations that are not archived. Past this, the oldest ones count for
|
|
3108
|
+
* nothing.
|
|
3109
|
+
*/
|
|
3110
|
+
const SPACE_STATE_CONVERSATION_LIMIT = 200;
|
|
3111
|
+
const TREE_STATE_ORDER = [
|
|
3112
|
+
"needs_you",
|
|
3113
|
+
"working",
|
|
3114
|
+
"done"
|
|
3115
|
+
];
|
|
3116
|
+
/**
|
|
3117
|
+
* Roll up the tree state of every Conversation in each Space that the viewer
|
|
3118
|
+
* can read and that is not archived, the Lead included. Each Space gets an
|
|
3119
|
+
* entry, and a Space with none of them reads `done`. `treeState` is the
|
|
3120
|
+
* first that applies over them, as for one Conversation. `latestTurnFailed`
|
|
3121
|
+
* is set when the latest Turn of one of them failed.
|
|
3122
|
+
*/
|
|
3123
|
+
async function readSpaceStates(db, spaceIds, viewerUserId) {
|
|
3124
|
+
if (spaceIds.length === 0) return /* @__PURE__ */ new Map();
|
|
3125
|
+
const roots = await db.select({
|
|
3126
|
+
conversationId: juniorConversations.conversationId,
|
|
3127
|
+
spaceId: juniorConversations.spaceId,
|
|
3128
|
+
latestTurnFailed: conversationTurnFailedSql(juniorConversations)
|
|
3129
|
+
}).from(juniorConversations).where(and(inArray(juniorConversations.spaceId, [...spaceIds]), isNull(juniorConversations.parentConversationId), isNull(juniorConversations.archivedAt), isNull(juniorConversations.quickQuestionAt), rootVisibleToViewer(viewerUserId))).orderBy(desc(juniorConversations.lastActivityAt)).limit(SPACE_STATE_CONVERSATION_LIMIT);
|
|
3130
|
+
const trees = await readConversationTreeStates(db, roots.map((root) => root.conversationId), viewerUserId);
|
|
3131
|
+
const states = new Map(spaceIds.map((spaceId) => [spaceId, {
|
|
3132
|
+
latestTurnFailed: false,
|
|
3133
|
+
treeState: "done"
|
|
3134
|
+
}]));
|
|
3135
|
+
for (const root of roots) {
|
|
3136
|
+
const current = root.spaceId ? states.get(root.spaceId) : void 0;
|
|
3137
|
+
if (!current) continue;
|
|
3138
|
+
const treeState = trees.get(root.conversationId)?.treeState ?? "done";
|
|
3139
|
+
if (root.latestTurnFailed) current.latestTurnFailed = true;
|
|
3140
|
+
if (TREE_STATE_ORDER.indexOf(treeState) < TREE_STATE_ORDER.indexOf(current.treeState)) current.treeState = treeState;
|
|
3141
|
+
}
|
|
3142
|
+
return states;
|
|
3143
|
+
}
|
|
3100
3144
|
// src/api/spaces/space.ts
|
|
3101
3145
|
/** Create the routes that list, create, read, and change Spaces. */
|
|
3102
3146
|
function createSpaceRoutes() {
|
|
3103
3147
|
const app = new Hono();
|
|
3104
3148
|
app.get("/", requireViewer, validateRequest("query", spaceListQuerySchema, "Invalid query parameters."), async (context) => {
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3149
|
+
const viewerUserId = context.get("viewer").id;
|
|
3150
|
+
const spaces = await listSpaces(viewerUserId, context.req.valid("query"));
|
|
3151
|
+
const states = await readSpaceStates(getDb(), spaces.map((space) => space.id), viewerUserId);
|
|
3152
|
+
return jsonResponse(spaceListSchema, { spaces: spaces.map((space) => ({
|
|
3153
|
+
...spaceReport(space),
|
|
3154
|
+
...states.get(space.id)
|
|
3155
|
+
})) });
|
|
3107
3156
|
});
|
|
3108
3157
|
app.post("/", requireViewer, validateRequest("json", createSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
3109
3158
|
const body = context.req.valid("json");
|
|
@@ -3534,7 +3583,7 @@ async function readPeoplePluginReports(args) {
|
|
|
3534
3583
|
reports: [],
|
|
3535
3584
|
source: "plugins"
|
|
3536
3585
|
});
|
|
3537
|
-
const { getPluginProfileReports } = await import("./db-
|
|
3586
|
+
const { getPluginProfileReports } = await import("./db-DhzvUY23.js").then((n) => n.W);
|
|
3538
3587
|
return pluginOperationalReportFeedSchema.parse({
|
|
3539
3588
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3540
3589
|
reports: await getPluginProfileReports({
|
|
@@ -3598,7 +3647,7 @@ function channelExpression(table) {
|
|
|
3598
3647
|
}
|
|
3599
3648
|
function locationLabel(row) {
|
|
3600
3649
|
if (row.surface !== "slack") return surfaceLabel(row.surface);
|
|
3601
|
-
if (row.
|
|
3650
|
+
if (row.visibility !== "public") return "Private Conversation";
|
|
3602
3651
|
return slackLocationLabel({
|
|
3603
3652
|
channel: row.channel || void 0,
|
|
3604
3653
|
channelName: row.channelName ?? void 0
|
|
@@ -3654,7 +3703,7 @@ function rootBucketRows(args) {
|
|
|
3654
3703
|
date: sql`TO_CHAR(${buckets.bucket}, ${sql.raw(`'${format}'`)})`,
|
|
3655
3704
|
durationMs: sql`COALESCE(sum(${buckets.durationMs}), 0)::double precision`,
|
|
3656
3705
|
failed: sql`(count(*) FILTER (
|
|
3657
|
-
WHERE ${buckets.isLastTurn} AND ${
|
|
3706
|
+
WHERE ${buckets.isLastTurn} AND ${turnRoot.stoppedAt} IS NULL AND ${conversationTurnFailedSql(turnRoot)}
|
|
3658
3707
|
))::integer`,
|
|
3659
3708
|
tokens: sql`sum(${buckets.tokens})::double precision`
|
|
3660
3709
|
}).from(buckets).innerJoin(turnRoot, eq(turnRoot.conversationId, buckets.rootConversationId)).where(sql`${buckets.bucket} >= (${args.since.toISOString()}::timestamptz AT TIME ZONE 'UTC')`).groupBy(buckets.bucket);
|
|
@@ -3688,10 +3737,10 @@ async function readPeopleProfileFromSql(email, options = {}) {
|
|
|
3688
3737
|
getDb().select({
|
|
3689
3738
|
channel,
|
|
3690
3739
|
channelName: turnRoot.channelName,
|
|
3691
|
-
destinationVisibility: juniorDestinations.visibility,
|
|
3692
3740
|
surface,
|
|
3741
|
+
visibility: turnRoot.visibility,
|
|
3693
3742
|
...aggregate
|
|
3694
|
-
}).from(roots).innerJoin(turnRoot, personRootJoin(roots)).
|
|
3743
|
+
}).from(roots).innerJoin(turnRoot, personRootJoin(roots)).groupBy(channel, turnRoot.channelName, turnRoot.visibility, surface),
|
|
3695
3744
|
getDb().select({
|
|
3696
3745
|
surface,
|
|
3697
3746
|
...aggregate
|
|
@@ -3867,6 +3916,110 @@ async function readPersonalSpendFromSql(email, nowMs = Date.now()) {
|
|
|
3867
3916
|
windowStart: thirtyDayStart.toISOString()
|
|
3868
3917
|
};
|
|
3869
3918
|
}
|
|
3919
|
+
// src/api/people/user-search.query.ts
|
|
3920
|
+
const USER_SEARCH_TERMS = 4;
|
|
3921
|
+
/**
|
|
3922
|
+
* Split typed text into lowercase search terms. A leading `@` of a Slack
|
|
3923
|
+
* handle is not part of it.
|
|
3924
|
+
*/
|
|
3925
|
+
function userSearchTerms(query) {
|
|
3926
|
+
return query.toLowerCase().split(/\s+/).map((term) => term.replace(/^@+/, "")).filter(Boolean).slice(0, USER_SEARCH_TERMS);
|
|
3927
|
+
}
|
|
3928
|
+
/**
|
|
3929
|
+
* Find Users whose name, Slack name, Slack handle, or primary email holds
|
|
3930
|
+
* each word of the query. An exact match of a whole field ranks first, then
|
|
3931
|
+
* a field or a word of the name that starts with the query, then any other
|
|
3932
|
+
* match. Ties sort by name, then email, then User id, so the order is
|
|
3933
|
+
* stable. Users are people: Slack bots and service accounts have none.
|
|
3934
|
+
*/
|
|
3935
|
+
async function readUserSearchFromSql(args) {
|
|
3936
|
+
const terms = userSearchTerms(args.query);
|
|
3937
|
+
if (terms.length === 0) return [];
|
|
3938
|
+
const whole = terms.join(" ");
|
|
3939
|
+
const { target } = args;
|
|
3940
|
+
const db = getDb();
|
|
3941
|
+
const slack = alias(juniorIdentities, "user_search_slack");
|
|
3942
|
+
const slackJoin = and(eq(slack.userId, juniorUsers.id), slackPersonPredicate(slack), target.kind === "conversation" && target.slackTeamId ? eq(slack.providerTenantId, target.slackTeamId) : void 0);
|
|
3943
|
+
const name = sql`lower(coalesce(${juniorUsers.displayName}, ${slack.displayName}, ''))`;
|
|
3944
|
+
const handle = sql`lower(coalesce(${slack.handle}, ''))`;
|
|
3945
|
+
const email = juniorUsers.primaryEmailNormalized;
|
|
3946
|
+
const document = sql`(${name} || ' ' || lower(coalesce(${slack.displayName}, '')) || ' ' || ${handle} || ' ' || ${email})`;
|
|
3947
|
+
const exact = sql`(${name} = ${whole} or ${handle} = ${whole} or ${email} = ${whole} or split_part(${email}, '@', 1) = ${whole})`;
|
|
3948
|
+
const prefix = sql`(starts_with(${name}, ${whole}) or starts_with(${handle}, ${whole}) or starts_with(${email}, ${whole}) or strpos(' ' || ${name}, ' ' || ${whole}) > 0)`;
|
|
3949
|
+
const rank = sql`case when ${exact} then 0 when ${prefix} then 1 else 2 end`;
|
|
3950
|
+
const base = db.selectDistinctOn([juniorUsers.id], {
|
|
3951
|
+
email: juniorUsers.primaryEmail,
|
|
3952
|
+
emailNormalized: email,
|
|
3953
|
+
fullName: sql`coalesce(${juniorUsers.displayName}, ${slack.displayName})`.as("full_name"),
|
|
3954
|
+
rank: rank.as("rank"),
|
|
3955
|
+
slackUserId: slack.providerSubjectId,
|
|
3956
|
+
slackUserName: slack.handle,
|
|
3957
|
+
sortName: name.as("sort_name"),
|
|
3958
|
+
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");
|
|
3961
|
+
const rows = await db.select({
|
|
3962
|
+
email: matches.email,
|
|
3963
|
+
fullName: matches.fullName,
|
|
3964
|
+
isMember: memberSql(db, target, matches.userId).as("is_member"),
|
|
3965
|
+
slackUserId: matches.slackUserId,
|
|
3966
|
+
slackUserName: matches.slackUserName,
|
|
3967
|
+
userId: matches.userId
|
|
3968
|
+
}).from(matches).orderBy(asc(matches.rank), asc(matches.sortName), asc(matches.emailNormalized), asc(matches.userId)).limit(args.limit);
|
|
3969
|
+
const avatars = await readUserAvatarUrls(db, rows.map((row) => row.userId));
|
|
3970
|
+
return rows.map((row) => {
|
|
3971
|
+
const fullName = row.fullName?.trim();
|
|
3972
|
+
const avatarUrl = avatars.get(row.userId);
|
|
3973
|
+
return {
|
|
3974
|
+
email: row.email,
|
|
3975
|
+
userId: row.userId,
|
|
3976
|
+
...fullName ? { fullName } : void 0,
|
|
3977
|
+
...row.slackUserName ? { slackUserName: row.slackUserName } : void 0,
|
|
3978
|
+
...target.kind === "conversation" && row.slackUserId ? { slackUserId: row.slackUserId } : void 0,
|
|
3979
|
+
...avatarUrl ? { avatarUrl } : void 0,
|
|
3980
|
+
...row.isMember ? { isMember: true } : void 0
|
|
3981
|
+
};
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/** SQL: the User is already a Member of the Space or a Participant. */
|
|
3985
|
+
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
|
+
const participants = juniorConversationParticipants;
|
|
3988
|
+
return sql`${exists(db.select({ userId: participants.userId }).from(participants).where(and(eq(participants.rootConversationId, target.rootConversationId), eq(participants.userId, userId))))}`;
|
|
3989
|
+
}
|
|
3990
|
+
// src/api/people/user-search.ts
|
|
3991
|
+
/**
|
|
3992
|
+
* Find Users to add to a Space or a Conversation. The viewer must be able
|
|
3993
|
+
* to read it, so who is a member does not leak; otherwise it looks
|
|
3994
|
+
* missing. The Users are those of this install, which is the tenant of
|
|
3995
|
+
* every Space and dashboard Conversation. A Conversation in a Slack
|
|
3996
|
+
* workspace narrows them to that workspace. Whether the viewer may add
|
|
3997
|
+
* them stays with the route that adds them.
|
|
3998
|
+
*/
|
|
3999
|
+
async function searchUsersForViewer(viewer, query) {
|
|
4000
|
+
return await readUserSearchFromSql({
|
|
4001
|
+
limit: query.limit,
|
|
4002
|
+
query: query.q,
|
|
4003
|
+
target: await readUserSearchTarget(viewer, query)
|
|
4004
|
+
});
|
|
4005
|
+
}
|
|
4006
|
+
async function readUserSearchTarget(viewer, query) {
|
|
4007
|
+
if (query.spaceId) {
|
|
4008
|
+
await requireSpace(viewer.id, query.spaceId);
|
|
4009
|
+
return {
|
|
4010
|
+
kind: "space",
|
|
4011
|
+
spaceId: query.spaceId
|
|
4012
|
+
};
|
|
4013
|
+
}
|
|
4014
|
+
const conversationId = query.conversationId;
|
|
4015
|
+
const access = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId);
|
|
4016
|
+
if (!access?.canViewPrivateContent || !access.rootConversationId) throwApiError(404, "Conversation not found.");
|
|
4017
|
+
return {
|
|
4018
|
+
kind: "conversation",
|
|
4019
|
+
rootConversationId: access.rootConversationId,
|
|
4020
|
+
slackTeamId: readableSlackTeamId(access)
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
3870
4023
|
// src/api/people/routes.ts
|
|
3871
4024
|
/** Create the HTTP routes owned by the People API. */
|
|
3872
4025
|
function createPeopleRoutes(options) {
|
|
@@ -3890,6 +4043,7 @@ function createPeopleRoutes(options) {
|
|
|
3890
4043
|
const slackTeamId = conversationId ? readableSlackTeamId((await readConversationAccessFromSql(getDb(), [conversationId], context.get("viewer"))).get(conversationId)) : void 0;
|
|
3891
4044
|
return jsonResponse(peopleSearchReportSchema, { people: await readPeopleSearchFromSql(q, slackTeamId) });
|
|
3892
4045
|
});
|
|
4046
|
+
app.get("/user-search", requireViewer, validateRequest("query", userSearchQuerySchema, "Invalid search query."), async (context) => jsonResponse(userSearchReportSchema, { users: await searchUsersForViewer(context.get("viewer"), context.req.valid("query")) }));
|
|
3893
4047
|
app.get("/:email/plugin-reports", requireViewer, validateRequest("param", personParamsSchema, "Invalid route parameters."), async (context) => {
|
|
3894
4048
|
const { email } = context.req.valid("param");
|
|
3895
4049
|
const viewer = context.get("viewer");
|
|
@@ -4193,7 +4347,7 @@ async function searchTodosForViewer(viewer, query, limit) {
|
|
|
4193
4347
|
const candidates = db.select({
|
|
4194
4348
|
conversationId: todos.conversationId,
|
|
4195
4349
|
id: todos.id
|
|
4196
|
-
}).from(todos).innerJoin(conversation, eq(conversation.conversationId, todos.conversationId)).innerJoin(juniorConversations, and(eq(juniorConversations.conversationId, conversation.rootConversationId), eq(juniorConversations.rootConversationId, juniorConversations.conversationId), isNull(juniorConversations.parentConversationId))).
|
|
4350
|
+
}).from(todos).innerJoin(conversation, eq(conversation.conversationId, todos.conversationId)).innerJoin(juniorConversations, and(eq(juniorConversations.conversationId, conversation.rootConversationId), eq(juniorConversations.rootConversationId, juniorConversations.conversationId), isNull(juniorConversations.parentConversationId))).where(and(or(prefixMatch(todoSearchDocument(todos), query), fuzzyMatch(todoFuzzyTitle(todos), query)), or(isNotNull(conversation.parentConversationId), eq(conversation.rootConversationId, conversation.conversationId)), rootVisibleToViewer(viewer.id))).orderBy(desc(todos.updatedAt), desc(todos.conversationId), desc(todos.id)).limit(200).as("todo_candidates");
|
|
4197
4351
|
const todo = alias(juniorTodos, "todo");
|
|
4198
4352
|
const document = todoSearchDocument(todo);
|
|
4199
4353
|
const title = todoFuzzyTitle(todo);
|
|
@@ -5774,128 +5928,7 @@ async function readStatsReport() {
|
|
|
5774
5928
|
windowStart: start
|
|
5775
5929
|
};
|
|
5776
5930
|
}
|
|
5777
|
-
// src/
|
|
5778
|
-
/**
|
|
5779
|
-
* The session runs `SELECT 1` this often. A socket that drops with no close
|
|
5780
|
-
* frame reports nothing, and a `NOTIFY` sent to a dead session is lost, so
|
|
5781
|
-
* the ping is the only way to notice.
|
|
5782
|
-
*/
|
|
5783
|
-
const PING_INTERVAL_MS = 15e3;
|
|
5784
|
-
const PING_TIMEOUT_MS = 5e3;
|
|
5785
|
-
/**
|
|
5786
|
-
* Open a session on the direct endpoint of `databaseUrl` and `LISTEN` on
|
|
5787
|
-
* `channel`. The pooled endpoint cannot hold a `LISTEN`, because it shares
|
|
5788
|
-
* one server session between clients.
|
|
5789
|
-
*
|
|
5790
|
-
* `onNotify` runs for each notification. `onLost` runs at most once, when
|
|
5791
|
-
* the session fails, ends, or misses a ping. The caller then opens a new
|
|
5792
|
-
* session: a `NOTIFY` sent while no session listens is lost.
|
|
5793
|
-
*/
|
|
5794
|
-
async function openListenSession(args) {
|
|
5795
|
-
const config = { connectionString: readDirectDatabaseUrl(args.databaseUrl) };
|
|
5796
|
-
const client = args.driver === "postgres" ? new pg.Client(config) : new Client(config);
|
|
5797
|
-
let connected = false;
|
|
5798
|
-
let ended = false;
|
|
5799
|
-
let ping;
|
|
5800
|
-
const end = async () => {
|
|
5801
|
-
ended = true;
|
|
5802
|
-
clearInterval(ping);
|
|
5803
|
-
await client.end().catch(() => void 0);
|
|
5804
|
-
};
|
|
5805
|
-
const lose = (error) => {
|
|
5806
|
-
if (ended) return;
|
|
5807
|
-
end();
|
|
5808
|
-
if (connected) args.onLost(error);
|
|
5809
|
-
};
|
|
5810
|
-
client.on("error", lose);
|
|
5811
|
-
try {
|
|
5812
|
-
await client.connect();
|
|
5813
|
-
await client.query(`SET application_name = '${args.applicationName}'`);
|
|
5814
|
-
await client.query(`LISTEN "${args.channel}"`);
|
|
5815
|
-
connected = true;
|
|
5816
|
-
} catch (error) {
|
|
5817
|
-
await end();
|
|
5818
|
-
throw error;
|
|
5819
|
-
}
|
|
5820
|
-
client.on("notification", () => {
|
|
5821
|
-
if (!ended) args.onNotify();
|
|
5822
|
-
});
|
|
5823
|
-
client.on("end", () => lose(/* @__PURE__ */ new Error("LISTEN session ended")));
|
|
5824
|
-
ping = setInterval(() => {
|
|
5825
|
-
let timer;
|
|
5826
|
-
const timeout = new Promise((_, reject) => {
|
|
5827
|
-
timer = setTimeout(() => reject(/* @__PURE__ */ new Error("LISTEN session missed a ping")), PING_TIMEOUT_MS);
|
|
5828
|
-
});
|
|
5829
|
-
Promise.race([client.query("SELECT 1"), timeout]).catch((error) => lose(error instanceof Error ? error : new Error(String(error)))).finally(() => clearTimeout(timer));
|
|
5830
|
-
}, PING_INTERVAL_MS);
|
|
5831
|
-
ping.unref?.();
|
|
5832
|
-
return { close: end };
|
|
5833
|
-
}
|
|
5834
|
-
// src/api/versions/changes.ts
|
|
5835
|
-
/**
|
|
5836
|
-
* The channel that the `junior_notify_versions` triggers send to. They send
|
|
5837
|
-
* an empty payload, so Postgres folds the notifications of one transaction
|
|
5838
|
-
* into one.
|
|
5839
|
-
*/
|
|
5840
|
-
const VERSIONS_CHANNEL = "junior_versions";
|
|
5841
|
-
/** Lets an operator find this instance's session in `pg_stat_activity`. */
|
|
5842
|
-
const APPLICATION_NAME = "junior-versions-listen";
|
|
5843
|
-
/**
|
|
5844
|
-
* Share one direct Postgres `LISTEN` session among the versions streams of
|
|
5845
|
-
* one API instance. The session opens with the first stream and closes with
|
|
5846
|
-
* the last one.
|
|
5847
|
-
*/
|
|
5848
|
-
function createVersionChanges() {
|
|
5849
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
5850
|
-
let session;
|
|
5851
|
-
const lose = (lost, error) => {
|
|
5852
|
-
if (session !== lost) return;
|
|
5853
|
-
session = void 0;
|
|
5854
|
-
logWarn("versions_stream.listener_lost", {
|
|
5855
|
-
"error.type": error.name,
|
|
5856
|
-
"exception.message": error.message,
|
|
5857
|
-
"app.versions_stream.subscribers": subscribers.size
|
|
5858
|
-
});
|
|
5859
|
-
const ended = [...subscribers];
|
|
5860
|
-
subscribers.clear();
|
|
5861
|
-
for (const subscriber of ended) subscriber.onLost();
|
|
5862
|
-
};
|
|
5863
|
-
const connect = () => {
|
|
5864
|
-
const { sql } = getChatConfig();
|
|
5865
|
-
const opened = openListenSession({
|
|
5866
|
-
applicationName: APPLICATION_NAME,
|
|
5867
|
-
channel: VERSIONS_CHANNEL,
|
|
5868
|
-
databaseUrl: sql.databaseUrl,
|
|
5869
|
-
driver: sql.driver,
|
|
5870
|
-
onLost: (error) => lose(opened, error),
|
|
5871
|
-
onNotify: () => {
|
|
5872
|
-
for (const subscriber of subscribers) subscriber.onChange();
|
|
5873
|
-
}
|
|
5874
|
-
});
|
|
5875
|
-
opened.catch(() => {
|
|
5876
|
-
if (session === opened) session = void 0;
|
|
5877
|
-
});
|
|
5878
|
-
return opened;
|
|
5879
|
-
};
|
|
5880
|
-
return { async subscribe(subscriber) {
|
|
5881
|
-
session ??= connect();
|
|
5882
|
-
const current = session;
|
|
5883
|
-
subscribers.add(subscriber);
|
|
5884
|
-
try {
|
|
5885
|
-
await current;
|
|
5886
|
-
} catch (error) {
|
|
5887
|
-
subscribers.delete(subscriber);
|
|
5888
|
-
throw error;
|
|
5889
|
-
}
|
|
5890
|
-
return () => {
|
|
5891
|
-
if (!subscribers.delete(subscriber)) return;
|
|
5892
|
-
if (subscribers.size > 0 || session !== current) return;
|
|
5893
|
-
session = void 0;
|
|
5894
|
-
current.then((listen) => listen.close());
|
|
5895
|
-
};
|
|
5896
|
-
} };
|
|
5897
|
-
}
|
|
5898
|
-
// src/api/versions/read.ts
|
|
5931
|
+
// src/api/versions.ts
|
|
5899
5932
|
/**
|
|
5900
5933
|
* Build a JSON object of each Conversation's tree token by id, with no entry
|
|
5901
5934
|
* for a missing one. The tokens come from one grouped pass over all the ids.
|
|
@@ -5923,152 +5956,6 @@ async function readVersions(viewer, options) {
|
|
|
5923
5956
|
if (!row) throw new Error("Viewer user row is missing");
|
|
5924
5957
|
return row;
|
|
5925
5958
|
}
|
|
5926
|
-
// src/api/versions/stream.ts
|
|
5927
|
-
/**
|
|
5928
|
-
* A stream ends by itself after about this long. Vercel does not tell the
|
|
5929
|
-
* function when the client goes away, and a write to a closed client does
|
|
5930
|
-
* not fail, so the cap is what ends a stream that nobody reads. The client
|
|
5931
|
-
* reconnects and reads a fresh baseline. The cap also bounds how long a
|
|
5932
|
-
* revoked session keeps getting tokens.
|
|
5933
|
-
*/
|
|
5934
|
-
const STREAM_MAX_MS = 12e4;
|
|
5935
|
-
/** Ends spread out, so tabs that opened together do not reconnect together. */
|
|
5936
|
-
const STREAM_MAX_JITTER_MS = 2e4;
|
|
5937
|
-
/** The stream ends this long before the function's max duration. */
|
|
5938
|
-
const FUNCTION_DEADLINE_MARGIN_MS = 15e3;
|
|
5939
|
-
/** The client counts a stream as healthy while it hears from it this often. */
|
|
5940
|
-
const KEEPALIVE_MS = 15e3;
|
|
5941
|
-
/**
|
|
5942
|
-
* After a read, the next one waits at least this long, the same as the poll
|
|
5943
|
-
* of a present reader. A busy viewer then costs no more than the poll.
|
|
5944
|
-
*/
|
|
5945
|
-
const MIN_READ_GAP_MS = 5e3;
|
|
5946
|
-
/** The client waits this long, plus jitter, before it reconnects. */
|
|
5947
|
-
const RETRY_MS = 1e3;
|
|
5948
|
-
const RETRY_JITTER_MS = 2e3;
|
|
5949
|
-
function streamMaxMs() {
|
|
5950
|
-
const functionMaxMs = getChatConfig().functionMaxDurationSeconds * 1e3 - FUNCTION_DEADLINE_MARGIN_MS;
|
|
5951
|
-
return Math.min(STREAM_MAX_MS - STREAM_MAX_JITTER_MS / 2 + Math.random() * STREAM_MAX_JITTER_MS, functionMaxMs);
|
|
5952
|
-
}
|
|
5953
|
-
/**
|
|
5954
|
-
* Open an SSE stream of one viewer's `Versions`. The first message is the
|
|
5955
|
-
* baseline. After that, a message comes only when a write may have moved a
|
|
5956
|
-
* token and a fresh read differs from the last message. Each message is a
|
|
5957
|
-
* fresh `readVersions`, with the same access as the poll.
|
|
5958
|
-
*/
|
|
5959
|
-
async function openVersionsStream(args) {
|
|
5960
|
-
const encoder = new TextEncoder();
|
|
5961
|
-
let controller;
|
|
5962
|
-
const body = new ReadableStream({
|
|
5963
|
-
start(streamController) {
|
|
5964
|
-
controller = streamController;
|
|
5965
|
-
},
|
|
5966
|
-
cancel() {
|
|
5967
|
-
close();
|
|
5968
|
-
}
|
|
5969
|
-
});
|
|
5970
|
-
let closed = false;
|
|
5971
|
-
let unsubscribe;
|
|
5972
|
-
let keepAlive;
|
|
5973
|
-
let cap;
|
|
5974
|
-
let nextRead;
|
|
5975
|
-
let reading = false;
|
|
5976
|
-
let dirty = false;
|
|
5977
|
-
let lastReadAtMs = 0;
|
|
5978
|
-
let lastMessage;
|
|
5979
|
-
function close() {
|
|
5980
|
-
if (closed) return;
|
|
5981
|
-
closed = true;
|
|
5982
|
-
clearInterval(keepAlive);
|
|
5983
|
-
clearTimeout(cap);
|
|
5984
|
-
clearTimeout(nextRead);
|
|
5985
|
-
unsubscribe?.();
|
|
5986
|
-
try {
|
|
5987
|
-
controller.close();
|
|
5988
|
-
} catch {}
|
|
5989
|
-
}
|
|
5990
|
-
const write = (chunk) => {
|
|
5991
|
-
if (closed) return;
|
|
5992
|
-
try {
|
|
5993
|
-
controller.enqueue(encoder.encode(chunk));
|
|
5994
|
-
} catch {
|
|
5995
|
-
close();
|
|
5996
|
-
}
|
|
5997
|
-
};
|
|
5998
|
-
const read = async () => {
|
|
5999
|
-
reading = true;
|
|
6000
|
-
dirty = false;
|
|
6001
|
-
lastReadAtMs = Date.now();
|
|
6002
|
-
try {
|
|
6003
|
-
const message = JSON.stringify(await readVersions(args.viewer, { conversationIds: args.conversationIds }));
|
|
6004
|
-
if (message !== lastMessage) {
|
|
6005
|
-
lastMessage = message;
|
|
6006
|
-
write(`data: ${message}\n\n`);
|
|
6007
|
-
}
|
|
6008
|
-
} catch (error) {
|
|
6009
|
-
logException(error, "versions_stream.read_failed");
|
|
6010
|
-
close();
|
|
6011
|
-
return;
|
|
6012
|
-
} finally {
|
|
6013
|
-
reading = false;
|
|
6014
|
-
}
|
|
6015
|
-
if (dirty) scheduleRead();
|
|
6016
|
-
};
|
|
6017
|
-
function scheduleRead() {
|
|
6018
|
-
if (closed || reading || nextRead) return;
|
|
6019
|
-
nextRead = setTimeout(() => {
|
|
6020
|
-
nextRead = void 0;
|
|
6021
|
-
read();
|
|
6022
|
-
}, Math.max(0, lastReadAtMs + MIN_READ_GAP_MS - Date.now()));
|
|
6023
|
-
}
|
|
6024
|
-
try {
|
|
6025
|
-
unsubscribe = await args.changes.subscribe({
|
|
6026
|
-
onChange: () => {
|
|
6027
|
-
dirty = true;
|
|
6028
|
-
scheduleRead();
|
|
6029
|
-
},
|
|
6030
|
-
onLost: close
|
|
6031
|
-
});
|
|
6032
|
-
} catch (error) {
|
|
6033
|
-
close();
|
|
6034
|
-
throw error;
|
|
6035
|
-
}
|
|
6036
|
-
write(`retry: ${Math.round(RETRY_MS + Math.random() * RETRY_JITTER_MS)}\n\n`);
|
|
6037
|
-
keepAlive = setInterval(() => write(`event: ${VERSIONS_STREAM_KEEPALIVE_EVENT}\ndata: 1\n\n`), KEEPALIVE_MS);
|
|
6038
|
-
keepAlive.unref?.();
|
|
6039
|
-
cap = setTimeout(close, streamMaxMs());
|
|
6040
|
-
cap.unref?.();
|
|
6041
|
-
read();
|
|
6042
|
-
return new Response(body, { headers: {
|
|
6043
|
-
"cache-control": "private, no-store, no-transform",
|
|
6044
|
-
"content-type": "text/event-stream"
|
|
6045
|
-
} });
|
|
6046
|
-
}
|
|
6047
|
-
// src/api/versions/routes.ts
|
|
6048
|
-
/**
|
|
6049
|
-
* Create the routes of the dashboard change tokens: one poll, and one SSE
|
|
6050
|
-
* stream that pushes the same tokens. The streams of this API share one
|
|
6051
|
-
* Postgres `LISTEN` session.
|
|
6052
|
-
*/
|
|
6053
|
-
function createVersionsRoutes() {
|
|
6054
|
-
const app = new Hono();
|
|
6055
|
-
const changes = createVersionChanges();
|
|
6056
|
-
const query = validateRequest("query", versionsQuerySchema, "Invalid query parameters.");
|
|
6057
|
-
app.get("/", requireViewer, query, async (context) => {
|
|
6058
|
-
const headers = { "cache-control": "private, no-store" };
|
|
6059
|
-
if (getChatConfig().versionsStreamEnabled) headers[VERSIONS_STREAM_HEADER] = "1";
|
|
6060
|
-
return jsonResponse(versionsSchema, await readVersions(context.get("viewer"), context.req.valid("query")), { headers });
|
|
6061
|
-
});
|
|
6062
|
-
app.get("/stream", requireViewer, query, async (context) => {
|
|
6063
|
-
if (!getChatConfig().versionsStreamEnabled) return emptyResponse();
|
|
6064
|
-
return await openVersionsStream({
|
|
6065
|
-
changes,
|
|
6066
|
-
conversationIds: context.req.valid("query").conversationIds,
|
|
6067
|
-
viewer: context.get("viewer")
|
|
6068
|
-
});
|
|
6069
|
-
});
|
|
6070
|
-
return app;
|
|
6071
|
-
}
|
|
6072
5959
|
// src/reporting.ts
|
|
6073
5960
|
function readDescriptionText(home) {
|
|
6074
5961
|
try {
|
|
@@ -6079,7 +5966,7 @@ function readDescriptionText(home) {
|
|
|
6079
5966
|
}
|
|
6080
5967
|
/** Read discovered skills for runtime diagnostics and the Automation editor. */
|
|
6081
5968
|
async function readSkillReports() {
|
|
6082
|
-
const { discoverSkills } = await import("./skills-
|
|
5969
|
+
const { discoverSkills } = await import("./skills-DgJ9GBPR.js").then((n) => n.s);
|
|
6083
5970
|
const skills = await discoverSkills();
|
|
6084
5971
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
6085
5972
|
name: skill.name,
|
|
@@ -6093,7 +5980,7 @@ async function readSkillReports() {
|
|
|
6093
5980
|
* what the skill tells Junior. Returns null when no skill has that name.
|
|
6094
5981
|
*/
|
|
6095
5982
|
async function readSkillDetailReport(name) {
|
|
6096
|
-
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-
|
|
5983
|
+
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-DgJ9GBPR.js").then((n) => n.s);
|
|
6097
5984
|
const skill = findSkillByName(name, await discoverSkills());
|
|
6098
5985
|
if (!skill) return null;
|
|
6099
5986
|
const parsed = parseSkillFile(await fs.readFile(path.join(skill.skillPath, "SKILL.md"), "utf8"), skill.name);
|
|
@@ -6108,7 +5995,7 @@ async function readSkillDetailReport(name) {
|
|
|
6108
5995
|
}
|
|
6109
5996
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
6110
5997
|
async function readPlugins() {
|
|
6111
|
-
const { pluginCatalogRuntime } = await import("./db-
|
|
5998
|
+
const { pluginCatalogRuntime } = await import("./db-DhzvUY23.js").then((n) => n.Ar);
|
|
6112
5999
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
6113
6000
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
6114
6001
|
description: plugin.manifest.description,
|
|
@@ -6120,7 +6007,7 @@ async function readPlugins() {
|
|
|
6120
6007
|
async function readRuntimeInfoReport() {
|
|
6121
6008
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
6122
6009
|
import("./package-discovery-BI6T_RkD.js").then((n) => n.r),
|
|
6123
|
-
import("./db-
|
|
6010
|
+
import("./db-DhzvUY23.js").then((n) => n.Ar),
|
|
6124
6011
|
readPlugins(),
|
|
6125
6012
|
readSkillReports()
|
|
6126
6013
|
]);
|
|
@@ -6137,7 +6024,7 @@ async function readRuntimeInfoReport() {
|
|
|
6137
6024
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
6138
6025
|
async function readPluginOperationalReportFeed() {
|
|
6139
6026
|
const nowMs = Date.now();
|
|
6140
|
-
const { getPluginOperationalReports } = await import("./db-
|
|
6027
|
+
const { getPluginOperationalReports } = await import("./db-DhzvUY23.js").then((n) => n.W);
|
|
6141
6028
|
return pluginOperationalReportFeedSchema.parse({
|
|
6142
6029
|
source: "plugins",
|
|
6143
6030
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -6159,7 +6046,7 @@ function createJuniorApi(options = {}) {
|
|
|
6159
6046
|
});
|
|
6160
6047
|
app.get("/api/plugin-reports", async () => jsonResponse(pluginOperationalReportFeedSchema, await readPluginOperationalReportFeed()));
|
|
6161
6048
|
app.get("/api/stats", async () => jsonResponse(statsReportSchema, await readStatsReport()));
|
|
6162
|
-
app.
|
|
6049
|
+
app.get("/api/versions", requireViewer, validateRequest("query", versionsQuerySchema, "Invalid query parameters."), async (context) => jsonResponse(versionsSchema, await readVersions(context.get("viewer"), context.req.valid("query")), { headers: { "cache-control": "private, no-store" } }));
|
|
6163
6050
|
for (const path of REVALIDATED_READ_PATHS) app.use(path, revalidateContent);
|
|
6164
6051
|
const queue = options.conversationWorkQueue ?? getVercelConversationWorkQueue();
|
|
6165
6052
|
const waitUntil$1 = options.waitUntil ?? ((task) => waitUntil(typeof task === "function" ? task() : task));
|