@sentry/junior 0.288.0 → 0.289.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-Cikcqdty.js → adapter-tE1wnl0T.js} +1 -1
- package/dist/{admin-BcSxHuTB.js → admin-BmsPbmO_.js} +2 -2
- package/dist/{agent-runner-9MXyWUL8.js → agent-runner-bvl8U5uH.js} +343 -103
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +281 -254
- package/dist/{app-BUklJVBe.d.ts → app-Cu454FXq.d.ts} +2 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +92 -64
- package/dist/assistant-reply-1N9oxyyb.js +58 -0
- package/dist/{automation-DDXwHQs5.js → automation-DWbjJltM.js} +1 -1
- package/dist/{background-compaction-queue-CjllSPir.js → background-compaction-queue-D36oCldp.js} +4 -4
- package/dist/{briefs-DW9iuolG.js → briefs-CV-1qkXa.js} +3 -4
- package/dist/{catalog-runtime-B3gfH58M.js → catalog-runtime-BNK4uJVZ.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-CLJcyYEF.js → config-DHAy7XlP.js} +4 -41
- package/dist/{connections-BtdJftow.js → connections-C3VmH3cf.js} +7 -129
- package/dist/{conversation-DhoqHtQ7.js → conversation-CwC8K3RZ.js} +8 -8
- package/dist/{conversation-pending-messages-DHV0S4uF.js → conversation-pending-messages-B0cuLReP.js} +1 -1
- package/dist/{conversation-privacy-BPirIVlX.js → conversation-privacy-Bky_veSp.js} +1 -1
- package/dist/{credential-sync-Co8Q2xRW.js → credential-sync-dY9o0YSj.js} +13 -13
- package/dist/{db-Co7DTYYh.js → db-BS2Kql3j.js} +56 -31
- package/dist/{db-zIs8-Ba3.d.ts → db-BebRmhsH.d.ts} +5 -1
- package/dist/{executor-m0kIN71Q.js → executor-cc4nH86C.js} +35 -9
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-DbD-dErY.js → logging-CtCJmt9p.js} +2 -2
- package/dist/{history-IjdmO_r6.js → media-BepyEUNm.js} +85 -1
- package/dist/{message-DKTdTYm-.js → message-C5VuRcP9.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-CpbepSbp.js → oauth-callback-server-KRrYUZ35.js} +2 -2
- package/dist/{projection-BViECfYu.js → projection-BFJG58TG.js} +153 -119
- package/dist/{prompt-KT6MaDHN.js → prompt-D15oftoL.js} +183 -3
- package/dist/{registry-D-Acyjhh.js → registry-C_JrgqUz.js} +1 -1
- package/dist/{resolve-gkT2R66z.js → resolve-Cn_7JfP-.js} +3 -3
- package/dist/{result-DHmCFEt8.js → result-CIbQFLp6.js} +16 -10
- package/dist/{runner-DBKjGjH-.js → runner-BwmaMJVO.js} +8 -8
- package/dist/{sandbox-egress-signals-9n8hqx29.js → sandbox-egress-signals-BOQ8gn7i.js} +1 -1
- package/dist/{schema-DxicIQbc.js → schema-Bptz19Ja.js} +14 -9
- package/dist/{schema-B_6aOcx5.d.ts → schema-DQaFSkZZ.d.ts} +13 -5
- package/dist/{service-account-CDlC9ssy.js → service-account-AGw_pANb.js} +3 -3
- package/dist/{service-account-Bi0HsY6w.js → service-account-CLZfF8O1.js} +3 -3
- package/dist/{session-stop-BWOsuo8p.js → session-stop-CbzKf7UI.js} +41 -30
- package/dist/{skills-DO5K68Rq.js → skills-CcAJBquq.js} +2 -2
- package/dist/{spawn-BBqZDcPa.js → spawn-BvAk2vTI.js} +5 -5
- package/dist/{stop-WC97cmHz.js → stop-BQU4u7la.js} +123 -213
- package/dist/{store-ByR1Lr7e.js → store-DE7NJOvQ.js} +3 -3
- package/dist/{task-runner-B-Ewf8TX.js → task-runner-Q_7duP_T.js} +13 -17
- package/dist/{turn-failure-response-CpdPoZSl.js → turn-failure-response-aWZLfUM8.js} +8 -8
- package/dist/{validation-B4sbIoES.js → validation-BOoPeIJR.js} +1 -1
- package/dist/{version-D6lpuAgL.js → version-Db0MFy61.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CeP27tC3.js → viewer-FFEFu9In.js} +4 -4
- package/dist/{warmup-P_GJCL1c.js → warmup-DDzrA9Gv.js} +260 -60
- package/dist/{work-DI7x1Slm.js → work-BBJK458E.js} +14 -14
- package/dist/{worker-CYPTOT4j.js → worker-2iU5RFyq.js} +6 -30
- package/migrations/0091_conversation_participant_unsubscribed_index.sql +20 -0
- package/migrations/0092_turn_metric_actor.sql +12 -0
- package/migrations/0093_participant_root_actor_backfill.sql +18 -0
- package/migrations/0094_conversation_delivery_paused_at.sql +1 -0
- package/migrations/meta/0091_snapshot.json +4410 -0
- package/migrations/meta/0092_snapshot.json +4446 -0
- package/migrations/meta/0093_snapshot.json +4446 -0
- package/migrations/meta/0094_snapshot.json +4452 -0
- package/migrations/meta/_journal.json +28 -0
- package/package.json +5 -5
- package/dist/assistant-reply-mj47jMRV.js +0 -65
- package/dist/core-model-BTt5E5b0.js +0 -182
- package/dist/media-BAHvgkok.js +0 -85
package/dist/api.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
3
|
-
import { m as logInfo, p as logException } from "./logging-
|
|
1
|
+
import { $a as readConversationAccessFromSql, $n as isPausedBySlack, Aa as SANDBOX_RUNTIME, En as createUserTokenStore, Er as reviewItemReaderForUserInConversation, Gn as readWebPushConfig, Jn as deletePushSubscription, Kn as sendPushNotificationToUser, Na as workspaceRepoCheckoutPath, Qa as createConversationAccessReader, Qn as savePushSubscription, Ti as hash, Tr as reviewItemReaderForUser, Xn as readNotificationSchedule, Ya as createPluginLogger, Yn as listPushSubscriptions, Zn as saveNotificationSchedule, _i as listWorkspacesByRepository, ai as getDashboardSettingsLink, dr as searchReviewItems, fi as createWorkspace, gi as listWorkspaces, hr as canActOnReviewItem, jo as createPluginCache, lo as readConversationEventPage, lr as listWaitingConversations, mi as getWorkspace, mr as PLUGIN_REVIEW_ITEM_KEY_PREFIX, pi as deleteWorkspace, qn as resolveNotificationTimezone, rr as countReviewItemsNeedingUser, so as readConversationBriefThrough, to as conversationIsMemberRoot, ur as reviewItemsNeedingUserVersionQuery, vi as updateWorkspace, wi as create, wr as reviewItemNeedsUser, yi as WorkspaceValidationError, yr as isOnlyAssignee, zn as getPlugins } from "./projection-BFJG58TG.js";
|
|
2
|
+
import { L as escapeXml, n as botConfig, q as getAttachmentStorage } from "./config-DHAy7XlP.js";
|
|
3
|
+
import { m as logInfo, p as logException } from "./logging-CtCJmt9p.js";
|
|
4
4
|
import { f as parseSlackTeamId, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
5
|
-
import {
|
|
6
|
-
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, S as juniorConversationMetrics, T as juniorApiTokens, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, w as juniorConversationEvents } from "./executor-
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { J as nextDetailVersion, a as getConversationStore, b as withConversationMutationLock, o as getDb, s as getSqlExecutor, v as loadConversationSlackTenantIds, x as conversationKindFromRow } from "./db-BS2Kql3j.js";
|
|
6
|
+
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, S as juniorConversationMetrics, T as juniorApiTokens, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, w as juniorConversationEvents } from "./executor-cc4nH86C.js";
|
|
7
|
+
import { n as INPUT_IMAGE_TYPES, t as INLINE_VIDEO_TYPES } from "./media-BepyEUNm.js";
|
|
8
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BNK4uJVZ.js";
|
|
9
|
+
import { $ as readViewerAutomationSummary, $t as resumeConversationDelivery, A as runWithSlackInstallation, Ct as emptyResponse, G as changeViewerAutomationLifecycle, J as updateViewerAutomation, K as deleteViewerTask, Q as readViewerAutomationRuns, Qt as pauseConversationDelivery, S as createSlackReviewItemShow, Tt as throwApiError, W as activateViewerAutomationVersion, Y as ViewerTaskNotFoundError, Z as readViewerAutomationExecutions, Zt as canPauseConversationDelivery, _t as readLiveAttachment, bt as archiveConversation, et as readViewerAutomationVersions, it as listOwnedWatches, m as readStats, mt as webActorFromUser, nt as AutomationEditError, on as listChildAgents, q as readViewerAutomationEdit, tt as readViewerAutomations, v as setConversationSubscription, wt as jsonResponse } from "./agent-runner-bvl8U5uH.js";
|
|
10
|
+
import { n as briefEntriesFromReportEvents, u as completeText } from "./prompt-D15oftoL.js";
|
|
11
|
+
import { c as readViewerAvatarUrl, d as updateViewerDisplayName, l as resolveViewerUser, m as readAvatarImage, t as findUserByEmail } from "./viewer-FFEFu9In.js";
|
|
12
|
+
import { r as getStateAdapter } from "./adapter-tE1wnl0T.js";
|
|
12
13
|
import { r as notificationScheduleSchema } from "./schedule-cP0AACm1.js";
|
|
13
|
-
import { n as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { g as getVercelConversationWorkQueue } from "./background-compaction-queue-CjllSPir.js";
|
|
17
|
-
import { O as getEventCatalog, et as readUserCustomization, rt as isExperimentalFeatureEnabled, tt as saveUserCustomization } from "./session-stop-BWOsuo8p.js";
|
|
14
|
+
import { A as renameConversationBodySchema, C as createConversationBodySchema, E as forkConversationResponseSchema, M as conversationReadPositionSchema, N as conversationReadReportSchema, T as forkConversationBodySchema, c as conversationDetailQuerySchema, d as conversationEventPageSchema, f as conversationEventsQuerySchema, h as conversationParamsSchema, j as renameConversationResponseSchema, l as conversationDetailReportSchema, m as conversationFeedSchema, n as CONVERSATION_VERSION_HEADER, o as conversationAttachmentParamsSchema, p as conversationFeedQuerySchema, r as acceptedConversationMessageSchema, t as CONVERSATION_DETAIL_VERSION_HEADER, w as createConversationMessageBodySchema } from "./conversation-CwC8K3RZ.js";
|
|
15
|
+
import { g as getVercelConversationWorkQueue } from "./background-compaction-queue-D36oCldp.js";
|
|
16
|
+
import { O as getEventCatalog, et as readUserCustomization, rt as isExperimentalFeatureEnabled, tt as saveUserCustomization } from "./session-stop-CbzKf7UI.js";
|
|
18
17
|
import { E as userCustomizationSchema, a as fillUtcSixHours, c as trailingUtcDayWindow, d as utcDayKey, f as utcHourKey, i as fillUtcHours, l as trailingUtcHourWindow, m as apiErrorSchema, n as HOUR_MS$1, o as startOfUtcHour, r as fillUtcDays, s as sumUtcHoursIntoSixHours, t as DAY_MS$1, u as trailingUtcSixHourWindow } from "./reporting-window-B3Ze-Qnt.js";
|
|
19
|
-
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-
|
|
20
|
-
import { J as AutomationConflictError,
|
|
21
|
-
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-
|
|
22
|
-
import { N as ScheduleIntentError, P as compileScheduleIntent, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-
|
|
23
|
-
import { _ as pluginsSchema, b as skillReportsSchema, c as conversationUnchangedDetailWithMailboxSchema, d as healthReportSchema, f as pluginOperationalReportFeedSchema, l as steerConversationPendingMessagesBodySchema, n as cancelConversationPendingMessagesResponseSchema, r as conversationDetailWithMailboxReportSchema, s as conversationPendingMessagesReportSchema, t as cancelConversationPendingMessagesBodySchema, u as steerConversationPendingMessagesResponseSchema, v as runtimeInfoReportSchema } from "./conversation-pending-messages-
|
|
24
|
-
import { $ as actOnReviewItem, C as createConversationForViewer, E as cancelConversationPendingMessagesForViewer, F as isAllowedSignInEmail, M as getProductionSlackAdapter, O as requireConversationPendingMessages, Q as ReviewItemActionError, S as appendConversationMessageForViewer, _ as keepQuickQuestionForViewer, a as pinConversation, at as continueConversationInSlack, c as readConversationParticipants, ct as archiveViewerDoneConversations, d as readConversationTreeMetricsFromSql, dt as setConversationAutoArchive, f as conversationVersionQuery, ft as updateUserAutoArchiveSettings, g as forkConversationForViewer, gt as readHealthReport, h as reportConversationRead, i as readConversationFeed, it as canContinueInSlack, k as resolveMentions, l as readConversationAuxiliaryCostsFromSql, lt as readUserAutoArchiveSettings, m as markConversationUnread, n as steerConversationPendingMessagesForViewer, o as reorderPinnedConversations, p as readConversationDetailEtag, r as conversationFeedVersionQuery, s as readConversationDetail, st as DEFAULT_AUTO_ARCHIVE_SETTINGS, t as stopConversationTurnForViewer, tt as readReviewItemForUser, u as childAgentTotalsReport, v as readConversationEvents, x as readFirstHumanMessageTexts, y as conversationSummaryFromStoredConversation } from "./stop-
|
|
25
|
-
import { a as startConnection, n as isConnectableProvider, r as listConnections, s as htmlCallbackResponse, t as disconnectConnection } from "./connections-
|
|
26
|
-
import {
|
|
18
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-Cn_7JfP-.js";
|
|
19
|
+
import { J as AutomationConflictError, bt as automationEventCatalog, lt as conversationAggregateColumns, st as readAutomationTitlesByConversationId, ut as conversationRangeColumns } from "./task-runner-Q_7duP_T.js";
|
|
20
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-AGw_pANb.js";
|
|
21
|
+
import { N as ScheduleIntentError, P as compileScheduleIntent, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-DWbjJltM.js";
|
|
22
|
+
import { _ as pluginsSchema, b as skillReportsSchema, c as conversationUnchangedDetailWithMailboxSchema, d as healthReportSchema, f as pluginOperationalReportFeedSchema, l as steerConversationPendingMessagesBodySchema, n as cancelConversationPendingMessagesResponseSchema, r as conversationDetailWithMailboxReportSchema, s as conversationPendingMessagesReportSchema, t as cancelConversationPendingMessagesBodySchema, u as steerConversationPendingMessagesResponseSchema, v as runtimeInfoReportSchema } from "./conversation-pending-messages-B0cuLReP.js";
|
|
23
|
+
import { $ as actOnReviewItem, C as createConversationForViewer, E as cancelConversationPendingMessagesForViewer, F as isAllowedSignInEmail, M as getProductionSlackAdapter, O as requireConversationPendingMessages, Q as ReviewItemActionError, S as appendConversationMessageForViewer, _ as keepQuickQuestionForViewer, a as pinConversation, at as continueConversationInSlack, c as readConversationParticipants, ct as archiveViewerDoneConversations, d as readConversationTreeMetricsFromSql, dt as setConversationAutoArchive, f as conversationVersionQuery, ft as updateUserAutoArchiveSettings, g as forkConversationForViewer, gt as readHealthReport, h as reportConversationRead, i as readConversationFeed, it as canContinueInSlack, k as resolveMentions, l as readConversationAuxiliaryCostsFromSql, lt as readUserAutoArchiveSettings, m as markConversationUnread, n as steerConversationPendingMessagesForViewer, o as reorderPinnedConversations, p as readConversationDetailEtag, r as conversationFeedVersionQuery, s as readConversationDetail, st as DEFAULT_AUTO_ARCHIVE_SETTINGS, t as stopConversationTurnForViewer, tt as readReviewItemForUser, u as childAgentTotalsReport, v as readConversationEvents, x as readFirstHumanMessageTexts, y as conversationSummaryFromStoredConversation } from "./stop-BQU4u7la.js";
|
|
24
|
+
import { a as startConnection, n as isConnectableProvider, r as listConnections, s as htmlCallbackResponse, t as disconnectConnection } from "./connections-C3VmH3cf.js";
|
|
25
|
+
import { A as actorDirectoryReportSchema, At as reorderPinnedConversationsResponseSchema, B as activityHours$1, C as startServiceAccountSignInResponseSchema, Ct as conversationSubscriptionBodySchema, Dt as pinConversationBodySchema, E as personalTokenListSchema, Et as conversationDeliveryResponseSchema, G as pushSubscriptionDeleteBodySchema, I as locationDetailReportSchema, J as connectionParamsSchema, K as testNotificationResponseSchema, L as locationDirectoryReportSchema, M as avatarParamsSchema, Mt as conversationCatchUpSchema, N as personParamsSchema, O as personalTokenParamsSchema, Ot as pinConversationResponseSchema, P as personalSpendReportSchema, R as locationParamsSchema, St as markConversationUnreadBodySchema, T as createdPersonalTokenSchema, Tt as conversationDeliveryBodySchema, U as notificationSettingsSchema, V as activitySixHours$1, W as pushSubscriptionBodySchema, X as disconnectConnectionResponseSchema, Z as startConnectionResponseSchema, _ as reviewItemSchema, _t as archiveConversationBodySchema, b as serviceAccountListSchema, bt as conversationAutoArchiveSchema, c as workspaceListSchema, ct as conversationWatchesReportSchema, d as workspaceSchema, dt as continueConversationInSlackBodySchema, f as reviewItemActionSchema, ft as continueConversationInSlackResponseSchema, g as reviewItemParamsSchema, gt as conversationOutlineSchema, h as reviewItemListSchema, i as statsReportSchema, it as codeRepositoryReportSchema, j as actorProfileReportSchema, jt as conversationCatchUpBodySchema, k as revokePersonalTokenResponseSchema, kt as reorderPinnedConversationsBodySchema, l as workspaceParamsSchema, m as reviewItemListQuerySchema, mt as conversationStatsReportSchema, n as versionsSchema, nt as codePersonReportSchema, o as deleteWorkspaceResponseSchema, ot as boardReportSchema, p as reviewItemCountSchema, pt as stopConversationTurnResponseSchema, q as connectionListSchema, rt as codeRepositoryParamsSchema, s as workspaceBodySchema, t as versionsQuerySchema, tt as codeOverviewReportSchema, ut as conversationChildAgentsReportSchema, v as reviewItemWaitingConversationsSchema, vt as archiveConversationResponseSchema, w as createPersonalTokenBodySchema, wt as conversationSubscriptionResponseSchema, x as serviceAccountParamsSchema, xt as conversationUnreadSchema, y as disconnectServiceAccountResponseSchema, yt as archiveDoneConversationsResponseSchema, z as activityDays$1 } from "./schema-Bptz19Ja.js";
|
|
27
26
|
import { Hono } from "hono";
|
|
28
27
|
import path from "node:path";
|
|
29
28
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
30
29
|
import * as z from "zod";
|
|
31
|
-
import { and, arrayOverlaps, asc, desc, eq, gt, gte, inArray, isNull, like, lte,
|
|
30
|
+
import { and, arrayOverlaps, asc, desc, eq, gt, gte, inArray, isNull, like, lte, or, sql } from "drizzle-orm";
|
|
32
31
|
import { conversationAnnotationInputSchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
33
32
|
import { alias } from "drizzle-orm/pg-core";
|
|
34
33
|
import { readFileSync } from "node:fs";
|
|
@@ -70,7 +69,7 @@ Rules:
|
|
|
70
69
|
- Use only facts in the input. Do not invent names, ids, numbers, outcomes, or links.
|
|
71
70
|
- Do not repeat what the Brief already says unless it changed.
|
|
72
71
|
- Never say that a code change was merged, closed, deployed, or released unless a row says so.
|
|
73
|
-
- Ignore Junior runtime mechanics
|
|
72
|
+
- Ignore Junior runtime mechanics and context tags.
|
|
74
73
|
- Address the reader as "you".
|
|
75
74
|
- When a row asks the reader a question, asks them to review, approve, or decide something, or waits on them, add one last line that starts with "Needs you:" and says what. Otherwise, do not add that line.
|
|
76
75
|
- Plain text only. No headings, lists, or Markdown.`;
|
|
@@ -197,6 +196,20 @@ async function catchUpOnConversation(viewer, conversationId, range) {
|
|
|
197
196
|
...conversation.title ? { title: conversation.title } : void 0
|
|
198
197
|
});
|
|
199
198
|
}
|
|
199
|
+
// src/api/conversations/delivery.ts
|
|
200
|
+
/**
|
|
201
|
+
* Detach a root from its Location, or attach it again. Only a participant
|
|
202
|
+
* can change it, the same as rename. A mention in the Location attaches it
|
|
203
|
+
* again too.
|
|
204
|
+
*/
|
|
205
|
+
async function setConversationDeliveryForViewer(viewer, conversationId, body) {
|
|
206
|
+
const conversation = (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant ? await getConversationStore().get({ conversationId }) : void 0;
|
|
207
|
+
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
208
|
+
if (!canPauseConversationDelivery(conversation)) throwApiError(409, "Only a conversation with a Slack thread can detach.");
|
|
209
|
+
if (body.paused) await pauseConversationDelivery(conversationId);
|
|
210
|
+
else await resumeConversationDelivery(conversationId);
|
|
211
|
+
return { paused: body.paused };
|
|
212
|
+
}
|
|
200
213
|
// src/chat/conversations/sql/title.ts
|
|
201
214
|
/**
|
|
202
215
|
* Replace one Conversation's title. Returns the stored title, or undefined
|
|
@@ -879,6 +892,7 @@ function createConversationRoutes(options) {
|
|
|
879
892
|
return jsonResponse(archiveConversationResponseSchema, await archiveConversation(viewer, conversationId, body));
|
|
880
893
|
});
|
|
881
894
|
app.patch("/:conversationId/pin", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", pinConversationBodySchema, "Invalid request body."), async (context) => jsonResponse(pinConversationResponseSchema, await pinConversation(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
895
|
+
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"))));
|
|
882
896
|
app.patch("/:conversationId/subscription", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationSubscriptionBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationSubscriptionResponseSchema, await setConversationSubscription(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
883
897
|
app.patch("/:conversationId/unread", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", markConversationUnreadBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationUnreadSchema, await markConversationUnread(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
884
898
|
app.patch("/:conversationId/title", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", renameConversationBodySchema, "Invalid request body."), async (context) => jsonResponse(renameConversationResponseSchema, await renameConversation(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
@@ -2242,22 +2256,94 @@ async function readPeopleCode(email) {
|
|
|
2242
2256
|
}
|
|
2243
2257
|
return await readPersonCodeOverview({ userId: subject.id });
|
|
2244
2258
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
}
|
|
2259
|
+
function turnMetricSum(metric) {
|
|
2260
|
+
return sql`SUM(${juniorConversationMetrics.value}) FILTER (
|
|
2261
|
+
WHERE ${juniorConversationMetrics.metric} = ${metric}
|
|
2262
|
+
)`;
|
|
2263
|
+
}
|
|
2264
|
+
/** Sum the spend of Turn metric rows read straight from their table. */
|
|
2265
|
+
const turnMetricColumns = { costUsd: sql`${turnMetricSum("cost_usd")}::double precision` };
|
|
2266
|
+
/** Root Conversation of a person's Turn, for status, location, and surface. */
|
|
2267
|
+
const turnRoot = alias(juniorConversations, "person_turn_root");
|
|
2252
2268
|
/**
|
|
2253
|
-
*
|
|
2269
|
+
* Read one row per Turn metric of each verified person, with the root
|
|
2270
|
+
* Conversation of the Turn.
|
|
2254
2271
|
*
|
|
2255
|
-
*
|
|
2256
|
-
*
|
|
2272
|
+
* People counts and spend come only from Turns. The Actor that started a
|
|
2273
|
+
* Conversation does not matter here.
|
|
2257
2274
|
*/
|
|
2258
|
-
function
|
|
2259
|
-
|
|
2260
|
-
|
|
2275
|
+
function personTurns(email) {
|
|
2276
|
+
return getDb().select({
|
|
2277
|
+
conversationId: sql`${juniorConversationMetrics.conversationId}`.as("turn_conversation_id"),
|
|
2278
|
+
email: sql`${juniorUsers.primaryEmailNormalized}`.as("email"),
|
|
2279
|
+
fullName: juniorUsers.displayName,
|
|
2280
|
+
metric: juniorConversationMetrics.metric,
|
|
2281
|
+
occurredAt: juniorConversationMetrics.occurredAt,
|
|
2282
|
+
rootConversationId: sql`coalesce(
|
|
2283
|
+
${juniorConversations.rootConversationId},
|
|
2284
|
+
${juniorConversations.conversationId}
|
|
2285
|
+
)`.as("turn_root_conversation_id"),
|
|
2286
|
+
lastRootTurnAt: sql`max(${juniorConversationMetrics.occurredAt}) OVER (
|
|
2287
|
+
PARTITION BY ${juniorUsers.id}, coalesce(
|
|
2288
|
+
${juniorConversations.rootConversationId},
|
|
2289
|
+
${juniorConversations.conversationId}
|
|
2290
|
+
)
|
|
2291
|
+
)`.as("last_root_turn_at"),
|
|
2292
|
+
slackUserId: sql`CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.providerSubjectId} END`.as("slack_user_id"),
|
|
2293
|
+
slackUserName: sql`CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.handle} END`.as("slack_user_name"),
|
|
2294
|
+
userId: sql`${juniorUsers.id}`.as("user_id"),
|
|
2295
|
+
value: juniorConversationMetrics.value
|
|
2296
|
+
}).from(juniorConversationMetrics).innerJoin(juniorConversations, eq(juniorConversations.conversationId, juniorConversationMetrics.conversationId)).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationMetrics.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(verifiedActorWhere(email)).as("person_turns");
|
|
2297
|
+
}
|
|
2298
|
+
/** Join a person's Turn rows to the root Conversation of each Turn. */
|
|
2299
|
+
function turnRootJoin(turns) {
|
|
2300
|
+
return eq(turnRoot.conversationId, turns.rootConversationId);
|
|
2301
|
+
}
|
|
2302
|
+
function turnSum(turns, metric) {
|
|
2303
|
+
return sql`SUM(${turns.value}) FILTER (WHERE ${turns.metric} = ${metric})`;
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Aggregate a person's Turn rows. A Conversation counts once for each person
|
|
2307
|
+
* who ran a Turn in it. Child Conversation Turns count for the root.
|
|
2308
|
+
*
|
|
2309
|
+
* Active and failed read the root's current status. They count only in the
|
|
2310
|
+
* bucket of the person's last Turn in that root, so a status change does not
|
|
2311
|
+
* mark every past day.
|
|
2312
|
+
*/
|
|
2313
|
+
function turnAggregateColumns(turns) {
|
|
2314
|
+
const roots = sql`COUNT(DISTINCT ${turns.rootConversationId})`;
|
|
2315
|
+
const lastTurn = sql`${turns.occurredAt} = ${turns.lastRootTurnAt}`;
|
|
2316
|
+
return {
|
|
2317
|
+
active: sql`${roots} FILTER (
|
|
2318
|
+
WHERE ${lastTurn} AND ${turnRoot.executionStatus} NOT IN ('idle', 'failed')
|
|
2319
|
+
)::integer`,
|
|
2320
|
+
conversations: sql`${roots}::integer`,
|
|
2321
|
+
costUsd: sql`${turnSum(turns, "cost_usd")}::double precision`,
|
|
2322
|
+
durationMs: sql`COALESCE(${turnSum(turns, "duration_ms")}, 0)::double precision`,
|
|
2323
|
+
failed: sql`${roots} FILTER (
|
|
2324
|
+
WHERE ${lastTurn}
|
|
2325
|
+
AND ${turnRoot.executionStatus} = 'failed'
|
|
2326
|
+
AND ${turnRoot.stoppedAt} IS NULL
|
|
2327
|
+
)::integer`,
|
|
2328
|
+
tokens: sql`${turnSum(turns, "total_tokens")}::double precision`
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
/** Format the UTC day or hour of a person's Turn rows for activity buckets. */
|
|
2332
|
+
function turnBucket(turns, unit) {
|
|
2333
|
+
const format = unit === "day" ? "YYYY-MM-DD" : "YYYY-MM-DD\"T\"HH24";
|
|
2334
|
+
return sql`TO_CHAR(${turns.occurredAt} AT TIME ZONE 'UTC', ${sql.raw(`'${format}'`)})`;
|
|
2335
|
+
}
|
|
2336
|
+
/** Select the identity fields and Turn range of a grouped person row. */
|
|
2337
|
+
function turnPersonColumns(turns) {
|
|
2338
|
+
return {
|
|
2339
|
+
activeDays: sql`COUNT(DISTINCT (${turns.occurredAt} AT TIME ZONE 'UTC')::date)::integer`,
|
|
2340
|
+
email: turns.email,
|
|
2341
|
+
firstSeenAt: sql`MIN(${turns.occurredAt})`.mapWith(juniorConversationMetrics.occurredAt),
|
|
2342
|
+
fullName: turns.fullName,
|
|
2343
|
+
lastSeenAt: sql`MAX(${turns.occurredAt})`.mapWith(juniorConversationMetrics.occurredAt),
|
|
2344
|
+
slackUserId: sql`MAX(${turns.slackUserId})`,
|
|
2345
|
+
slackUserName: sql`MAX(${turns.slackUserName})`
|
|
2346
|
+
};
|
|
2261
2347
|
}
|
|
2262
2348
|
/** Normalize emails before matching people API rows. */
|
|
2263
2349
|
function normalizeEmail$1(email) {
|
|
@@ -2331,20 +2417,13 @@ function verifiedActorWhere(email) {
|
|
|
2331
2417
|
const normalizedEmail = normalizeEmail$1(email);
|
|
2332
2418
|
return and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.emailVerified, true), sql`${juniorUsers.primaryEmailNormalized} IS NOT NULL`, normalizedEmail ? eq(juniorUsers.primaryEmailNormalized, normalizedEmail) : void 0);
|
|
2333
2419
|
}
|
|
2334
|
-
/**
|
|
2335
|
-
* Read the Slack user fields for a grouped person row.
|
|
2336
|
-
*
|
|
2337
|
-
* Web identities use the email as the provider subject, so only Slack
|
|
2338
|
-
* identities can supply these fields.
|
|
2339
|
-
*/
|
|
2340
|
-
function slackActorColumns() {
|
|
2341
|
-
return {
|
|
2342
|
-
slackUserId: sql`MAX(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.providerSubjectId} END)`,
|
|
2343
|
-
slackUserName: sql`MAX(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.handle} END)`
|
|
2344
|
-
};
|
|
2345
|
-
}
|
|
2346
|
-
/** Read only the recent conversation rows required by a People profile. */
|
|
2420
|
+
/** Read the Conversations where a person ran a Turn, by their last Turn. */
|
|
2347
2421
|
async function recentActorRows(email) {
|
|
2422
|
+
const turns = personTurns(email);
|
|
2423
|
+
const lastTurns = getDb().select({
|
|
2424
|
+
conversationId: turns.conversationId,
|
|
2425
|
+
lastTurnAt: sql`max(${turns.occurredAt})`.as("last_turn_at")
|
|
2426
|
+
}).from(turns).groupBy(turns.conversationId).as("person_last_turns");
|
|
2348
2427
|
return getDb().select({
|
|
2349
2428
|
channelName: juniorConversations.channelName,
|
|
2350
2429
|
conversationId: juniorConversations.conversationId,
|
|
@@ -2366,7 +2445,7 @@ async function recentActorRows(email) {
|
|
|
2366
2445
|
title: juniorConversations.title,
|
|
2367
2446
|
updatedAt: juniorConversations.updatedAt,
|
|
2368
2447
|
usage: juniorConversations.usage
|
|
2369
|
-
}).from(
|
|
2448
|
+
}).from(lastTurns).innerJoin(juniorConversations, eq(juniorConversations.conversationId, lastTurns.conversationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).orderBy(desc(lastTurns.lastTurnAt), asc(juniorConversations.conversationId)).limit(25);
|
|
2370
2449
|
}
|
|
2371
2450
|
// src/api/people/list.query.ts
|
|
2372
2451
|
const DIRECTORY_ACTIVITY_DAYS = 90;
|
|
@@ -2383,7 +2462,6 @@ function emptyDirectoryDay(date) {
|
|
|
2383
2462
|
}
|
|
2384
2463
|
function emptyBucket() {
|
|
2385
2464
|
return {
|
|
2386
|
-
conversations: 0,
|
|
2387
2465
|
costUsd: 0,
|
|
2388
2466
|
durationMs: 0
|
|
2389
2467
|
};
|
|
@@ -2419,13 +2497,12 @@ function sumBuckets(buckets, startMs, endMs, keyFor, stepMs) {
|
|
|
2419
2497
|
for (let cursor = startMs; cursor <= endMs; cursor += stepMs) {
|
|
2420
2498
|
const bucket = buckets.get(keyFor(cursor));
|
|
2421
2499
|
if (!bucket) continue;
|
|
2422
|
-
total.conversations += bucket.conversations;
|
|
2423
2500
|
total.costUsd = addUsd$1(total.costUsd, bucket.costUsd);
|
|
2424
2501
|
total.durationMs += bucket.durationMs;
|
|
2425
2502
|
}
|
|
2426
2503
|
return total;
|
|
2427
2504
|
}
|
|
2428
|
-
function rangeWindow(buckets, nowMs, range) {
|
|
2505
|
+
function rangeWindow(buckets, nowMs, range, conversations) {
|
|
2429
2506
|
if (range === 1) {
|
|
2430
2507
|
const current = trailingUtcHourWindow(nowMs, 24);
|
|
2431
2508
|
const priorEndMs = current.start.getTime() - HOUR_MS$1;
|
|
@@ -2433,7 +2510,7 @@ function rangeWindow(buckets, nowMs, range) {
|
|
|
2433
2510
|
const currentTotals = sumBuckets(buckets, current.start.getTime(), current.end.getTime(), utcHourKey, HOUR_MS$1);
|
|
2434
2511
|
const priorTotals = sumBuckets(buckets, priorStartMs, priorEndMs, utcHourKey, HOUR_MS$1);
|
|
2435
2512
|
return {
|
|
2436
|
-
conversations
|
|
2513
|
+
conversations,
|
|
2437
2514
|
costUsd: currentTotals.costUsd,
|
|
2438
2515
|
durationMs: currentTotals.durationMs,
|
|
2439
2516
|
priorCostUsd: priorTotals.costUsd
|
|
@@ -2445,101 +2522,94 @@ function rangeWindow(buckets, nowMs, range) {
|
|
|
2445
2522
|
const currentTotals = sumBuckets(buckets, current.start.getTime(), current.end.getTime(), utcDayKey, DAY_MS$1);
|
|
2446
2523
|
const priorTotals = sumBuckets(buckets, priorStartMs, priorEndMs, utcDayKey, DAY_MS$1);
|
|
2447
2524
|
return {
|
|
2448
|
-
conversations
|
|
2525
|
+
conversations,
|
|
2449
2526
|
costUsd: currentTotals.costUsd,
|
|
2450
2527
|
durationMs: currentTotals.durationMs,
|
|
2451
2528
|
priorCostUsd: priorTotals.costUsd
|
|
2452
2529
|
};
|
|
2453
2530
|
}
|
|
2454
2531
|
function buildActorWindows(args) {
|
|
2532
|
+
const { conversations, dayBuckets, hourBuckets, nowMs } = args;
|
|
2455
2533
|
return {
|
|
2456
|
-
1: rangeWindow(
|
|
2457
|
-
7: rangeWindow(
|
|
2458
|
-
30: rangeWindow(
|
|
2459
|
-
90: rangeWindow(
|
|
2534
|
+
1: rangeWindow(hourBuckets, nowMs, 1, conversations[1]),
|
|
2535
|
+
7: rangeWindow(dayBuckets, nowMs, 7, conversations[7]),
|
|
2536
|
+
30: rangeWindow(dayBuckets, nowMs, 30, conversations[30]),
|
|
2537
|
+
90: rangeWindow(dayBuckets, nowMs, 90, conversations[90])
|
|
2460
2538
|
};
|
|
2461
2539
|
}
|
|
2462
|
-
/**
|
|
2540
|
+
/** Start of the current period of each directory range. */
|
|
2541
|
+
function rangeStart(nowMs, range) {
|
|
2542
|
+
return range === 1 ? trailingUtcHourWindow(nowMs, 24).start : trailingUtcDayWindow(nowMs, range).start;
|
|
2543
|
+
}
|
|
2544
|
+
function metricBuckets(rows) {
|
|
2545
|
+
const byEmail = /* @__PURE__ */ new Map();
|
|
2546
|
+
for (const row of rows) {
|
|
2547
|
+
const buckets = byEmail.get(row.email) ?? /* @__PURE__ */ new Map();
|
|
2548
|
+
byEmail.set(row.email, buckets);
|
|
2549
|
+
buckets.set(row.date, {
|
|
2550
|
+
costUsd: row.costUsd ?? 0,
|
|
2551
|
+
durationMs: row.durationMs
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
return byEmail;
|
|
2555
|
+
}
|
|
2556
|
+
/**
|
|
2557
|
+
* Load the complete People directory with grouping and metrics owned by SQL.
|
|
2558
|
+
*
|
|
2559
|
+
* Every count and total comes from Turns. A person counts a Conversation when
|
|
2560
|
+
* they ran a Turn in it, whoever started it.
|
|
2561
|
+
*/
|
|
2463
2562
|
async function readPeopleListFromSql() {
|
|
2464
2563
|
const nowMs = Date.now();
|
|
2465
2564
|
const { end, start } = trailingUtcDayWindow(nowMs, DIRECTORY_ACTIVITY_DAYS);
|
|
2466
|
-
const activityDate = sql`TO_CHAR(
|
|
2467
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
2468
|
-
'YYYY-MM-DD'
|
|
2469
|
-
)`;
|
|
2470
|
-
const activityHour = sql`TO_CHAR(
|
|
2471
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
2472
|
-
'YYYY-MM-DD"T"HH24'
|
|
2473
|
-
)`;
|
|
2474
2565
|
const hourWindow = trailingUtcHourWindow(nowMs, 168);
|
|
2475
2566
|
const sixHourWindow = trailingUtcSixHourWindow(nowMs);
|
|
2476
2567
|
const dayMetricStart = trailingUtcDayWindow(nowMs, DAY_METRIC_LOOKBACK).start;
|
|
2477
2568
|
const hourMetricStart = trailingUtcHourWindow(nowMs, HOUR_METRIC_LOOKBACK).start;
|
|
2478
|
-
const
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
|
|
2569
|
+
const turns = personTurns();
|
|
2570
|
+
const { active, conversations, costUsd, durationMs, failed, tokens } = turnAggregateColumns(turns);
|
|
2571
|
+
const day = turnBucket(turns, "day");
|
|
2572
|
+
const hour = turnBucket(turns, "hour");
|
|
2573
|
+
const sixHour = sql`TO_CHAR(
|
|
2574
|
+
date_trunc('day', ${turns.occurredAt} AT TIME ZONE 'UTC')
|
|
2575
|
+
+ (FLOOR(EXTRACT(HOUR FROM ${turns.occurredAt} AT TIME ZONE 'UTC') / 6) * INTERVAL '6 hours'),
|
|
2482
2576
|
'YYYY-MM-DD"T"HH24'
|
|
2483
2577
|
)`;
|
|
2484
|
-
const
|
|
2578
|
+
const rangeConversations = (range) => sql`COUNT(DISTINCT ${turns.rootConversationId}) FILTER (
|
|
2579
|
+
WHERE ${turns.occurredAt} >= ${rangeStart(nowMs, range).toISOString()}::timestamptz
|
|
2580
|
+
)::integer`;
|
|
2581
|
+
const spendRows = (since, bucket) => getDb().select({
|
|
2582
|
+
email: turns.email,
|
|
2583
|
+
date: bucket,
|
|
2584
|
+
costUsd,
|
|
2585
|
+
durationMs
|
|
2586
|
+
}).from(turns).where(gte(turns.occurredAt, since)).groupBy(turns.email, bucket);
|
|
2587
|
+
const activityRows = (since, bucket) => getDb().select({
|
|
2588
|
+
activePeople: sql`COUNT(DISTINCT ${turns.userId})::int`,
|
|
2589
|
+
conversations,
|
|
2590
|
+
date: bucket
|
|
2591
|
+
}).from(turns).where(gte(turns.occurredAt, since)).groupBy(bucket);
|
|
2592
|
+
const [rows, activityDayRows, activityHourRows, activitySixHourRows, daySpendRows, hourSpendRows] = await Promise.all([
|
|
2485
2593
|
getDb().select({
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(verifiedActorWhere(), gte(juniorConversations.lastActivityAt, hourWindow.start))).groupBy(activityHour),
|
|
2503
|
-
getDb().select({
|
|
2504
|
-
activePeople: sql`COUNT(DISTINCT ${juniorUsers.id})::int`,
|
|
2505
|
-
conversations: sql`COUNT(*)::int`,
|
|
2506
|
-
date: activitySixHour
|
|
2507
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(verifiedActorWhere(), gte(juniorConversations.lastActivityAt, sixHourWindow.start))).groupBy(activitySixHour),
|
|
2508
|
-
getDb().select({
|
|
2509
|
-
email: juniorUsers.primaryEmailNormalized,
|
|
2510
|
-
date: activityDate,
|
|
2511
|
-
conversations: peopleTreeAggregateColumns.conversations,
|
|
2512
|
-
costUsd: peopleTreeAggregateColumns.costUsd,
|
|
2513
|
-
durationMs: peopleTreeAggregateColumns.durationMs
|
|
2514
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(peopleTreeConversation, metricsJoin).where(and(verifiedActorWhere(), gte(juniorConversations.lastActivityAt, dayMetricStart))).groupBy(juniorUsers.primaryEmailNormalized, activityDate),
|
|
2515
|
-
getDb().select({
|
|
2516
|
-
email: juniorUsers.primaryEmailNormalized,
|
|
2517
|
-
date: activityHour,
|
|
2518
|
-
conversations: peopleTreeAggregateColumns.conversations,
|
|
2519
|
-
costUsd: peopleTreeAggregateColumns.costUsd,
|
|
2520
|
-
durationMs: peopleTreeAggregateColumns.durationMs
|
|
2521
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(peopleTreeConversation, metricsJoin).where(and(verifiedActorWhere(), gte(juniorConversations.lastActivityAt, hourMetricStart))).groupBy(juniorUsers.primaryEmailNormalized, activityHour)
|
|
2594
|
+
...turnPersonColumns(turns),
|
|
2595
|
+
active,
|
|
2596
|
+
conversations,
|
|
2597
|
+
durationMs,
|
|
2598
|
+
failed,
|
|
2599
|
+
tokens,
|
|
2600
|
+
conversations1: rangeConversations(1),
|
|
2601
|
+
conversations7: rangeConversations(7),
|
|
2602
|
+
conversations30: rangeConversations(30),
|
|
2603
|
+
conversations90: rangeConversations(90)
|
|
2604
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).groupBy(turns.email, turns.fullName),
|
|
2605
|
+
activityRows(start, day),
|
|
2606
|
+
activityRows(hourWindow.start, hour),
|
|
2607
|
+
activityRows(sixHourWindow.start, sixHour),
|
|
2608
|
+
spendRows(dayMetricStart, day),
|
|
2609
|
+
spendRows(hourMetricStart, hour)
|
|
2522
2610
|
]);
|
|
2523
|
-
const dayBucketsByEmail =
|
|
2524
|
-
|
|
2525
|
-
const buckets = dayBucketsByEmail.get(row.email) ?? /* @__PURE__ */ new Map();
|
|
2526
|
-
buckets.set(row.date, {
|
|
2527
|
-
conversations: row.conversations,
|
|
2528
|
-
costUsd: row.costUsd ?? 0,
|
|
2529
|
-
durationMs: row.durationMs
|
|
2530
|
-
});
|
|
2531
|
-
dayBucketsByEmail.set(row.email, buckets);
|
|
2532
|
-
}
|
|
2533
|
-
const hourBucketsByEmail = /* @__PURE__ */ new Map();
|
|
2534
|
-
for (const row of hourMetricRows) {
|
|
2535
|
-
const buckets = hourBucketsByEmail.get(row.email) ?? /* @__PURE__ */ new Map();
|
|
2536
|
-
buckets.set(row.date, {
|
|
2537
|
-
conversations: row.conversations,
|
|
2538
|
-
costUsd: row.costUsd ?? 0,
|
|
2539
|
-
durationMs: row.durationMs
|
|
2540
|
-
});
|
|
2541
|
-
hourBucketsByEmail.set(row.email, buckets);
|
|
2542
|
-
}
|
|
2611
|
+
const dayBucketsByEmail = metricBuckets(daySpendRows);
|
|
2612
|
+
const hourBucketsByEmail = metricBuckets(hourSpendRows);
|
|
2543
2613
|
const people = rows.map((row) => {
|
|
2544
2614
|
const actor = {
|
|
2545
2615
|
email: row.email,
|
|
@@ -2557,6 +2627,12 @@ async function readPeopleListFromSql() {
|
|
|
2557
2627
|
lastSeenAt: row.lastSeenAt.toISOString(),
|
|
2558
2628
|
actor,
|
|
2559
2629
|
windows: buildActorWindows({
|
|
2630
|
+
conversations: {
|
|
2631
|
+
1: row.conversations1,
|
|
2632
|
+
7: row.conversations7,
|
|
2633
|
+
30: row.conversations30,
|
|
2634
|
+
90: row.conversations90
|
|
2635
|
+
},
|
|
2560
2636
|
dayBuckets: dayBucketsByEmail.get(row.email) ?? /* @__PURE__ */ new Map(),
|
|
2561
2637
|
hourBuckets: hourBucketsByEmail.get(row.email) ?? /* @__PURE__ */ new Map(),
|
|
2562
2638
|
nowMs
|
|
@@ -2565,7 +2641,7 @@ async function readPeopleListFromSql() {
|
|
|
2565
2641
|
};
|
|
2566
2642
|
});
|
|
2567
2643
|
return {
|
|
2568
|
-
activityDays: directoryActivityDays(
|
|
2644
|
+
activityDays: directoryActivityDays(activityDayRows, nowMs),
|
|
2569
2645
|
activityHours: directoryActivityHours(activityHourRows, nowMs),
|
|
2570
2646
|
activitySixHours: directoryActivitySixHours(activitySixHourRows, nowMs),
|
|
2571
2647
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -2590,7 +2666,7 @@ async function readPeoplePluginReports(args) {
|
|
|
2590
2666
|
reports: [],
|
|
2591
2667
|
source: "plugins"
|
|
2592
2668
|
});
|
|
2593
|
-
const { getPluginProfileReports } = await import("./projection-
|
|
2669
|
+
const { getPluginProfileReports } = await import("./projection-BFJG58TG.js").then((n) => n.jn);
|
|
2594
2670
|
return pluginOperationalReportFeedSchema.parse({
|
|
2595
2671
|
generatedAt: new Date(nowMs).toISOString(),
|
|
2596
2672
|
reports: await getPluginProfileReports({
|
|
@@ -2637,18 +2713,21 @@ function addAggregate(map, label, row) {
|
|
|
2637
2713
|
if (row.tokens !== null) item.tokens = (item.tokens ?? 0) + row.tokens;
|
|
2638
2714
|
map.set(label, item);
|
|
2639
2715
|
}
|
|
2640
|
-
function surfaceExpression() {
|
|
2716
|
+
function surfaceExpression(table) {
|
|
2641
2717
|
return sql`CASE
|
|
2642
|
-
WHEN ${
|
|
2643
|
-
THEN ${
|
|
2718
|
+
WHEN ${table.source} IN ('api', 'scheduler', 'slack')
|
|
2719
|
+
THEN ${table.source}
|
|
2644
2720
|
-- Dashboard web conversations share the product api surface label.
|
|
2645
|
-
WHEN ${
|
|
2646
|
-
WHEN ${
|
|
2647
|
-
WHEN ${
|
|
2648
|
-
WHEN ${
|
|
2721
|
+
WHEN ${table.source} = 'web' THEN 'api'
|
|
2722
|
+
WHEN ${table.conversationId} LIKE 'slack:%' THEN 'slack'
|
|
2723
|
+
WHEN ${table.conversationId} LIKE 'scheduler:%' THEN 'scheduler'
|
|
2724
|
+
WHEN ${table.conversationId} LIKE 'api:%' THEN 'api'
|
|
2649
2725
|
ELSE 'internal'
|
|
2650
2726
|
END`;
|
|
2651
2727
|
}
|
|
2728
|
+
function channelExpression(table) {
|
|
2729
|
+
return sql`SPLIT_PART(${table.conversationId}, ':', 2)`;
|
|
2730
|
+
}
|
|
2652
2731
|
function locationLabel(row) {
|
|
2653
2732
|
if (row.surface !== "slack") return surfaceLabel(row.surface);
|
|
2654
2733
|
if (row.destinationVisibility !== "public") return "Private Conversation";
|
|
@@ -2657,6 +2736,14 @@ function locationLabel(row) {
|
|
|
2657
2736
|
channelName: row.channelName ?? void 0
|
|
2658
2737
|
}) ?? "Conversation";
|
|
2659
2738
|
}
|
|
2739
|
+
function activityBuckets(rows) {
|
|
2740
|
+
return new Map(rows.map(({ costUsd, tokens, ...row }) => [row.date, {
|
|
2741
|
+
...emptyActivityDay(row.date),
|
|
2742
|
+
...row,
|
|
2743
|
+
...costUsd !== null ? { costUsd } : void 0,
|
|
2744
|
+
...tokens !== null ? { tokens } : void 0
|
|
2745
|
+
}]));
|
|
2746
|
+
}
|
|
2660
2747
|
/** Load one complete person profile while bounding only its recent-conversation list. */
|
|
2661
2748
|
async function readPeopleProfileFromSql(email, options = {}) {
|
|
2662
2749
|
const nowMs = Date.now();
|
|
@@ -2666,76 +2753,49 @@ async function readPeopleProfileFromSql(email, options = {}) {
|
|
|
2666
2753
|
end.setUTCHours(0, 0, 0, 0);
|
|
2667
2754
|
const start = new Date(end);
|
|
2668
2755
|
start.setUTCDate(start.getUTCDate() - 364);
|
|
2669
|
-
const
|
|
2670
|
-
const
|
|
2671
|
-
const surface = surfaceExpression();
|
|
2672
|
-
const
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
)`;
|
|
2676
|
-
const activityHour = sql`TO_CHAR(
|
|
2677
|
-
${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
|
|
2678
|
-
'YYYY-MM-DD"T"HH24'
|
|
2679
|
-
)`;
|
|
2680
|
-
const channel = sql`SPLIT_PART(${juniorConversations.conversationId}, ':', 2)`;
|
|
2756
|
+
const turns = personTurns(normalizedEmail);
|
|
2757
|
+
const aggregate = turnAggregateColumns(turns);
|
|
2758
|
+
const surface = surfaceExpression(turnRoot);
|
|
2759
|
+
const channel = channelExpression(turnRoot);
|
|
2760
|
+
const day = turnBucket(turns, "day");
|
|
2761
|
+
const hour = turnBucket(turns, "hour");
|
|
2681
2762
|
const hourWindow = trailingUtcHourWindow(nowMs, 168);
|
|
2682
2763
|
const [totalsRows, dayRows, hourRows, locationRows, surfaceRows, recentRows] = await Promise.all([
|
|
2683
2764
|
getDb().select({
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
activeDays: conversationActiveDaysColumn(),
|
|
2688
|
-
...peopleTreeAggregateColumns
|
|
2689
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(peopleTreeConversation, metricsJoin).where(where).groupBy(juniorUsers.primaryEmailNormalized, juniorUsers.displayName),
|
|
2765
|
+
...turnPersonColumns(turns),
|
|
2766
|
+
...aggregate
|
|
2767
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).groupBy(turns.email, turns.fullName),
|
|
2690
2768
|
getDb().select({
|
|
2691
|
-
date:
|
|
2692
|
-
...
|
|
2693
|
-
}).from(
|
|
2769
|
+
date: day,
|
|
2770
|
+
...aggregate
|
|
2771
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).where(gte(turns.occurredAt, start)).groupBy(day),
|
|
2694
2772
|
getDb().select({
|
|
2695
|
-
date:
|
|
2696
|
-
...
|
|
2697
|
-
}).from(
|
|
2773
|
+
date: hour,
|
|
2774
|
+
...aggregate
|
|
2775
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).where(gte(turns.occurredAt, hourWindow.start)).groupBy(hour),
|
|
2698
2776
|
getDb().select({
|
|
2699
2777
|
channel,
|
|
2700
|
-
channelName:
|
|
2778
|
+
channelName: turnRoot.channelName,
|
|
2701
2779
|
destinationVisibility: juniorDestinations.visibility,
|
|
2702
2780
|
surface,
|
|
2703
|
-
...
|
|
2704
|
-
}).from(
|
|
2781
|
+
...aggregate
|
|
2782
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).leftJoin(juniorDestinations, eq(juniorDestinations.id, turnRoot.destinationId)).groupBy(channel, turnRoot.channelName, juniorDestinations.visibility, surface),
|
|
2705
2783
|
getDb().select({
|
|
2706
2784
|
surface,
|
|
2707
|
-
...
|
|
2708
|
-
}).from(
|
|
2785
|
+
...aggregate
|
|
2786
|
+
}).from(turns).innerJoin(turnRoot, turnRootJoin(turns)).groupBy(surface),
|
|
2709
2787
|
recentActorRows(normalizedEmail)
|
|
2710
2788
|
]);
|
|
2711
|
-
const
|
|
2712
|
-
if (!
|
|
2789
|
+
const person = totalsRows[0];
|
|
2790
|
+
if (!person) return emptyProfile(normalizedEmail, nowMs);
|
|
2713
2791
|
const actor = {
|
|
2714
|
-
email:
|
|
2715
|
-
...
|
|
2716
|
-
...
|
|
2717
|
-
...
|
|
2792
|
+
email: person.email,
|
|
2793
|
+
...person.fullName ? { fullName: person.fullName } : void 0,
|
|
2794
|
+
...person.slackUserId ? { slackUserId: person.slackUserId } : void 0,
|
|
2795
|
+
...person.slackUserName ? { slackUserName: person.slackUserName } : void 0
|
|
2718
2796
|
};
|
|
2719
|
-
const days =
|
|
2720
|
-
|
|
2721
|
-
active: row.active,
|
|
2722
|
-
conversations: row.conversations,
|
|
2723
|
-
...row.costUsd !== null ? { costUsd: row.costUsd } : void 0,
|
|
2724
|
-
date: row.date,
|
|
2725
|
-
durationMs: row.durationMs,
|
|
2726
|
-
failed: row.failed,
|
|
2727
|
-
...row.tokens !== null ? { tokens: row.tokens } : void 0
|
|
2728
|
-
});
|
|
2729
|
-
const hours = /* @__PURE__ */ new Map();
|
|
2730
|
-
for (const row of hourRows) hours.set(row.date, {
|
|
2731
|
-
active: row.active,
|
|
2732
|
-
conversations: row.conversations,
|
|
2733
|
-
...row.costUsd !== null ? { costUsd: row.costUsd } : void 0,
|
|
2734
|
-
date: row.date,
|
|
2735
|
-
durationMs: row.durationMs,
|
|
2736
|
-
failed: row.failed,
|
|
2737
|
-
...row.tokens !== null ? { tokens: row.tokens } : void 0
|
|
2738
|
-
});
|
|
2797
|
+
const days = activityBuckets(dayRows);
|
|
2798
|
+
const hours = activityBuckets(hourRows);
|
|
2739
2799
|
const locations = /* @__PURE__ */ new Map();
|
|
2740
2800
|
for (const row of locationRows) addAggregate(locations, locationLabel(row), row);
|
|
2741
2801
|
const surfaces = /* @__PURE__ */ new Map();
|
|
@@ -2763,12 +2823,12 @@ async function readPeopleProfileFromSql(email, options = {}) {
|
|
|
2763
2823
|
source: "conversation_index",
|
|
2764
2824
|
surfaces: statsItems(surfaces),
|
|
2765
2825
|
totals: {
|
|
2766
|
-
active:
|
|
2767
|
-
activeDays:
|
|
2768
|
-
conversations:
|
|
2769
|
-
durationMs:
|
|
2770
|
-
failed:
|
|
2771
|
-
...
|
|
2826
|
+
active: person.active,
|
|
2827
|
+
activeDays: person.activeDays,
|
|
2828
|
+
conversations: person.conversations,
|
|
2829
|
+
durationMs: person.durationMs,
|
|
2830
|
+
failed: person.failed,
|
|
2831
|
+
...person.tokens !== null ? { tokens: person.tokens } : void 0
|
|
2772
2832
|
},
|
|
2773
2833
|
windowEnd: end.toISOString(),
|
|
2774
2834
|
windowStart: start.toISOString()
|
|
@@ -2799,48 +2859,42 @@ function spendWindow(nowMs) {
|
|
|
2799
2859
|
thirtyDayStart
|
|
2800
2860
|
};
|
|
2801
2861
|
}
|
|
2802
|
-
/** Match the viewer's own
|
|
2862
|
+
/** Match the viewer's own Turn metric rows in the spend window. */
|
|
2803
2863
|
function viewerWindowWhere(email, nowMs) {
|
|
2804
2864
|
const normalizedEmail = normalizeEmail$1(email);
|
|
2805
2865
|
const { end, thirtyDayStart } = spendWindow(nowMs);
|
|
2806
|
-
return normalizedEmail ? and(verifiedActorWhere(normalizedEmail), gte(
|
|
2866
|
+
return normalizedEmail ? and(verifiedActorWhere(normalizedEmail), gte(juniorConversationMetrics.occurredAt, thirtyDayStart), lte(juniorConversationMetrics.occurredAt, end)) : sql`false`;
|
|
2807
2867
|
}
|
|
2808
2868
|
/** Return a query for one viewer's model spend for each UTC day in the window. */
|
|
2809
|
-
function personalSpendDaysQuery(
|
|
2810
|
-
const
|
|
2811
|
-
${
|
|
2869
|
+
function personalSpendDaysQuery(email, nowMs) {
|
|
2870
|
+
const date = sql`TO_CHAR(
|
|
2871
|
+
${juniorConversationMetrics.occurredAt} AT TIME ZONE 'UTC',
|
|
2812
2872
|
'YYYY-MM-DD'
|
|
2813
2873
|
)`;
|
|
2814
|
-
return
|
|
2815
|
-
costUsd:
|
|
2816
|
-
date
|
|
2817
|
-
}).from(
|
|
2874
|
+
return getDb().select({
|
|
2875
|
+
costUsd: turnMetricColumns.costUsd,
|
|
2876
|
+
date
|
|
2877
|
+
}).from(juniorConversationMetrics).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationMetrics.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(viewerWindowWhere(email, nowMs)).groupBy(date);
|
|
2818
2878
|
}
|
|
2819
2879
|
/**
|
|
2820
2880
|
* Return a query for a change marker of one viewer's spend window.
|
|
2821
2881
|
*
|
|
2822
|
-
* It reads
|
|
2823
|
-
*
|
|
2824
|
-
* and the UTC day of its last activity, so a recorded cost, or a
|
|
2825
|
-
* Conversation that moves to a new day, moves it. Other writes do not. A
|
|
2826
|
-
* Task that another person's Turn started under the viewer's root is not
|
|
2827
|
-
* the viewer's row, so its cost shows on the next spend read: a page load,
|
|
2828
|
-
* a tab focus, or the viewer's next own cost. The window start moves it at
|
|
2829
|
-
* UTC midnight.
|
|
2882
|
+
* It reads the same Turn metric rows as the spend read. A new or replaced
|
|
2883
|
+
* row moves it, and the window start moves it at UTC midnight.
|
|
2830
2884
|
*/
|
|
2831
2885
|
function personalSpendVersionQuery(db, email, nowMs) {
|
|
2832
2886
|
const { thirtyDayStart } = spendWindow(nowMs);
|
|
2833
2887
|
return db.select({ version: sql`concat_ws(':',
|
|
2834
2888
|
${thirtyDayStart.toISOString().slice(0, 10)}::text,
|
|
2835
2889
|
count(*),
|
|
2836
|
-
sum(${
|
|
2837
|
-
|
|
2838
|
-
)` }).from(
|
|
2890
|
+
sum(${juniorConversationMetrics.value}),
|
|
2891
|
+
max(${juniorConversationMetrics.updatedAt})
|
|
2892
|
+
)` }).from(juniorConversationMetrics).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationMetrics.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(viewerWindowWhere(email, nowMs));
|
|
2839
2893
|
}
|
|
2840
2894
|
/** Read one viewer's rolling model spend with one bounded aggregate query. */
|
|
2841
2895
|
async function readPersonalSpendFromSql(email, nowMs = Date.now()) {
|
|
2842
2896
|
const { end, sevenDayStart, thirtyDayStart } = spendWindow(nowMs);
|
|
2843
|
-
const rows = await personalSpendDaysQuery(
|
|
2897
|
+
const rows = await personalSpendDaysQuery(email, nowMs);
|
|
2844
2898
|
const sevenDayStartDate = sevenDayStart.toISOString().slice(0, 10);
|
|
2845
2899
|
let sevenDaysUsd = 0;
|
|
2846
2900
|
let thirtyDaysUsd = 0;
|
|
@@ -3303,32 +3357,6 @@ function createAutomationRoutes() {
|
|
|
3303
3357
|
});
|
|
3304
3358
|
return app;
|
|
3305
3359
|
}
|
|
3306
|
-
// src/api/transcriptions/routes.ts
|
|
3307
|
-
/** Create the route that turns one dashboard dictation recording into text. */
|
|
3308
|
-
function createTranscriptionRoutes() {
|
|
3309
|
-
const app = new Hono();
|
|
3310
|
-
app.post("/", requireViewer, bodyLimit({
|
|
3311
|
-
maxSize: 445e4,
|
|
3312
|
-
onError: () => {
|
|
3313
|
-
throwApiError(413, "Recording is too long.");
|
|
3314
|
-
}
|
|
3315
|
-
}), validateRequest("json", transcriptionRequestSchema, "Send the recording as base64 audio."), async (context) => {
|
|
3316
|
-
const audio = Buffer.from(context.req.valid("json").audio, "base64");
|
|
3317
|
-
try {
|
|
3318
|
-
const { text } = await transcribeAudio({
|
|
3319
|
-
audio,
|
|
3320
|
-
modelId: botConfig.transcriptionModelId,
|
|
3321
|
-
signal: context.req.raw.signal
|
|
3322
|
-
});
|
|
3323
|
-
return jsonResponse(transcriptionSchema, { text: text.trim() });
|
|
3324
|
-
} catch (error) {
|
|
3325
|
-
const providerError = findProviderError(error);
|
|
3326
|
-
if (!providerError) throw error;
|
|
3327
|
-
throwApiError(502, getProviderErrorUserMessage(providerError), providerError);
|
|
3328
|
-
}
|
|
3329
|
-
});
|
|
3330
|
-
return app;
|
|
3331
|
-
}
|
|
3332
3360
|
// src/api/user-customization/routes.ts
|
|
3333
3361
|
/**
|
|
3334
3362
|
* Create routes that read and replace the viewer's customization. They return
|
|
@@ -3438,7 +3466,7 @@ function createReviewItemRoutes(services) {
|
|
|
3438
3466
|
const after = query.cursor ? decodeCursor(query.cursor, filters) : void 0;
|
|
3439
3467
|
if (query.cursor && !after) return jsonResponse(apiErrorSchema, { error: "Invalid review item cursor." }, { status: 400 });
|
|
3440
3468
|
const db = getDb();
|
|
3441
|
-
const reader = reviewItemReaderForUser(viewer);
|
|
3469
|
+
const reader = filters.conversationId ? await reviewItemReaderForUserInConversation(viewer, filters.conversationId) : reviewItemReaderForUser(viewer);
|
|
3442
3470
|
const open = await searchReviewItems(db, reader, {
|
|
3443
3471
|
...filters,
|
|
3444
3472
|
limit: query.limit + 1,
|
|
@@ -3645,7 +3673,7 @@ function readDescriptionText(home) {
|
|
|
3645
3673
|
}
|
|
3646
3674
|
/** Read discovered skill names for authenticated runtime diagnostics. */
|
|
3647
3675
|
async function readSkillReports() {
|
|
3648
|
-
const { discoverSkills } = await import("./skills-
|
|
3676
|
+
const { discoverSkills } = await import("./skills-CcAJBquq.js").then((n) => n.o);
|
|
3649
3677
|
const skills = await discoverSkills();
|
|
3650
3678
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
3651
3679
|
name: skill.name,
|
|
@@ -3654,7 +3682,7 @@ async function readSkillReports() {
|
|
|
3654
3682
|
}
|
|
3655
3683
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
3656
3684
|
async function readPlugins() {
|
|
3657
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime-
|
|
3685
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-BNK4uJVZ.js").then((n) => n.t);
|
|
3658
3686
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
3659
3687
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
3660
3688
|
description: plugin.manifest.description,
|
|
@@ -3666,7 +3694,7 @@ async function readPlugins() {
|
|
|
3666
3694
|
async function readRuntimeInfoReport() {
|
|
3667
3695
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
3668
3696
|
import("./package-discovery-DJhGdS4c.js").then((n) => n.r),
|
|
3669
|
-
import("./catalog-runtime-
|
|
3697
|
+
import("./catalog-runtime-BNK4uJVZ.js").then((n) => n.t),
|
|
3670
3698
|
readPlugins(),
|
|
3671
3699
|
readSkillReports()
|
|
3672
3700
|
]);
|
|
@@ -3683,7 +3711,7 @@ async function readRuntimeInfoReport() {
|
|
|
3683
3711
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
3684
3712
|
async function readPluginOperationalReportFeed() {
|
|
3685
3713
|
const nowMs = Date.now();
|
|
3686
|
-
const { getPluginOperationalReports } = await import("./projection-
|
|
3714
|
+
const { getPluginOperationalReports } = await import("./projection-BFJG58TG.js").then((n) => n.jn);
|
|
3687
3715
|
return pluginOperationalReportFeedSchema.parse({
|
|
3688
3716
|
source: "plugins",
|
|
3689
3717
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -3719,7 +3747,6 @@ function createJuniorApi(options = {}) {
|
|
|
3719
3747
|
app.route("/api/people", createPeopleRoutes());
|
|
3720
3748
|
app.route("/api/locations", createLocationRoutes());
|
|
3721
3749
|
app.route("/api/user-pages", createUserPageRoutes());
|
|
3722
|
-
app.route("/api/transcriptions", createTranscriptionRoutes());
|
|
3723
3750
|
app.route("/api/user-customization", createUserCustomizationRoutes());
|
|
3724
3751
|
app.route("/api/automations", createAutomationRoutes());
|
|
3725
3752
|
app.route("/api/workspaces", createWorkspaceRoutes());
|