@sentry/junior 0.287.0 → 0.288.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-CL-HUKgd.js → adapter-Cikcqdty.js} +1 -1
- package/dist/{admin-C9urXVfi.js → admin-BcSxHuTB.js} +2 -2
- package/dist/{agent-runner-Bfnw551N.js → agent-runner-9MXyWUL8.js} +173 -89
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +8 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +403 -40
- package/dist/{app-DBY5TnfY.d.ts → app-BUklJVBe.d.ts} +4 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +521 -70
- package/dist/{assistant-reply-u_PRYzuz.js → assistant-reply-mj47jMRV.js} +1 -1
- package/dist/{automation-DksGNDRO.js → automation-DDXwHQs5.js} +2 -2
- package/dist/{background-compaction-queue-CYI909P5.js → background-compaction-queue-CjllSPir.js} +161 -90
- package/dist/{briefs-DaXiMWzT.js → briefs-DW9iuolG.js} +4 -3
- package/dist/{catalog-runtime-BCIuBe4d.js → catalog-runtime-B3gfH58M.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-CkHcUMN7.js → config-CLJcyYEF.js} +401 -9
- package/dist/{connections-BnIj0wtx.js → connections-BtdJftow.js} +9 -9
- package/dist/{conversation-E7ZPJx2H.js → conversation-DhoqHtQ7.js} +23 -6
- package/dist/{conversation-pending-messages-DVch6YQw.js → conversation-pending-messages-DHV0S4uF.js} +1 -1
- package/dist/{conversation-privacy-DF1hW0ja.js → conversation-privacy-BPirIVlX.js} +1 -1
- package/dist/core-model-BTt5E5b0.js +182 -0
- package/dist/{credential-sync-CzMar9hq.js → credential-sync-Co8Q2xRW.js} +28 -20
- package/dist/{db-DJ11eZqq.js → db-Co7DTYYh.js} +30 -20
- package/dist/{db-YDKKDxlh.d.ts → db-zIs8-Ba3.d.ts} +6 -2
- package/dist/{executor-BY9TB31g.js → executor-m0kIN71Q.js} +93 -12
- package/dist/{media-Cz1ZiV1U.js → history-IjdmO_r6.js} +6 -86
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BO5zU6Mt.js → logging-DbD-dErY.js} +3 -2
- package/dist/media-BAHvgkok.js +85 -0
- package/dist/{message-CsUbuEc8.js → message-DKTdTYm-.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +19 -41
- package/dist/{oauth-callback-server-hiDKK0_n.js → oauth-callback-server-CpbepSbp.js} +2 -2
- package/dist/{projection-CL_YWeGf.js → projection-BViECfYu.js} +309 -616
- package/dist/{prompt-BHOEQSmf.js → prompt-KT6MaDHN.js} +2 -182
- package/dist/{registry-BriFLnaJ.js → registry-D-Acyjhh.js} +1 -1
- package/dist/{resolve-Bt6GgAiA.js → resolve-gkT2R66z.js} +3 -3
- package/dist/{result-Bo1TZu0Q.js → result-DHmCFEt8.js} +8 -8
- package/dist/{runner-D3YeCQgt.js → runner-DBKjGjH-.js} +8 -8
- package/dist/{sandbox-egress-signals-CcnSPP4S.js → sandbox-egress-signals-9n8hqx29.js} +1 -1
- package/dist/{schedule-BTp__wrw.js → schedule-cP0AACm1.js} +11 -2
- package/dist/{schema-C6fsEwjo.d.ts → schema-B_6aOcx5.d.ts} +114 -3
- package/dist/{schema-BWE3RJEB.js → schema-DxicIQbc.js} +66 -13
- package/dist/{service-account-r6fl0b-9.js → service-account-Bi0HsY6w.js} +3 -3
- package/dist/{service-account-DiQQuuw7.js → service-account-CDlC9ssy.js} +3 -3
- package/dist/{session-stop-B2Nut40V.js → session-stop-BWOsuo8p.js} +56 -14
- package/dist/{skills-CD5aJdzg.js → skills-DO5K68Rq.js} +2 -2
- package/dist/{spawn-CalgZQiu.js → spawn-BBqZDcPa.js} +5 -5
- package/dist/{stop-kujZLbi0.js → stop-WC97cmHz.js} +802 -338
- package/dist/{store-DdIEUL1q.js → store-ByR1Lr7e.js} +4 -16
- package/dist/{task-runner-D_RDr2Hu.js → task-runner-B-Ewf8TX.js} +30 -22
- package/dist/{turn-failure-response-B5nV1Er-.js → turn-failure-response-CpdPoZSl.js} +18 -9
- package/dist/{validation-K4pqwoVZ.js → validation-B4sbIoES.js} +1 -1
- package/dist/{version-DBvhk1X9.js → version-D6lpuAgL.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DrMmFUul.js → viewer-CeP27tC3.js} +4 -4
- package/dist/warmup-P_GJCL1c.js +767 -0
- package/dist/{work-ljRoODGu.js → work-DI7x1Slm.js} +14 -13
- package/dist/{worker-CYO1Q0Js.js → worker-CYPTOT4j.js} +6 -6
- package/migrations/0089_conversation_paused_status.sql +3 -0
- package/migrations/0090_guardian_review_time_index.sql +20 -0
- package/migrations/meta/0089_snapshot.json +4372 -0
- package/migrations/meta/0090_snapshot.json +4388 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -4
package/dist/api.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { H as getAttachmentStorage,
|
|
3
|
-
import { m as logInfo, p as logException } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
8
|
-
import { $ as readViewerAutomationSummary, Et as throwApiError, G as changeViewerAutomationLifecycle, J as updateViewerAutomation, K as deleteViewerTask, Q as readViewerAutomationRuns, S as createSlackReviewItemShow, Tt as jsonResponse, W as activateViewerAutomationVersion, Y as ViewerTaskNotFoundError, Z as readViewerAutomationExecutions, _t as readLiveAttachment, et as readViewerAutomationVersions, it as listOwnedWatches, m as readStats, mt as webActorFromUser, nt as AutomationEditError, q as readViewerAutomationEdit,
|
|
9
|
-
import {
|
|
10
|
-
import { c as readViewerAvatarUrl, d as updateViewerDisplayName, l as resolveViewerUser, m as readAvatarImage, t as findUserByEmail } from "./viewer-
|
|
11
|
-
import { r as getStateAdapter } from "./adapter-
|
|
12
|
-
import { r as notificationScheduleSchema } from "./schedule-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { $n as savePushSubscription, Aa as workspaceRepoCheckoutPath, Bn as getPlugins, Cr as reviewItemNeedsUser, Da as SANDBOX_RUNTIME, Dn as createUserTokenStore, Ja as createConversationAccessReader, Jn as resolveNotificationTimezone, Ka as createPluginLogger, Kn as readWebPushConfig, Oo as createPluginCache, Qn as saveNotificationSchedule, Si as hash, Xn as listPushSubscriptions, Ya as readConversationAccessFromSql, Yn as deletePushSubscription, Za as conversationIsMemberRoot, Zn as readNotificationSchedule, di as getWorkspace, dr as searchReviewItems, er as isPausedBySlack, gi as WorkspaceValidationError, hi as updateWorkspace, hr as canActOnReviewItem, io as readConversationBriefThrough, li as createWorkspace, lr as listWaitingConversations, mi as listWorkspacesByRepository, mr as PLUGIN_REVIEW_ITEM_KEY_PREFIX, ni as getDashboardSettingsLink, oo as readConversationEventPage, pi as listWorkspaces, qn as sendPushNotificationToUser, rr as countReviewItemsNeedingUser, ui as deleteWorkspace, ur as reviewItemsNeedingUserVersionQuery, vr as isOnlyAssignee, wr as reviewItemReaderForUser, xi as create } from "./projection-BViECfYu.js";
|
|
2
|
+
import { D as transcribeAudio, H as findProviderError, J as getAttachmentStorage, R as escapeXml, W as getProviderErrorUserMessage, n as botConfig } from "./config-CLJcyYEF.js";
|
|
3
|
+
import { m as logInfo, p as logException } from "./logging-DbD-dErY.js";
|
|
4
|
+
import { f as parseSlackTeamId, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
5
|
+
import { V as nextDetailVersion, a as getConversationStore, b as withConversationMutationLock, o as getDb, s as getSqlExecutor, v as loadConversationSlackTenantIds, x as conversationKindFromRow } from "./db-Co7DTYYh.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-m0kIN71Q.js";
|
|
7
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-B3gfH58M.js";
|
|
8
|
+
import { $ as readViewerAutomationSummary, A as runWithSlackInstallation, Et as throwApiError, G as changeViewerAutomationLifecycle, J as updateViewerAutomation, Jt as listChildAgents, K as deleteViewerTask, Q as readViewerAutomationRuns, S as createSlackReviewItemShow, Tt as jsonResponse, W as activateViewerAutomationVersion, Y as ViewerTaskNotFoundError, Z as readViewerAutomationExecutions, _t as readLiveAttachment, et as readViewerAutomationVersions, it as listOwnedWatches, m as readStats, mt as webActorFromUser, nt as AutomationEditError, q as readViewerAutomationEdit, tt as readViewerAutomations, v as setConversationSubscription, wt as emptyResponse, xt as archiveConversation } from "./agent-runner-9MXyWUL8.js";
|
|
9
|
+
import { r as completeText } from "./core-model-BTt5E5b0.js";
|
|
10
|
+
import { c as readViewerAvatarUrl, d as updateViewerDisplayName, l as resolveViewerUser, m as readAvatarImage, t as findUserByEmail } from "./viewer-CeP27tC3.js";
|
|
11
|
+
import { r as getStateAdapter } from "./adapter-Cikcqdty.js";
|
|
12
|
+
import { r as notificationScheduleSchema } from "./schedule-cP0AACm1.js";
|
|
13
|
+
import { n as INPUT_IMAGE_TYPES, t as INLINE_VIDEO_TYPES } from "./media-BAHvgkok.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-DhoqHtQ7.js";
|
|
15
|
+
import { n as briefEntriesFromReportEvents } from "./prompt-KT6MaDHN.js";
|
|
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";
|
|
15
18
|
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";
|
|
16
|
-
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { _ as
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { A as actorDirectoryReportSchema, At as conversationCatchUpSchema, B as activityHours$1, C as startServiceAccountSignInResponseSchema, Ct as conversationSubscriptionBodySchema, Dt as reorderPinnedConversationsBodySchema, E as personalTokenListSchema, Et as pinConversationResponseSchema, G as pushSubscriptionDeleteBodySchema, I as locationDetailReportSchema, J as connectionParamsSchema, K as testNotificationResponseSchema, L as locationDirectoryReportSchema, M as avatarParamsSchema, N as personParamsSchema, O as personalTokenParamsSchema, Ot as reorderPinnedConversationsResponseSchema, P as personalSpendReportSchema, R as locationParamsSchema, St as markConversationUnreadBodySchema, T as createdPersonalTokenSchema, Tt as pinConversationBodySchema, 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, d as workspaceSchema, dt as continueConversationInSlackResponseSchema, f as reviewItemActionSchema, ft as stopConversationTurnResponseSchema, g as reviewItemParamsSchema, gt as renameConversationResponseSchema, h as reviewItemListSchema, ht as renameConversationBodySchema, i as statsReportSchema, it as codeRepositoryReportSchema, j as actorProfileReportSchema, k as revokePersonalTokenResponseSchema, kt as conversationCatchUpBodySchema, l as workspaceParamsSchema, lt as conversationChildAgentsReportSchema, m as reviewItemListQuerySchema, n as versionsSchema, nt as codePersonReportSchema, o as deleteWorkspaceResponseSchema, p as reviewItemCountSchema, pt as conversationStatsReportSchema, q as connectionListSchema, rt as codeRepositoryParamsSchema, s as workspaceBodySchema, st as conversationWatchesReportSchema, t as versionsQuerySchema, tt as codeOverviewReportSchema, ut as continueConversationInSlackBodySchema, 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-BWE3RJEB.js";
|
|
19
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-gkT2R66z.js";
|
|
20
|
+
import { J as AutomationConflictError, St as automationEventCatalog, dt as conversationRangeColumns, ft as conversationUsageCostExpr, lt as conversationActiveDaysColumn, st as readAutomationTitlesByConversationId, ut as conversationAggregateColumns } from "./task-runner-B-Ewf8TX.js";
|
|
21
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CDlC9ssy.js";
|
|
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-DDXwHQs5.js";
|
|
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-DHV0S4uF.js";
|
|
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-WC97cmHz.js";
|
|
25
|
+
import { a as startConnection, n as isConnectableProvider, r as listConnections, s as htmlCallbackResponse, t as disconnectConnection } from "./connections-BtdJftow.js";
|
|
26
|
+
import { $ as startConnectionResponseSchema, A as personalTokenParamsSchema, At as reorderPinnedConversationsResponseSchema, B as locationParamsSchema, C as serviceAccountParamsSchema, Ct as conversationUnreadSchema, D as createdPersonalTokenSchema, Dt as pinConversationBodySchema, E as createPersonalTokenBodySchema, Et as conversationSubscriptionResponseSchema, F as personParamsSchema, G as notificationSettingsSchema, H as activityHours$1, I as personalSpendReportSchema, J as testNotificationResponseSchema, K as pushSubscriptionBodySchema, M as actorDirectoryReportSchema, Mt as conversationCatchUpSchema, N as actorProfileReportSchema, O as personalTokenListSchema, Ot as pinConversationResponseSchema, P as avatarParamsSchema, Q as disconnectConnectionResponseSchema, R as locationDetailReportSchema, S as serviceAccountListSchema, St as conversationAutoArchiveSchema, T as startServiceAccountSignInResponseSchema, Tt as conversationSubscriptionBodySchema, U as activitySixHours$1, V as activityDays$1, X as connectionParamsSchema, Y as connectionListSchema, _ as reviewItemSchema, at as codeRepositoryParamsSchema, b as transcriptionSchema, bt as archiveConversationResponseSchema, c as workspaceListSchema, ct as boardReportSchema, d as workspaceSchema, f as reviewItemActionSchema, ft as conversationChildAgentsReportSchema, g as reviewItemParamsSchema, gt as conversationStatsReportSchema, h as reviewItemListSchema, ht as stopConversationTurnResponseSchema, i as statsReportSchema, it as codePersonReportSchema, j as revokePersonalTokenResponseSchema, jt as conversationCatchUpBodySchema, kt as reorderPinnedConversationsBodySchema, l as workspaceParamsSchema, m as reviewItemListQuerySchema, mt as continueConversationInSlackResponseSchema, n as versionsSchema, o as deleteWorkspaceResponseSchema, ot as codeRepositoryReportSchema, p as reviewItemCountSchema, pt as continueConversationInSlackBodySchema, q as pushSubscriptionDeleteBodySchema, rt as codeOverviewReportSchema, s as workspaceBodySchema, t as versionsQuerySchema, ut as conversationWatchesReportSchema, v as reviewItemWaitingConversationsSchema, vt as conversationOutlineSchema, wt as markConversationUnreadBodySchema, x as disconnectServiceAccountResponseSchema, xt as archiveDoneConversationsResponseSchema, y as transcriptionRequestSchema, yt as archiveConversationBodySchema, z as locationDirectoryReportSchema } from "./schema-DxicIQbc.js";
|
|
25
27
|
import { Hono } from "hono";
|
|
26
28
|
import path from "node:path";
|
|
27
29
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
28
30
|
import * as z from "zod";
|
|
29
|
-
import { and, asc, desc, eq, gt, gte, isNull, lte, notExists, or, sql } from "drizzle-orm";
|
|
30
|
-
import { pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
31
|
+
import { and, arrayOverlaps, asc, desc, eq, gt, gte, inArray, isNull, like, lte, notExists, or, sql } from "drizzle-orm";
|
|
32
|
+
import { conversationAnnotationInputSchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
31
33
|
import { alias } from "drizzle-orm/pg-core";
|
|
32
34
|
import { readFileSync } from "node:fs";
|
|
33
35
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -266,6 +268,47 @@ async function requireConversationChildAgents(conversationId, options = {}) {
|
|
|
266
268
|
conversationId
|
|
267
269
|
});
|
|
268
270
|
}
|
|
271
|
+
// src/api/conversations/continue-in-slack.ts
|
|
272
|
+
async function readSlackChannelLocation(locationId) {
|
|
273
|
+
const [row] = await getDb().select({
|
|
274
|
+
channelId: juniorDestinations.providerDestinationId,
|
|
275
|
+
displayName: juniorDestinations.displayName,
|
|
276
|
+
teamId: juniorDestinations.providerTenantId
|
|
277
|
+
}).from(juniorDestinations).where(and(eq(juniorDestinations.id, locationId), eq(juniorDestinations.provider, "slack"), eq(juniorDestinations.kind, "channel")));
|
|
278
|
+
const channelId = parseSlackChannelId(row?.channelId);
|
|
279
|
+
const teamId = parseSlackTeamId(row?.teamId);
|
|
280
|
+
if (!row || !channelId || !teamId) return void 0;
|
|
281
|
+
return {
|
|
282
|
+
channelId,
|
|
283
|
+
...row.displayName ? { channelName: row.displayName } : void 0,
|
|
284
|
+
teamId
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** Move a participant's public dashboard Conversation to a new Slack thread. */
|
|
288
|
+
async function continueConversationInSlackForViewer(viewer, conversationId, body) {
|
|
289
|
+
const conversation = await getConversationStore().get({ conversationId });
|
|
290
|
+
const access = conversation ? (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId) : void 0;
|
|
291
|
+
if (!conversation || !access?.canViewPrivateContent) throwApiError(404, "Conversation not found.");
|
|
292
|
+
if (!access.isParticipant) throwApiError(403, "Only conversation participants can move it to Slack.");
|
|
293
|
+
if (!canContinueInSlack(conversation, access)) throwApiError(409, "Only a public dashboard conversation can move to Slack, once.");
|
|
294
|
+
const channel = await readSlackChannelLocation(body.locationId);
|
|
295
|
+
if (!channel) throwApiError(404, "Channel not found.");
|
|
296
|
+
const result = await runWithSlackInstallation({
|
|
297
|
+
adapter: getProductionSlackAdapter(),
|
|
298
|
+
installation: { teamId: channel.teamId },
|
|
299
|
+
task: () => continueConversationInSlack({
|
|
300
|
+
actorName: viewer.displayName ?? viewer.email,
|
|
301
|
+
channel,
|
|
302
|
+
conversation
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
if (result.status === "refused") throwApiError(409, result.message);
|
|
306
|
+
return {
|
|
307
|
+
conversationId,
|
|
308
|
+
...result.channelName ? { channelName: result.channelName } : void 0,
|
|
309
|
+
...result.locationUrl ? { locationUrl: result.locationUrl } : void 0
|
|
310
|
+
};
|
|
311
|
+
}
|
|
269
312
|
// src/api/conversations/attachments.ts
|
|
270
313
|
const INLINE_TYPES = [...INPUT_IMAGE_TYPES, ...INLINE_VIDEO_TYPES];
|
|
271
314
|
function contentDisposition(filename, contentType) {
|
|
@@ -345,6 +388,50 @@ async function conversationAttachmentResponse(args) {
|
|
|
345
388
|
function notFound() {
|
|
346
389
|
throwApiError(404, "Attachment not found.");
|
|
347
390
|
}
|
|
391
|
+
// src/api/conversations/outline.ts
|
|
392
|
+
const payload = juniorConversationEvents.payload;
|
|
393
|
+
/**
|
|
394
|
+
* List the person messages of a whole Conversation for the dashboard
|
|
395
|
+
* outline. The dashboard transcript loads only the latest pages, so the
|
|
396
|
+
* outline cannot build its items from the loaded rows alone.
|
|
397
|
+
*
|
|
398
|
+
* It uses the same rules as the transcript: Event messages are not person
|
|
399
|
+
* messages, and a message that does not mention Junior is thread context.
|
|
400
|
+
* The `message_role_idx` index reads only this Conversation's user
|
|
401
|
+
* messages, so the cost grows with the person messages, not all events.
|
|
402
|
+
*/
|
|
403
|
+
async function readConversationOutline(conversationId, options = {}) {
|
|
404
|
+
const access = (await readConversationAccessFromSql(getDb(), [conversationId], options.viewer)).get(conversationId);
|
|
405
|
+
if (!access) return void 0;
|
|
406
|
+
if (!access.canViewPrivateContent) return { items: [] };
|
|
407
|
+
const items = (await getDb().select({
|
|
408
|
+
seq: juniorConversationEvents.seq,
|
|
409
|
+
text: sql`left(${payload}->>'text', ${200})`
|
|
410
|
+
}).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), sql`${juniorConversationEvents.type} = 'message'`, sql`${payload}->>'role' = 'user'`, sql`${payload}->'meta'->>'eventType' is null`, sql`coalesce(${payload}->'meta'->>'explicitMention', 'true') <> 'false'`)).orderBy(asc(juniorConversationEvents.seq))).flatMap((row) => {
|
|
411
|
+
const text = withoutCutToken(row.text).trim();
|
|
412
|
+
return text ? [{
|
|
413
|
+
seq: row.seq,
|
|
414
|
+
text
|
|
415
|
+
}] : [];
|
|
416
|
+
});
|
|
417
|
+
const tenantId = (await loadConversationSlackTenantIds(getSqlExecutor(), [conversationId])).get(conversationId);
|
|
418
|
+
const mentions = await resolveMentions(getSqlExecutor(), items.map((item) => ({
|
|
419
|
+
tenantId,
|
|
420
|
+
texts: [item.text]
|
|
421
|
+
})));
|
|
422
|
+
return { items: items.map((item, index) => mentions[index].length > 0 ? {
|
|
423
|
+
...item,
|
|
424
|
+
mentions: mentions[index]
|
|
425
|
+
} : item) };
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Repair a Slack token that the length cut split. A cut mention, such as
|
|
429
|
+
* `<@U12`, cannot resolve, so it is dropped. A cut link keeps its URL text,
|
|
430
|
+
* so a message that is only a long link still has a title.
|
|
431
|
+
*/
|
|
432
|
+
function withoutCutToken(text) {
|
|
433
|
+
return text.length < 200 ? text : text.replace(/<([^<>]*)$/, (_, token) => /^[@#!]/.test(token) ? "" : token.split("|")[0]);
|
|
434
|
+
}
|
|
348
435
|
// src/api/conversations/metric-buckets.ts
|
|
349
436
|
/** Sum all Conversation metrics into UTC day or hour buckets. */
|
|
350
437
|
async function readConversationMetricBuckets(db, options) {
|
|
@@ -821,6 +908,13 @@ function createConversationRoutes(options) {
|
|
|
821
908
|
if (!report) throwApiError(404, "Conversation not found.");
|
|
822
909
|
return jsonResponse(conversationEventPageSchema, report);
|
|
823
910
|
});
|
|
911
|
+
app.get("/:conversationId/outline", validateRequest("param", conversationParamsSchema, "Invalid route parameters."), async (context) => {
|
|
912
|
+
const { conversationId } = context.req.valid("param");
|
|
913
|
+
const viewer = context.get("viewer");
|
|
914
|
+
const outline = await readConversationOutline(conversationId, viewer ? { viewer } : void 0);
|
|
915
|
+
if (!outline) throwApiError(404, "Conversation not found.");
|
|
916
|
+
return jsonResponse(conversationOutlineSchema, outline);
|
|
917
|
+
});
|
|
824
918
|
app.get("/:conversationId/agents", validateRequest("param", conversationParamsSchema, "Invalid route parameters."), async (context) => {
|
|
825
919
|
const { conversationId } = context.req.valid("param");
|
|
826
920
|
const viewer = context.get("viewer");
|
|
@@ -890,7 +984,10 @@ function createConversationRoutes(options) {
|
|
|
890
984
|
});
|
|
891
985
|
const report = await readConversationDetail(conversationId, {
|
|
892
986
|
...query,
|
|
893
|
-
...version ? {
|
|
987
|
+
...version ? { stored: {
|
|
988
|
+
record: version.record,
|
|
989
|
+
state: version.state
|
|
990
|
+
} } : void 0,
|
|
894
991
|
...viewerOptions
|
|
895
992
|
});
|
|
896
993
|
if (!report) throwApiError(404, "Conversation not found.");
|
|
@@ -902,6 +999,239 @@ function createConversationRoutes(options) {
|
|
|
902
999
|
});
|
|
903
1000
|
return app;
|
|
904
1001
|
}
|
|
1002
|
+
// src/api/board/columns.ts
|
|
1003
|
+
const DONE_WINDOW_MS = 216e5;
|
|
1004
|
+
/** Choose the column of a code change that Junior created. */
|
|
1005
|
+
function codeChangeColumn(args) {
|
|
1006
|
+
if (args.state === "merged") return args.mergedAtMs !== void 0 && args.nowMs - args.mergedAtMs <= DONE_WINDOW_MS ? "done" : void 0;
|
|
1007
|
+
if (args.state === "closed") return void 0;
|
|
1008
|
+
return args.hasReadyNotice ? "ready" : "in_progress";
|
|
1009
|
+
}
|
|
1010
|
+
/** Choose the column of a ticket linked to a Conversation. */
|
|
1011
|
+
function ticketColumn(args) {
|
|
1012
|
+
if (args.status === "closed") return args.nowMs - args.updatedAtMs <= DONE_WINDOW_MS ? "done" : void 0;
|
|
1013
|
+
if (args.status !== "open") return void 0;
|
|
1014
|
+
return args.working ? "in_progress" : "planned";
|
|
1015
|
+
}
|
|
1016
|
+
// src/api/board/read.ts
|
|
1017
|
+
/** Root Conversations with activity in this window feed the Board. */
|
|
1018
|
+
const ACTIVE_WINDOW_MS = 12096e5;
|
|
1019
|
+
/** Bound the Board to the viewer's most recent root Conversations. */
|
|
1020
|
+
const ROOT_LIMIT = 200;
|
|
1021
|
+
function parentOf(nodes, node) {
|
|
1022
|
+
return node.parentConversationId ? nodes.get(node.parentConversationId) : void 0;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* A card belongs to the nearest root or Thread. People do not message a
|
|
1026
|
+
* Task, so its work shows on its parent. A row from an older deploy has no
|
|
1027
|
+
* kind; a child without a kind is treated as a Task. A Conversation shows
|
|
1028
|
+
* only while it and every ancestor are unarchived.
|
|
1029
|
+
*/
|
|
1030
|
+
function homeId(nodes, conversationId) {
|
|
1031
|
+
const start = nodes.get(conversationId);
|
|
1032
|
+
for (let node = start; node; node = parentOf(nodes, node)) if (node.archived) return void 0;
|
|
1033
|
+
let node = start;
|
|
1034
|
+
while (node && (node.kind === "task" || !node.kind && node.parentConversationId)) node = parentOf(nodes, node);
|
|
1035
|
+
return node?.conversationId;
|
|
1036
|
+
}
|
|
1037
|
+
function rootOf(nodes, node) {
|
|
1038
|
+
let current = node;
|
|
1039
|
+
for (let parent = parentOf(nodes, current); parent; parent = parentOf(nodes, parent)) current = parent;
|
|
1040
|
+
return current;
|
|
1041
|
+
}
|
|
1042
|
+
async function readViewerTrees(userId, nowMs) {
|
|
1043
|
+
const db = getDb();
|
|
1044
|
+
const rootIds = (await db.select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).where(and(conversationIsMemberRoot({ userId }), isNull(juniorConversations.parentConversationId), isNull(juniorConversations.archivedAt), isNull(juniorConversations.quickQuestionAt), gte(juniorConversations.lastActivityAt, /* @__PURE__ */ new Date(nowMs - ACTIVE_WINDOW_MS)))).orderBy(desc(juniorConversations.lastActivityAt)).limit(ROOT_LIMIT)).map((row) => row.conversationId);
|
|
1045
|
+
if (rootIds.length === 0) return {
|
|
1046
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
1047
|
+
rootIds
|
|
1048
|
+
};
|
|
1049
|
+
const rows = await db.select({
|
|
1050
|
+
archivedAt: juniorConversations.archivedAt,
|
|
1051
|
+
conversationId: juniorConversations.conversationId,
|
|
1052
|
+
createdAt: juniorConversations.createdAt,
|
|
1053
|
+
kind: juniorConversations.kind,
|
|
1054
|
+
parentConversationId: juniorConversations.parentConversationId,
|
|
1055
|
+
status: juniorConversations.executionStatus,
|
|
1056
|
+
title: juniorConversations.title
|
|
1057
|
+
}).from(juniorConversations).where(or(inArray(juniorConversations.conversationId, rootIds), inArray(juniorConversations.rootConversationId, rootIds)));
|
|
1058
|
+
return {
|
|
1059
|
+
nodes: new Map(rows.map((row) => [row.conversationId, {
|
|
1060
|
+
archived: row.archivedAt !== null,
|
|
1061
|
+
conversationId: row.conversationId,
|
|
1062
|
+
createdAtMs: row.createdAt.getTime(),
|
|
1063
|
+
kind: row.kind,
|
|
1064
|
+
parentConversationId: row.parentConversationId,
|
|
1065
|
+
status: row.status,
|
|
1066
|
+
title: row.title
|
|
1067
|
+
}])),
|
|
1068
|
+
rootIds
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Read the viewer's Board: the code changes and tickets of their recent
|
|
1073
|
+
* Conversations, each in one column. See `./columns` for the column rules.
|
|
1074
|
+
*/
|
|
1075
|
+
async function readBoard(args) {
|
|
1076
|
+
const db = getDb();
|
|
1077
|
+
const { nodes, rootIds } = await readViewerTrees(args.userId, args.nowMs);
|
|
1078
|
+
const treeIds = [...nodes.keys()];
|
|
1079
|
+
if (treeIds.length === 0) return {
|
|
1080
|
+
cards: [],
|
|
1081
|
+
doneWindowHours: 6
|
|
1082
|
+
};
|
|
1083
|
+
const doneSince = /* @__PURE__ */ new Date(args.nowMs - 216e5);
|
|
1084
|
+
const [codeChanges, ticketRows, needsViewerRows, participants] = await Promise.all([
|
|
1085
|
+
db.select({
|
|
1086
|
+
conversationIds: juniorCodeChanges.conversationIds,
|
|
1087
|
+
id: juniorCodeChanges.id,
|
|
1088
|
+
mergedAt: juniorCodeChanges.mergedAt,
|
|
1089
|
+
number: juniorCodeChanges.number,
|
|
1090
|
+
repository: juniorCodeRepositories.name,
|
|
1091
|
+
state: juniorCodeChanges.state,
|
|
1092
|
+
title: juniorCodeChanges.title,
|
|
1093
|
+
updatedAt: juniorCodeChanges.updatedAt,
|
|
1094
|
+
url: juniorCodeChanges.url
|
|
1095
|
+
}).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, juniorCodeChanges.repositoryId)).where(and(or(eq(juniorCodeChanges.state, "open"), and(eq(juniorCodeChanges.state, "merged"), gte(juniorCodeChanges.mergedAt, doneSince))), arrayOverlaps(juniorCodeChanges.conversationIds, treeIds))),
|
|
1096
|
+
db.select({
|
|
1097
|
+
annotation: juniorConversationAnnotations.annotation,
|
|
1098
|
+
conversationId: juniorConversationAnnotations.conversationId,
|
|
1099
|
+
key: juniorConversationAnnotations.key,
|
|
1100
|
+
plugin: juniorConversationAnnotations.plugin,
|
|
1101
|
+
updatedAt: juniorConversationAnnotations.updatedAt
|
|
1102
|
+
}).from(juniorConversationAnnotations).where(and(inArray(juniorConversationAnnotations.conversationId, treeIds), sql`${juniorConversationAnnotations.annotation}->>'objectType' = 'task'`)),
|
|
1103
|
+
db.selectDistinct({ conversationId: juniorReviewItemConversations.conversationId }).from(juniorReviewItemConversations).innerJoin(juniorReviewItems, eq(juniorReviewItems.id, juniorReviewItemConversations.itemId)).where(and(inArray(juniorReviewItemConversations.conversationId, treeIds), reviewItemNeedsUser(args.userId))),
|
|
1104
|
+
readConversationParticipants(db, rootIds)
|
|
1105
|
+
]);
|
|
1106
|
+
const codeChangeUrls = codeChanges.flatMap((change) => change.state === "open" && change.url ? [change.url] : []);
|
|
1107
|
+
const readyUrls = new Set(codeChangeUrls.length === 0 ? [] : (await db.select({ subjectId: juniorReviewItems.subjectId }).from(juniorReviewItems).where(and(eq(juniorReviewItems.status, "open"), eq(juniorReviewItems.kind, "notice"), like(juniorReviewItems.dedupeKey, `${PLUGIN_REVIEW_ITEM_KEY_PREFIX}%`), inArray(juniorReviewItems.subjectId, codeChangeUrls)))).flatMap((row) => row.subjectId ? [row.subjectId] : []));
|
|
1108
|
+
const homes = /* @__PURE__ */ new Map();
|
|
1109
|
+
const workingHomes = /* @__PURE__ */ new Set();
|
|
1110
|
+
const needsViewerHomes = /* @__PURE__ */ new Set();
|
|
1111
|
+
for (const node of nodes.values()) {
|
|
1112
|
+
if (node.status !== "running" && node.status !== "pending") continue;
|
|
1113
|
+
const home = homeId(nodes, node.conversationId);
|
|
1114
|
+
if (home) workingHomes.add(home);
|
|
1115
|
+
}
|
|
1116
|
+
for (const row of needsViewerRows) {
|
|
1117
|
+
const home = homeId(nodes, row.conversationId);
|
|
1118
|
+
if (home) needsViewerHomes.add(home);
|
|
1119
|
+
}
|
|
1120
|
+
const homeFor = (conversationIds) => {
|
|
1121
|
+
let node;
|
|
1122
|
+
for (const conversationId of conversationIds) {
|
|
1123
|
+
const candidateId = homeId(nodes, conversationId);
|
|
1124
|
+
const candidate = candidateId ? nodes.get(candidateId) : void 0;
|
|
1125
|
+
if (!candidate) continue;
|
|
1126
|
+
if (!node || candidate.createdAtMs < node.createdAtMs || candidate.createdAtMs === node.createdAtMs && candidate.conversationId < node.conversationId) node = candidate;
|
|
1127
|
+
}
|
|
1128
|
+
if (!node) return void 0;
|
|
1129
|
+
const id = node.conversationId;
|
|
1130
|
+
const cached = homes.get(id);
|
|
1131
|
+
if (cached) return cached;
|
|
1132
|
+
const root = rootOf(nodes, node);
|
|
1133
|
+
const home = {
|
|
1134
|
+
conversation: {
|
|
1135
|
+
conversationId: id,
|
|
1136
|
+
...node.title ? { title: node.title } : void 0,
|
|
1137
|
+
...root !== node && root.title ? { rootTitle: root.title } : void 0
|
|
1138
|
+
},
|
|
1139
|
+
needsViewer: needsViewerHomes.has(id),
|
|
1140
|
+
participants: participants.get(root.conversationId) ?? [],
|
|
1141
|
+
working: workingHomes.has(id)
|
|
1142
|
+
};
|
|
1143
|
+
homes.set(id, home);
|
|
1144
|
+
return home;
|
|
1145
|
+
};
|
|
1146
|
+
const cards = [];
|
|
1147
|
+
for (const change of codeChanges) {
|
|
1148
|
+
const home = homeFor(change.conversationIds);
|
|
1149
|
+
if (!home) continue;
|
|
1150
|
+
const mergedAtMs = change.mergedAt?.getTime();
|
|
1151
|
+
const column = codeChangeColumn({
|
|
1152
|
+
hasReadyNotice: Boolean(change.url && readyUrls.has(change.url)),
|
|
1153
|
+
...mergedAtMs !== void 0 ? { mergedAtMs } : void 0,
|
|
1154
|
+
nowMs: args.nowMs,
|
|
1155
|
+
state: change.state
|
|
1156
|
+
});
|
|
1157
|
+
if (!column) continue;
|
|
1158
|
+
const label = `${change.repository}#${change.number}`;
|
|
1159
|
+
cards.push({
|
|
1160
|
+
column,
|
|
1161
|
+
conversation: home.conversation,
|
|
1162
|
+
key: `code_change:${change.id}`,
|
|
1163
|
+
label,
|
|
1164
|
+
needsViewer: home.needsViewer,
|
|
1165
|
+
objectType: "code_change",
|
|
1166
|
+
participants: home.participants,
|
|
1167
|
+
status: change.state,
|
|
1168
|
+
title: change.title ?? label,
|
|
1169
|
+
updatedAt: (change.mergedAt ?? change.updatedAt).toISOString(),
|
|
1170
|
+
...change.url ? { url: change.url } : void 0,
|
|
1171
|
+
working: home.working
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
const tickets = /* @__PURE__ */ new Map();
|
|
1175
|
+
for (const row of ticketRows) {
|
|
1176
|
+
const key = `${row.plugin}:${row.key}`;
|
|
1177
|
+
const current = tickets.get(key);
|
|
1178
|
+
if (!current) {
|
|
1179
|
+
tickets.set(key, {
|
|
1180
|
+
conversationIds: /* @__PURE__ */ new Set([row.conversationId]),
|
|
1181
|
+
latest: row
|
|
1182
|
+
});
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
current.conversationIds.add(row.conversationId);
|
|
1186
|
+
if (row.updatedAt > current.latest.updatedAt) current.latest = row;
|
|
1187
|
+
}
|
|
1188
|
+
for (const [key, ticket] of tickets) {
|
|
1189
|
+
const parsed = conversationAnnotationInputSchema.safeParse(ticket.latest.annotation);
|
|
1190
|
+
if (!parsed.success) continue;
|
|
1191
|
+
const annotation = parsed.data;
|
|
1192
|
+
const status = annotation.status;
|
|
1193
|
+
if (!status) continue;
|
|
1194
|
+
const home = homeFor(ticket.conversationIds);
|
|
1195
|
+
if (!home) continue;
|
|
1196
|
+
const column = ticketColumn({
|
|
1197
|
+
nowMs: args.nowMs,
|
|
1198
|
+
status,
|
|
1199
|
+
updatedAtMs: ticket.latest.updatedAt.getTime(),
|
|
1200
|
+
working: home.working
|
|
1201
|
+
});
|
|
1202
|
+
if (!column) continue;
|
|
1203
|
+
const title = annotation.kind === "object" ? annotation.title : annotation.description ?? annotation.label;
|
|
1204
|
+
cards.push({
|
|
1205
|
+
column,
|
|
1206
|
+
conversation: home.conversation,
|
|
1207
|
+
key: `ticket:${key}`,
|
|
1208
|
+
label: annotation.label,
|
|
1209
|
+
needsViewer: home.needsViewer,
|
|
1210
|
+
objectType: "task",
|
|
1211
|
+
participants: home.participants,
|
|
1212
|
+
status,
|
|
1213
|
+
title,
|
|
1214
|
+
updatedAt: ticket.latest.updatedAt.toISOString(),
|
|
1215
|
+
...annotation.url ? { url: annotation.url } : void 0,
|
|
1216
|
+
working: home.working
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
cards.sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
|
|
1220
|
+
return {
|
|
1221
|
+
cards,
|
|
1222
|
+
doneWindowHours: 6
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
// src/api/board/routes.ts
|
|
1226
|
+
/** Create the viewer's Board API. */
|
|
1227
|
+
function createBoardRoutes() {
|
|
1228
|
+
const app = new Hono();
|
|
1229
|
+
app.get("/", requireViewer, async (context) => jsonResponse(boardReportSchema, await readBoard({
|
|
1230
|
+
nowMs: Date.now(),
|
|
1231
|
+
userId: context.get("viewer").id
|
|
1232
|
+
}), { headers: { "cache-control": "private, no-store" } }));
|
|
1233
|
+
return app;
|
|
1234
|
+
}
|
|
905
1235
|
// src/api/code/overview.ts
|
|
906
1236
|
const DAY_MS = 864e5;
|
|
907
1237
|
const WINDOW_DAYS = 30;
|
|
@@ -1409,17 +1739,22 @@ async function readSettings(userId) {
|
|
|
1409
1739
|
const db = getDb();
|
|
1410
1740
|
const nowMs = Date.now();
|
|
1411
1741
|
const schedule = await readNotificationSchedule(db, userId);
|
|
1412
|
-
const [{ source, timezone }, subscriptions] = await Promise.all([
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1742
|
+
const [{ source, timezone }, subscriptions, slackPausedNow] = await Promise.all([
|
|
1743
|
+
resolveNotificationTimezone({
|
|
1744
|
+
db,
|
|
1745
|
+
nowMs,
|
|
1746
|
+
schedule,
|
|
1747
|
+
userId
|
|
1748
|
+
}),
|
|
1749
|
+
listPushSubscriptions(db, userId),
|
|
1750
|
+
isPausedBySlack(db, userId, nowMs)
|
|
1751
|
+
]);
|
|
1418
1752
|
const config = readWebPushConfig();
|
|
1419
1753
|
return notificationSettingsSchema.parse({
|
|
1420
1754
|
...config ? { publicKey: config.publicKey } : void 0,
|
|
1421
1755
|
deviceCount: subscriptions.length,
|
|
1422
1756
|
schedule,
|
|
1757
|
+
slackPausedNow,
|
|
1423
1758
|
timezone,
|
|
1424
1759
|
timezoneSource: source
|
|
1425
1760
|
});
|
|
@@ -1428,7 +1763,7 @@ async function settingsResponse(userId) {
|
|
|
1428
1763
|
return jsonResponse(notificationSettingsSchema, await readSettings(userId));
|
|
1429
1764
|
}
|
|
1430
1765
|
/**
|
|
1431
|
-
* Create authenticated routes for the viewer's
|
|
1766
|
+
* Create authenticated routes for the viewer's push notifications: browser
|
|
1432
1767
|
* subscriptions, notification hours, and a test notification.
|
|
1433
1768
|
*/
|
|
1434
1769
|
function createNotificationRoutes() {
|
|
@@ -1440,7 +1775,7 @@ function createNotificationRoutes() {
|
|
|
1440
1775
|
return await settingsResponse(viewer.id);
|
|
1441
1776
|
});
|
|
1442
1777
|
app.post("/subscriptions", requireViewer, validateRequest("json", pushSubscriptionBodySchema, "Invalid subscription."), async (context) => {
|
|
1443
|
-
if (!readWebPushConfig()) throwApiError(503, "
|
|
1778
|
+
if (!readWebPushConfig()) throwApiError(503, "Push notifications are not configured.");
|
|
1444
1779
|
const viewer = context.get("viewer");
|
|
1445
1780
|
const { endpoint, keys } = context.req.valid("json");
|
|
1446
1781
|
await savePushSubscription(getDb(), viewer.id, {
|
|
@@ -1458,7 +1793,7 @@ function createNotificationRoutes() {
|
|
|
1458
1793
|
});
|
|
1459
1794
|
app.post("/test", requireViewer, async (context) => {
|
|
1460
1795
|
const config = readWebPushConfig();
|
|
1461
|
-
if (!config) throwApiError(503, "
|
|
1796
|
+
if (!config) throwApiError(503, "Push notifications are not configured.");
|
|
1462
1797
|
const result = await sendPushNotificationToUser({
|
|
1463
1798
|
config,
|
|
1464
1799
|
db: getDb(),
|
|
@@ -2255,7 +2590,7 @@ async function readPeoplePluginReports(args) {
|
|
|
2255
2590
|
reports: [],
|
|
2256
2591
|
source: "plugins"
|
|
2257
2592
|
});
|
|
2258
|
-
const { getPluginProfileReports } = await import("./projection-
|
|
2593
|
+
const { getPluginProfileReports } = await import("./projection-BViECfYu.js").then((n) => n.Mn);
|
|
2259
2594
|
return pluginOperationalReportFeedSchema.parse({
|
|
2260
2595
|
generatedAt: new Date(nowMs).toISOString(),
|
|
2261
2596
|
reports: await getPluginProfileReports({
|
|
@@ -2968,6 +3303,32 @@ function createAutomationRoutes() {
|
|
|
2968
3303
|
});
|
|
2969
3304
|
return app;
|
|
2970
3305
|
}
|
|
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
|
+
}
|
|
2971
3332
|
// src/api/user-customization/routes.ts
|
|
2972
3333
|
/**
|
|
2973
3334
|
* Create routes that read and replace the viewer's customization. They return
|
|
@@ -3284,7 +3645,7 @@ function readDescriptionText(home) {
|
|
|
3284
3645
|
}
|
|
3285
3646
|
/** Read discovered skill names for authenticated runtime diagnostics. */
|
|
3286
3647
|
async function readSkillReports() {
|
|
3287
|
-
const { discoverSkills } = await import("./skills-
|
|
3648
|
+
const { discoverSkills } = await import("./skills-DO5K68Rq.js").then((n) => n.o);
|
|
3288
3649
|
const skills = await discoverSkills();
|
|
3289
3650
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
3290
3651
|
name: skill.name,
|
|
@@ -3293,7 +3654,7 @@ async function readSkillReports() {
|
|
|
3293
3654
|
}
|
|
3294
3655
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
3295
3656
|
async function readPlugins() {
|
|
3296
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime-
|
|
3657
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-B3gfH58M.js").then((n) => n.t);
|
|
3297
3658
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
3298
3659
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
3299
3660
|
description: plugin.manifest.description,
|
|
@@ -3305,7 +3666,7 @@ async function readPlugins() {
|
|
|
3305
3666
|
async function readRuntimeInfoReport() {
|
|
3306
3667
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
3307
3668
|
import("./package-discovery-DJhGdS4c.js").then((n) => n.r),
|
|
3308
|
-
import("./catalog-runtime-
|
|
3669
|
+
import("./catalog-runtime-B3gfH58M.js").then((n) => n.t),
|
|
3309
3670
|
readPlugins(),
|
|
3310
3671
|
readSkillReports()
|
|
3311
3672
|
]);
|
|
@@ -3322,7 +3683,7 @@ async function readRuntimeInfoReport() {
|
|
|
3322
3683
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
3323
3684
|
async function readPluginOperationalReportFeed() {
|
|
3324
3685
|
const nowMs = Date.now();
|
|
3325
|
-
const { getPluginOperationalReports } = await import("./projection-
|
|
3686
|
+
const { getPluginOperationalReports } = await import("./projection-BViECfYu.js").then((n) => n.Mn);
|
|
3326
3687
|
return pluginOperationalReportFeedSchema.parse({
|
|
3327
3688
|
source: "plugins",
|
|
3328
3689
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -3349,6 +3710,7 @@ function createJuniorApi(options = {}) {
|
|
|
3349
3710
|
queue,
|
|
3350
3711
|
show: createSlackReviewItemShow(getProductionSlackAdapter)
|
|
3351
3712
|
} }));
|
|
3713
|
+
app.route("/api/board", createBoardRoutes());
|
|
3352
3714
|
app.route("/api/code", createCodeRoutes());
|
|
3353
3715
|
app.route("/api/connections", createConnectionRoutes());
|
|
3354
3716
|
app.route("/api/notifications", createNotificationRoutes());
|
|
@@ -3357,6 +3719,7 @@ function createJuniorApi(options = {}) {
|
|
|
3357
3719
|
app.route("/api/people", createPeopleRoutes());
|
|
3358
3720
|
app.route("/api/locations", createLocationRoutes());
|
|
3359
3721
|
app.route("/api/user-pages", createUserPageRoutes());
|
|
3722
|
+
app.route("/api/transcriptions", createTranscriptionRoutes());
|
|
3360
3723
|
app.route("/api/user-customization", createUserCustomizationRoutes());
|
|
3361
3724
|
app.route("/api/automations", createAutomationRoutes());
|
|
3362
3725
|
app.route("/api/workspaces", createWorkspaceRoutes());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ConversationWorkQueue, t as ConversationQueueMessage } from "./queue-CZyYgPF0.js";
|
|
2
|
-
import { t as ConversationStore } from "./db-
|
|
3
|
-
import "./schema-
|
|
2
|
+
import { t as ConversationStore } from "./db-zIs8-Ba3.js";
|
|
3
|
+
import "./schema-B_6aOcx5.js";
|
|
4
4
|
import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
|
|
5
5
|
import "./sentry-DrKC2NeM.js";
|
|
6
6
|
import { Hono } from "hono";
|
|
@@ -32,6 +32,8 @@ interface BotModelConfig {
|
|
|
32
32
|
guardianModelId?: string;
|
|
33
33
|
/** Model used to generate images. */
|
|
34
34
|
imageGenerationModelId?: string;
|
|
35
|
+
/** Model used to transcribe dictated audio. */
|
|
36
|
+
transcriptionModelId?: string;
|
|
35
37
|
/** Model used to analyze images. */
|
|
36
38
|
visionModelId?: string;
|
|
37
39
|
/** Model used for web search. */
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-
|
|
1
|
+
import { i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-BUklJVBe.js";
|
|
2
2
|
import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-DtmjkTza.js";
|
|
3
3
|
import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
|
|
4
4
|
export { JUNIOR_VERSION, JuniorApp, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, createApp, defineJuniorPlugins };
|