@sentry/junior 0.275.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-dE2BiWP_.js → adapter-BtfBHVM5.js} +1 -1
- package/dist/{admin-CkPaAYuZ.js → admin-DzAKbZsm.js} +1 -1
- package/dist/{agent-invocations-C1RNOCs8.js → agent-invocations-Crs3XHhg.js} +6 -1
- package/dist/{agent-runner-bE7aH7ew.js → agent-runner-BsYAbniN.js} +394 -244
- 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 +186 -68
- package/dist/{app-CgkquhZ8.d.ts → app-BjEQwNVP.d.ts} +11 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +227 -112
- package/dist/{assistant-reply-CjRU9Z59.js → assistant-reply-NebRGG4G.js} +1 -1
- package/dist/{automation-BGrd03QO.js → automation-Cql9h2vO.js} +42 -13
- package/dist/{background-compaction-queue-BYuOt3qK.js → background-compaction-queue-hh18yCeU.js} +2 -2
- package/dist/{briefs-6xUvmGos.js → briefs-BBo0Eimi.js} +4 -4
- package/dist/{catalog-runtime-DcJ5NHDW.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-gnKpkpqP.js → client-DZ8HTnYH.js} +2 -2
- package/dist/{config-D0GKc9sC.js → config-D5uUtrCP.js} +2 -2
- package/dist/{connections-DLqP5Bp1.js → connections-Do24CGP5.js} +14 -14
- package/dist/{conversation-BjTo9ZFL.js → conversation-SsASlWL7.js} +35 -12
- package/dist/{conversation-privacy-BCXFshP9.js → conversation-privacy-VuylvlKr.js} +1 -1
- package/dist/{credential-sync-BjihXFF2.js → credential-sync-BGQK3pOa.js} +13 -13
- package/dist/{db-BMZhoYKj.d.ts → db-DEiwO5Sh.d.ts} +1 -1
- package/dist/{executor-j8VMt-To.js → executor-hPfFTH0C.js} +13 -5
- package/dist/instrumentation.d.ts +14 -0
- package/dist/instrumentation.js +29 -6
- package/dist/{logging-CFHIO4Vs.js → logging-cI3T1dNc.js} +4 -2
- package/dist/{message-DH0cqFRS.js → message-DBwsAl7O.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +7 -3
- package/dist/{oauth-callback-server-BgU4EZsJ.js → oauth-callback-server-DXrnbplb.js} +2 -2
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
- package/dist/{projection-CTvLSwcm.js → projection-7EFIqzuj.js} +4108 -3898
- package/dist/{prompt-JEWUUpLW.js → prompt-oRfGsxd3.js} +1 -1
- package/dist/{registry-OsyWR4GO.js → registry-Bzefs7kT.js} +24 -8
- package/dist/{resolve-DCrKjmVP.js → resolve-CuiEY_2u.js} +3 -3
- package/dist/{result-Btdt5bSl.js → result-DrcUtFaD.js} +9 -9
- package/dist/{runner-C1AwS93W.js → runner-CDE4CZ52.js} +12 -12
- package/dist/{sandbox-egress-signals-C-5i7Zxm.js → sandbox-egress-signals-0tcmGd13.js} +1 -1
- package/dist/{schema-DfdHlBnb.d.ts → schema-B6N2nc6v.d.ts} +108 -15
- package/dist/{schema-CX9XGKCm.js → schema-Dzi3lkdP.js} +25 -8
- package/dist/{service-account-DZX1KlQl.js → service-account-BOz9pqOE.js} +3 -3
- package/dist/{service-account-CQIW6At4.js → service-account-DIyz_9Uh.js} +3 -3
- package/dist/{session-stop-DjIyORJw.js → session-stop-0juF_BP0.js} +159 -55
- package/dist/{skills-BEfAAT6p.js → skills-CU5Is147.js} +2 -2
- package/dist/{spawn-Dgj4xxvO.js → spawn-6C9jHH4b.js} +2 -2
- package/dist/{stop-DomyNvuv.js → stop-6FVG1c-r.js} +487 -203
- package/dist/{store-Dp3RMEQd.js → store-DKs1WwdB.js} +3 -3
- package/dist/{store-B7Z6zIc7.js → store-DtHZviJ1.js} +11 -9
- package/dist/{task-queue-CVQ9cWnC.js → task-queue-CcvFQE_p.js} +3 -3
- package/dist/{task-runner-DHBG47gS.js → task-runner-DBkNejLl.js} +6 -6
- package/dist/{thread-state-BF8VwIxd.js → thread-state-4hjEIkIq.js} +4 -4
- package/dist/{turn-failure-response-Di7TbgsF.js → turn-failure-response-BZNLydC3.js} +7 -7
- package/dist/{turn-lifecycle-DzXwXmLg.js → turn-lifecycle-BhqYjaa4.js} +6 -1
- package/dist/{turn-session-routing-CIWhXKeT.js → turn-session-routing-jnLOfBHJ.js} +17 -16
- package/dist/{validation-BRmwRaXc.js → validation-BUFmsnKs.js} +1 -1
- package/dist/{version-DBVMsgvA.js → version-DJTk0ZCE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-BFADRGP8.js → viewer-WY0RYE4E.js} +53 -15
- package/dist/{work-DDaoxZAw.js → work-C5AKvXJV.js} +30 -12
- package/dist/{worker-Bub0fDtW.js → worker-BcYVDVUy.js} +6 -6
- package/migrations/0073_conversation_quick_question.sql +1 -0
- 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/0073_snapshot.json +4070 -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 +29 -1
- package/package.json +5 -4
|
@@ -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";
|
|
@@ -140,6 +140,14 @@ declare const inboundMessageSchema: z.ZodObject<{
|
|
|
140
140
|
authorId: z.ZodOptional<z.ZodString>;
|
|
141
141
|
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
142
142
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
143
|
+
reviewItemChange: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
kind: z.ZodEnum<{
|
|
145
|
+
dismissed: "dismissed";
|
|
146
|
+
submitted: "submitted";
|
|
147
|
+
taken: "taken";
|
|
148
|
+
}>;
|
|
149
|
+
reviewItemId: z.ZodString;
|
|
150
|
+
}, z.core.$strict>>;
|
|
143
151
|
text: z.ZodString;
|
|
144
152
|
}, z.core.$strict>;
|
|
145
153
|
receivedAtMs: z.ZodNumber;
|
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 { Ai as
|
|
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
|
|
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 {
|
|
17
|
-
import {
|
|
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
|
|
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$
|
|
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";
|
|
@@ -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
|
});
|
|
@@ -1140,12 +1142,13 @@ async function runHeartbeat(args) {
|
|
|
1140
1142
|
nowMs: args.nowMs
|
|
1141
1143
|
});
|
|
1142
1144
|
}
|
|
1143
|
-
// src/handlers/
|
|
1144
|
-
function
|
|
1145
|
+
// src/handlers/scheduler-auth.ts
|
|
1146
|
+
function getSchedulerSecret() {
|
|
1145
1147
|
return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
|
|
1146
1148
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
+
/** Check the bearer secret that internal cron requests must send. */
|
|
1150
|
+
function verifySchedulerRequest(request) {
|
|
1151
|
+
const secret = getSchedulerSecret();
|
|
1149
1152
|
if (!secret) return false;
|
|
1150
1153
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1151
1154
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -1153,9 +1156,10 @@ function verifyHeartbeatRequest(request) {
|
|
|
1153
1156
|
const expected = Buffer.from(secret);
|
|
1154
1157
|
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
1155
1158
|
}
|
|
1159
|
+
// src/handlers/heartbeat.ts
|
|
1156
1160
|
/** Handle the authenticated internal heartbeat. */
|
|
1157
|
-
async function GET$
|
|
1158
|
-
if (!
|
|
1161
|
+
async function GET$3(request, waitUntil, options = {}) {
|
|
1162
|
+
if (!verifySchedulerRequest(request)) return new Response("Unauthorized", { status: 401 });
|
|
1159
1163
|
const nowMs = Date.now();
|
|
1160
1164
|
waitUntil(() => runHeartbeat({
|
|
1161
1165
|
conversationWorkQueue: options.conversationWorkQueue,
|
|
@@ -1342,6 +1346,7 @@ async function purgeConversationTree(executor, args) {
|
|
|
1342
1346
|
actor: null
|
|
1343
1347
|
} : void 0
|
|
1344
1348
|
}).where(inArray(juniorConversations.conversationId, ids));
|
|
1349
|
+
await touchConversationDetail(executor.db(), ids);
|
|
1345
1350
|
return {
|
|
1346
1351
|
purged: true,
|
|
1347
1352
|
conversations: ids.length
|
|
@@ -1426,25 +1431,13 @@ async function runRetentionPurge(executor, args) {
|
|
|
1426
1431
|
};
|
|
1427
1432
|
}
|
|
1428
1433
|
// src/handlers/retention.ts
|
|
1429
|
-
function getRetentionSecret() {
|
|
1430
|
-
return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
|
|
1431
|
-
}
|
|
1432
|
-
function verifyRetentionRequest(request) {
|
|
1433
|
-
const secret = getRetentionSecret();
|
|
1434
|
-
if (!secret) return false;
|
|
1435
|
-
const authorization = request.headers.get("authorization")?.trim();
|
|
1436
|
-
if (!authorization?.startsWith("Bearer ")) return false;
|
|
1437
|
-
const actual = Buffer.from(authorization.slice(7));
|
|
1438
|
-
const expected = Buffer.from(secret);
|
|
1439
|
-
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
1440
|
-
}
|
|
1441
1434
|
/**
|
|
1442
1435
|
* Handle the authenticated internal retention cron. One request runs a single
|
|
1443
1436
|
* bounded purge batch and returns its counts. Failures are contained here so
|
|
1444
1437
|
* retention can never affect task execution, heartbeat recovery, or delivery.
|
|
1445
1438
|
*/
|
|
1446
|
-
async function GET$
|
|
1447
|
-
if (!
|
|
1439
|
+
async function GET$2(request, options = {}) {
|
|
1440
|
+
if (!verifySchedulerRequest(request)) return new Response("Unauthorized", { status: 401 });
|
|
1448
1441
|
try {
|
|
1449
1442
|
const result = await runRetentionPurge(getSqlExecutor(), {
|
|
1450
1443
|
attachmentStorage: options.attachmentStorage ?? getAttachmentStorage(),
|
|
@@ -1456,6 +1449,21 @@ async function GET$1(request, options = {}) {
|
|
|
1456
1449
|
return new Response("Retention purge failed", { status: 500 });
|
|
1457
1450
|
}
|
|
1458
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
|
+
}
|
|
1459
1467
|
// src/handlers/sandbox-egress-proxy.ts
|
|
1460
1468
|
/** Handles Vercel Sandbox firewall egress proxy requests. */
|
|
1461
1469
|
async function ALL(request, options = {}) {
|
|
@@ -1852,7 +1860,7 @@ async function act(args) {
|
|
|
1852
1860
|
text: renderReviewItemMessage(item, change),
|
|
1853
1861
|
threadTs: target.threadTs,
|
|
1854
1862
|
userId: actor.slackUserId
|
|
1855
|
-
}));
|
|
1863
|
+
}), { reviewItemChange: reviewItemChangeRecord(item, change) });
|
|
1856
1864
|
} catch (error) {
|
|
1857
1865
|
logException(error, "review_item.slack_input.persist.failed", { "app.review_item.id": item.id });
|
|
1858
1866
|
await deliverReviewItemChange({
|
|
@@ -2063,7 +2071,7 @@ async function handleSlackForm(args) {
|
|
|
2063
2071
|
adapter,
|
|
2064
2072
|
payload,
|
|
2065
2073
|
isAuthorAllowed: (userId) => args.isAuthorAllowed(userId, installation),
|
|
2066
|
-
persistMessage: (message) => args.persistMessage(message, installation),
|
|
2074
|
+
persistMessage: (message, facts) => args.persistMessage(message, installation, facts),
|
|
2067
2075
|
queue: args.queue,
|
|
2068
2076
|
state,
|
|
2069
2077
|
userTokenStore: args.getUserTokenStore()
|
|
@@ -2073,6 +2081,32 @@ async function handleSlackForm(args) {
|
|
|
2073
2081
|
})));
|
|
2074
2082
|
return new Response("", { status: 200 });
|
|
2075
2083
|
}
|
|
2084
|
+
// src/chat/ingress/slack-message-subtypes.ts
|
|
2085
|
+
const IGNORED_MESSAGE_SUBTYPES = /* @__PURE__ */ new Set([
|
|
2086
|
+
"message_changed",
|
|
2087
|
+
"message_deleted",
|
|
2088
|
+
"message_replied",
|
|
2089
|
+
"channel_join",
|
|
2090
|
+
"channel_leave",
|
|
2091
|
+
"channel_topic",
|
|
2092
|
+
"channel_purpose",
|
|
2093
|
+
"channel_name",
|
|
2094
|
+
"channel_archive",
|
|
2095
|
+
"channel_unarchive",
|
|
2096
|
+
"group_join",
|
|
2097
|
+
"group_leave",
|
|
2098
|
+
"group_topic",
|
|
2099
|
+
"group_purpose",
|
|
2100
|
+
"group_name",
|
|
2101
|
+
"group_archive",
|
|
2102
|
+
"group_unarchive",
|
|
2103
|
+
"ekm_access_denied",
|
|
2104
|
+
"tombstone"
|
|
2105
|
+
]);
|
|
2106
|
+
/** Whether ingress ignores a Slack message event for its subtype. */
|
|
2107
|
+
function shouldIgnoreMessageSubtype(event) {
|
|
2108
|
+
return Boolean(event.subtype && IGNORED_MESSAGE_SUBTYPES.has(event.subtype));
|
|
2109
|
+
}
|
|
2076
2110
|
// src/chat/ingress/slack-channel-created.ts
|
|
2077
2111
|
const slackChannelCreatedEnvelopeSchema = z.object({
|
|
2078
2112
|
type: z.literal("event_callback"),
|
|
@@ -2471,27 +2505,6 @@ function slackEventLogContext(event) {
|
|
|
2471
2505
|
userId: event?.user?.trim() || void 0
|
|
2472
2506
|
};
|
|
2473
2507
|
}
|
|
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
2508
|
function enqueue(waitUntil, task) {
|
|
2496
2509
|
waitUntil(task);
|
|
2497
2510
|
}
|
|
@@ -2515,9 +2528,6 @@ function installationFromEnvelope(body) {
|
|
|
2515
2528
|
function isDmEvent(event) {
|
|
2516
2529
|
return event.channel_type === "im" || event.channel?.startsWith("D") === true;
|
|
2517
2530
|
}
|
|
2518
|
-
function shouldIgnoreMessageSubtype(event) {
|
|
2519
|
-
return Boolean(event.subtype && IGNORED_MESSAGE_SUBTYPES.has(event.subtype));
|
|
2520
|
-
}
|
|
2521
2531
|
function normalizeMessageThreadId(message) {
|
|
2522
2532
|
const threadId = normalizeIncomingSlackThreadId(message.threadId, message);
|
|
2523
2533
|
return {
|
|
@@ -2578,6 +2588,7 @@ async function persistSlackMessage(args) {
|
|
|
2578
2588
|
const inbound = buildSlackInboundMessage({
|
|
2579
2589
|
conversationId,
|
|
2580
2590
|
installation: args.installation,
|
|
2591
|
+
reviewItemChange: args.facts?.reviewItemChange,
|
|
2581
2592
|
message: args.message,
|
|
2582
2593
|
receivedAtMs: args.receivedAtMs,
|
|
2583
2594
|
route: args.route,
|
|
@@ -2937,6 +2948,7 @@ async function persistSlackMentionWithLock(args) {
|
|
|
2937
2948
|
try {
|
|
2938
2949
|
if (!(await withLock(args.state, `slack:ingress:${threadId}`, () => persistSlackMessage({
|
|
2939
2950
|
adapter: args.adapter,
|
|
2951
|
+
facts: args.facts,
|
|
2940
2952
|
installation: args.installation,
|
|
2941
2953
|
message,
|
|
2942
2954
|
conversationStore: args.services.conversationStore,
|
|
@@ -2978,8 +2990,9 @@ async function handleSlackWebhook(args) {
|
|
|
2978
2990
|
teamId: installation.teamId,
|
|
2979
2991
|
user: userId
|
|
2980
2992
|
}),
|
|
2981
|
-
persistMessage: (message, installation) => persistSlackMentionWithLock({
|
|
2993
|
+
persistMessage: (message, installation, facts) => persistSlackMentionWithLock({
|
|
2982
2994
|
adapter,
|
|
2995
|
+
facts,
|
|
2983
2996
|
installation,
|
|
2984
2997
|
message,
|
|
2985
2998
|
services: args.services,
|
|
@@ -3360,9 +3373,6 @@ function createEventAppPublisher(args) {
|
|
|
3360
3373
|
}
|
|
3361
3374
|
// src/api/acp/conversations.ts
|
|
3362
3375
|
const EVENT_PAGE_SIZE = 50;
|
|
3363
|
-
function actorFromUser(user) {
|
|
3364
|
-
return webActorFromEmail(user.email, user.displayName ? { fullName: user.displayName } : void 0);
|
|
3365
|
-
}
|
|
3366
3376
|
async function hasConversationAccess(conversationId, user) {
|
|
3367
3377
|
const access = (await readConversationAccessFromSql(getDb(), [conversationId], user)).get(conversationId);
|
|
3368
3378
|
return Boolean(access?.isParticipant);
|
|
@@ -3404,7 +3414,7 @@ function createAcpConversations(options) {
|
|
|
3404
3414
|
},
|
|
3405
3415
|
async create({ conversationId, user }) {
|
|
3406
3416
|
await recordWebConversationActivity({
|
|
3407
|
-
actor:
|
|
3417
|
+
actor: webActorFromUser(user),
|
|
3408
3418
|
conversationId,
|
|
3409
3419
|
conversationStore: options.conversationStore,
|
|
3410
3420
|
nowMs: Date.now(),
|
|
@@ -3419,7 +3429,7 @@ function createAcpConversations(options) {
|
|
|
3419
3429
|
const currentCursor = await latestEventCursor(options.eventStore, conversationId);
|
|
3420
3430
|
if (await getAuthPausedConversationTurnId(conversationId)) return { status: "active" };
|
|
3421
3431
|
const result = await appendAndEnqueueWebMessage({
|
|
3422
|
-
actor:
|
|
3432
|
+
actor: webActorFromUser(user),
|
|
3423
3433
|
conversationId,
|
|
3424
3434
|
idempotencyKey,
|
|
3425
3435
|
message: text
|
|
@@ -4979,9 +4989,106 @@ function requestHasSameOrigin(request) {
|
|
|
4979
4989
|
const origin = request.headers.get("origin");
|
|
4980
4990
|
return origin !== null && URL.parse(origin)?.origin === new URL(request.url).origin;
|
|
4981
4991
|
}
|
|
4992
|
+
const PAGE_STYLE = `
|
|
4993
|
+
:root {
|
|
4994
|
+
color-scheme: dark;
|
|
4995
|
+
--bg: #060607;
|
|
4996
|
+
--panel: #0c0c0e;
|
|
4997
|
+
--raised: #101013;
|
|
4998
|
+
--hover: #17171a;
|
|
4999
|
+
--text: #f4f4f5;
|
|
5000
|
+
--muted: #a1a1aa;
|
|
5001
|
+
--faint: #8a8a93;
|
|
5002
|
+
--solid: #ffffff;
|
|
5003
|
+
--subtle: #c4c4cc;
|
|
5004
|
+
--inverse: #000000;
|
|
5005
|
+
--focus: #beaaff;
|
|
5006
|
+
--border: rgb(255 255 255 / 0.08);
|
|
5007
|
+
--border-emphasis: rgb(255 255 255 / 0.15);
|
|
5008
|
+
--border-heavy: rgb(255 255 255 / 0.3);
|
|
5009
|
+
--warning-bg: rgb(251 191 36 / 0.08);
|
|
5010
|
+
--warning-border: rgb(251 191 36 / 0.3);
|
|
5011
|
+
--warning-text: #fcd34d;
|
|
5012
|
+
--shadow: 0 16px 40px rgb(0 0 0 / 0.5);
|
|
5013
|
+
}
|
|
5014
|
+
@media (prefers-color-scheme: light) {
|
|
5015
|
+
:root {
|
|
5016
|
+
color-scheme: light;
|
|
5017
|
+
--bg: #ffffff;
|
|
5018
|
+
--panel: #f9f9fa;
|
|
5019
|
+
--raised: #ffffff;
|
|
5020
|
+
--hover: #f1f1f3;
|
|
5021
|
+
--text: #18181b;
|
|
5022
|
+
--muted: #52525b;
|
|
5023
|
+
--faint: #71717a;
|
|
5024
|
+
--solid: #09090b;
|
|
5025
|
+
--subtle: #3f3f46;
|
|
5026
|
+
--inverse: #ffffff;
|
|
5027
|
+
--focus: #7553ff;
|
|
5028
|
+
--border: rgb(0 0 0 / 0.09);
|
|
5029
|
+
--border-emphasis: rgb(0 0 0 / 0.16);
|
|
5030
|
+
--border-heavy: rgb(0 0 0 / 0.32);
|
|
5031
|
+
--warning-bg: rgb(245 158 11 / 0.1);
|
|
5032
|
+
--warning-border: rgb(217 119 6 / 0.35);
|
|
5033
|
+
--warning-text: #92400e;
|
|
5034
|
+
--shadow: 0 16px 40px rgb(0 0 0 / 0.08);
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
* { box-sizing: border-box; }
|
|
5038
|
+
body {
|
|
5039
|
+
margin: 0;
|
|
5040
|
+
min-height: 100vh;
|
|
5041
|
+
display: grid;
|
|
5042
|
+
place-items: center;
|
|
5043
|
+
padding: 24px 16px;
|
|
5044
|
+
background: var(--bg);
|
|
5045
|
+
color: var(--text);
|
|
5046
|
+
font: 16px/1.5 Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
|
|
5047
|
+
}
|
|
5048
|
+
main {
|
|
5049
|
+
width: 100%;
|
|
5050
|
+
max-width: 28rem;
|
|
5051
|
+
padding: 32px;
|
|
5052
|
+
border: 1px solid var(--border);
|
|
5053
|
+
border-radius: 12px;
|
|
5054
|
+
background: var(--panel);
|
|
5055
|
+
box-shadow: var(--shadow);
|
|
5056
|
+
}
|
|
5057
|
+
h1, h2 { font-family: Outfit, "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif; }
|
|
5058
|
+
h1 { margin: 0 0 8px; font-size: 1.5rem; line-height: 1.25; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
|
|
5059
|
+
h2 { margin: 24px 0 8px; font-size: 0.875rem; line-height: 1.35; font-weight: 600; color: var(--subtle); }
|
|
5060
|
+
p { margin: 0 0 16px; color: var(--muted); text-wrap: pretty; }
|
|
5061
|
+
p:last-child { margin-bottom: 0; }
|
|
5062
|
+
strong { color: var(--text); font-weight: 600; }
|
|
5063
|
+
code { font: 0.8125rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--faint); overflow-wrap: anywhere; }
|
|
5064
|
+
.list { margin: 0 0 24px; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); }
|
|
5065
|
+
.list li { padding: 12px 16px; font-size: 0.875rem; line-height: 1.35; }
|
|
5066
|
+
.list li + li { border-top: 1px solid var(--border); }
|
|
5067
|
+
.list code { display: block; margin-top: 4px; }
|
|
5068
|
+
.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; }
|
|
5069
|
+
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
|
5070
|
+
label { display: block; margin: 0 0 16px; font-size: 0.875rem; font-weight: 600; color: var(--subtle); }
|
|
5071
|
+
label input {
|
|
5072
|
+
display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 12px;
|
|
5073
|
+
border: 1px solid var(--border-emphasis); border-radius: 6px; background: var(--raised);
|
|
5074
|
+
color: var(--text); font: 1rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
5075
|
+
}
|
|
5076
|
+
button {
|
|
5077
|
+
width: 100%; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border-emphasis); border-radius: 6px;
|
|
5078
|
+
background: var(--raised); color: var(--text); cursor: pointer;
|
|
5079
|
+
font-family: inherit; font-size: 0.875rem; font-weight: 600; line-height: 1; transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
5080
|
+
}
|
|
5081
|
+
button:hover { border-color: var(--border-heavy); background: var(--hover); }
|
|
5082
|
+
button.primary { border-color: var(--solid); background: var(--solid); color: var(--inverse); }
|
|
5083
|
+
button.primary:hover { border-color: var(--subtle); background: var(--subtle); }
|
|
5084
|
+
button:focus-visible, label input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
5085
|
+
@media (max-width: 480px) { main { padding: 24px; } }
|
|
5086
|
+
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
|
|
5087
|
+
`;
|
|
4982
5088
|
/**
|
|
4983
5089
|
* Render one sign-in page that browsers cannot frame or cache. `bodyHtml`
|
|
4984
|
-
* follows the heading, and the caller escapes every value in it.
|
|
5090
|
+
* follows the heading, and the caller escapes every value in it. Callers use
|
|
5091
|
+
* the `list`, `warning`, `actions`, and `primary` classes from `PAGE_STYLE`.
|
|
4985
5092
|
*/
|
|
4986
5093
|
function renderHtmlPage(page) {
|
|
4987
5094
|
return new Response(`<!DOCTYPE html>
|
|
@@ -4990,13 +5097,12 @@ function renderHtmlPage(page) {
|
|
|
4990
5097
|
<meta charset="utf-8" />
|
|
4991
5098
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
4992
5099
|
<title>${escapeHtml(page.title)}</title>
|
|
5100
|
+
<style>${PAGE_STYLE}</style>
|
|
4993
5101
|
</head>
|
|
4994
|
-
<body
|
|
4995
|
-
<main
|
|
4996
|
-
<
|
|
4997
|
-
<h1 style="margin:0 0 .75rem;font-size:2rem">${escapeHtml(page.title)}</h1>
|
|
5102
|
+
<body>
|
|
5103
|
+
<main>
|
|
5104
|
+
<h1>${escapeHtml(page.title)}</h1>
|
|
4998
5105
|
${page.bodyHtml}
|
|
4999
|
-
</section>
|
|
5000
5106
|
</main>
|
|
5001
5107
|
</body>
|
|
5002
5108
|
</html>`, {
|
|
@@ -5324,15 +5430,18 @@ function redirectUriMatches(registered, requested) {
|
|
|
5324
5430
|
});
|
|
5325
5431
|
}
|
|
5326
5432
|
// src/api/mcp/oauth/page.ts
|
|
5327
|
-
/**
|
|
5433
|
+
/**
|
|
5434
|
+
* Render one MCP sign-in page. It loads no resources and sends no referrer to
|
|
5435
|
+
* other origins.
|
|
5436
|
+
*/
|
|
5328
5437
|
function renderMcpPage(page) {
|
|
5329
5438
|
const formAction = ["'self'", ...page.formOrigin ? [page.formOrigin] : []];
|
|
5330
|
-
const message = `
|
|
5439
|
+
const message = ` <p>${escapeHtml(page.message)}</p>`;
|
|
5331
5440
|
return renderHtmlPage({
|
|
5332
5441
|
bodyHtml: page.bodyHtml ? `${message}\n${page.bodyHtml}` : message,
|
|
5333
5442
|
headers: {
|
|
5334
5443
|
"content-security-policy": `default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'; form-action ${formAction.join(" ")}`,
|
|
5335
|
-
"referrer-policy": "
|
|
5444
|
+
"referrer-policy": "same-origin"
|
|
5336
5445
|
},
|
|
5337
5446
|
status: page.status,
|
|
5338
5447
|
title: page.title
|
|
@@ -5793,17 +5902,19 @@ function blockedPage() {
|
|
|
5793
5902
|
function consentPage(args) {
|
|
5794
5903
|
const clientHost = new URL(args.authorization.clientId).host;
|
|
5795
5904
|
const clientName = args.authorization.clientName ?? clientHost;
|
|
5796
|
-
const
|
|
5797
|
-
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("");
|
|
5905
|
+
const scopeItems = (parseMcpScopes(args.authorization.scope) ?? []).map((scope) => `<li>${escapeHtml(MCP_SCOPE_DESCRIPTIONS[scope])}<code>${escapeHtml(scope)}</code></li>`).join("");
|
|
5798
5906
|
return renderMcpPage({
|
|
5799
|
-
bodyHtml: `
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5907
|
+
bodyHtml: ` <p>The app is published at <strong>${escapeHtml(clientHost)}</strong>.</p>
|
|
5908
|
+
<h2>In ${escapeHtml(args.agentName)}, it can:</h2>
|
|
5909
|
+
<ul class="list">${scopeItems}</ul>
|
|
5910
|
+
<p class="warning" role="note">Only continue if you started this connection.</p>
|
|
5911
|
+
<form method="post" class="actions">
|
|
5912
|
+
<input type="hidden" name="csrf" value="${escapeHtml(args.csrfToken)}">
|
|
5913
|
+
<button type="submit" name="action" value="deny">Deny</button>
|
|
5914
|
+
<button type="submit" name="action" value="approve" class="primary">Allow</button>
|
|
5915
|
+
</form>`,
|
|
5805
5916
|
formOrigin: new URL(args.authorization.redirectUri).origin,
|
|
5806
|
-
message: `${clientName} wants to connect to ${args.agentName}
|
|
5917
|
+
message: `${clientName} wants to connect to ${args.agentName}.`,
|
|
5807
5918
|
status: 200,
|
|
5808
5919
|
title: `Connect ${clientName}`
|
|
5809
5920
|
});
|
|
@@ -6635,7 +6746,7 @@ function renderResult(agentName, result) {
|
|
|
6635
6746
|
}
|
|
6636
6747
|
}[result];
|
|
6637
6748
|
return renderHtmlPage({
|
|
6638
|
-
bodyHtml: `
|
|
6749
|
+
bodyHtml: ` <p>${escapeHtml(content.message)}</p>`,
|
|
6639
6750
|
headers: ACP_PAGE_HEADERS,
|
|
6640
6751
|
status: content.status,
|
|
6641
6752
|
title: content.title
|
|
@@ -6643,11 +6754,12 @@ function renderResult(agentName, result) {
|
|
|
6643
6754
|
}
|
|
6644
6755
|
function renderConfirmation(agentName) {
|
|
6645
6756
|
return renderHtmlPage({
|
|
6646
|
-
bodyHtml: `
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
</
|
|
6757
|
+
bodyHtml: ` <p>Enter the verification code shown by your ACP client.</p>
|
|
6758
|
+
<p class="warning" role="note">Only continue if you started sign-in from your ACP client.</p>
|
|
6759
|
+
<form method="post">
|
|
6760
|
+
<label>Verification code<input name="code" required autocomplete="one-time-code" inputmode="text"></label>
|
|
6761
|
+
<button type="submit" class="primary">Connect</button>
|
|
6762
|
+
</form>`,
|
|
6651
6763
|
headers: ACP_PAGE_HEADERS,
|
|
6652
6764
|
status: 200,
|
|
6653
6765
|
title: `Connect ${agentName}`
|
|
@@ -7351,17 +7463,17 @@ async function createApp(options) {
|
|
|
7351
7463
|
createDashboardApp: virtualConfig?.createDashboardApp,
|
|
7352
7464
|
pluginRoutes: pluginApiRoutes
|
|
7353
7465
|
}));
|
|
7354
|
-
app.get("/", () => GET$
|
|
7355
|
-
app.get("/health", () => GET$
|
|
7466
|
+
app.get("/", () => GET$4());
|
|
7467
|
+
app.get("/health", () => GET$4());
|
|
7356
7468
|
app.get("/public/artifacts/:filename", (c) => publicArtifactGET({
|
|
7357
7469
|
filename: c.req.param("filename"),
|
|
7358
7470
|
storage: attachmentStorage
|
|
7359
7471
|
}));
|
|
7360
7472
|
app.get("/api/oauth/callback/mcp/:provider", (c) => {
|
|
7361
|
-
return GET$
|
|
7473
|
+
return GET$5(c.req.raw, c.req.param("provider"), waitUntil, { conversationWorkQueue });
|
|
7362
7474
|
});
|
|
7363
7475
|
app.get("/api/oauth/callback/:provider", (c) => {
|
|
7364
|
-
return GET$
|
|
7476
|
+
return GET$6(c.req.raw, c.req.param("provider"), waitUntil, { conversationWorkQueue });
|
|
7365
7477
|
});
|
|
7366
7478
|
app.get("/api/internal/sandbox-egress/signals", (c) => {
|
|
7367
7479
|
return GET(c.req.raw);
|
|
@@ -7399,9 +7511,12 @@ async function createApp(options) {
|
|
|
7399
7511
|
return backgroundCompactionPOST(c.req.raw);
|
|
7400
7512
|
});
|
|
7401
7513
|
app.get("/api/internal/heartbeat", (c) => {
|
|
7402
|
-
return GET$
|
|
7514
|
+
return GET$3(c.req.raw, waitUntil, { conversationWorkQueue });
|
|
7403
7515
|
});
|
|
7404
7516
|
app.get("/api/internal/retention", (c) => {
|
|
7517
|
+
return GET$2(c.req.raw);
|
|
7518
|
+
});
|
|
7519
|
+
app.get(JUNIOR_AUTO_ARCHIVE_ROUTE, (c) => {
|
|
7405
7520
|
return GET$1(c.req.raw);
|
|
7406
7521
|
});
|
|
7407
7522
|
app.post("/api/webhooks/slack", (c) => {
|