@sentry/junior 0.277.0 → 0.279.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-BtfBHVM5.js → adapter-phTTgw7H.js} +1 -1
- package/dist/{admin-DzAKbZsm.js → admin-PcpJDugZ.js} +1 -1
- package/dist/{agent-invocations-Crs3XHhg.js → agent-invocations-CUg_SODU.js} +0 -1
- package/dist/{agent-runner-BsYAbniN.js → agent-runner-DwvT1BY0.js} +321 -847
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +46 -414
- package/dist/{app-BjEQwNVP.d.ts → app-DVs6noo7.d.ts} +6 -27
- package/dist/app.d.ts +2 -2
- package/dist/app.js +460 -78
- package/dist/{assistant-reply-NebRGG4G.js → assistant-reply-BXfxczd7.js} +28 -6
- package/dist/{automation-Cql9h2vO.js → automation-BehArCcq.js} +1 -1
- package/dist/{background-compaction-queue-hh18yCeU.js → background-compaction-queue-CcbuLJrZ.js} +2 -2
- package/dist/{briefs-BBo0Eimi.js → briefs-Dd_ezwED.js} +10 -10
- package/dist/{catalog-runtime-DE-F4Awo.js → catalog-runtime-BWVMeZhW.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +0 -2
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{client-DZ8HTnYH.js → client-Bpxe4vKa.js} +8 -4
- package/dist/{config-D5uUtrCP.js → config-C_bmRhrJ.js} +25 -100
- package/dist/{connections-Do24CGP5.js → connections-B2rHe5W5.js} +10 -10
- package/dist/{conversation-SsASlWL7.js → conversation-CIiJtx5q.js} +56 -104
- package/dist/conversation-pending-messages-CnBvE6-6.js +173 -0
- package/dist/{conversation-privacy-VuylvlKr.js → conversation-privacy-CzOfcz0U.js} +1 -1
- package/dist/{credential-sync-BGQK3pOa.js → credential-sync-Dal_unpv.js} +15 -15
- package/dist/{db-DEiwO5Sh.d.ts → db-CyLrV9C7.d.ts} +1 -1
- package/dist/{executor-hPfFTH0C.js → executor-BfYH-Wws.js} +6 -4
- package/dist/instrumentation.d.ts +12 -0
- package/dist/instrumentation.js +56 -23
- package/dist/{logging-cI3T1dNc.js → logging-CkT3_Xxp.js} +2 -2
- package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
- package/dist/{message-DBwsAl7O.js → message-Q5dkgaJ5.js} +23 -29
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +18 -6
- package/dist/{oauth-callback-server-DXrnbplb.js → oauth-callback-server-BDRaqe8O.js} +2 -2
- package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D0G3T16m.js} +1 -1
- package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
- package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
- package/dist/{projection-7EFIqzuj.js → projection-DWxX7pb1.js} +214 -138
- package/dist/{prompt-oRfGsxd3.js → prompt--dwus7Y-.js} +1 -1
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/{registry-Bzefs7kT.js → registry-DnrdeO4s.js} +2 -2
- package/dist/{resolve-CuiEY_2u.js → resolve-C_QXfqD_.js} +3 -3
- package/dist/{result-DrcUtFaD.js → result-DNmOxT-N.js} +10 -10
- package/dist/{runner-CDE4CZ52.js → runner-zd_noJ1l.js} +11 -11
- package/dist/{sandbox-egress-signals-0tcmGd13.js → sandbox-egress-signals-DQjv-nbG.js} +1 -1
- package/dist/{schema-Dzi3lkdP.js → schema-CNJNzvr8.js} +4 -4
- package/dist/{schema-B6N2nc6v.d.ts → schema-e90H5FIN.d.ts} +2176 -967
- package/dist/sentry-BRTJqumy.js +51 -0
- package/dist/sentry-DrKC2NeM.d.ts +1 -0
- package/dist/sentry-route-name-BhwWnfqj.js +51 -0
- package/dist/{service-account-BOz9pqOE.js → service-account-BK26XlHo.js} +3 -3
- package/dist/{service-account-DIyz_9Uh.js → service-account-CCH2Hv4h.js} +3 -3
- package/dist/{session-stop-0juF_BP0.js → session-stop-6Tf--T7G.js} +23 -16
- package/dist/{skills-CU5Is147.js → skills-BNrk8gi4.js} +4 -4
- package/dist/{spawn-6C9jHH4b.js → spawn-C75hAB9l.js} +3 -4
- package/dist/{stop-6FVG1c-r.js → stop-RYbf7PWi.js} +742 -207
- package/dist/{store-DtHZviJ1.js → store-CO5vGjwD.js} +9 -16
- package/dist/{store-DKs1WwdB.js → store-G3h2djJU.js} +3 -3
- package/dist/{task-queue-CcvFQE_p.js → task-queue-DlN58XeM.js} +3 -3
- package/dist/{task-runner-DBkNejLl.js → task-runner-B-Bdm23d.js} +22 -10
- package/dist/{thread-state-4hjEIkIq.js → thread-state-Cj_7Slru.js} +4 -4
- package/dist/{turn-failure-response-BZNLydC3.js → turn-failure-response-CE7gaoC7.js} +7 -7
- package/dist/{turn-lifecycle-BhqYjaa4.js → turn-lifecycle-7sXwXLJ6.js} +1 -1
- package/dist/{turn-session-routing-jnLOfBHJ.js → turn-session-routing-FBdaH1zf.js} +10 -10
- package/dist/{validation-BUFmsnKs.js → validation-DLWxEzWW.js} +2 -2
- package/dist/{version-DJTk0ZCE.js → version-DtQ8WFIZ.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-WY0RYE4E.js → viewer-vsM8_90o.js} +53 -22
- package/dist/{work-C5AKvXJV.js → work-DsoFRO_0.js} +12 -17
- package/dist/{worker-BcYVDVUy.js → worker-6kZEsCXs.js} +7 -7
- package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
- package/migrations/0078_plugin_conversation_index.sql +20 -0
- package/migrations/0079_conversation_event_author_index.sql +20 -0
- package/migrations/meta/0075_snapshot.json +98 -314
- package/migrations/meta/0076_snapshot.json +98 -314
- package/migrations/meta/0077_snapshot.json +4141 -0
- package/migrations/meta/0078_snapshot.json +4175 -0
- package/migrations/meta/0079_snapshot.json +4203 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -5
- package/dist/common-Eu6sx09c.js +0 -107
- package/dist/model-profile-B998sjVd.js +0 -67
- package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
- package/dist/sentry-MDkYAVPV.js +0 -23
package/dist/api.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as escapeXml } from "./client-
|
|
3
|
-
import { m as logInfo, p as logException } from "./logging-
|
|
4
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
5
|
-
import { C as getSqlExecutor,
|
|
6
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
7
|
-
import { C as juniorCodeChanges, b as juniorConversationEvents,
|
|
8
|
-
import { t as INPUT_IMAGE_TYPES } from "./media-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
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,
|
|
11
|
-
import { r as getStateAdapter } from "./adapter-
|
|
12
|
-
import {
|
|
13
|
-
import { d as getEventCatalog } from "./session-stop-
|
|
14
|
-
import { S as userCustomizationSchema, a as fillUtcSixHours,
|
|
15
|
-
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-
|
|
16
|
-
import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { c as
|
|
22
|
-
import {
|
|
23
|
-
import { f as
|
|
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";
|
|
1
|
+
import { $r as updateWorkspace, Aa as createPluginLogger, Gn as countReviewItemsNeedingUser, Jr as deleteWorkspace, Ln as getPlugins, Ma as readConversationAccessFromSql, Qn as searchReviewItems, Qr as listWorkspacesByRepository, Sn as isExperimentalFeatureEnabled, Va as readConversationViewerMarks, Yr as getWorkspace, Zn as listWaitingConversations, Zr as listWorkspaces, ai as create, ar as isOnlyAssignee, do as createPluginCache, ei as WorkspaceValidationError, nr as canActOnReviewItem, oi as hash, pa as workspaceRepoCheckoutPath, qr as createWorkspace, ua as SANDBOX_RUNTIME, ur as reviewItemReaderForUser, wn as createUserTokenStore } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { m as escapeXml } from "./client-Bpxe4vKa.js";
|
|
3
|
+
import { m as logInfo, p as logException } from "./logging-CkT3_Xxp.js";
|
|
4
|
+
import { t as JUNIOR_VERSION } from "./version-DtQ8WFIZ.js";
|
|
5
|
+
import { C as getSqlExecutor, S as getDb, c as readViewerAvatarUrl, d as updateViewerDisplayName, l as resolveViewerUser, m as readAvatarImage, t as findUserByEmail, x as getConversationStore } from "./viewer-vsM8_90o.js";
|
|
6
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
|
|
7
|
+
import { C as juniorCodeChanges, b as juniorConversationEvents, w as juniorCodeRepositories, x as juniorApiTokens, y as juniorConversationMetrics } from "./executor-BfYH-Wws.js";
|
|
8
|
+
import { t as INPUT_IMAGE_TYPES } from "./media-DTAA8Qs_.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.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, nt as listOwnedWatches, q as ViewerTaskNotFoundError } from "./agent-runner-DwvT1BY0.js";
|
|
11
|
+
import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
12
|
+
import { C as createConversationMessageBodySchema, D as conversationReadPositionSchema, S as createConversationBodySchema, T as forkConversationResponseSchema, a as conversationAttachmentParamsSchema, c as conversationDetailReportSchema, d as conversationEventsQuerySchema, f as conversationFeedQuerySchema, m as conversationParamsSchema, n as acceptedConversationMessageSchema, p as conversationFeedSchema, s as conversationDetailQuerySchema, t as CONVERSATION_DETAIL_VERSION_HEADER, u as conversationEventPageSchema, w as forkConversationBodySchema } from "./conversation-CIiJtx5q.js";
|
|
13
|
+
import { d as getEventCatalog } from "./session-stop-6Tf--T7G.js";
|
|
14
|
+
import { S as userCustomizationSchema, a as fillUtcSixHours, 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";
|
|
15
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-C_QXfqD_.js";
|
|
16
|
+
import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-CcbuLJrZ.js";
|
|
17
|
+
import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, ct as AutomationConflictError, ft as automationEventCatalog, j as readAutomationTitlesByConversationId } from "./turn-session-routing-FBdaH1zf.js";
|
|
18
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CCH2Hv4h.js";
|
|
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-BehArCcq.js";
|
|
20
|
+
import { _ as pluginsSchema, b as skillReportsSchema, c as steerConversationPendingMessagesBodySchema, d as healthReportSchema, f as pluginOperationalReportFeedSchema, l as steerConversationPendingMessagesResponseSchema, n as cancelConversationPendingMessagesResponseSchema, r as conversationDetailWithMailboxReportSchema, s as conversationPendingMessagesReportSchema, t as cancelConversationPendingMessagesBodySchema, u as apiErrorSchema, v as runtimeInfoReportSchema } from "./conversation-pending-messages-CnBvE6-6.js";
|
|
21
|
+
import { $ as readReviewItemForUser, A as getProductionSlackAdapter, C as cancelConversationPendingMessagesForViewer, D as archiveConversation, E as resolveMentions, P as isAllowedSignInEmail, T as requireConversationPendingMessages, X as ReviewItemActionError, Z as actOnReviewItem, _ as conversationSummaryFromStoredConversation, a as markConversationRead, b as createConversationForViewer, c as forkConversationForViewer, ct as emptyResponse, d as readConversationEvents, dt as getAttachmentStorage, f as readConversationFeed, g as readConversationTreeMetricsFromSql, h as childAgentTotalsReport, ht as readHealthReport, i as readConversationDetail, it as readUserAutoArchiveSettings, l as keepQuickQuestionForViewer, lt as jsonResponse, m as readConversationAuxiliaryCostsFromSql, n as steerConversationPendingMessagesForViewer, nt as archiveViewerDoneConversations, o as readConversationReadPosition, ot as setConversationAutoArchive, r as pinConversation, rt as readConversationAutoArchive, s as readConversationAgentTree, st as updateUserAutoArchiveSettings, t as stopConversationTurnForViewer, tt as DEFAULT_AUTO_ARCHIVE_SETTINGS, u as readConversationForks, ut as throwApiError, v as readFirstHumanMessageTexts, y as appendConversationMessageForViewer } from "./stop-RYbf7PWi.js";
|
|
22
|
+
import { a as startConnection, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-B2rHe5W5.js";
|
|
23
|
+
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-CNJNzvr8.js";
|
|
26
24
|
import { Hono } from "hono";
|
|
27
25
|
import path from "node:path";
|
|
28
26
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -55,42 +53,6 @@ const requireAdmin = createMiddleware(async (context, next) => {
|
|
|
55
53
|
if (viewer.isAdmin !== true) throwApiError(403, "Only Junior admins can do this.");
|
|
56
54
|
await next();
|
|
57
55
|
});
|
|
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
|
-
}
|
|
94
56
|
// src/api/conversations/child-agents.ts
|
|
95
57
|
/**
|
|
96
58
|
* Load the direct child agents of one Conversation, or throw a standard API
|
|
@@ -170,89 +132,6 @@ async function requireConversationAttachment(args) {
|
|
|
170
132
|
if (!opened) throwApiError(404, "Attachment not found.");
|
|
171
133
|
return opened;
|
|
172
134
|
}
|
|
173
|
-
// src/api/conversations/create.ts
|
|
174
|
-
/** Turn image validation failures into request errors before accepting work. */
|
|
175
|
-
function parseImages(images) {
|
|
176
|
-
try {
|
|
177
|
-
return decodeInputImages(images ?? []);
|
|
178
|
-
} catch (error) {
|
|
179
|
-
throwApiError(400, error instanceof Error ? error.message : "Unable to read images.");
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function actorFromViewer(viewer) {
|
|
183
|
-
const normalized = viewer.email.trim().toLowerCase();
|
|
184
|
-
return webActorFromUser(viewer, { userName: normalized.split("@")[0] || normalized });
|
|
185
|
-
}
|
|
186
|
-
/** Create a dashboard root conversation and enqueue its first message. */
|
|
187
|
-
async function createConversationForViewer(viewer, body, services) {
|
|
188
|
-
const images = parseImages(body.images);
|
|
189
|
-
try {
|
|
190
|
-
return await createAndEnqueueConversation({
|
|
191
|
-
actor: actorFromViewer(viewer),
|
|
192
|
-
idempotencyKey: body.idempotencyKey,
|
|
193
|
-
message: body.message,
|
|
194
|
-
images,
|
|
195
|
-
...body.visibility ? { visibility: body.visibility } : void 0
|
|
196
|
-
}, {
|
|
197
|
-
conversationStore: getConversationStore(),
|
|
198
|
-
attachmentStorage: services.attachmentStorage,
|
|
199
|
-
queue: services.queue
|
|
200
|
-
});
|
|
201
|
-
} catch (error) {
|
|
202
|
-
throwApiError(500, "Unable to create conversation.", error);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
/** Append one dashboard message to an existing conversation. */
|
|
206
|
-
async function appendConversationMessageForViewer(viewer, conversationId, body, services) {
|
|
207
|
-
const conversation = await getConversationStore().get({ conversationId });
|
|
208
|
-
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
209
|
-
if (!acceptsWebMessages(conversationId, conversation.destination)) throwApiError(409, "Conversation does not accept web messages.");
|
|
210
|
-
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(403, "Only conversation participants can add messages.");
|
|
211
|
-
const images = parseImages(body.images);
|
|
212
|
-
const actor = actorFromViewer(viewer);
|
|
213
|
-
const append = () => appendAndEnqueueWebMessage({
|
|
214
|
-
actor,
|
|
215
|
-
conversationId,
|
|
216
|
-
idempotencyKey: body.idempotencyKey,
|
|
217
|
-
message: body.message,
|
|
218
|
-
images
|
|
219
|
-
}, {
|
|
220
|
-
conversationStore: getConversationStore(),
|
|
221
|
-
attachmentStorage: services.attachmentStorage,
|
|
222
|
-
queue: services.queue
|
|
223
|
-
});
|
|
224
|
-
const closeAnswered = () => closeReviewItemsAnsweredByReply({
|
|
225
|
-
conversationId,
|
|
226
|
-
delivery: {
|
|
227
|
-
queue: services.queue,
|
|
228
|
-
show: createSlackReviewItemShow(getProductionSlackAdapter)
|
|
229
|
-
},
|
|
230
|
-
resolveUser: async () => viewer,
|
|
231
|
-
text: body.message
|
|
232
|
-
});
|
|
233
|
-
try {
|
|
234
|
-
let accepted;
|
|
235
|
-
try {
|
|
236
|
-
accepted = await append();
|
|
237
|
-
} catch (error) {
|
|
238
|
-
const state = getStateAdapter();
|
|
239
|
-
await state.connect();
|
|
240
|
-
const [messageId, work] = await Promise.all([webMessageId({
|
|
241
|
-
conversationId,
|
|
242
|
-
idempotencyKey: body.idempotencyKey
|
|
243
|
-
}), getConversationWorkState({
|
|
244
|
-
conversationId,
|
|
245
|
-
state
|
|
246
|
-
})]);
|
|
247
|
-
if (work?.execution.inboundMessageIds.includes(messageId)) await closeAnswered();
|
|
248
|
-
throw error;
|
|
249
|
-
}
|
|
250
|
-
await closeAnswered();
|
|
251
|
-
return accepted;
|
|
252
|
-
} catch (error) {
|
|
253
|
-
throwApiError(500, "Unable to append message.", error);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
135
|
// src/api/conversations/detail-etag.ts
|
|
257
136
|
/**
|
|
258
137
|
* Sum the detail versions of a Conversation and its child agents. Child
|
|
@@ -301,257 +180,7 @@ async function readConversationDetailEtag(conversationId, options) {
|
|
|
301
180
|
subtree,
|
|
302
181
|
viewerMarks: viewerMarks ?? null
|
|
303
182
|
});
|
|
304
|
-
return
|
|
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
|
-
}
|
|
311
|
-
// src/api/conversations/event-list.ts
|
|
312
|
-
/** Read one bounded page of reporting events before a signed cursor. */
|
|
313
|
-
async function readConversationEvents(conversationId, beforeValue, options = {}) {
|
|
314
|
-
const record = await readConversationRecordFromSql(conversationId);
|
|
315
|
-
if (!record) return void 0;
|
|
316
|
-
const before = decodeConversationCursor({
|
|
317
|
-
conversationId,
|
|
318
|
-
cursor: beforeValue
|
|
319
|
-
});
|
|
320
|
-
if (!before) throwApiError(400, "Invalid conversation cursor.");
|
|
321
|
-
const canExposePayload = (await readConversationAccessFromSql(getDb(), [conversationId], options.viewer)).get(conversationId)?.canViewPrivateContent ?? false;
|
|
322
|
-
const transcriptPurgedAtMs = record.conversation.transcriptPurgedAtMs;
|
|
323
|
-
const page = transcriptPurgedAtMs === void 0 ? await readConversationEventPage(getSqlExecutor(), {
|
|
324
|
-
beforeSeq: before.seq,
|
|
325
|
-
canExposePayload,
|
|
326
|
-
conversationId,
|
|
327
|
-
limit: options.limit ?? 500
|
|
328
|
-
}) : { events: [] };
|
|
329
|
-
return conversationEventPageSchema.parse({
|
|
330
|
-
events: (await attachConversationMentions(getSqlExecutor(), conversationId, { events: page.events })).events,
|
|
331
|
-
eventHistory: conversationEventHistory({
|
|
332
|
-
canExposePayload,
|
|
333
|
-
...transcriptPurgedAtMs === void 0 ? void 0 : { transcriptPurgedAtMs }
|
|
334
|
-
}),
|
|
335
|
-
...page.previousSeq === void 0 ? void 0 : { previousCursor: encodeConversationCursor({
|
|
336
|
-
conversationId,
|
|
337
|
-
seq: page.previousSeq
|
|
338
|
-
}) },
|
|
339
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
// src/api/conversations/cancel-pending-messages.ts
|
|
343
|
-
/** Cancel accepted human-facing mailbox rows for one conversation participant. */
|
|
344
|
-
async function cancelConversationPendingMessagesForViewer(viewer, conversationId, body = {}) {
|
|
345
|
-
if (!await getConversationStore().get({ conversationId })) throwApiError(404, "Conversation not found.");
|
|
346
|
-
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(403, "Only conversation participants can cancel queued messages.");
|
|
347
|
-
try {
|
|
348
|
-
const result = await cancelHumanFacingPendingMessages({
|
|
349
|
-
conversationId,
|
|
350
|
-
...body.inboundMessageIds ? { inboundMessageIds: body.inboundMessageIds } : void 0,
|
|
351
|
-
...body.receivedBefore ? { receivedBeforeMs: Date.parse(body.receivedBefore) } : void 0,
|
|
352
|
-
conversationStore: getConversationStore()
|
|
353
|
-
});
|
|
354
|
-
await clearSlackPendingReactions({
|
|
355
|
-
getSlackAdapter: getProductionSlackAdapter,
|
|
356
|
-
messages: result.cancelledMessages
|
|
357
|
-
});
|
|
358
|
-
return {
|
|
359
|
-
cancelledCount: result.cancelledInboundMessageIds.length,
|
|
360
|
-
cancelledInboundMessageIds: result.cancelledInboundMessageIds,
|
|
361
|
-
conversationId
|
|
362
|
-
};
|
|
363
|
-
} catch (error) {
|
|
364
|
-
throwApiError(500, "Unable to cancel queued messages.", error);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
// src/api/conversations/steer-pending-messages.ts
|
|
368
|
-
/**
|
|
369
|
-
* Steer the viewer's own queued web messages into the conversation now.
|
|
370
|
-
*
|
|
371
|
-
* Only the author can steer a message. Ids that are not the viewer's queued
|
|
372
|
-
* web messages, or that Junior already read, are left out of the result.
|
|
373
|
-
*/
|
|
374
|
-
async function steerConversationPendingMessagesForViewer(viewer, conversationId, body) {
|
|
375
|
-
if (!await getConversationStore().get({ conversationId })) throwApiError(404, "Conversation not found.");
|
|
376
|
-
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(403, "Only conversation participants can steer queued messages.");
|
|
377
|
-
return {
|
|
378
|
-
conversationId,
|
|
379
|
-
steeredInboundMessageIds: (await steerWebPendingMessages({
|
|
380
|
-
authorIds: webActorUserIds(viewer),
|
|
381
|
-
conversationId,
|
|
382
|
-
inboundMessageIds: body.inboundMessageIds
|
|
383
|
-
})).steeredInboundMessageIds
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
// src/api/conversations/pending-messages.ts
|
|
387
|
-
const slackMailboxAuthorSchema = z.object({
|
|
388
|
-
userId: z.string(),
|
|
389
|
-
userName: z.string().optional(),
|
|
390
|
-
fullName: z.string().optional(),
|
|
391
|
-
isMe: z.boolean().optional()
|
|
392
|
-
}).passthrough();
|
|
393
|
-
const slackMailboxMessageSchema = z.object({
|
|
394
|
-
author: slackMailboxAuthorSchema,
|
|
395
|
-
id: z.string().min(1),
|
|
396
|
-
raw: z.unknown().optional()
|
|
397
|
-
}).passthrough();
|
|
398
|
-
const slackMailboxMetadataSchema = z.object({
|
|
399
|
-
message: slackMailboxMessageSchema,
|
|
400
|
-
platform: z.literal("slack")
|
|
401
|
-
}).passthrough();
|
|
402
|
-
/**
|
|
403
|
-
* Project Slack text the way the Turn stores it in history. The SDK text
|
|
404
|
-
* turns `<@U123>` into a bare `@U123` or `@name`, which the dashboard
|
|
405
|
-
* cannot render as a mention.
|
|
406
|
-
*/
|
|
407
|
-
function slackDisplayText(message, sdkText) {
|
|
408
|
-
return parseContent({
|
|
409
|
-
attachments: [],
|
|
410
|
-
formatted: {
|
|
411
|
-
type: "root",
|
|
412
|
-
children: []
|
|
413
|
-
},
|
|
414
|
-
raw: message.raw,
|
|
415
|
-
text: sdkText
|
|
416
|
-
}).text;
|
|
417
|
-
}
|
|
418
|
-
function isoFromMs(value) {
|
|
419
|
-
return new Date(value).toISOString();
|
|
420
|
-
}
|
|
421
|
-
function actorIdentityFromWebMetadata(metadata) {
|
|
422
|
-
return {
|
|
423
|
-
email: metadata.authorEmail.trim().toLowerCase(),
|
|
424
|
-
...metadata.authorFullName ? { fullName: metadata.authorFullName } : void 0
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
async function actorIdentityFromSlackMetadata(metadata, teamId) {
|
|
428
|
-
if (metadata.message.author.isMe === true) return void 0;
|
|
429
|
-
const slackUserId = metadata.message.author.userId.trim();
|
|
430
|
-
if (!slackUserId) return void 0;
|
|
431
|
-
const profile = teamId ? await lookupSlackUser(teamId, slackUserId) : null;
|
|
432
|
-
const slackUserName = profile?.userName?.trim() || metadata.message.author.userName?.trim();
|
|
433
|
-
const fullName = profile?.fullName?.trim() || metadata.message.author.fullName?.trim();
|
|
434
|
-
const email = profile?.email?.trim().toLowerCase();
|
|
435
|
-
return {
|
|
436
|
-
slackUserId,
|
|
437
|
-
...slackUserName ? { slackUserName } : void 0,
|
|
438
|
-
...fullName ? { fullName } : void 0,
|
|
439
|
-
...email ? { email } : void 0
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
async function projectPendingMessage(message, canExposePayload) {
|
|
443
|
-
if (message.source === "web") {
|
|
444
|
-
const metadata = legacyWebMailboxMetadataSchema.safeParse(message.input.metadata);
|
|
445
|
-
if (!metadata.success) return void 0;
|
|
446
|
-
const text = message.input.text.trim();
|
|
447
|
-
const attachments = readMessageAttachments(message.input.attachments);
|
|
448
|
-
if (!text && !attachments.length) return void 0;
|
|
449
|
-
return {
|
|
450
|
-
createdAt: isoFromMs(message.createdAtMs),
|
|
451
|
-
delivery: message.delivery,
|
|
452
|
-
inboundMessageId: message.inboundMessageId,
|
|
453
|
-
messageId: metadata.data.messageId,
|
|
454
|
-
receivedAt: isoFromMs(message.receivedAtMs),
|
|
455
|
-
role: "user",
|
|
456
|
-
source: "web",
|
|
457
|
-
...canExposePayload ? {
|
|
458
|
-
actorIdentity: actorIdentityFromWebMetadata(metadata.data),
|
|
459
|
-
text,
|
|
460
|
-
...attachments.length ? { attachments } : void 0,
|
|
461
|
-
...message.input.reviewItemChange ? { reviewItemChange: message.input.reviewItemChange } : void 0
|
|
462
|
-
} : { redacted: true }
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
if (message.source === "slack") {
|
|
466
|
-
const metadata = slackMailboxMetadataSchema.safeParse(message.input.metadata);
|
|
467
|
-
if (!metadata.success) return void 0;
|
|
468
|
-
if (metadata.data.message.author.isMe === true) return void 0;
|
|
469
|
-
const text = slackDisplayText(metadata.data.message, message.input.text).trim();
|
|
470
|
-
if (!text) return void 0;
|
|
471
|
-
if (!canExposePayload) return {
|
|
472
|
-
createdAt: isoFromMs(message.createdAtMs),
|
|
473
|
-
delivery: message.delivery,
|
|
474
|
-
inboundMessageId: message.inboundMessageId,
|
|
475
|
-
messageId: metadata.data.message.id,
|
|
476
|
-
receivedAt: isoFromMs(message.receivedAtMs),
|
|
477
|
-
redacted: true,
|
|
478
|
-
role: "user",
|
|
479
|
-
source: "slack"
|
|
480
|
-
};
|
|
481
|
-
const actorIdentity = await actorIdentityFromSlackMetadata(metadata.data, message.destination?.platform === "slack" ? message.destination.teamId : void 0);
|
|
482
|
-
return {
|
|
483
|
-
createdAt: isoFromMs(message.createdAtMs),
|
|
484
|
-
delivery: message.delivery,
|
|
485
|
-
inboundMessageId: message.inboundMessageId,
|
|
486
|
-
messageId: metadata.data.message.id,
|
|
487
|
-
receivedAt: isoFromMs(message.receivedAtMs),
|
|
488
|
-
role: "user",
|
|
489
|
-
source: "slack",
|
|
490
|
-
...actorIdentity ? { actorIdentity } : void 0,
|
|
491
|
-
...message.input.reviewItemChange ? { reviewItemChange: message.input.reviewItemChange } : void 0,
|
|
492
|
-
text
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
async function attachPendingMentions(conversationId, messages) {
|
|
497
|
-
if (!messages.some((message) => message.text?.includes("<@"))) return messages;
|
|
498
|
-
const executor = getSqlExecutor();
|
|
499
|
-
const tenantId = (await loadConversationSlackTenantIds(executor, [conversationId])).get(conversationId);
|
|
500
|
-
const mentions = await resolveMentions(executor, messages.map((message) => ({
|
|
501
|
-
tenantId,
|
|
502
|
-
texts: [message.text]
|
|
503
|
-
})));
|
|
504
|
-
return messages.map((message, index) => mentions[index].length > 0 ? {
|
|
505
|
-
...message,
|
|
506
|
-
mentions: mentions[index]
|
|
507
|
-
} : message);
|
|
508
|
-
}
|
|
509
|
-
/** Read the viewer's pending authorization, also one saved before a deploy. */
|
|
510
|
-
async function findViewerWebAuthorization(conversationId, viewer) {
|
|
511
|
-
for (const actorId of webActorUserIds(viewer)) {
|
|
512
|
-
const authorization = await getWebAuthorization({
|
|
513
|
-
actorId,
|
|
514
|
-
conversationId
|
|
515
|
-
});
|
|
516
|
-
if (authorization) return authorization;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Read accepted mailbox messages that have not reached durable history yet.
|
|
521
|
-
*
|
|
522
|
-
* Returns only human-facing web and Slack rows. Internal mailbox work stays
|
|
523
|
-
* hidden from the transcript.
|
|
524
|
-
*/
|
|
525
|
-
async function readConversationPendingMessages(conversationId, options = {}) {
|
|
526
|
-
if (!await getConversationStore().get({ conversationId })) return void 0;
|
|
527
|
-
const access = (await readConversationAccessFromSql(getDb(), [conversationId], options.viewer)).get(conversationId);
|
|
528
|
-
const canExposePayload = access?.canViewPrivateContent ?? false;
|
|
529
|
-
const authorization = (access?.isParticipant ?? false) && options.viewer ? await findViewerWebAuthorization(conversationId, options.viewer) : void 0;
|
|
530
|
-
const pendingMessages = (await getConversation({ conversationId }))?.execution.pendingMessages ?? [];
|
|
531
|
-
const messages = await attachPendingMentions(conversationId, (await Promise.all(pendingMessages.map((message) => projectPendingMessage(message, canExposePayload)))).flatMap((message, index) => {
|
|
532
|
-
if (!message) return [];
|
|
533
|
-
const actorIdentityId = pendingMessages[index].input.authorIdentityId;
|
|
534
|
-
return [canExposePayload && actorIdentityId ? {
|
|
535
|
-
...message,
|
|
536
|
-
actorIdentityId
|
|
537
|
-
} : message];
|
|
538
|
-
}));
|
|
539
|
-
return conversationPendingMessagesReportSchema.parse({
|
|
540
|
-
...authorization ? { authorization: {
|
|
541
|
-
authorizationUrl: authorization.authorizationUrl,
|
|
542
|
-
completionText: authorization.completionText,
|
|
543
|
-
label: authorization.label
|
|
544
|
-
} } : void 0,
|
|
545
|
-
conversationId,
|
|
546
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
547
|
-
messages
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
/** Load pending mailbox messages or throw a standard API not-found error. */
|
|
551
|
-
async function requireConversationPendingMessages(conversationId, options = {}) {
|
|
552
|
-
const report = await readConversationPendingMessages(conversationId, options);
|
|
553
|
-
if (!report) throwApiError(404, "Conversation not found.");
|
|
554
|
-
return report;
|
|
183
|
+
return createHash("sha256").update(basis).digest("hex");
|
|
555
184
|
}
|
|
556
185
|
// src/api/conversations/metric-buckets.ts
|
|
557
186
|
/** Sum all Conversation metrics into UTC day or hour buckets. */
|
|
@@ -1009,9 +638,9 @@ function createConversationRoutes(options) {
|
|
|
1009
638
|
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)));
|
|
1010
639
|
app.get("/:conversationId/events", validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("query", conversationEventsQuerySchema, "Invalid query parameters."), async (context) => {
|
|
1011
640
|
const { conversationId } = context.req.valid("param");
|
|
1012
|
-
const {
|
|
641
|
+
const { limit, ...boundary } = context.req.valid("query");
|
|
1013
642
|
const viewer = context.get("viewer");
|
|
1014
|
-
const report = await readConversationEvents(conversationId,
|
|
643
|
+
const report = await readConversationEvents(conversationId, boundary, {
|
|
1015
644
|
limit,
|
|
1016
645
|
...viewer ? { viewer } : void 0
|
|
1017
646
|
});
|
|
@@ -1062,28 +691,31 @@ function createConversationRoutes(options) {
|
|
|
1062
691
|
});
|
|
1063
692
|
app.get("/:conversationId", validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("query", conversationDetailQuerySchema, "Invalid query parameters."), async (context) => {
|
|
1064
693
|
const { conversationId } = context.req.valid("param");
|
|
1065
|
-
const query = context.req.valid("query");
|
|
694
|
+
const { mailbox: withMailbox, ...query } = context.req.valid("query");
|
|
1066
695
|
const viewer = context.get("viewer");
|
|
696
|
+
const mailbox = withMailbox ? await requireConversationPendingMessages(conversationId, { ...viewer ? { viewer } : void 0 }) : void 0;
|
|
1067
697
|
const etag = await readConversationDetailEtag(conversationId, {
|
|
1068
698
|
limit: query.limit,
|
|
1069
699
|
...viewer ? { viewer } : void 0
|
|
1070
700
|
});
|
|
1071
|
-
|
|
701
|
+
const headers = etag ? {
|
|
702
|
+
"cache-control": "private, no-store",
|
|
703
|
+
[CONVERSATION_DETAIL_VERSION_HEADER]: etag
|
|
704
|
+
} : void 0;
|
|
705
|
+
if (headers && !mailbox && context.req.header("x-junior-detail-version") === etag) return new Response(null, {
|
|
1072
706
|
status: 304,
|
|
1073
|
-
headers
|
|
1074
|
-
"cache-control": "private, no-store",
|
|
1075
|
-
etag
|
|
1076
|
-
}
|
|
707
|
+
headers
|
|
1077
708
|
});
|
|
1078
709
|
const report = await readConversationDetail(conversationId, {
|
|
1079
710
|
...query,
|
|
1080
711
|
...viewer ? { viewer } : void 0
|
|
1081
712
|
});
|
|
1082
713
|
if (!report) throwApiError(404, "Conversation not found.");
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
714
|
+
const init = headers ? { headers } : void 0;
|
|
715
|
+
return mailbox ? jsonResponse(conversationDetailWithMailboxReportSchema, {
|
|
716
|
+
...report,
|
|
717
|
+
mailbox
|
|
718
|
+
}, init) : jsonResponse(conversationDetailReportSchema, report, init);
|
|
1087
719
|
});
|
|
1088
720
|
return app;
|
|
1089
721
|
}
|
|
@@ -2357,7 +1989,7 @@ async function readPeoplePluginReports(args) {
|
|
|
2357
1989
|
reports: [],
|
|
2358
1990
|
source: "plugins"
|
|
2359
1991
|
});
|
|
2360
|
-
const { getPluginProfileReports } = await import("./projection-
|
|
1992
|
+
const { getPluginProfileReports } = await import("./projection-DWxX7pb1.js").then((n) => n.kn);
|
|
2361
1993
|
return pluginOperationalReportFeedSchema.parse({
|
|
2362
1994
|
generatedAt: new Date(nowMs).toISOString(),
|
|
2363
1995
|
reports: await getPluginProfileReports({
|
|
@@ -3099,7 +2731,7 @@ function createAutomationRoutes() {
|
|
|
3099
2731
|
*/
|
|
3100
2732
|
function createUserCustomizationRoutes() {
|
|
3101
2733
|
const app = new Hono();
|
|
3102
|
-
app.use("*", async (_context, next)
|
|
2734
|
+
app.use("*", async function requireUserCustomizationExperiment(_context, next) {
|
|
3103
2735
|
if (!isExperimentalFeatureEnabled("user-customization")) throwApiError(404, "Resource not found.");
|
|
3104
2736
|
await next();
|
|
3105
2737
|
});
|
|
@@ -3385,7 +3017,7 @@ function readDescriptionText(home) {
|
|
|
3385
3017
|
}
|
|
3386
3018
|
/** Read discovered skill names for authenticated runtime diagnostics. */
|
|
3387
3019
|
async function readSkillReports() {
|
|
3388
|
-
const { discoverSkills } = await import("./skills-
|
|
3020
|
+
const { discoverSkills } = await import("./skills-BNrk8gi4.js").then((n) => n.o);
|
|
3389
3021
|
const skills = await discoverSkills();
|
|
3390
3022
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
3391
3023
|
name: skill.name,
|
|
@@ -3394,7 +3026,7 @@ async function readSkillReports() {
|
|
|
3394
3026
|
}
|
|
3395
3027
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
3396
3028
|
async function readPlugins() {
|
|
3397
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime-
|
|
3029
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-BWVMeZhW.js").then((n) => n.t);
|
|
3398
3030
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
3399
3031
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
3400
3032
|
description: plugin.manifest.description,
|
|
@@ -3405,8 +3037,8 @@ async function readPlugins() {
|
|
|
3405
3037
|
/** Read authenticated runtime discovery data. */
|
|
3406
3038
|
async function readRuntimeInfoReport() {
|
|
3407
3039
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
3408
|
-
import("./package-discovery-
|
|
3409
|
-
import("./catalog-runtime-
|
|
3040
|
+
import("./package-discovery-DJhGdS4c.js").then((n) => n.r),
|
|
3041
|
+
import("./catalog-runtime-BWVMeZhW.js").then((n) => n.t),
|
|
3410
3042
|
readPlugins(),
|
|
3411
3043
|
readSkillReports()
|
|
3412
3044
|
]);
|
|
@@ -3423,7 +3055,7 @@ async function readRuntimeInfoReport() {
|
|
|
3423
3055
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
3424
3056
|
async function readPluginOperationalReportFeed() {
|
|
3425
3057
|
const nowMs = Date.now();
|
|
3426
|
-
const { getPluginOperationalReports } = await import("./projection-
|
|
3058
|
+
const { getPluginOperationalReports } = await import("./projection-DWxX7pb1.js").then((n) => n.kn);
|
|
3427
3059
|
return pluginOperationalReportFeedSchema.parse({
|
|
3428
3060
|
source: "plugins",
|
|
3429
3061
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as ConversationWorkQueue, t as ConversationQueueMessage } from "./queue-C37RbDVc.js";
|
|
2
|
-
import { t as ConversationStore } from "./db-
|
|
3
|
-
import "./schema-
|
|
2
|
+
import { t as ConversationStore } from "./db-CyLrV9C7.js";
|
|
3
|
+
import "./schema-e90H5FIN.js";
|
|
4
4
|
import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
|
|
5
|
+
import "./sentry-DrKC2NeM.js";
|
|
5
6
|
import { Hono } from "hono";
|
|
6
7
|
import "@earendil-works/pi-ai/compat";
|
|
7
8
|
import "@earendil-works/pi-ai/api/anthropic-messages";
|
|
8
9
|
import "ai";
|
|
9
|
-
import "@sentry/node";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import "drizzle-orm";
|
|
12
12
|
import { Destination, OwnedObjectAnnotation, PluginRegistration, Source, User } from "@sentry/junior-plugin-api";
|
|
@@ -17,22 +17,9 @@ import { Client } from "@modelcontextprotocol/sdk/client";
|
|
|
17
17
|
import "@sinclair/typebox";
|
|
18
18
|
import { Message, StateAdapter } from "chat";
|
|
19
19
|
import "@chat-adapter/slack";
|
|
20
|
-
declare const TURN_REASONING_LEVELS: readonly ["none", "low", "medium", "high", "xhigh"];
|
|
21
|
-
type TurnReasoningLevel = (typeof TURN_REASONING_LEVELS)[number];
|
|
22
|
-
/** Runtime configuration for one named model profile. */
|
|
23
|
-
interface ModelProfileConfig {
|
|
24
|
-
/**
|
|
25
|
-
* Tells models which tasks fit this profile.
|
|
26
|
-
* Name concrete tasks. Add use and avoid cases when helpful.
|
|
27
|
-
* Do not use model product names as the selection rule.
|
|
28
|
-
*/
|
|
29
|
-
description?: string;
|
|
30
|
-
modelId: string;
|
|
31
|
-
reasoningLevel?: TurnReasoningLevel;
|
|
32
|
-
}
|
|
33
|
-
/** App-level profile input: a model id string or a full profile config. */
|
|
34
|
-
type ModelProfileInput = string | ModelProfileConfig;
|
|
35
20
|
interface BotModelConfig {
|
|
21
|
+
/** Model that runs every agent Turn. */
|
|
22
|
+
modelId?: string;
|
|
36
23
|
/** Decision model used by the passive reply router. */
|
|
37
24
|
decisionModelId?: string;
|
|
38
25
|
/** Model used for embeddings. */
|
|
@@ -263,14 +250,6 @@ interface JuniorAppOptions extends BotModelConfig {
|
|
|
263
250
|
* you are deliberately dogfooding a pre-stable surface.
|
|
264
251
|
*/
|
|
265
252
|
experimental?: ExperimentalFeaturesConfig;
|
|
266
|
-
/** Profile used for new conversations. Configure with `profiles`. */
|
|
267
|
-
defaultProfile?: string;
|
|
268
|
-
/**
|
|
269
|
-
* Named profiles available to the router and `handoff` tool. Configure with
|
|
270
|
-
* `defaultProfile`. Each value may be a model id string or an object with
|
|
271
|
-
* `modelId` and optional `description` and `reasoningLevel` settings.
|
|
272
|
-
*/
|
|
273
|
-
profiles?: Readonly<Record<string, ModelProfileInput>>;
|
|
274
253
|
/** Turn and conversation limits. Unset limits keep their defaults. */
|
|
275
254
|
limits?: RuntimeLimits;
|
|
276
255
|
/** Slack-specific overrides applied after env parsing. */
|
|
@@ -345,4 +324,4 @@ type JuniorApp = Hono & {
|
|
|
345
324
|
};
|
|
346
325
|
/** Create a Hono app with all Junior routes. */
|
|
347
326
|
declare function createApp(options?: JuniorAppOptions): Promise<JuniorApp>;
|
|
348
|
-
export {
|
|
327
|
+
export { JuniorDashboardOptions as i, JuniorAppOptions as n, createApp as r, JuniorApp as t };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-DVs6noo7.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
|
-
export { JUNIOR_VERSION, JuniorApp, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions,
|
|
4
|
+
export { JUNIOR_VERSION, JuniorApp, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, createApp, defineJuniorPlugins };
|