@sentry/junior 0.274.0 → 0.276.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-4qThDhgF.js → adapter-DoPR2jS-.js} +1 -1
- package/dist/{admin-c7ASvs6x.js → admin-BJTT-kXb.js} +1 -1
- package/dist/{agent-invocations-C1RNOCs8.js → agent-invocations-CUWrrzkc.js} +1 -0
- package/dist/{agent-runner-CLHM48dh.js → agent-runner-sMpA5qGM.js} +1118 -394
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +3 -3
- package/dist/api.d.ts +1 -1
- package/dist/api.js +75 -66
- package/dist/{app-BlmPpPoR.d.ts → app-DTj-yAQt.d.ts} +26 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +237 -87
- package/dist/{assistant-reply-2IwdFWuQ.js → assistant-reply-DbxKnBQF.js} +1 -1
- package/dist/{automation-BGrd03QO.js → automation-B8_mC68r.js} +42 -13
- package/dist/{job-queue-Bh9sFO9t.js → background-compaction-queue-Bywqo1WJ.js} +42 -3
- package/dist/{briefs-C1-NOh8m.js → briefs-IL7QnCCR.js} +4 -4
- package/dist/{catalog-runtime-BnIJimKZ.js → catalog-runtime--sC2CYLQ.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-C0ZIxoDr.js → client-7diKvInp.js} +2 -2
- package/dist/{config-DS-QLVSL.js → config-Cb--cuv-.js} +2 -2
- package/dist/{connections-Djb6ANAh.js → connections-C4-4fxaE.js} +14 -14
- package/dist/{conversation-BjTo9ZFL.js → conversation-DppJ83Hw.js} +32 -7
- package/dist/{conversation-privacy-3IMUZSHC.js → conversation-privacy-DTwdT3Pi.js} +1 -1
- package/dist/{credential-sync-ig88EB_v.js → credential-sync-Sl5RQCkS.js} +13 -13
- package/dist/{db-BMZhoYKj.d.ts → db-Ck6TXQIx.d.ts} +1 -1
- package/dist/{executor-C2moGIHS.js → executor-BFKmqxYe.js} +3 -3
- package/dist/instrumentation.d.ts +14 -0
- package/dist/instrumentation.js +29 -6
- package/dist/{logging-DYRS7E8s.js → logging-B04X_eCB.js} +3 -2
- package/dist/{message-CicNrhCv.js → message-DQMFyyE-.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +13 -3
- package/dist/{oauth-callback-server-BXyrepfY.js → oauth-callback-server-BGq0_vQI.js} +2 -2
- package/dist/{projection-CMRrv9Pt.js → projection-6dXaN0n-.js} +109 -17
- package/dist/{prompt-JEWUUpLW.js → prompt-B4fQKGZR.js} +1 -1
- package/dist/{registry-D92WLl5I.js → registry-CEqKR_ld.js} +1 -1
- package/dist/{resolve-C-Dh14ps.js → resolve-8I5DkrfI.js} +3 -3
- package/dist/{result-DZ8TCQkd.js → result-BgAW90IM.js} +9 -9
- package/dist/{runner-BBmhrQTM.js → runner-CSKDr_19.js} +12 -12
- package/dist/{sandbox-egress-signals-Cehpq6hC.js → sandbox-egress-signals-BxAT276e.js} +1 -1
- package/dist/{schema-DfdHlBnb.d.ts → schema-CaUWl2EV.d.ts} +74 -6
- package/dist/{schema-CX9XGKCm.js → schema-Cal-EFdi.js} +9 -7
- package/dist/{service-account-Bapo6l0R.js → service-account-CUuVJCKT.js} +3 -3
- package/dist/{service-account-Ce1465Fn.js → service-account-CtOab1Xz.js} +3 -3
- package/dist/{session-stop-CI5qJU7a.js → session-stop-DK8LuPZW.js} +155 -54
- package/dist/{skills-D-d79XQ6.js → skills-Bc0D7BGy.js} +2 -2
- package/dist/{spawn-C_FETz5x.js → spawn-DF_GUcd8.js} +2 -2
- package/dist/{stop-CmwFHwiN.js → stop-DthSy-z8.js} +159 -121
- package/dist/{store-BvI3yBGS.js → store-BgH2P3X9.js} +3 -3
- package/dist/{store-BIQYXvoV.js → store-C5uVTx2G.js} +11 -9
- package/dist/{task-queue-BdB0pab8.js → task-queue-C6ROM_XJ.js} +3 -3
- package/dist/{task-runner-DQr2QfvJ.js → task-runner-BwAkjjVE.js} +6 -6
- package/dist/{thread-state-ngCvtWNa.js → thread-state-BXjgk1pW.js} +4 -4
- package/dist/{turn-failure-response-BDT3sT2v.js → turn-failure-response-CVI57qKL.js} +7 -7
- package/dist/{turn-lifecycle-B7O6rZEX.js → turn-lifecycle-CF6ibonp.js} +6 -1
- package/dist/{turn-session-routing-DIeqG2pO.js → turn-session-routing-DddybdNu.js} +17 -16
- package/dist/{validation-D3Xik64v.js → validation-BxF1nQbC.js} +1 -1
- package/dist/{version-BoWLhNzj.js → version-CTzSbCmR.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D25XOUHc.js → viewer-CQwBszc7.js} +10 -7
- package/dist/{work-D12-wcf4.js → work-BHlShEQ6.js} +30 -12
- package/dist/{worker-DGxfDtES.js → worker-DhY9MnsH.js} +6 -6
- package/migrations/0073_conversation_quick_question.sql +1 -0
- package/migrations/meta/0073_snapshot.json +4070 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -5
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 { $a as listConversationAnnotations, Aa as createPluginLogger, Bi as takeDueTimerWatches, Bn as getPlugins, C as projectConversationMessages, Da as createPluginState, Dn as createUserTokenStore, E as settleConversationTitleWork, En as setExperimentalFeatures, Et as isInvalidConversationRecordError, Fn as getPluginRoutes, Fr as proxyVercelSandboxEgressRequest, Gi as verifyScheduledAutomationCredentialSubject, Gn as setBriefsConfig, Gr as slackMention, Ha as readConversationEventPage, Hi as bindScheduledAutomationCredentialSubject, Hn as validatePlugins, Ki as verifySlackDirectCredentialSubject, Li as findMatchingWatches, Ni as collectEventMatchKeys, Oa as createPluginEmbedder, Pn as getPluginApiRoutes, Pr as isVercelSandboxEgressRequest, Qi as getSlackClient, Qr as postSlackEphemeralMessage, Tn as isExperimentalFeatureEnabled, Ui as bindSlackDirectCredentialSubject, Vi as bindEventAutomationCredentialSubject, Vn as setPlugins, Wi as verifyEventAutomationCredentialSubject, Xa as resolveRootVisibility, Yn as dismissOpenReviewItems, Zr as openSlackModal, _i as parseSandboxEgressCredentialToken, _n as getThreadStopDecision, aa as getWorkspaceTeamId, ar as canActOnReviewItem, b as appendConversationMessages, ca as getDashboardConversationLink, ct as CONVERSATION_WORK_STALE_ENQUEUE_MS, da as getDashboardTaskLink, ea as isDmChannel, fa as setDashboardConversationLinkOptions, fo as getConfigDefaults, fr as reviewItemReaderForUser, hi as consumeSandboxEgressPermissionDeniedSignal, ii as slackExternalRefIdSchema, io as createPluginCache, ja as readConversationAccessFromSql, mi as consumeSandboxEgressAuthRequiredSignal, mn as SubscribedReplyReason, oa as runWithWorkspaceTeamId, pi as clearSandboxEgressSignals, po as setConfigDefaults, ri as slackEntitySchema, tr as searchReviewItems, ua as getDashboardReviewItemLink, wn as getExperimentalFeatures, wt as hasRunnableConversationWork, xi as normalizeSandboxEgressTracePropagationDomains, zr as resolveBaseUrl } from "./projection-6dXaN0n-.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-Cb--cuv-.js";
|
|
3
|
+
import { D as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, P as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, T as withLogContext, V as normalizeIdentityEmail, b as setSpanAttributes, h as logWarn, j as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext, z as GOOGLE_IDENTITY_PROVIDER } from "./logging-B04X_eCB.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-CTzSbCmR.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
|
|
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-CQwBszc7.js";
|
|
8
|
+
import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-CUWrrzkc.js";
|
|
9
|
+
import { _ as juniorConversationBriefs, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, l as juniorAutomationRuns } from "./executor-BFKmqxYe.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime--sC2CYLQ.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-sMpA5qGM.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-DoPR2jS-.js";
|
|
14
14
|
import { n as getNextRunAtMs } from "./cadence-R7Em4RjE.js";
|
|
15
|
-
import { D as conversationSurfaceSchema,
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { D as conversationSurfaceSchema, R as annotationCard, T as conversationReportStatusSchema, X as conversationBriefSchema, h as conversationFeedQuerySchema } from "./conversation-DppJ83Hw.js";
|
|
16
|
+
import { S as listPendingAgentInvocationResults, x as listPendingAgentInvocationMailboxAppends } from "./store-C5uVTx2G.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-DK8LuPZW.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
|
|
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-8I5DkrfI.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-Bywqo1WJ.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-BgH2P3X9.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-DddybdNu.js";
|
|
23
|
+
import { M as scheduledRunSchema, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-B8_mC68r.js";
|
|
24
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BxF1nQbC.js";
|
|
25
25
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-DOm9Y6qI.js";
|
|
26
|
-
import { A as
|
|
27
|
-
import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-
|
|
28
|
-
import {
|
|
29
|
-
import { o as coerceThreadConversationState } from "./thread-state-
|
|
30
|
-
import { o as unlinkProvider } from "./connections-
|
|
31
|
-
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
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 { 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, Q as GET$3, R as stopConversationTurn, S as createProductionConversationWorkOptions, T as createSlackWebApiStatusSender, U as parseContent, V as startProcessingReaction, W as ReviewItemActionError, Y as getAttachmentStorage, Z as enqueueAgentDispatch, _ as encodeConversationCursor, g as decodeConversationCursor, j as recordSkippedConversationMessage, k as readEnvList, n as readConversationDetail, o as readConversationFeed, q as readReviewItemForUser, s as readConversationRecordFromSql, t as stopConversationTurnForViewer, v as archiveConversation, w as getProductionSlackAdapter, z as THREAD_OPTOUT_ACK } from "./stop-DthSy-z8.js";
|
|
27
|
+
import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-BgAW90IM.js";
|
|
28
|
+
import { i as enqueueAgentInvocation, r as endAgentInvocationsOfStoppedWork } from "./work-BHlShEQ6.js";
|
|
29
|
+
import { o as coerceThreadConversationState } from "./thread-state-BXjgk1pW.js";
|
|
30
|
+
import { o as unlinkProvider } from "./connections-C4-4fxaE.js";
|
|
31
|
+
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-Sl5RQCkS.js";
|
|
32
|
+
import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-C6ROM_XJ.js";
|
|
33
|
+
import { t as processConversationWork } from "./worker-DhY9MnsH.js";
|
|
34
|
+
import { t as bindMessageAgent } from "./message-DQMFyyE-.js";
|
|
35
|
+
import { t as bindSpawnAgent } from "./spawn-DF_GUcd8.js";
|
|
36
|
+
import { t as processPluginTask } from "./task-runner-BwAkjjVE.js";
|
|
37
37
|
import { createRequire } from "node:module";
|
|
38
38
|
import { Hono } from "hono";
|
|
39
39
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -128,6 +128,7 @@ async function recoverConversationWork(args) {
|
|
|
128
128
|
}
|
|
129
129
|
if (work.execution.lease && work.execution.lease.expiresAtMs <= args.nowMs) {
|
|
130
130
|
const recovery = await clearExpiredConversationLease({
|
|
131
|
+
beforeWorkStops: args.beforeWorkStops,
|
|
131
132
|
conversationId,
|
|
132
133
|
nowMs: args.nowMs,
|
|
133
134
|
state: args.state
|
|
@@ -1103,6 +1104,7 @@ async function recoverPendingAgentInvocationResults(args) {
|
|
|
1103
1104
|
async function runHeartbeat(args) {
|
|
1104
1105
|
const queue = args.conversationWorkQueue ?? getVercelConversationWorkQueue();
|
|
1105
1106
|
await recoverConversationWork({
|
|
1107
|
+
beforeWorkStops: endAgentInvocationsOfStoppedWork,
|
|
1106
1108
|
nowMs: args.nowMs,
|
|
1107
1109
|
queue
|
|
1108
1110
|
});
|
|
@@ -1852,7 +1854,7 @@ async function act(args) {
|
|
|
1852
1854
|
text: renderReviewItemMessage(item, change),
|
|
1853
1855
|
threadTs: target.threadTs,
|
|
1854
1856
|
userId: actor.slackUserId
|
|
1855
|
-
}));
|
|
1857
|
+
}), { reviewItemChange: reviewItemChangeRecord(item, change) });
|
|
1856
1858
|
} catch (error) {
|
|
1857
1859
|
logException(error, "review_item.slack_input.persist.failed", { "app.review_item.id": item.id });
|
|
1858
1860
|
await deliverReviewItemChange({
|
|
@@ -2063,7 +2065,7 @@ async function handleSlackForm(args) {
|
|
|
2063
2065
|
adapter,
|
|
2064
2066
|
payload,
|
|
2065
2067
|
isAuthorAllowed: (userId) => args.isAuthorAllowed(userId, installation),
|
|
2066
|
-
persistMessage: (message) => args.persistMessage(message, installation),
|
|
2068
|
+
persistMessage: (message, facts) => args.persistMessage(message, installation, facts),
|
|
2067
2069
|
queue: args.queue,
|
|
2068
2070
|
state,
|
|
2069
2071
|
userTokenStore: args.getUserTokenStore()
|
|
@@ -2073,6 +2075,32 @@ async function handleSlackForm(args) {
|
|
|
2073
2075
|
})));
|
|
2074
2076
|
return new Response("", { status: 200 });
|
|
2075
2077
|
}
|
|
2078
|
+
// src/chat/ingress/slack-message-subtypes.ts
|
|
2079
|
+
const IGNORED_MESSAGE_SUBTYPES = /* @__PURE__ */ new Set([
|
|
2080
|
+
"message_changed",
|
|
2081
|
+
"message_deleted",
|
|
2082
|
+
"message_replied",
|
|
2083
|
+
"channel_join",
|
|
2084
|
+
"channel_leave",
|
|
2085
|
+
"channel_topic",
|
|
2086
|
+
"channel_purpose",
|
|
2087
|
+
"channel_name",
|
|
2088
|
+
"channel_archive",
|
|
2089
|
+
"channel_unarchive",
|
|
2090
|
+
"group_join",
|
|
2091
|
+
"group_leave",
|
|
2092
|
+
"group_topic",
|
|
2093
|
+
"group_purpose",
|
|
2094
|
+
"group_name",
|
|
2095
|
+
"group_archive",
|
|
2096
|
+
"group_unarchive",
|
|
2097
|
+
"ekm_access_denied",
|
|
2098
|
+
"tombstone"
|
|
2099
|
+
]);
|
|
2100
|
+
/** Whether ingress ignores a Slack message event for its subtype. */
|
|
2101
|
+
function shouldIgnoreMessageSubtype(event) {
|
|
2102
|
+
return Boolean(event.subtype && IGNORED_MESSAGE_SUBTYPES.has(event.subtype));
|
|
2103
|
+
}
|
|
2076
2104
|
// src/chat/ingress/slack-channel-created.ts
|
|
2077
2105
|
const slackChannelCreatedEnvelopeSchema = z.object({
|
|
2078
2106
|
type: z.literal("event_callback"),
|
|
@@ -2471,27 +2499,6 @@ function slackEventLogContext(event) {
|
|
|
2471
2499
|
userId: event?.user?.trim() || void 0
|
|
2472
2500
|
};
|
|
2473
2501
|
}
|
|
2474
|
-
const IGNORED_MESSAGE_SUBTYPES = /* @__PURE__ */ new Set([
|
|
2475
|
-
"message_changed",
|
|
2476
|
-
"message_deleted",
|
|
2477
|
-
"message_replied",
|
|
2478
|
-
"channel_join",
|
|
2479
|
-
"channel_leave",
|
|
2480
|
-
"channel_topic",
|
|
2481
|
-
"channel_purpose",
|
|
2482
|
-
"channel_name",
|
|
2483
|
-
"channel_archive",
|
|
2484
|
-
"channel_unarchive",
|
|
2485
|
-
"group_join",
|
|
2486
|
-
"group_leave",
|
|
2487
|
-
"group_topic",
|
|
2488
|
-
"group_purpose",
|
|
2489
|
-
"group_name",
|
|
2490
|
-
"group_archive",
|
|
2491
|
-
"group_unarchive",
|
|
2492
|
-
"ekm_access_denied",
|
|
2493
|
-
"tombstone"
|
|
2494
|
-
]);
|
|
2495
2502
|
function enqueue(waitUntil, task) {
|
|
2496
2503
|
waitUntil(task);
|
|
2497
2504
|
}
|
|
@@ -2515,9 +2522,6 @@ function installationFromEnvelope(body) {
|
|
|
2515
2522
|
function isDmEvent(event) {
|
|
2516
2523
|
return event.channel_type === "im" || event.channel?.startsWith("D") === true;
|
|
2517
2524
|
}
|
|
2518
|
-
function shouldIgnoreMessageSubtype(event) {
|
|
2519
|
-
return Boolean(event.subtype && IGNORED_MESSAGE_SUBTYPES.has(event.subtype));
|
|
2520
|
-
}
|
|
2521
2525
|
function normalizeMessageThreadId(message) {
|
|
2522
2526
|
const threadId = normalizeIncomingSlackThreadId(message.threadId, message);
|
|
2523
2527
|
return {
|
|
@@ -2578,6 +2582,7 @@ async function persistSlackMessage(args) {
|
|
|
2578
2582
|
const inbound = buildSlackInboundMessage({
|
|
2579
2583
|
conversationId,
|
|
2580
2584
|
installation: args.installation,
|
|
2585
|
+
reviewItemChange: args.facts?.reviewItemChange,
|
|
2581
2586
|
message: args.message,
|
|
2582
2587
|
receivedAtMs: args.receivedAtMs,
|
|
2583
2588
|
route: args.route,
|
|
@@ -2937,6 +2942,7 @@ async function persistSlackMentionWithLock(args) {
|
|
|
2937
2942
|
try {
|
|
2938
2943
|
if (!(await withLock(args.state, `slack:ingress:${threadId}`, () => persistSlackMessage({
|
|
2939
2944
|
adapter: args.adapter,
|
|
2945
|
+
facts: args.facts,
|
|
2940
2946
|
installation: args.installation,
|
|
2941
2947
|
message,
|
|
2942
2948
|
conversationStore: args.services.conversationStore,
|
|
@@ -2978,8 +2984,9 @@ async function handleSlackWebhook(args) {
|
|
|
2978
2984
|
teamId: installation.teamId,
|
|
2979
2985
|
user: userId
|
|
2980
2986
|
}),
|
|
2981
|
-
persistMessage: (message, installation) => persistSlackMentionWithLock({
|
|
2987
|
+
persistMessage: (message, installation, facts) => persistSlackMentionWithLock({
|
|
2982
2988
|
adapter,
|
|
2989
|
+
facts,
|
|
2983
2990
|
installation,
|
|
2984
2991
|
message,
|
|
2985
2992
|
services: args.services,
|
|
@@ -3230,6 +3237,41 @@ function workspaceSnapshotJobQueueConsumer() {
|
|
|
3230
3237
|
function registerVercelWorkspaceSnapshotJobDevConsumer() {
|
|
3231
3238
|
return workspaceSnapshotJobCallback().registerDev();
|
|
3232
3239
|
}
|
|
3240
|
+
// src/chat/services/background-compaction-callback.ts
|
|
3241
|
+
/** Receive background compaction jobs from the queue. */
|
|
3242
|
+
const BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP = "junior_context_compaction_dev";
|
|
3243
|
+
const BACKGROUND_COMPACTION_MAX_DELIVERIES = 3;
|
|
3244
|
+
function logRejected(reason, metadata) {
|
|
3245
|
+
logWarn("context_compaction.queue_message.rejected", {
|
|
3246
|
+
"app.queue.consumer_group": metadata.consumerGroup,
|
|
3247
|
+
"app.queue.delivery_count": metadata.deliveryCount,
|
|
3248
|
+
"app.queue.message_id": metadata.messageId,
|
|
3249
|
+
"app.queue.reject_reason": reason,
|
|
3250
|
+
"app.queue.topic_name": metadata.topicName
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
function backgroundCompactionCallback() {
|
|
3254
|
+
return queueCallback({
|
|
3255
|
+
consumerGroup: BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP,
|
|
3256
|
+
maxDeliveries: BACKGROUND_COMPACTION_MAX_DELIVERIES,
|
|
3257
|
+
onRejected: logRejected,
|
|
3258
|
+
run: async (message, metadata) => await processBackgroundCompaction(message, { enqueuedAtMs: metadata.createdAt.getTime() }),
|
|
3259
|
+
topic: BACKGROUND_COMPACTION_QUEUE_TOPIC,
|
|
3260
|
+
verify: verifyBackgroundCompactionMessage
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
/** Create the HTTP route for background compaction jobs. */
|
|
3264
|
+
function createVercelBackgroundCompactionCallback() {
|
|
3265
|
+
return backgroundCompactionCallback().create();
|
|
3266
|
+
}
|
|
3267
|
+
/** Return the queue consumer for background compaction, for a pulling worker. */
|
|
3268
|
+
function backgroundCompactionQueueConsumer() {
|
|
3269
|
+
return backgroundCompactionCallback().consumer;
|
|
3270
|
+
}
|
|
3271
|
+
/** Receive background compaction jobs during local development. */
|
|
3272
|
+
function registerVercelBackgroundCompactionDevConsumer() {
|
|
3273
|
+
return backgroundCompactionCallback().registerDev();
|
|
3274
|
+
}
|
|
3233
3275
|
// src/handlers/artifacts.ts
|
|
3234
3276
|
/** Serve one content-addressed public artifact without authentication. */
|
|
3235
3277
|
async function publicArtifactGET(args) {
|
|
@@ -3325,9 +3367,6 @@ function createEventAppPublisher(args) {
|
|
|
3325
3367
|
}
|
|
3326
3368
|
// src/api/acp/conversations.ts
|
|
3327
3369
|
const EVENT_PAGE_SIZE = 50;
|
|
3328
|
-
function actorFromUser(user) {
|
|
3329
|
-
return webActorFromEmail(user.email, user.displayName ? { fullName: user.displayName } : void 0);
|
|
3330
|
-
}
|
|
3331
3370
|
async function hasConversationAccess(conversationId, user) {
|
|
3332
3371
|
const access = (await readConversationAccessFromSql(getDb(), [conversationId], user)).get(conversationId);
|
|
3333
3372
|
return Boolean(access?.isParticipant);
|
|
@@ -3369,7 +3408,7 @@ function createAcpConversations(options) {
|
|
|
3369
3408
|
},
|
|
3370
3409
|
async create({ conversationId, user }) {
|
|
3371
3410
|
await recordWebConversationActivity({
|
|
3372
|
-
actor:
|
|
3411
|
+
actor: webActorFromUser(user),
|
|
3373
3412
|
conversationId,
|
|
3374
3413
|
conversationStore: options.conversationStore,
|
|
3375
3414
|
nowMs: Date.now(),
|
|
@@ -3384,7 +3423,7 @@ function createAcpConversations(options) {
|
|
|
3384
3423
|
const currentCursor = await latestEventCursor(options.eventStore, conversationId);
|
|
3385
3424
|
if (await getAuthPausedConversationTurnId(conversationId)) return { status: "active" };
|
|
3386
3425
|
const result = await appendAndEnqueueWebMessage({
|
|
3387
|
-
actor:
|
|
3426
|
+
actor: webActorFromUser(user),
|
|
3388
3427
|
conversationId,
|
|
3389
3428
|
idempotencyKey,
|
|
3390
3429
|
message: text
|
|
@@ -4944,9 +4983,106 @@ function requestHasSameOrigin(request) {
|
|
|
4944
4983
|
const origin = request.headers.get("origin");
|
|
4945
4984
|
return origin !== null && URL.parse(origin)?.origin === new URL(request.url).origin;
|
|
4946
4985
|
}
|
|
4986
|
+
const PAGE_STYLE = `
|
|
4987
|
+
:root {
|
|
4988
|
+
color-scheme: dark;
|
|
4989
|
+
--bg: #060607;
|
|
4990
|
+
--panel: #0c0c0e;
|
|
4991
|
+
--raised: #101013;
|
|
4992
|
+
--hover: #17171a;
|
|
4993
|
+
--text: #f4f4f5;
|
|
4994
|
+
--muted: #a1a1aa;
|
|
4995
|
+
--faint: #8a8a93;
|
|
4996
|
+
--solid: #ffffff;
|
|
4997
|
+
--subtle: #c4c4cc;
|
|
4998
|
+
--inverse: #000000;
|
|
4999
|
+
--focus: #beaaff;
|
|
5000
|
+
--border: rgb(255 255 255 / 0.08);
|
|
5001
|
+
--border-emphasis: rgb(255 255 255 / 0.15);
|
|
5002
|
+
--border-heavy: rgb(255 255 255 / 0.3);
|
|
5003
|
+
--warning-bg: rgb(251 191 36 / 0.08);
|
|
5004
|
+
--warning-border: rgb(251 191 36 / 0.3);
|
|
5005
|
+
--warning-text: #fcd34d;
|
|
5006
|
+
--shadow: 0 16px 40px rgb(0 0 0 / 0.5);
|
|
5007
|
+
}
|
|
5008
|
+
@media (prefers-color-scheme: light) {
|
|
5009
|
+
:root {
|
|
5010
|
+
color-scheme: light;
|
|
5011
|
+
--bg: #ffffff;
|
|
5012
|
+
--panel: #f9f9fa;
|
|
5013
|
+
--raised: #ffffff;
|
|
5014
|
+
--hover: #f1f1f3;
|
|
5015
|
+
--text: #18181b;
|
|
5016
|
+
--muted: #52525b;
|
|
5017
|
+
--faint: #71717a;
|
|
5018
|
+
--solid: #09090b;
|
|
5019
|
+
--subtle: #3f3f46;
|
|
5020
|
+
--inverse: #ffffff;
|
|
5021
|
+
--focus: #7553ff;
|
|
5022
|
+
--border: rgb(0 0 0 / 0.09);
|
|
5023
|
+
--border-emphasis: rgb(0 0 0 / 0.16);
|
|
5024
|
+
--border-heavy: rgb(0 0 0 / 0.32);
|
|
5025
|
+
--warning-bg: rgb(245 158 11 / 0.1);
|
|
5026
|
+
--warning-border: rgb(217 119 6 / 0.35);
|
|
5027
|
+
--warning-text: #92400e;
|
|
5028
|
+
--shadow: 0 16px 40px rgb(0 0 0 / 0.08);
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
* { box-sizing: border-box; }
|
|
5032
|
+
body {
|
|
5033
|
+
margin: 0;
|
|
5034
|
+
min-height: 100vh;
|
|
5035
|
+
display: grid;
|
|
5036
|
+
place-items: center;
|
|
5037
|
+
padding: 24px 16px;
|
|
5038
|
+
background: var(--bg);
|
|
5039
|
+
color: var(--text);
|
|
5040
|
+
font: 16px/1.5 Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
|
|
5041
|
+
}
|
|
5042
|
+
main {
|
|
5043
|
+
width: 100%;
|
|
5044
|
+
max-width: 28rem;
|
|
5045
|
+
padding: 32px;
|
|
5046
|
+
border: 1px solid var(--border);
|
|
5047
|
+
border-radius: 12px;
|
|
5048
|
+
background: var(--panel);
|
|
5049
|
+
box-shadow: var(--shadow);
|
|
5050
|
+
}
|
|
5051
|
+
h1, h2 { font-family: Outfit, "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif; }
|
|
5052
|
+
h1 { margin: 0 0 8px; font-size: 1.5rem; line-height: 1.25; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
|
|
5053
|
+
h2 { margin: 24px 0 8px; font-size: 0.875rem; line-height: 1.35; font-weight: 600; color: var(--subtle); }
|
|
5054
|
+
p { margin: 0 0 16px; color: var(--muted); text-wrap: pretty; }
|
|
5055
|
+
p:last-child { margin-bottom: 0; }
|
|
5056
|
+
strong { color: var(--text); font-weight: 600; }
|
|
5057
|
+
code { font: 0.8125rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--faint); overflow-wrap: anywhere; }
|
|
5058
|
+
.list { margin: 0 0 24px; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); }
|
|
5059
|
+
.list li { padding: 12px 16px; font-size: 0.875rem; line-height: 1.35; }
|
|
5060
|
+
.list li + li { border-top: 1px solid var(--border); }
|
|
5061
|
+
.list code { display: block; margin-top: 4px; }
|
|
5062
|
+
.warning { margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--warning-border); border-radius: 8px; background: var(--warning-bg); color: var(--warning-text); font-size: 0.875rem; line-height: 1.35; }
|
|
5063
|
+
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
|
5064
|
+
label { display: block; margin: 0 0 16px; font-size: 0.875rem; font-weight: 600; color: var(--subtle); }
|
|
5065
|
+
label input {
|
|
5066
|
+
display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 12px;
|
|
5067
|
+
border: 1px solid var(--border-emphasis); border-radius: 6px; background: var(--raised);
|
|
5068
|
+
color: var(--text); font: 1rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
5069
|
+
}
|
|
5070
|
+
button {
|
|
5071
|
+
width: 100%; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border-emphasis); border-radius: 6px;
|
|
5072
|
+
background: var(--raised); color: var(--text); cursor: pointer;
|
|
5073
|
+
font-family: inherit; font-size: 0.875rem; font-weight: 600; line-height: 1; transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
5074
|
+
}
|
|
5075
|
+
button:hover { border-color: var(--border-heavy); background: var(--hover); }
|
|
5076
|
+
button.primary { border-color: var(--solid); background: var(--solid); color: var(--inverse); }
|
|
5077
|
+
button.primary:hover { border-color: var(--subtle); background: var(--subtle); }
|
|
5078
|
+
button:focus-visible, label input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
5079
|
+
@media (max-width: 480px) { main { padding: 24px; } }
|
|
5080
|
+
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
|
|
5081
|
+
`;
|
|
4947
5082
|
/**
|
|
4948
5083
|
* Render one sign-in page that browsers cannot frame or cache. `bodyHtml`
|
|
4949
|
-
* follows the heading, and the caller escapes every value in it.
|
|
5084
|
+
* follows the heading, and the caller escapes every value in it. Callers use
|
|
5085
|
+
* the `list`, `warning`, `actions`, and `primary` classes from `PAGE_STYLE`.
|
|
4950
5086
|
*/
|
|
4951
5087
|
function renderHtmlPage(page) {
|
|
4952
5088
|
return new Response(`<!DOCTYPE html>
|
|
@@ -4955,13 +5091,12 @@ function renderHtmlPage(page) {
|
|
|
4955
5091
|
<meta charset="utf-8" />
|
|
4956
5092
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
4957
5093
|
<title>${escapeHtml(page.title)}</title>
|
|
5094
|
+
<style>${PAGE_STYLE}</style>
|
|
4958
5095
|
</head>
|
|
4959
|
-
<body
|
|
4960
|
-
<main
|
|
4961
|
-
<
|
|
4962
|
-
<h1 style="margin:0 0 .75rem;font-size:2rem">${escapeHtml(page.title)}</h1>
|
|
5096
|
+
<body>
|
|
5097
|
+
<main>
|
|
5098
|
+
<h1>${escapeHtml(page.title)}</h1>
|
|
4963
5099
|
${page.bodyHtml}
|
|
4964
|
-
</section>
|
|
4965
5100
|
</main>
|
|
4966
5101
|
</body>
|
|
4967
5102
|
</html>`, {
|
|
@@ -5289,15 +5424,18 @@ function redirectUriMatches(registered, requested) {
|
|
|
5289
5424
|
});
|
|
5290
5425
|
}
|
|
5291
5426
|
// src/api/mcp/oauth/page.ts
|
|
5292
|
-
/**
|
|
5427
|
+
/**
|
|
5428
|
+
* Render one MCP sign-in page. It loads no resources and sends no referrer to
|
|
5429
|
+
* other origins.
|
|
5430
|
+
*/
|
|
5293
5431
|
function renderMcpPage(page) {
|
|
5294
5432
|
const formAction = ["'self'", ...page.formOrigin ? [page.formOrigin] : []];
|
|
5295
|
-
const message = `
|
|
5433
|
+
const message = ` <p>${escapeHtml(page.message)}</p>`;
|
|
5296
5434
|
return renderHtmlPage({
|
|
5297
5435
|
bodyHtml: page.bodyHtml ? `${message}\n${page.bodyHtml}` : message,
|
|
5298
5436
|
headers: {
|
|
5299
5437
|
"content-security-policy": `default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'; form-action ${formAction.join(" ")}`,
|
|
5300
|
-
"referrer-policy": "
|
|
5438
|
+
"referrer-policy": "same-origin"
|
|
5301
5439
|
},
|
|
5302
5440
|
status: page.status,
|
|
5303
5441
|
title: page.title
|
|
@@ -5758,17 +5896,19 @@ function blockedPage() {
|
|
|
5758
5896
|
function consentPage(args) {
|
|
5759
5897
|
const clientHost = new URL(args.authorization.clientId).host;
|
|
5760
5898
|
const clientName = args.authorization.clientName ?? clientHost;
|
|
5761
|
-
const
|
|
5762
|
-
const scopeItems = (parseMcpScopes(args.authorization.scope) ?? []).map((scope) => `<li style="margin:0 0 .25rem">${escapeHtml(MCP_SCOPE_DESCRIPTIONS[scope])} <code style="color:#8a8a8a">${escapeHtml(scope)}</code></li>`).join("");
|
|
5899
|
+
const scopeItems = (parseMcpScopes(args.authorization.scope) ?? []).map((scope) => `<li>${escapeHtml(MCP_SCOPE_DESCRIPTIONS[scope])}<code>${escapeHtml(scope)}</code></li>`).join("");
|
|
5763
5900
|
return renderMcpPage({
|
|
5764
|
-
bodyHtml: `
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5901
|
+
bodyHtml: ` <p>The app is published at <strong>${escapeHtml(clientHost)}</strong>.</p>
|
|
5902
|
+
<h2>In ${escapeHtml(args.agentName)}, it can:</h2>
|
|
5903
|
+
<ul class="list">${scopeItems}</ul>
|
|
5904
|
+
<p class="warning" role="note">Only continue if you started this connection.</p>
|
|
5905
|
+
<form method="post" class="actions">
|
|
5906
|
+
<input type="hidden" name="csrf" value="${escapeHtml(args.csrfToken)}">
|
|
5907
|
+
<button type="submit" name="action" value="deny">Deny</button>
|
|
5908
|
+
<button type="submit" name="action" value="approve" class="primary">Allow</button>
|
|
5909
|
+
</form>`,
|
|
5770
5910
|
formOrigin: new URL(args.authorization.redirectUri).origin,
|
|
5771
|
-
message: `${clientName} wants to connect to ${args.agentName}
|
|
5911
|
+
message: `${clientName} wants to connect to ${args.agentName}.`,
|
|
5772
5912
|
status: 200,
|
|
5773
5913
|
title: `Connect ${clientName}`
|
|
5774
5914
|
});
|
|
@@ -6600,7 +6740,7 @@ function renderResult(agentName, result) {
|
|
|
6600
6740
|
}
|
|
6601
6741
|
}[result];
|
|
6602
6742
|
return renderHtmlPage({
|
|
6603
|
-
bodyHtml: `
|
|
6743
|
+
bodyHtml: ` <p>${escapeHtml(content.message)}</p>`,
|
|
6604
6744
|
headers: ACP_PAGE_HEADERS,
|
|
6605
6745
|
status: content.status,
|
|
6606
6746
|
title: content.title
|
|
@@ -6608,11 +6748,12 @@ function renderResult(agentName, result) {
|
|
|
6608
6748
|
}
|
|
6609
6749
|
function renderConfirmation(agentName) {
|
|
6610
6750
|
return renderHtmlPage({
|
|
6611
|
-
bodyHtml: `
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
</
|
|
6751
|
+
bodyHtml: ` <p>Enter the verification code shown by your ACP client.</p>
|
|
6752
|
+
<p class="warning" role="note">Only continue if you started sign-in from your ACP client.</p>
|
|
6753
|
+
<form method="post">
|
|
6754
|
+
<label>Verification code<input name="code" required autocomplete="one-time-code" inputmode="text"></label>
|
|
6755
|
+
<button type="submit" class="primary">Connect</button>
|
|
6756
|
+
</form>`,
|
|
6616
6757
|
headers: ACP_PAGE_HEADERS,
|
|
6617
6758
|
status: 200,
|
|
6618
6759
|
title: `Connect ${agentName}`
|
|
@@ -7173,9 +7314,11 @@ async function createApp(options) {
|
|
|
7173
7314
|
messageId: delivery.messageId
|
|
7174
7315
|
})) ?? getVercelConversationWorkQueue();
|
|
7175
7316
|
const pluginTaskQueue = options?.pluginTaskQueue?.(processPluginTask);
|
|
7317
|
+
const backgroundCompactionQueue = options?.backgroundCompactionQueue?.((message) => processBackgroundCompaction(message)) ?? vercelBackgroundCompactionQueue;
|
|
7176
7318
|
const attachmentStorage = getAttachmentStorage();
|
|
7177
7319
|
const agentRunner = createAgentRunner(executeAgentRun, {
|
|
7178
7320
|
attachmentStorage,
|
|
7321
|
+
backgroundCompactionQueue,
|
|
7179
7322
|
bindMessageAgent: (request) => bindMessageAgent(request, { queue: conversationWorkQueue }),
|
|
7180
7323
|
bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: conversationWorkQueue }),
|
|
7181
7324
|
conversationWorkQueue,
|
|
@@ -7341,6 +7484,7 @@ async function createApp(options) {
|
|
|
7341
7484
|
registerVercelConversationWorkDevConsumer(getConversationWorkOptions());
|
|
7342
7485
|
registerVercelPluginTaskDevConsumer();
|
|
7343
7486
|
registerVercelWorkspaceSnapshotJobDevConsumer();
|
|
7487
|
+
registerVercelBackgroundCompactionDevConsumer();
|
|
7344
7488
|
}
|
|
7345
7489
|
app.post("/api/internal/agent/continue", (c) => {
|
|
7346
7490
|
agentContinuePOST ??= createVercelConversationWorkCallback(getConversationWorkOptions());
|
|
@@ -7355,6 +7499,11 @@ async function createApp(options) {
|
|
|
7355
7499
|
workspaceSnapshotJobPOST ??= createVercelWorkspaceSnapshotJobCallback();
|
|
7356
7500
|
return workspaceSnapshotJobPOST(c.req.raw);
|
|
7357
7501
|
});
|
|
7502
|
+
let backgroundCompactionPOST;
|
|
7503
|
+
app.post(JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, (c) => {
|
|
7504
|
+
backgroundCompactionPOST ??= createVercelBackgroundCompactionCallback();
|
|
7505
|
+
return backgroundCompactionPOST(c.req.raw);
|
|
7506
|
+
});
|
|
7358
7507
|
app.get("/api/internal/heartbeat", (c) => {
|
|
7359
7508
|
return GET$2(c.req.raw, waitUntil, { conversationWorkQueue });
|
|
7360
7509
|
});
|
|
@@ -7370,7 +7519,8 @@ async function createApp(options) {
|
|
|
7370
7519
|
return Object.assign(app, { startQueueWorker: () => startQueueWorker([
|
|
7371
7520
|
conversationWorkQueueConsumer(getConversationWorkOptions()),
|
|
7372
7521
|
pluginTaskQueueConsumer(),
|
|
7373
|
-
workspaceSnapshotJobQueueConsumer()
|
|
7522
|
+
workspaceSnapshotJobQueueConsumer(),
|
|
7523
|
+
backgroundCompactionQueueConsumer()
|
|
7374
7524
|
], backgroundWork) });
|
|
7375
7525
|
}
|
|
7376
7526
|
export { JUNIOR_VERSION, createApp, defineJuniorPlugins };
|