@sentry/junior 0.276.0 → 0.277.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-DoPR2jS-.js → adapter-BtfBHVM5.js} +1 -1
- package/dist/{admin-BJTT-kXb.js → admin-DzAKbZsm.js} +1 -1
- package/dist/{agent-invocations-CUWrrzkc.js → agent-invocations-Crs3XHhg.js} +5 -1
- package/dist/{agent-runner-sMpA5qGM.js → agent-runner-BsYAbniN.js} +151 -65
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +13 -2
- package/dist/api.js +137 -28
- package/dist/{app-DTj-yAQt.d.ts → app-BjEQwNVP.d.ts} +3 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +65 -56
- package/dist/{assistant-reply-DbxKnBQF.js → assistant-reply-NebRGG4G.js} +1 -1
- package/dist/{automation-B8_mC68r.js → automation-Cql9h2vO.js} +1 -1
- package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-hh18yCeU.js} +2 -2
- package/dist/{briefs-IL7QnCCR.js → briefs-BBo0Eimi.js} +4 -4
- package/dist/{catalog-runtime--sC2CYLQ.js → catalog-runtime-DE-F4Awo.js} +1 -1
- package/dist/cli/chat.d.ts +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.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-7diKvInp.js → client-DZ8HTnYH.js} +2 -2
- package/dist/{config-Cb--cuv-.js → config-D5uUtrCP.js} +2 -2
- package/dist/{connections-C4-4fxaE.js → connections-Do24CGP5.js} +10 -10
- package/dist/{conversation-DppJ83Hw.js → conversation-SsASlWL7.js} +4 -6
- package/dist/{conversation-privacy-DTwdT3Pi.js → conversation-privacy-VuylvlKr.js} +1 -1
- package/dist/{credential-sync-Sl5RQCkS.js → credential-sync-BGQK3pOa.js} +13 -13
- package/dist/{db-Ck6TXQIx.d.ts → db-DEiwO5Sh.d.ts} +1 -1
- package/dist/{executor-BFKmqxYe.js → executor-hPfFTH0C.js} +13 -5
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-B04X_eCB.js → logging-cI3T1dNc.js} +4 -2
- package/dist/{message-DQMFyyE-.js → message-DBwsAl7O.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +7 -3
- package/dist/{oauth-callback-server-BGq0_vQI.js → oauth-callback-server-DXrnbplb.js} +2 -2
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
- package/dist/{projection-6dXaN0n-.js → projection-7EFIqzuj.js} +4476 -4348
- package/dist/{prompt-B4fQKGZR.js → prompt-oRfGsxd3.js} +1 -1
- package/dist/{registry-CEqKR_ld.js → registry-Bzefs7kT.js} +24 -8
- package/dist/{resolve-8I5DkrfI.js → resolve-CuiEY_2u.js} +3 -3
- package/dist/{result-BgAW90IM.js → result-DrcUtFaD.js} +9 -9
- package/dist/{runner-CSKDr_19.js → runner-CDE4CZ52.js} +11 -11
- package/dist/{sandbox-egress-signals-BxAT276e.js → sandbox-egress-signals-0tcmGd13.js} +1 -1
- package/dist/{schema-CaUWl2EV.d.ts → schema-B6N2nc6v.d.ts} +35 -10
- package/dist/{schema-Cal-EFdi.js → schema-Dzi3lkdP.js} +19 -4
- package/dist/{service-account-CtOab1Xz.js → service-account-BOz9pqOE.js} +3 -3
- package/dist/{service-account-CUuVJCKT.js → service-account-DIyz_9Uh.js} +3 -3
- package/dist/{session-stop-DK8LuPZW.js → session-stop-0juF_BP0.js} +17 -14
- package/dist/{skills-Bc0D7BGy.js → skills-CU5Is147.js} +2 -2
- package/dist/{spawn-DF_GUcd8.js → spawn-6C9jHH4b.js} +2 -2
- package/dist/{stop-DthSy-z8.js → stop-6FVG1c-r.js} +388 -153
- package/dist/{store-BgH2P3X9.js → store-DKs1WwdB.js} +3 -3
- package/dist/{store-C5uVTx2G.js → store-DtHZviJ1.js} +4 -4
- package/dist/{task-queue-C6ROM_XJ.js → task-queue-CcvFQE_p.js} +3 -3
- package/dist/{task-runner-BwAkjjVE.js → task-runner-DBkNejLl.js} +6 -6
- package/dist/{thread-state-BXjgk1pW.js → thread-state-4hjEIkIq.js} +4 -4
- package/dist/{turn-failure-response-CVI57qKL.js → turn-failure-response-BZNLydC3.js} +7 -7
- package/dist/{turn-lifecycle-CF6ibonp.js → turn-lifecycle-BhqYjaa4.js} +1 -1
- package/dist/{turn-session-routing-DddybdNu.js → turn-session-routing-jnLOfBHJ.js} +10 -10
- package/dist/{validation-BxF1nQbC.js → validation-BUFmsnKs.js} +1 -1
- package/dist/{version-CTzSbCmR.js → version-DJTk0ZCE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CQwBszc7.js → viewer-WY0RYE4E.js} +47 -12
- package/dist/{work-BHlShEQ6.js → work-C5AKvXJV.js} +10 -10
- package/dist/{worker-DhY9MnsH.js → worker-BcYVDVUy.js} +6 -6
- package/migrations/0074_conversation_participant_pins.sql +1 -0
- package/migrations/0075_conversation_detail_version.sql +1 -0
- package/migrations/0076_conversation_auto_archive.sql +5 -0
- package/migrations/meta/0074_snapshot.json +4076 -0
- package/migrations/meta/0075_snapshot.json +4299 -0
- package/migrations/meta/0076_snapshot.json +4363 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -5
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ConversationWorkQueue } from "./queue-C37RbDVc.js";
|
|
2
|
-
import "./db-
|
|
2
|
+
import "./db-DEiwO5Sh.js";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { User } from "@sentry/junior-plugin-api";
|
|
@@ -21,6 +21,17 @@ export declare function authenticatePersonalToken(token: string, now?: Date): Pr
|
|
|
21
21
|
* needs a configured list, so an empty list allows no email.
|
|
22
22
|
*/
|
|
23
23
|
export declare function isAllowedSignInEmail(email: string, allowedDomains: readonly string[]): boolean;
|
|
24
|
+
/** A user's auto-archive settings. */
|
|
25
|
+
type AutoArchiveSettings = {
|
|
26
|
+
autoArchiveDefault: boolean;
|
|
27
|
+
autoArchiveGraceHours: number;
|
|
28
|
+
};
|
|
29
|
+
/** Settings of a user who has not changed auto-archive. */
|
|
30
|
+
export declare const DEFAULT_AUTO_ARCHIVE_SETTINGS: AutoArchiveSettings;
|
|
31
|
+
/** Read the user's auto-archive settings. */
|
|
32
|
+
export declare function readUserAutoArchiveSettings(userId: string): Promise<AutoArchiveSettings | undefined>;
|
|
33
|
+
/** Save changed auto-archive settings and return the saved settings. */
|
|
34
|
+
export declare function updateUserAutoArchiveSettings(userId: string, settings: Partial<AutoArchiveSettings>): Promise<AutoArchiveSettings | undefined>;
|
|
24
35
|
/** Resolve or create the canonical user for one authenticated viewer. */
|
|
25
36
|
export declare function resolveViewerUser(email: string): Promise<User | undefined>;
|
|
26
37
|
/** Read the photo path of one canonical user: Slack, then Google. */
|
|
@@ -34,4 +45,4 @@ export interface JuniorApiOptions {
|
|
|
34
45
|
}
|
|
35
46
|
/** Create Junior's production REST API for authenticated dashboard consumers. */
|
|
36
47
|
export declare function createJuniorApi(options?: JuniorApiOptions): Hono<JuniorApiEnv>;
|
|
37
|
-
export type { ConversationWorkQueue, JuniorApiVariables };
|
|
48
|
+
export type { AutoArchiveSettings, ConversationWorkQueue, JuniorApiVariables };
|
package/dist/api.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as escapeXml } from "./client-
|
|
3
|
-
import { m as logInfo, p as logException } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import {
|
|
1
|
+
import { Bn as getPlugins, Dn as createUserTokenStore, Ha as readConversationViewerMarks, Jn as countReviewItemsNeedingUser, Ka as readConversationEventPage, Ma as createPluginLogger, Na as readConversationAccessFromSql, Qr as getWorkspace, Tn as isExperimentalFeatureEnabled, Xr as createWorkspace, Zr as deleteWorkspace, ar as canActOnReviewItem, ci as create, co as createPluginCache, cr as isOnlyAssignee, ei as listWorkspaces, er as listWaitingConversations, ga as workspaceRepoCheckoutPath, kn as webActorUserIds, li as hash, ni as updateWorkspace, pa as SANDBOX_RUNTIME, pr as reviewItemReaderForUser, ri as WorkspaceValidationError, so as lookupSlackUser, ti as listWorkspacesByRepository, tr as searchReviewItems } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { m as escapeXml } from "./client-DZ8HTnYH.js";
|
|
3
|
+
import { m as logInfo, p as logException } from "./logging-cI3T1dNc.js";
|
|
4
|
+
import { t as JUNIOR_VERSION } from "./version-DJTk0ZCE.js";
|
|
5
|
+
import { C as getSqlExecutor, D as loadConversationSlackTenantIds, Q as resolveRootConversationId, S as getDb, c as readViewerAvatarUrl, d as updateViewerDisplayName, l as resolveViewerUser, m as readAvatarImage, t as findUserByEmail, x as getConversationStore } from "./viewer-WY0RYE4E.js";
|
|
6
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
|
|
7
|
+
import { C as juniorCodeChanges, b as juniorConversationEvents, h as juniorConversationParticipants, w as juniorCodeRepositories, x as juniorApiTokens, y as juniorConversationMetrics } from "./executor-hPfFTH0C.js";
|
|
7
8
|
import { t as INPUT_IMAGE_TYPES } from "./media-DstkkoNP.js";
|
|
8
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime
|
|
9
|
-
import { $ as readViewerAutomations, Ct as listChildAgents, G as readViewerAutomationEdit, H as activateViewerAutomationVersion, K as updateViewerAutomation, Mt as saveUserCustomization, Q as readViewerAutomationVersions, S as createSlackReviewItemShow, U as changeViewerAutomationLifecycle, W as deleteViewerTask, X as readViewerAutomationRuns, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, et as AutomationEditError, ft as webActorFromUser, gt as readLiveAttachment, h as readStats, jt as readUserCustomization, lt as createAndEnqueueConversation, mt as decodeInputImages, nt as listOwnedWatches, ot as acceptsWebMessages, q as ViewerTaskNotFoundError, st as appendAndEnqueueWebMessage } from "./agent-runner-
|
|
10
|
-
import { r as getStateAdapter } from "./adapter-
|
|
11
|
-
import { A as
|
|
12
|
-
import { d as getEventCatalog } from "./session-stop-
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DE-F4Awo.js";
|
|
10
|
+
import { $ as readViewerAutomations, Ct as listChildAgents, Et as conversationSubtreeColumns, G as readViewerAutomationEdit, H as activateViewerAutomationVersion, K as updateViewerAutomation, Mt as saveUserCustomization, Q as readViewerAutomationVersions, S as createSlackReviewItemShow, Tt as conversationSubtree, U as changeViewerAutomationLifecycle, W as deleteViewerTask, X as readViewerAutomationRuns, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, et as AutomationEditError, ft as webActorFromUser, gt as readLiveAttachment, h as readStats, jt as readUserCustomization, lt as createAndEnqueueConversation, mt as decodeInputImages, nt as listOwnedWatches, ot as acceptsWebMessages, q as ViewerTaskNotFoundError, st as appendAndEnqueueWebMessage } from "./agent-runner-BsYAbniN.js";
|
|
11
|
+
import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
|
|
12
|
+
import { A as forkConversationResponseSchema, D as createConversationBodySchema, M as steerConversationPendingMessagesResponseSchema, O as createConversationMessageBodySchema, P as conversationReadPositionSchema, W as readMessageAttachments, c as conversationDetailQuerySchema, d as conversationEventPageSchema, f as conversationEventsQuerySchema, h as conversationParamsSchema, i as cancelConversationPendingMessagesResponseSchema, j as steerConversationPendingMessagesBodySchema, k as forkConversationBodySchema, l as conversationDetailReportSchema, m as conversationFeedSchema, o as conversationAttachmentParamsSchema, p as conversationFeedQuerySchema, r as cancelConversationPendingMessagesBodySchema, t as acceptedConversationMessageSchema, y as conversationPendingMessagesReportSchema } from "./conversation-SsASlWL7.js";
|
|
13
|
+
import { d as getEventCatalog } from "./session-stop-0juF_BP0.js";
|
|
13
14
|
import { S as userCustomizationSchema, a as fillUtcSixHours, b as webMessageId, c as trailingUtcDayWindow, d as utcDayKey, f as utcHourKey, i as fillUtcHours, l as trailingUtcHourWindow, 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-DgHgwQB3.js";
|
|
14
|
-
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-
|
|
15
|
-
import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-
|
|
16
|
-
import { E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation } from "./store-
|
|
17
|
-
import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, ct as AutomationConflictError, ft as automationEventCatalog, j as readAutomationTitlesByConversationId } from "./turn-session-routing-
|
|
18
|
-
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-
|
|
19
|
-
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-
|
|
15
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-CuiEY_2u.js";
|
|
16
|
+
import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-hh18yCeU.js";
|
|
17
|
+
import { E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation } from "./store-DKs1WwdB.js";
|
|
18
|
+
import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, ct as AutomationConflictError, ft as automationEventCatalog, j as readAutomationTitlesByConversationId } from "./turn-session-routing-jnLOfBHJ.js";
|
|
19
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-DIyz_9Uh.js";
|
|
20
|
+
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-Cql9h2vO.js";
|
|
20
21
|
import { c as pluginsSchema, d as skillReportsSchema, l as runtimeInfoReportSchema, n as healthReportSchema, r as pluginOperationalReportFeedSchema, t as apiErrorSchema } from "./common-Eu6sx09c.js";
|
|
21
|
-
import {
|
|
22
|
-
import { f as legacyWebMailboxMetadataSchema } from "./result-
|
|
23
|
-
import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-
|
|
24
|
-
import { A as avatarParamsSchema, C as createdPersonalTokenSchema, D as revokePersonalTokenResponseSchema, E as personalTokenParamsSchema, F as locationDirectoryReportSchema, G as startConnectionResponseSchema, H as connectionParamsSchema, I as locationParamsSchema, L as activityDays$1, M as personalSpendReportSchema, O as actorDirectoryReportSchema, P as locationDetailReportSchema, Q as codeRepositoryReportSchema, R as activityHours$1, S as createPersonalTokenBodySchema, V as connectionListSchema, W as disconnectConnectionResponseSchema, X as codePersonReportSchema, Y as codeOverviewReportSchema, Z as codeRepositoryParamsSchema, _ as disconnectServiceAccountResponseSchema, a as workspaceBodySchema, at as conversationStatsReportSchema, d as reviewItemCountSchema, f as reviewItemListQuerySchema, g as reviewItemWaitingConversationsSchema, h as reviewItemSchema, i as deleteWorkspaceResponseSchema, it as stopConversationTurnResponseSchema, j as personParamsSchema, k as actorProfileReportSchema, l as workspaceSchema, m as reviewItemParamsSchema, n as statsReportSchema, o as workspaceListSchema, p as reviewItemListSchema, rt as conversationChildAgentsReportSchema, s as workspaceParamsSchema, tt as conversationWatchesReportSchema, u as reviewItemActionSchema, v as serviceAccountListSchema, w as personalTokenListSchema, x as startServiceAccountSignInResponseSchema, y as serviceAccountParamsSchema, z as activitySixHours$1 } from "./schema-
|
|
22
|
+
import { G as actOnReviewItem, K as closeReviewItemsAnsweredByReply, N as clearSlackPendingReactions, O as isAllowedSignInEmail, Q as readUserAutoArchiveSettings, U as parseContent, W as ReviewItemActionError, X as archiveViewerDoneConversations, Y as DEFAULT_AUTO_ARCHIVE_SETTINGS, Z as readConversationAutoArchive, _ as resolveMentions, a as readConversationAgentTree, at as getAttachmentStorage, b as encodeConversationCursor, c as readConversationForks, d as readConversationAuxiliaryCostsFromSql, et as setConversationAutoArchive, f as childAgentTotalsReport, g as attachConversationMentions, h as conversationSummaryFromStoredConversation, i as readConversationReadPosition, it as throwApiError, l as readConversationFeed, lt as readHealthReport, m as conversationEventHistory, n as readConversationDetail, nt as emptyResponse, o as forkConversationForViewer, p as readConversationTreeMetricsFromSql, q as readReviewItemForUser, r as markConversationRead, rt as jsonResponse, s as keepQuickQuestionForViewer, t as stopConversationTurnForViewer, tt as updateUserAutoArchiveSettings, u as readConversationRecordFromSql, v as readFirstHumanMessageTexts, w as getProductionSlackAdapter, x as archiveConversation, y as decodeConversationCursor } from "./stop-6FVG1c-r.js";
|
|
23
|
+
import { f as legacyWebMailboxMetadataSchema } from "./result-DrcUtFaD.js";
|
|
24
|
+
import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-Do24CGP5.js";
|
|
25
|
+
import { A as avatarParamsSchema, C as createdPersonalTokenSchema, D as revokePersonalTokenResponseSchema, E as personalTokenParamsSchema, F as locationDirectoryReportSchema, G as startConnectionResponseSchema, H as connectionParamsSchema, I as locationParamsSchema, L as activityDays$1, M as personalSpendReportSchema, O as actorDirectoryReportSchema, P as locationDetailReportSchema, Q as codeRepositoryReportSchema, R as activityHours$1, S as createPersonalTokenBodySchema, V as connectionListSchema, W as disconnectConnectionResponseSchema, X as codePersonReportSchema, Y as codeOverviewReportSchema, Z as codeRepositoryParamsSchema, _ as disconnectServiceAccountResponseSchema, a as workspaceBodySchema, at as conversationStatsReportSchema, ct as archiveDoneConversationsResponseSchema, d as reviewItemCountSchema, dt as pinConversationResponseSchema, f as reviewItemListQuerySchema, g as reviewItemWaitingConversationsSchema, h as reviewItemSchema, i as deleteWorkspaceResponseSchema, it as stopConversationTurnResponseSchema, j as personParamsSchema, k as actorProfileReportSchema, l as workspaceSchema, lt as conversationAutoArchiveSchema, m as reviewItemParamsSchema, n as statsReportSchema, o as workspaceListSchema, ot as archiveConversationBodySchema, p as reviewItemListSchema, rt as conversationChildAgentsReportSchema, s as workspaceParamsSchema, st as archiveConversationResponseSchema, tt as conversationWatchesReportSchema, u as reviewItemActionSchema, ut as pinConversationBodySchema, v as serviceAccountListSchema, w as personalTokenListSchema, x as startServiceAccountSignInResponseSchema, y as serviceAccountParamsSchema, z as activitySixHours$1 } from "./schema-Dzi3lkdP.js";
|
|
25
26
|
import { Hono } from "hono";
|
|
26
27
|
import path from "node:path";
|
|
27
28
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -54,6 +55,42 @@ const requireAdmin = createMiddleware(async (context, next) => {
|
|
|
54
55
|
if (viewer.isAdmin !== true) throwApiError(403, "Only Junior admins can do this.");
|
|
55
56
|
await next();
|
|
56
57
|
});
|
|
58
|
+
// src/api/conversations/pin.ts
|
|
59
|
+
/**
|
|
60
|
+
* Pin or unpin one conversation for the signed-in viewer.
|
|
61
|
+
*
|
|
62
|
+
* A pin lives on the viewer's participant row, and that row grants send and
|
|
63
|
+
* control access. So only a participant can pin, the same as archive. The
|
|
64
|
+
* root actor may have no row yet, so pinning adds it. A pin also restores an
|
|
65
|
+
* archived conversation, because the Pinned section shows only active
|
|
66
|
+
* conversations.
|
|
67
|
+
*/
|
|
68
|
+
async function pinConversation(viewer, conversationId, body) {
|
|
69
|
+
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
70
|
+
const executor = getSqlExecutor();
|
|
71
|
+
const rootConversationId = await resolveRootConversationId(executor, conversationId);
|
|
72
|
+
const db = executor.db();
|
|
73
|
+
if (!body.pinned) {
|
|
74
|
+
await db.update(juniorConversationParticipants).set({ pinnedAt: null }).where(and(eq(juniorConversationParticipants.userId, viewer.id), eq(juniorConversationParticipants.rootConversationId, rootConversationId)));
|
|
75
|
+
return { pinnedAt: null };
|
|
76
|
+
}
|
|
77
|
+
const [root] = await db.select({ lastActivityAt: juniorConversations.lastActivityAt }).from(juniorConversations).where(eq(juniorConversations.conversationId, rootConversationId)).limit(1);
|
|
78
|
+
if (!root) throwApiError(404, "Conversation not found.");
|
|
79
|
+
const pinnedAt = /* @__PURE__ */ new Date();
|
|
80
|
+
await db.insert(juniorConversationParticipants).values({
|
|
81
|
+
lastMessageAt: root.lastActivityAt,
|
|
82
|
+
pinnedAt,
|
|
83
|
+
rootConversationId,
|
|
84
|
+
userId: viewer.id
|
|
85
|
+
}).onConflictDoUpdate({
|
|
86
|
+
target: [juniorConversationParticipants.userId, juniorConversationParticipants.rootConversationId],
|
|
87
|
+
set: {
|
|
88
|
+
archivedAt: null,
|
|
89
|
+
pinnedAt
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return { pinnedAt: pinnedAt.toISOString() };
|
|
93
|
+
}
|
|
57
94
|
// src/api/conversations/child-agents.ts
|
|
58
95
|
/**
|
|
59
96
|
* Load the direct child agents of one Conversation, or throw a standard API
|
|
@@ -216,6 +253,61 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
216
253
|
throwApiError(500, "Unable to append message.", error);
|
|
217
254
|
}
|
|
218
255
|
}
|
|
256
|
+
// src/api/conversations/detail-etag.ts
|
|
257
|
+
/**
|
|
258
|
+
* Sum the detail versions of a Conversation and its child agents. Child
|
|
259
|
+
* writes bump only their own row, and the row count changes when a child
|
|
260
|
+
* starts, so the parent needs no bump of its own.
|
|
261
|
+
*/
|
|
262
|
+
async function readSubtreeDetailVersion(conversationId) {
|
|
263
|
+
const [row] = await getDb().select({
|
|
264
|
+
conversations: sql`count(*)::int`,
|
|
265
|
+
version: sql`coalesce(sum(${juniorConversations.detailVersion}), 0)::text`
|
|
266
|
+
}).from(juniorConversations).innerJoin(conversationSubtree([conversationId]), eq(conversationSubtreeColumns.conversationId, juniorConversations.conversationId));
|
|
267
|
+
return row ?? {
|
|
268
|
+
conversations: 0,
|
|
269
|
+
version: "0"
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Return the detail ETag without building the report, or undefined for a
|
|
274
|
+
* missing Conversation.
|
|
275
|
+
*
|
|
276
|
+
* Shared content is covered by `detail_version`. Viewer state (marks, read
|
|
277
|
+
* position, auto-archive choice) and data that other Conversations own (forks,
|
|
278
|
+
* agent tree labels) are cheap, so they are read on each request. Names, avatars, Automation titles, and plugin sidebar
|
|
279
|
+
* labels are not covered: they refresh with the next detail change or a reload.
|
|
280
|
+
*/
|
|
281
|
+
async function readConversationDetailEtag(conversationId, options) {
|
|
282
|
+
const { viewer } = options;
|
|
283
|
+
const [subtree, access, viewerMarks, forks, agentTree, readPosition, autoArchive] = await Promise.all([
|
|
284
|
+
readSubtreeDetailVersion(conversationId),
|
|
285
|
+
readConversationAccessFromSql(getDb(), [conversationId], viewer),
|
|
286
|
+
viewer ? readConversationViewerMarks(viewer, conversationId) : void 0,
|
|
287
|
+
readConversationForks(conversationId, viewer),
|
|
288
|
+
readConversationAgentTree(conversationId, viewer),
|
|
289
|
+
viewer ? readConversationReadPosition(viewer, conversationId) : void 0,
|
|
290
|
+
viewer ? readConversationAutoArchive(viewer, conversationId) : void 0
|
|
291
|
+
]);
|
|
292
|
+
if (subtree.conversations === 0) return void 0;
|
|
293
|
+
const basis = JSON.stringify({
|
|
294
|
+
access: access.get(conversationId) ?? null,
|
|
295
|
+
agentTree: agentTree ?? null,
|
|
296
|
+
autoArchive: autoArchive ?? null,
|
|
297
|
+
forks,
|
|
298
|
+
junior: JUNIOR_VERSION,
|
|
299
|
+
limit: options.limit,
|
|
300
|
+
readPosition: readPosition ?? null,
|
|
301
|
+
subtree,
|
|
302
|
+
viewerMarks: viewerMarks ?? null
|
|
303
|
+
});
|
|
304
|
+
return `W/"${createHash("sha256").update(basis).digest("hex")}"`;
|
|
305
|
+
}
|
|
306
|
+
/** Report whether an `If-None-Match` header names the current ETag. */
|
|
307
|
+
function etagMatches(header, etag) {
|
|
308
|
+
const opaque = etag.replace(/^W\//, "");
|
|
309
|
+
return Boolean(header?.split(",").some((value) => value.trim().replace(/^W\//, "") === opaque));
|
|
310
|
+
}
|
|
219
311
|
// src/api/conversations/event-list.ts
|
|
220
312
|
/** Read one bounded page of reporting events before a signed cursor. */
|
|
221
313
|
async function readConversationEvents(conversationId, beforeValue, options = {}) {
|
|
@@ -906,12 +998,15 @@ function createConversationRoutes(options) {
|
|
|
906
998
|
const body = context.req.valid("json");
|
|
907
999
|
return jsonResponse(archiveConversationResponseSchema, await archiveConversation(viewer, conversationId, body));
|
|
908
1000
|
});
|
|
1001
|
+
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"))));
|
|
909
1002
|
app.put("/:conversationId/read-position", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationReadPositionSchema, "Invalid request body."), async (context) => {
|
|
910
1003
|
const viewer = context.get("viewer");
|
|
911
1004
|
const { conversationId } = context.req.valid("param");
|
|
912
1005
|
const body = context.req.valid("json");
|
|
913
1006
|
return jsonResponse(conversationReadPositionSchema, await markConversationRead(viewer, conversationId, body));
|
|
914
1007
|
});
|
|
1008
|
+
app.post("/archive-done", requireViewer, async (context) => jsonResponse(archiveDoneConversationsResponseSchema, await archiveViewerDoneConversations(context.get("viewer"))));
|
|
1009
|
+
app.patch("/:conversationId/auto-archive", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationAutoArchiveSchema, "Invalid request body."), async (context) => jsonResponse(conversationAutoArchiveSchema, await setConversationAutoArchive(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json").autoArchive)));
|
|
915
1010
|
app.get("/:conversationId/events", validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("query", conversationEventsQuerySchema, "Invalid query parameters."), async (context) => {
|
|
916
1011
|
const { conversationId } = context.req.valid("param");
|
|
917
1012
|
const { before, limit } = context.req.valid("query");
|
|
@@ -969,12 +1064,26 @@ function createConversationRoutes(options) {
|
|
|
969
1064
|
const { conversationId } = context.req.valid("param");
|
|
970
1065
|
const query = context.req.valid("query");
|
|
971
1066
|
const viewer = context.get("viewer");
|
|
1067
|
+
const etag = await readConversationDetailEtag(conversationId, {
|
|
1068
|
+
limit: query.limit,
|
|
1069
|
+
...viewer ? { viewer } : void 0
|
|
1070
|
+
});
|
|
1071
|
+
if (etag && etagMatches(context.req.header("if-none-match"), etag)) return new Response(null, {
|
|
1072
|
+
status: 304,
|
|
1073
|
+
headers: {
|
|
1074
|
+
"cache-control": "private, no-store",
|
|
1075
|
+
etag
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
972
1078
|
const report = await readConversationDetail(conversationId, {
|
|
973
1079
|
...query,
|
|
974
1080
|
...viewer ? { viewer } : void 0
|
|
975
1081
|
});
|
|
976
1082
|
if (!report) throwApiError(404, "Conversation not found.");
|
|
977
|
-
return jsonResponse(conversationDetailReportSchema, report
|
|
1083
|
+
return jsonResponse(conversationDetailReportSchema, report, etag ? { headers: {
|
|
1084
|
+
"cache-control": "private, no-store",
|
|
1085
|
+
etag
|
|
1086
|
+
} } : void 0);
|
|
978
1087
|
});
|
|
979
1088
|
return app;
|
|
980
1089
|
}
|
|
@@ -2248,7 +2357,7 @@ async function readPeoplePluginReports(args) {
|
|
|
2248
2357
|
reports: [],
|
|
2249
2358
|
source: "plugins"
|
|
2250
2359
|
});
|
|
2251
|
-
const { getPluginProfileReports } = await import("./projection-
|
|
2360
|
+
const { getPluginProfileReports } = await import("./projection-7EFIqzuj.js").then((n) => n.Mn);
|
|
2252
2361
|
return pluginOperationalReportFeedSchema.parse({
|
|
2253
2362
|
generatedAt: new Date(nowMs).toISOString(),
|
|
2254
2363
|
reports: await getPluginProfileReports({
|
|
@@ -3276,7 +3385,7 @@ function readDescriptionText(home) {
|
|
|
3276
3385
|
}
|
|
3277
3386
|
/** Read discovered skill names for authenticated runtime diagnostics. */
|
|
3278
3387
|
async function readSkillReports() {
|
|
3279
|
-
const { discoverSkills } = await import("./skills-
|
|
3388
|
+
const { discoverSkills } = await import("./skills-CU5Is147.js").then((n) => n.o);
|
|
3280
3389
|
const skills = await discoverSkills();
|
|
3281
3390
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
3282
3391
|
name: skill.name,
|
|
@@ -3285,7 +3394,7 @@ async function readSkillReports() {
|
|
|
3285
3394
|
}
|
|
3286
3395
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
3287
3396
|
async function readPlugins() {
|
|
3288
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime
|
|
3397
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-DE-F4Awo.js").then((n) => n.t);
|
|
3289
3398
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
3290
3399
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
3291
3400
|
description: plugin.manifest.description,
|
|
@@ -3297,7 +3406,7 @@ async function readPlugins() {
|
|
|
3297
3406
|
async function readRuntimeInfoReport() {
|
|
3298
3407
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
3299
3408
|
import("./package-discovery-DJBompdd.js").then((n) => n.r),
|
|
3300
|
-
import("./catalog-runtime
|
|
3409
|
+
import("./catalog-runtime-DE-F4Awo.js").then((n) => n.t),
|
|
3301
3410
|
readPlugins(),
|
|
3302
3411
|
readSkillReports()
|
|
3303
3412
|
]);
|
|
@@ -3314,7 +3423,7 @@ async function readRuntimeInfoReport() {
|
|
|
3314
3423
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
3315
3424
|
async function readPluginOperationalReportFeed() {
|
|
3316
3425
|
const nowMs = Date.now();
|
|
3317
|
-
const { getPluginOperationalReports } = await import("./projection-
|
|
3426
|
+
const { getPluginOperationalReports } = await import("./projection-7EFIqzuj.js").then((n) => n.Mn);
|
|
3318
3427
|
return pluginOperationalReportFeedSchema.parse({
|
|
3319
3428
|
source: "plugins",
|
|
3320
3429
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -3361,4 +3470,4 @@ function createJuniorApi(options = {}) {
|
|
|
3361
3470
|
});
|
|
3362
3471
|
return app;
|
|
3363
3472
|
}
|
|
3364
|
-
export { authenticatePersonalToken, createJuniorApi, isAllowedSignInEmail, jsonResponse, readViewerAvatarUrl, resolveViewerUser, updateViewerDisplayName };
|
|
3473
|
+
export { DEFAULT_AUTO_ARCHIVE_SETTINGS, authenticatePersonalToken, createJuniorApi, isAllowedSignInEmail, jsonResponse, readUserAutoArchiveSettings, readViewerAvatarUrl, resolveViewerUser, updateUserAutoArchiveSettings, updateViewerDisplayName };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ConversationWorkQueue, t as ConversationQueueMessage } from "./queue-C37RbDVc.js";
|
|
2
|
-
import { t as ConversationStore } from "./db-
|
|
3
|
-
import "./schema-
|
|
4
|
-
import { n as JuniorPluginSet } from "./plugins-
|
|
2
|
+
import { t as ConversationStore } from "./db-DEiwO5Sh.js";
|
|
3
|
+
import "./schema-B6N2nc6v.js";
|
|
4
|
+
import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
import "@earendil-works/pi-ai/compat";
|
|
7
7
|
import "@earendil-works/pi-ai/api/anthropic-messages";
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ModelProfileInput, i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-
|
|
2
|
-
import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-
|
|
1
|
+
import { a as ModelProfileInput, i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-BjEQwNVP.js";
|
|
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, type ModelProfileInput, createApp, defineJuniorPlugins };
|
package/dist/app.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as restoreRuntimeConfig, f as setBotModelConfig, g as snapshotRuntimeConfig, h as setSlackReactionConfig, i as getChatConfig, m as setRuntimeLimits, n as botConfig, o as getSlackBotToken, p as setProfiles, u as resetRuntimeConfig } from "./config-
|
|
3
|
-
import {
|
|
1
|
+
import { Ai as openSlackModal, Ar as findMatchingWatches, Bn as getPlugins, C as projectConversationMessages, Dn as createUserTokenStore, E as settleConversationTitleWork, En as setExperimentalFeatures, Er as collectEventMatchKeys, Et as isInvalidConversationRecordError, Fn as getPluginRoutes, Fr as bindScheduledAutomationCredentialSubject, Gn as setBriefsConfig, Gr as getDashboardTaskLink, Hi as getSlackClient, Hn as validatePlugins, Hr as getDashboardConversationLink, Ii as slackEntitySchema, Ir as bindSlackDirectCredentialSubject, Ji as getWorkspaceTeamId, Jr as createPluginState, Ka as readConversationEventPage, Kr as setDashboardConversationLinkOptions, Li as slackExternalRefIdSchema, Lr as verifyEventAutomationCredentialSubject, Ma as createPluginLogger, Na as readConversationAccessFromSql, Nr as takeDueTimerWatches, Pn as getPluginApiRoutes, Pr as bindEventAutomationCredentialSubject, Rr as verifyScheduledAutomationCredentialSubject, Tn as isExperimentalFeatureEnabled, Vn as setPlugins, Wi as isDmChannel, Wr as getDashboardReviewItemLink, Yi as runWithWorkspaceTeamId, Yn as dismissOpenReviewItems, _n as getThreadStopDecision, _o as setConfigDefaults, aa as consumeSandboxEgressAuthRequiredSignal, ar as canActOnReviewItem, b as appendConversationMessages, ca as parseSandboxEgressCredentialToken, co as createPluginCache, ct as CONVERSATION_WORK_STALE_ENQUEUE_MS, eo as resolveRootVisibility, fa as normalizeSandboxEgressTracePropagationDomains, go as getConfigDefaults, ia as clearSandboxEgressSignals, ji as postSlackEphemeralMessage, mi as proxyVercelSandboxEgressRequest, mn as SubscribedReplyReason, oa as consumeSandboxEgressPermissionDeniedSignal, pi as isVercelSandboxEgressRequest, pr as reviewItemReaderForUser, ro as listConversationAnnotations, tr as searchReviewItems, va as createPluginEmbedder, vi as resolveBaseUrl, wi as slackMention, wn as getExperimentalFeatures, wt as hasRunnableConversationWork, zr as verifySlackDirectCredentialSubject } from "./projection-7EFIqzuj.js";
|
|
2
|
+
import { d as restoreRuntimeConfig, f as setBotModelConfig, g as snapshotRuntimeConfig, h as setSlackReactionConfig, i as getChatConfig, m as setRuntimeLimits, n as botConfig, o as getSlackBotToken, p as setProfiles, u as resetRuntimeConfig } from "./config-D5uUtrCP.js";
|
|
3
|
+
import { E as withSpan, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, T as withLogContext, U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, b as setSpanAttributes, h as logWarn, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-cI3T1dNc.js";
|
|
4
4
|
import { n as captureMessage } from "./sentry-MDkYAVPV.js";
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-DJTk0ZCE.js";
|
|
6
6
|
import { _ as slackMessageTsSchema, f as parseSlackTeamId, g as slackMessageTsFromMs, h as parseSlackMessageTs, m as slackChannelIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-B4DYygOB.js";
|
|
7
|
-
import { C as getSqlExecutor, E as withConversationEventLock, N as resolveActorIdentityId, S as getDb, _ as closeDb, g as createCache, i as readActorIdentity, k as withConversationMutationLock, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore, z as recordGoogleSignIn } from "./viewer-
|
|
8
|
-
import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-
|
|
9
|
-
import { _ as juniorConversationBriefs, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, l as juniorAutomationRuns } from "./executor-
|
|
10
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime
|
|
11
|
-
import { $ as readViewerAutomations, A as runWithSlackInstallation, B as logScheduledAutomationRunSkipped, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, Dt as processWorkspaceSnapshotJob, E as buildSlackReviewItemModal, L as joinPublicChannel, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as ingestEvent, S as createSlackReviewItemShow, V as scheduledAutomationRunAttributes, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, _ as readPublicArtifact, _t as requestAttachmentDeletion, at as reviewItemChangeRecord, bt as stopConversationSession, ct as conversationTurnIdForMessage, dt as recordWebConversationActivity, ft as webActorFromUser, g as publicArtifactHeaders, ht as collectAttachmentGarbage, it as renderReviewItemMessage, j as verifySlackSignature, k as parseSlackUserInputSubmission, n as executeAgentRun, q as ViewerTaskNotFoundError, r as processBackgroundCompaction, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, tt as effectiveTaskOutcomes, v as unpublishedArtifactHeaders, w as syncReviewItemSlackCards, xt as recordSubagentEnded, y as lookupSlackUserProfile } from "./agent-runner-
|
|
7
|
+
import { C as getSqlExecutor, E as withConversationEventLock, K as touchConversationDetail, N as resolveActorIdentityId, S as getDb, _ as closeDb, g as createCache, i as readActorIdentity, k as withConversationMutationLock, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore, z as recordGoogleSignIn } from "./viewer-WY0RYE4E.js";
|
|
8
|
+
import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
|
|
9
|
+
import { _ as juniorConversationBriefs, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, l as juniorAutomationRuns } from "./executor-hPfFTH0C.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DE-F4Awo.js";
|
|
11
|
+
import { $ as readViewerAutomations, A as runWithSlackInstallation, B as logScheduledAutomationRunSkipped, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, Dt as processWorkspaceSnapshotJob, E as buildSlackReviewItemModal, L as joinPublicChannel, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as ingestEvent, S as createSlackReviewItemShow, V as scheduledAutomationRunAttributes, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, _ as readPublicArtifact, _t as requestAttachmentDeletion, at as reviewItemChangeRecord, bt as stopConversationSession, ct as conversationTurnIdForMessage, dt as recordWebConversationActivity, ft as webActorFromUser, g as publicArtifactHeaders, ht as collectAttachmentGarbage, it as renderReviewItemMessage, j as verifySlackSignature, k as parseSlackUserInputSubmission, n as executeAgentRun, q as ViewerTaskNotFoundError, r as processBackgroundCompaction, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, tt as effectiveTaskOutcomes, v as unpublishedArtifactHeaders, w as syncReviewItemSlackCards, xt as recordSubagentEnded, y as lookupSlackUserProfile } from "./agent-runner-BsYAbniN.js";
|
|
12
12
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
|
|
13
|
-
import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-
|
|
13
|
+
import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-BtfBHVM5.js";
|
|
14
14
|
import { n as getNextRunAtMs } from "./cadence-R7Em4RjE.js";
|
|
15
|
-
import {
|
|
16
|
-
import { S as listPendingAgentInvocationResults, x as listPendingAgentInvocationMailboxAppends } from "./store-
|
|
17
|
-
import { A as renderSlackObjectCard, T as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-
|
|
15
|
+
import { C as conversationReportStatusSchema, I as annotationCard, J as conversationBriefSchema, T as conversationSurfaceSchema, p as conversationFeedQuerySchema } from "./conversation-SsASlWL7.js";
|
|
16
|
+
import { S as listPendingAgentInvocationResults, x as listPendingAgentInvocationMailboxAppends } from "./store-DtHZviJ1.js";
|
|
17
|
+
import { A as renderSlackObjectCard, T as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-0juF_BP0.js";
|
|
18
18
|
import { h as buttonUserInputField } from "./reporting-window-DgHgwQB3.js";
|
|
19
|
-
import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-
|
|
20
|
-
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, b as isConversationQueueMessageRejectedError, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, h as getQueueProvider, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, y as conversationQueueMessageSchema } from "./background-compaction-queue-
|
|
21
|
-
import { S as removeActiveConversation, _ as hasRunnableConversationWork$1, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-
|
|
22
|
-
import { B as readScheduledAutomation, G as blockEventAutomation, H as saveScheduledAutomationInLock, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, W as withScheduledAutomationLock, Y as findMatchingEventAutomations, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, ht as eventGuidance, it as automationVersionOf, m as listPendingDispatchMailboxAppends, nt as eventAutomationRunLimitReason, o as createOrGetDispatch, p as isTerminalDispatchStatus, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed } from "./turn-session-routing-
|
|
23
|
-
import { M as scheduledRunSchema, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-
|
|
24
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
19
|
+
import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-CuiEY_2u.js";
|
|
20
|
+
import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, b as isConversationQueueMessageRejectedError, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, h as getQueueProvider, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, y as conversationQueueMessageSchema } from "./background-compaction-queue-hh18yCeU.js";
|
|
21
|
+
import { S as removeActiveConversation, _ as hasRunnableConversationWork$1, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-DKs1WwdB.js";
|
|
22
|
+
import { B as readScheduledAutomation, G as blockEventAutomation, H as saveScheduledAutomationInLock, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, W as withScheduledAutomationLock, Y as findMatchingEventAutomations, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, ht as eventGuidance, it as automationVersionOf, m as listPendingDispatchMailboxAppends, nt as eventAutomationRunLimitReason, o as createOrGetDispatch, p as isTerminalDispatchStatus, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed } from "./turn-session-routing-jnLOfBHJ.js";
|
|
23
|
+
import { M as scheduledRunSchema, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-Cql9h2vO.js";
|
|
24
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BUFmsnKs.js";
|
|
25
25
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-DOm9Y6qI.js";
|
|
26
|
-
import { A as resolveAllowedDomains, B as bindMessageAuthorIdentityId, C as createProductionSlackWebhookServices, D as isAllowedDomain, E as assertNoLegacyAllowedDomains, F as stopSlackThread, G as actOnReviewItem, H as stripLeadingBotMention, I as normalizeIncomingSlackThreadId, J as reviewItemChange, K as closeReviewItemsAnsweredByReply, L as withNormalizedThreadId, M as buildSlackInboundMessage, N as clearSlackPendingReactions, O as isAllowedSignInEmail, P as isSlackMessageStopped,
|
|
27
|
-
import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-
|
|
28
|
-
import { i as enqueueAgentInvocation, r as endAgentInvocationsOfStoppedWork } from "./work-
|
|
29
|
-
import { o as coerceThreadConversationState } from "./thread-state-
|
|
30
|
-
import { o as unlinkProvider } from "./connections-
|
|
31
|
-
import { a as GET$
|
|
32
|
-
import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-
|
|
33
|
-
import { t as processConversationWork } from "./worker-
|
|
34
|
-
import { t as bindMessageAgent } from "./message-
|
|
35
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
36
|
-
import { t as processPluginTask } from "./task-runner-
|
|
26
|
+
import { $ as runAutoArchiveSweep, A as resolveAllowedDomains, B as bindMessageAuthorIdentityId, C as createProductionSlackWebhookServices, D as isAllowedDomain, E as assertNoLegacyAllowedDomains, F as stopSlackThread, G as actOnReviewItem, H as stripLeadingBotMention, I as normalizeIncomingSlackThreadId, J as reviewItemChange, K as closeReviewItemsAnsweredByReply, L as withNormalizedThreadId, M as buildSlackInboundMessage, N as clearSlackPendingReactions, O as isAllowedSignInEmail, P as isSlackMessageStopped, R as stopConversationTurn, S as createProductionConversationWorkOptions, T as createSlackWebApiStatusSender, U as parseContent, V as startProcessingReaction, W as ReviewItemActionError, at as getAttachmentStorage, b as encodeConversationCursor, ct as GET$4, j as recordSkippedConversationMessage, k as readEnvList, l as readConversationFeed, n as readConversationDetail, q as readReviewItemForUser, st as enqueueAgentDispatch, t as stopConversationTurnForViewer, u as readConversationRecordFromSql, w as getProductionSlackAdapter, x as archiveConversation, y as decodeConversationCursor, z as THREAD_OPTOUT_ACK } from "./stop-6FVG1c-r.js";
|
|
27
|
+
import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-DrcUtFaD.js";
|
|
28
|
+
import { i as enqueueAgentInvocation, r as endAgentInvocationsOfStoppedWork } from "./work-C5AKvXJV.js";
|
|
29
|
+
import { o as coerceThreadConversationState } from "./thread-state-4hjEIkIq.js";
|
|
30
|
+
import { o as unlinkProvider } from "./connections-Do24CGP5.js";
|
|
31
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-BGQK3pOa.js";
|
|
32
|
+
import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-CcvFQE_p.js";
|
|
33
|
+
import { t as processConversationWork } from "./worker-BcYVDVUy.js";
|
|
34
|
+
import { t as bindMessageAgent } from "./message-DBwsAl7O.js";
|
|
35
|
+
import { t as bindSpawnAgent } from "./spawn-6C9jHH4b.js";
|
|
36
|
+
import { t as processPluginTask } from "./task-runner-DBkNejLl.js";
|
|
37
37
|
import { createRequire } from "node:module";
|
|
38
38
|
import { Hono } from "hono";
|
|
39
39
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -44,12 +44,12 @@ import { pathToFileURL } from "node:url";
|
|
|
44
44
|
import net from "node:net";
|
|
45
45
|
import { decodeJwt } from "jose";
|
|
46
46
|
import https from "node:https";
|
|
47
|
+
import { HTTPException } from "hono/http-exception";
|
|
47
48
|
import { Message, ThreadImpl } from "chat";
|
|
48
49
|
import * as acp from "@agentclientprotocol/sdk";
|
|
49
50
|
import dns from "node:dns";
|
|
50
51
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
51
52
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
52
|
-
import { HTTPException } from "hono/http-exception";
|
|
53
53
|
import { bodyLimit } from "hono/body-limit";
|
|
54
54
|
import { createAuthMiddleware } from "better-auth/api";
|
|
55
55
|
import { betterAuth } from "better-auth/minimal";
|
|
@@ -1142,12 +1142,13 @@ async function runHeartbeat(args) {
|
|
|
1142
1142
|
nowMs: args.nowMs
|
|
1143
1143
|
});
|
|
1144
1144
|
}
|
|
1145
|
-
// src/handlers/
|
|
1146
|
-
function
|
|
1145
|
+
// src/handlers/scheduler-auth.ts
|
|
1146
|
+
function getSchedulerSecret() {
|
|
1147
1147
|
return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
|
|
1148
1148
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1149
|
+
/** Check the bearer secret that internal cron requests must send. */
|
|
1150
|
+
function verifySchedulerRequest(request) {
|
|
1151
|
+
const secret = getSchedulerSecret();
|
|
1151
1152
|
if (!secret) return false;
|
|
1152
1153
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1153
1154
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -1155,9 +1156,10 @@ function verifyHeartbeatRequest(request) {
|
|
|
1155
1156
|
const expected = Buffer.from(secret);
|
|
1156
1157
|
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
1157
1158
|
}
|
|
1159
|
+
// src/handlers/heartbeat.ts
|
|
1158
1160
|
/** Handle the authenticated internal heartbeat. */
|
|
1159
|
-
async function GET$
|
|
1160
|
-
if (!
|
|
1161
|
+
async function GET$3(request, waitUntil, options = {}) {
|
|
1162
|
+
if (!verifySchedulerRequest(request)) return new Response("Unauthorized", { status: 401 });
|
|
1161
1163
|
const nowMs = Date.now();
|
|
1162
1164
|
waitUntil(() => runHeartbeat({
|
|
1163
1165
|
conversationWorkQueue: options.conversationWorkQueue,
|
|
@@ -1344,6 +1346,7 @@ async function purgeConversationTree(executor, args) {
|
|
|
1344
1346
|
actor: null
|
|
1345
1347
|
} : void 0
|
|
1346
1348
|
}).where(inArray(juniorConversations.conversationId, ids));
|
|
1349
|
+
await touchConversationDetail(executor.db(), ids);
|
|
1347
1350
|
return {
|
|
1348
1351
|
purged: true,
|
|
1349
1352
|
conversations: ids.length
|
|
@@ -1428,25 +1431,13 @@ async function runRetentionPurge(executor, args) {
|
|
|
1428
1431
|
};
|
|
1429
1432
|
}
|
|
1430
1433
|
// src/handlers/retention.ts
|
|
1431
|
-
function getRetentionSecret() {
|
|
1432
|
-
return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
|
|
1433
|
-
}
|
|
1434
|
-
function verifyRetentionRequest(request) {
|
|
1435
|
-
const secret = getRetentionSecret();
|
|
1436
|
-
if (!secret) return false;
|
|
1437
|
-
const authorization = request.headers.get("authorization")?.trim();
|
|
1438
|
-
if (!authorization?.startsWith("Bearer ")) return false;
|
|
1439
|
-
const actual = Buffer.from(authorization.slice(7));
|
|
1440
|
-
const expected = Buffer.from(secret);
|
|
1441
|
-
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
1442
|
-
}
|
|
1443
1434
|
/**
|
|
1444
1435
|
* Handle the authenticated internal retention cron. One request runs a single
|
|
1445
1436
|
* bounded purge batch and returns its counts. Failures are contained here so
|
|
1446
1437
|
* retention can never affect task execution, heartbeat recovery, or delivery.
|
|
1447
1438
|
*/
|
|
1448
|
-
async function GET$
|
|
1449
|
-
if (!
|
|
1439
|
+
async function GET$2(request, options = {}) {
|
|
1440
|
+
if (!verifySchedulerRequest(request)) return new Response("Unauthorized", { status: 401 });
|
|
1450
1441
|
try {
|
|
1451
1442
|
const result = await runRetentionPurge(getSqlExecutor(), {
|
|
1452
1443
|
attachmentStorage: options.attachmentStorage ?? getAttachmentStorage(),
|
|
@@ -1458,6 +1449,21 @@ async function GET$1(request, options = {}) {
|
|
|
1458
1449
|
return new Response("Retention purge failed", { status: 500 });
|
|
1459
1450
|
}
|
|
1460
1451
|
}
|
|
1452
|
+
// src/handlers/auto-archive.ts
|
|
1453
|
+
/**
|
|
1454
|
+
* Handle the authenticated auto-archive cron. One request runs one bounded
|
|
1455
|
+
* sweep. Failures stay here so archive state never affects task execution.
|
|
1456
|
+
*/
|
|
1457
|
+
async function GET$1(request) {
|
|
1458
|
+
if (!verifySchedulerRequest(request)) return new Response("Unauthorized", { status: 401 });
|
|
1459
|
+
try {
|
|
1460
|
+
const result = await runAutoArchiveSweep({ nowMs: Date.now() });
|
|
1461
|
+
return Response.json(result, { status: 200 });
|
|
1462
|
+
} catch (error) {
|
|
1463
|
+
logException(error, "auto_archive.run.failed");
|
|
1464
|
+
return new Response("Auto-archive failed", { status: 500 });
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1461
1467
|
// src/handlers/sandbox-egress-proxy.ts
|
|
1462
1468
|
/** Handles Vercel Sandbox firewall egress proxy requests. */
|
|
1463
1469
|
async function ALL(request, options = {}) {
|
|
@@ -7457,17 +7463,17 @@ async function createApp(options) {
|
|
|
7457
7463
|
createDashboardApp: virtualConfig?.createDashboardApp,
|
|
7458
7464
|
pluginRoutes: pluginApiRoutes
|
|
7459
7465
|
}));
|
|
7460
|
-
app.get("/", () => GET$
|
|
7461
|
-
app.get("/health", () => GET$
|
|
7466
|
+
app.get("/", () => GET$4());
|
|
7467
|
+
app.get("/health", () => GET$4());
|
|
7462
7468
|
app.get("/public/artifacts/:filename", (c) => publicArtifactGET({
|
|
7463
7469
|
filename: c.req.param("filename"),
|
|
7464
7470
|
storage: attachmentStorage
|
|
7465
7471
|
}));
|
|
7466
7472
|
app.get("/api/oauth/callback/mcp/:provider", (c) => {
|
|
7467
|
-
return GET$
|
|
7473
|
+
return GET$5(c.req.raw, c.req.param("provider"), waitUntil, { conversationWorkQueue });
|
|
7468
7474
|
});
|
|
7469
7475
|
app.get("/api/oauth/callback/:provider", (c) => {
|
|
7470
|
-
return GET$
|
|
7476
|
+
return GET$6(c.req.raw, c.req.param("provider"), waitUntil, { conversationWorkQueue });
|
|
7471
7477
|
});
|
|
7472
7478
|
app.get("/api/internal/sandbox-egress/signals", (c) => {
|
|
7473
7479
|
return GET(c.req.raw);
|
|
@@ -7505,9 +7511,12 @@ async function createApp(options) {
|
|
|
7505
7511
|
return backgroundCompactionPOST(c.req.raw);
|
|
7506
7512
|
});
|
|
7507
7513
|
app.get("/api/internal/heartbeat", (c) => {
|
|
7508
|
-
return GET$
|
|
7514
|
+
return GET$3(c.req.raw, waitUntil, { conversationWorkQueue });
|
|
7509
7515
|
});
|
|
7510
7516
|
app.get("/api/internal/retention", (c) => {
|
|
7517
|
+
return GET$2(c.req.raw);
|
|
7518
|
+
});
|
|
7519
|
+
app.get(JUNIOR_AUTO_ARCHIVE_ROUTE, (c) => {
|
|
7511
7520
|
return GET$1(c.req.raw);
|
|
7512
7521
|
});
|
|
7513
7522
|
app.post("/api/webhooks/slack", (c) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveLocalScheduleAtMs, i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
|
|
2
|
-
import { n as actorIdentitySchema } from "./conversation-
|
|
2
|
+
import { n as actorIdentitySchema } from "./conversation-SsASlWL7.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
5
5
|
// src/chat/scheduled-automations/schedule-intent.ts
|
package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-hh18yCeU.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
-
import { E as withSpan, m as logInfo, p as logException } from "./logging-
|
|
1
|
+
import { i as getChatConfig } from "./config-D5uUtrCP.js";
|
|
2
|
+
import { E as withSpan, m as logInfo, p as logException } from "./logging-cI3T1dNc.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as completeObject } from "./client-
|
|
1
|
+
import { i as completeObject } from "./client-DZ8HTnYH.js";
|
|
2
2
|
import { i as defaultModelId } from "./model-profile-B998sjVd.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
3
|
+
import { G as briefCodeChangeSchema, Y as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-SsASlWL7.js";
|
|
4
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-oRfGsxd3.js";
|
|
5
5
|
import { CLI_USAGE } from "./cli/run.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -267,7 +267,7 @@ async function parseRunOptions(argv) {
|
|
|
267
267
|
* `DATABASE_URL` at import, and `briefs pull` must work with only a token.
|
|
268
268
|
*/
|
|
269
269
|
async function configuredDefaultModelId() {
|
|
270
|
-
const { botConfig } = await import("./config-
|
|
270
|
+
const { botConfig } = await import("./config-D5uUtrCP.js").then((n) => n.r);
|
|
271
271
|
return defaultModelId(botConfig);
|
|
272
272
|
}
|
|
273
273
|
function apiUrl(baseUrl, pathname) {
|