@sentry/junior 0.313.0 → 0.314.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-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
- package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
- package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
- package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
- package/dist/agent-update-cS7Z9mnG.js +26 -0
- package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
- 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 +334 -100
- package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
- package/dist/app.d.ts +2 -2
- package/dist/app.js +80 -169
- package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
- package/dist/callback-C8SdXCwr.js +68 -0
- package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
- package/dist/{channel-access-mt7K6dPh.js → channel-access-BOL29BG3.js} +6 -6
- package/dist/child-message--2G3Ft26.js +19 -0
- package/dist/cli/chat.js +18 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +23 -4
- package/dist/{config-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
- package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
- package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
- package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
- package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
- package/dist/create-CrNt4Ewu.js +212 -0
- package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
- package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
- package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
- package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
- package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
- package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
- package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
- package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
- package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
- package/dist/markers-DUP8aBOp.js +323 -0
- package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
- package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
- package/dist/{model-input-BhPJYdSV.js → model-input-0osF3pBS.js} +3 -3
- package/dist/nitro.d.ts +2 -4
- package/dist/nitro.js +340 -13
- package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
- package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
- package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
- package/dist/result-D090hxr5.js +402 -0
- package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
- package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
- package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
- package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
- package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
- package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
- package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
- package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
- package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
- package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
- package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
- package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
- package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
- package/dist/turn-session-routing-CZTRU8IY.js +116 -0
- package/dist/turn-wake-Bzq1Efrm.js +154 -0
- package/dist/user-customization-B27StpVQ.js +9 -0
- package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
- package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
- package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
- package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
- package/migrations/0160_money_micro_usd_repair.sql +99 -0
- package/migrations/0161_agent_config_backfill.sql +34 -0
- package/migrations/0162_inbox_item_deliveries.sql +15 -0
- package/migrations/0163_pg_trgm.sql +2 -0
- package/migrations/0164_search_indexes.sql +4 -0
- package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
- package/migrations/0166_memory_prefix_index.sql +1 -0
- package/migrations/0167_todo_search_indexes.sql +2 -0
- package/migrations/0168_todo_inbox_items.sql +4 -0
- package/migrations/0169_drop_code_urls.sql +2 -0
- package/migrations/meta/0160_snapshot.json +6515 -0
- package/migrations/meta/0161_snapshot.json +6278 -0
- package/migrations/meta/0162_snapshot.json +6404 -0
- package/migrations/meta/0163_snapshot.json +6404 -0
- package/migrations/meta/0164_snapshot.json +6466 -0
- package/migrations/meta/0165_snapshot.json +6466 -0
- package/migrations/meta/0166_snapshot.json +6494 -0
- package/migrations/meta/0167_snapshot.json +6525 -0
- package/migrations/meta/0168_snapshot.json +6525 -0
- package/migrations/meta/0169_snapshot.json +6513 -0
- package/migrations/meta/_journal.json +70 -0
- package/package.json +9 -18
- package/skills/design-automation-skill/SKILL.md +2 -3
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/conversation-privacy-BrMiDN61.js +0 -189
- package/dist/executor-CgWyWfYz.js +0 -1858
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/ingest-B0AggUEC.js +0 -7931
- package/dist/request-deadline-BUiRYQYj.js +0 -24
- package/dist/service-account-o15pZWcJ.js +0 -931
- package/dist/state-BTawTCme.js +0 -161
- package/dist/statuses-BKwqCPhj.js +0 -69
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as JuniorPluginSet } from "./plugins-fBrz8PCV.js";
|
|
2
2
|
import { n as ConversationQueueMessage, r as ConversationWorkQueue, t as WaitUntilFn } from "./types-fnU7Xs__.js";
|
|
3
|
-
import "./schema-
|
|
4
|
-
import { t as ConversationStore } from "./db-
|
|
3
|
+
import "./schema-BB6E0wyV.js";
|
|
4
|
+
import { t as ConversationStore } from "./db-DcmzbA55.js";
|
|
5
5
|
import "./sentry-DrKC2NeM.js";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
7
|
import * as z from "zod";
|
|
@@ -91,11 +91,6 @@ interface MemoryOptions {
|
|
|
91
91
|
/** Model for extraction and supersession. Defaults to `AI_MEMORY_MODEL`, then the app structured model. */
|
|
92
92
|
modelId?: string;
|
|
93
93
|
}
|
|
94
|
-
/** Consumers that pull messages in one process. */
|
|
95
|
-
interface QueueWorker {
|
|
96
|
-
/** Stop taking messages, wait for running ones, and release connections. */
|
|
97
|
-
close(): Promise<void>;
|
|
98
|
-
}
|
|
99
94
|
declare const pluginTaskQueueMessageSchema: z.ZodObject<{
|
|
100
95
|
name: z.ZodString;
|
|
101
96
|
params: z.ZodObject<{
|
|
@@ -343,18 +338,6 @@ interface JuniorAppOptions extends BotModelConfig {
|
|
|
343
338
|
};
|
|
344
339
|
waitUntil?: WaitUntilFn;
|
|
345
340
|
}
|
|
346
|
-
/** A Hono app from `createApp()` that can also run its queue consumers. */
|
|
347
|
-
type JuniorApp = Hono & {
|
|
348
|
-
/**
|
|
349
|
-
* Pull this app's queue messages in this process until `close()`.
|
|
350
|
-
*
|
|
351
|
-
* Only for a queue provider whose consumers pull messages, such as the
|
|
352
|
-
* local BullMQ queue. The dev server runs it in its own worker process, so
|
|
353
|
-
* the Nitro process only sends messages. `close()` also closes the database
|
|
354
|
-
* and state connections of this process.
|
|
355
|
-
*/
|
|
356
|
-
startQueueWorker(): Promise<QueueWorker>;
|
|
357
|
-
};
|
|
358
341
|
/** Create a Hono app with all Junior routes. */
|
|
359
|
-
declare function createApp(options?: JuniorAppOptions): Promise<
|
|
360
|
-
export { MemoryOptions as
|
|
342
|
+
declare function createApp(options?: JuniorAppOptions): Promise<Hono>;
|
|
343
|
+
export { MemoryOptions as i, createApp as n, JuniorDashboardOptions as r, JuniorAppOptions as t };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as MemoryOptions, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-D7tKnw9a.js";
|
|
2
2
|
import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-fBrz8PCV.js";
|
|
3
3
|
import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
|
|
4
|
-
export { JUNIOR_VERSION,
|
|
4
|
+
export { JUNIOR_VERSION, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type MemoryOptions, createApp, defineJuniorPlugins };
|
package/dist/app.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I as MUTATION_LOCK_TTL_MS, R as fenceLock, d as setBotModelConfig, f as setBotName,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as getSandboxResourceConfig, s as setSandboxResourceConfig } from "./install-
|
|
8
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
9
|
-
import { $ as
|
|
10
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
11
|
-
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-
|
|
12
|
-
import { i as getStateAdapter
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { o as requestAttachmentDeletion, t as collectAttachmentGarbage } from "./store-CjXrp-Up.js";
|
|
20
|
-
import { c as conversationTurnIdForMessage, d as recordWebConversationActivity, f as webActorFromUser, h as collectAttachmentUploadGarbage, l as createAndEnqueueConversation, s as appendAndEnqueueWebMessage } from "./start-conversation-DbVujrwO.js";
|
|
1
|
+
import { $n as resolveRootVisibility, Aa as syncAutomationAlerts, An as consumeSandboxEgressPermissionDeniedSignal, B as projectConversationMessages, Da as refreshAutomationLastRun, Fi as saveScheduledAutomationInLock, Gi as getDashboardTaskLink, Hr as confirmDispatchMailboxAppend, Ii as scheduledRunId, Io as takeDueTimerWatches, Ka as searchInboxItems, La as dismissOpenInboxItems, Li as withScheduledAutomationLock, Ls as getConfigDefaults, Mn as parseSandboxEgressCredentialToken, Ni as readScheduledAutomation, On as clearSandboxEgressSignals, Ri as getDashboardConversationLink, Rn as normalizeSandboxEgressTracePropagationDomains, Rs as setConfigDefaults, S as readPublicArtifact, V as setMemoryConfig, Wr as getDispatchConversationId, Xr as isTerminalDispatchStatus, Yi as setDashboardConversationLinkOptions, Yo as getSlackClient, Zr as listPendingDispatchMailboxAppends, _a as existingConversationId, _i as slackExternalRefIdSchema, as as getWorkspaceTeamId, at as EVENT_INDEX_LOCK_TTL_MS, b as publicArtifactHeaders, ci as openSlackModal, dn as isVercelSandboxEgressRequest, dt as storeConversationEventLexemes, er as backfillConversationEmbeddings, fn as proxyVercelSandboxEgressRequest, fo as SLACK_EVENT_NAMESPACE, g as getRegistrations, gi as slackEntitySchema, gn as resolveBaseUrl, it as setEventEmbeddingsConfig, ji as listScheduledAutomationsForTeam, kn as consumeSandboxEgressAuthRequiredSignal, l as getPluginApiRoutes, la as automationVersionOf, li as postSlackEphemeralMessage, lr as listConversationAnnotations, mo as slackChannelMessageEvent, no as deleteExpiredInboxSnoozes, os as runWithWorkspaceTeamId, ot as embedConversationEvents, qr as getDispatchRecord, r as createUserTokenStore, ri as notifyAutomationBlocked, rt as isEventEmbeddingsEnabled, s as createPluginEventPublisher, st as eventIndexLockKey, ti as markDispatchFailed, tr as createConversationEmbedder, u as getPluginRoutes, v as setPlugins, w as unpublishedArtifactHeaders, wi as slackMention, y as validatePlugins, zi as getDashboardInboxItemLink } from "./credentialed-dWRA3-oJ.js";
|
|
2
|
+
import { I as MUTATION_LOCK_TTL_MS, R as fenceLock, d as setBotModelConfig, f as setBotName, h as snapshotRuntimeConfig, l as resetRuntimeConfig, m as setSlackReactionConfig, n as botConfig, p as setRuntimeLimits, r as getChatConfig, u as restoreRuntimeConfig, vt as getAttachmentStorage, z as withLock } from "./config-BIfHKNXN.js";
|
|
3
|
+
import { Ar as juniorConversationEvents, Br as juniorConversations, C as createSlackActor, D as parseActorUserId, Dr as juniorConversationEventEmbeddings, Er as juniorConversationEventLexemes, Gr as juniorDestinations, Lt as isPluginInboxItem, Mn as readConversationAccessFromSql, Mt as inboxItemReaderForUserInConversation, N as withConversationMutationLock, Or as juniorConversationEmbeddings, Q as conversationCostOf, Si as slackMessageTsSchema, Sr as juniorAgentBindings, Tr as juniorConversationBriefs, Xt as readActorIdentity, Zn as touchConversationDetail, _i as slackChannelIdSchema, a as getDb, bi as parseSlackMessageTs, bt as canActOnInboxItem, c as isPostgresErrorCode, ci as createSlackDestination, fi as parseSlackChannelId, fn as resolveActorIdentityId, h as withConversationEventLock, hr as juniorInboxItems, i as getConversationStore, jt as inboxItemReaderForUser, m as deleteMessageLinks, n as getConversationEventStore, o as getSqlExecutor, on as parseAvatarUrl, tn as resolveViewerUser, vi as slackTeamIdSchema, vr as juniorAutomations, xi as slackMessageTsFromMs, xn as recordGoogleSignIn, yr as juniorAutomationRuns } from "./db-BTmLKZrp.js";
|
|
4
|
+
import { B as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, C as logInfo, F as withSpan, K as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, L as JUNIOR_AUTO_ARCHIVE_ROUTE, N as withContext, P as withLogContext, R as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, S as logException, U as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, f as createRequestContext, k as setSpanAttributes, rt as normalizeIdentityEmail, tt as GOOGLE_IDENTITY_PROVIDER, w as logWarn, z as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./conversation-privacy-DtZhI91r.js";
|
|
5
|
+
import { D as renderSlackObjectCard, N as resumeConversationDelivery, O as annotationKeyDigest, S as parseSlackInboxItemFormTarget, _ as syncInboxItemSlackCards, b as buildSlackInboxItemModal, d as scheduledAutomationRunAttributes, f as createInboxItemShow, g as resolveSlackInboxItemCardConversationId, h as runInboxItemPushTimers, k as decodeAnnotationRef, n as executeAgentRun, p as pushConversationInboxItemsNow, t as createAgentRunner, u as logScheduledAutomationRunSkipped, v as findSlackThreadOwnerId, w as parseSlackUserInputSubmission, x as parseSlackInboxItemClick } from "./agent-runner-qZU5TR8i.js";
|
|
6
|
+
import { B as isTrustedSlackAuthor, Bt as getConversationWorkState, Ht as listActiveConversationIds, Mn as isExperimentalFeatureEnabled, Mt as clearExpiredConversationLease, Nn as setExperimentalFeatures, R as findTrustedUser, Rt as ensureConversationWake, Tt as appendAndEnqueueInboundMessage, U as setTrustConfig, V as parseEmail, ci as hasRunnableConversationWork, cn as renderTaskInput, fi as pruneActiveConversation, hr as settleConversationTitleWork, ii as CONVERSATION_WORK_STALE_ENQUEUE_MS, jn as getExperimentalFeatures, mn as deleteTodos, t as getAuthPausedConversationTurnId, ui as isInvalidConversationRecordError, ur as appendConversationMessages, yt as coerceThreadConversationState, z as isAllowedDomain, zt as getConversation } from "./mailbox-turn-DL3Lvsm0.js";
|
|
7
|
+
import { a as getSandboxResourceConfig, s as setSandboxResourceConfig } from "./install-OtFboxOM.js";
|
|
8
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BLKtnUL3.js";
|
|
9
|
+
import { $ as createEventAppPublisher, At as buildSlackInboundMessage, B as mcpMessageSchema, Bt as bindMessageAuthorIdentityId, Dt as createProductionConversationWorkOptions, Et as publicAddressLookup, F as mcpConversation, G as readMcpPendingWorkAfterSend, Gt as getThreadStopDecision, H as mcpMessages, Ht as stripLeadingBotMention, I as mcpConversationIdSchema, It as enqueueAgentDispatch, J as InboxItemActionError, Jt as readConversationRecordFromSql, L as mcpConversationSchema, Lt as failStoppedDispatch, Mt as slackInboundMessageId, N as mcpAcceptedMessageSchema, Nt as normalizeIncomingSlackThreadId, Ot as createProductionSlackWebhookServices, P as mcpAuthorizationSchema$1, Pt as withNormalizedThreadId, Q as reviewItemChange, R as mcpCursorSchema, Rt as recordSkippedConversationMessage, T as conversationOperations, Tt as isPublicAddress, U as mcpPendingMessagesSchema, Ut as parseContent, V as mcpMessageTextSchema, Vt as startProcessingReaction, W as readMcpPendingWork, Wt as SubscribedReplyReason, X as closeInboxItemsAnsweredByReply, Y as actOnInboxItem, Z as readInboxItemForUser, _ as appendConversationMessageForViewer, at as automationReplyAttribution, b as decodeConversationCursor, bt as readObjectLinkTypes, c as readConversationDetail, ct as dispatchScheduledAutomation, et as ingestEventAutomations, gt as GET$4, ht as backfillCacheWarmingGaps, jt as clearSlackPendingReactions, kt as getProductionSlackAdapter, lt as getScheduledAutomationDispatch, n as readConversationFeed, ot as settleEventAutomationRuns, pt as runSavingsRefillSlice, st as createHeartbeatContext, tt as runAutoArchiveSweep, ut as runInboxSnoozeTimers, v as createConversationForViewer, x as encodeConversationCursor, z as mcpIdempotencyKeySchema, zt as createSlackWebApiStatusSender } from "./list-C5400AlJ.js";
|
|
10
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-bTq88sya.js";
|
|
11
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-BXMdNdyA.js";
|
|
12
|
+
import { i as getStateAdapter } from "./adapter-JARQvoLw.js";
|
|
13
|
+
import { At as renderInboxItemMessage, O as ingestEvent, Ot as deliverInboxItemChange, T as processWorkspaceSnapshotJob, Zn as ViewerTaskNotFoundError, er as readViewerAutomationExecutions, fr as findAutomationSkill, ir as readViewerAutomations, kt as inboxItemChangeRecord, lr as automationCardStatus, mr as effectiveTaskOutcomes, nn as parseSlackThreadId, nr as readViewerAutomationSummary, p as processBackgroundCompaction, pr as missingAutomationSkillReason, wt as markConversationRead } from "./warmup-CCOuIwAS.js";
|
|
14
|
+
import { It as scheduledRunSchema, Qt as buttonUserInputField, Ut as getNextRunAtMs, b as automationListQuerySchema, dn as automationTaskSchema, fn as automationTaskText, g as automationExecutionStatusSchema, mt as conversationTitleSchema, yt as annotationCard } from "./media-FYM-Bl3H.js";
|
|
15
|
+
import { a as conversationQueueMessageSchema, d as getQueueProvider, m as readSignInSecret, n as resolveConversationWorkQueueTopic, o as isConversationQueueMessageRejectedError, p as readSchedulerSecret, r as verifyConversationQueueMessage, t as getVercelConversationWorkQueue } from "./vercel-queue-nL0Hq3hr.js";
|
|
16
|
+
import { r as createEndStoppedChildWork } from "./result-D090hxr5.js";
|
|
17
|
+
import { o as requestAttachmentDeletion, t as collectAttachmentGarbage } from "./store-BuhF1QDm.js";
|
|
18
|
+
import { c as conversationTurnIdForMessage, d as recordWebConversationActivity, f as webActorFromUser, h as collectAttachmentUploadGarbage, l as createAndEnqueueConversation, s as appendAndEnqueueWebMessage } from "./start-conversation-a4NXH4X9.js";
|
|
21
19
|
import { i as getActiveSpan, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
22
|
-
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
20
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-CtqsGjj1.js";
|
|
23
21
|
import { t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
24
22
|
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { s as joinPublicChannel } from "./channel-access-
|
|
30
|
-
import {
|
|
31
|
-
import { t as processConversationWork } from "./worker-
|
|
32
|
-
import { t as bindMessageAgent } from "./message-
|
|
33
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
34
|
-
import { a as
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
23
|
+
import { a as resolveSlackActingUser, i as unfurlDashboardConversationLinks, n as handleSlackContinueHereClick, o as isSlackWorkspaceMember, s as slackWorkspaceBotId, t as SLACK_CONTINUE_HERE_ACTION_ID } from "./slack-conversation-unfurl-CBgZqth6.js";
|
|
24
|
+
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-B8rBt7F4.js";
|
|
25
|
+
import { n as verifySlackSignature, t as runWithSlackInstallation } from "./adapter-context-B4BrJZuS.js";
|
|
26
|
+
import { a as stopConversation } from "./conversation-turn-DScuDYmN.js";
|
|
27
|
+
import { s as joinPublicChannel } from "./channel-access-BOL29BG3.js";
|
|
28
|
+
import { t as queueCallback } from "./callback-C8SdXCwr.js";
|
|
29
|
+
import { t as processConversationWork } from "./worker-AkZg7Dg1.js";
|
|
30
|
+
import { t as bindMessageAgent } from "./message-DuDelZFr.js";
|
|
31
|
+
import { t as bindSpawnAgent } from "./spawn-DRjdzh3R.js";
|
|
32
|
+
import { a as sendVercelPluginTask, n as createVercelPluginTaskCallback } from "./task-queue-CrRjFzOh.js";
|
|
33
|
+
import { c as readConversationEventPage, d as readConversationLastEventSeq, f as readConversationMessageEventSeq, l as readConversationEventPageAfter, t as processPluginTask } from "./task-runner-C-pXsgHM.js";
|
|
34
|
+
import { d as verifyWorkspaceSnapshotJobMessage, i as verifyBackgroundCompactionMessage, o as createVercelCacheWarmupCallback, r as vercelBackgroundCompactionQueue } from "./background-compaction-queue-C_uIBUvS.js";
|
|
35
|
+
import { t as JUNIOR_VERSION } from "./version-DGUa1dZK.js";
|
|
36
|
+
import { b as conversationPendingMessageDeliverySchema, t as conversationFeedQuerySchema } from "./conversation-feed-DdFQuQDR.js";
|
|
38
37
|
import { createRequire } from "node:module";
|
|
39
38
|
import { Hono } from "hono";
|
|
40
39
|
import * as z from "zod";
|
|
41
40
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
42
41
|
import { eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
43
42
|
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, notExists, or, sql } from "drizzle-orm";
|
|
43
|
+
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
44
44
|
import { pathToFileURL } from "node:url";
|
|
45
45
|
import { Message, ThreadImpl } from "chat";
|
|
46
46
|
import net from "node:net";
|
|
@@ -986,7 +986,6 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
986
986
|
const DEFAULT_PLUGIN_LIMIT = 25;
|
|
987
987
|
const PLUGIN_HEARTBEAT_TIMEOUT_MS = 25e3;
|
|
988
988
|
const DISPATCH_MAILBOX_APPEND_LIMIT = 100;
|
|
989
|
-
const AGENT_INVOCATION_MAILBOX_APPEND_LIMIT = 100;
|
|
990
989
|
async function runWithTimeout(promise, timeoutMs) {
|
|
991
990
|
let timeout;
|
|
992
991
|
try {
|
|
@@ -1053,47 +1052,6 @@ async function recoverPendingDispatchMailboxAppends(args) {
|
|
|
1053
1052
|
logException(error, "dispatch.mailbox.append_recovery.failed", { "app.dispatch.id": id });
|
|
1054
1053
|
}
|
|
1055
1054
|
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Run `work` for each item. Items for one mailbox run one at a time in list
|
|
1058
|
-
* order, so its appends keep that order. Different mailboxes run at once.
|
|
1059
|
-
*/
|
|
1060
|
-
async function runPerMailbox(items, mailboxOf, work) {
|
|
1061
|
-
const byMailbox = /* @__PURE__ */ new Map();
|
|
1062
|
-
for (const item of items) {
|
|
1063
|
-
const mailbox = mailboxOf(item);
|
|
1064
|
-
byMailbox.set(mailbox, [...byMailbox.get(mailbox) ?? [], item]);
|
|
1065
|
-
}
|
|
1066
|
-
await mapBounded([...byMailbox.values()], async (group) => {
|
|
1067
|
-
for (const item of group) await work(item);
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
/** Repair invocation creation that stopped before its idempotent mailbox append. */
|
|
1071
|
-
async function recoverPendingAgentInvocationMailboxAppends(args) {
|
|
1072
|
-
await runPerMailbox(await listPendingAgentInvocationMailboxAppends(AGENT_INVOCATION_MAILBOX_APPEND_LIMIT), (invocation) => invocation.childConversationId, async (invocation) => {
|
|
1073
|
-
try {
|
|
1074
|
-
await enqueueAgentInvocation(invocation, {
|
|
1075
|
-
nowMs: args.nowMs,
|
|
1076
|
-
queue: args.conversationWorkQueue
|
|
1077
|
-
});
|
|
1078
|
-
} catch (error) {
|
|
1079
|
-
logException(error, "agent.invocation.mailbox.append_recovery.failed", { "app.agent.invocation_id": invocation.invocationId });
|
|
1080
|
-
}
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
/** Repair terminal agent invocation results that never reached their parent. */
|
|
1084
|
-
async function recoverPendingAgentInvocationResults(args) {
|
|
1085
|
-
await runPerMailbox(await listPendingAgentInvocationResults(AGENT_INVOCATION_MAILBOX_APPEND_LIMIT), (invocation) => invocation.parentConversationId, async (invocation) => {
|
|
1086
|
-
try {
|
|
1087
|
-
await recordSubagentEnded(invocation);
|
|
1088
|
-
await enqueueAgentInvocationResult(invocation, {
|
|
1089
|
-
nowMs: args.nowMs,
|
|
1090
|
-
queue: args.conversationWorkQueue
|
|
1091
|
-
});
|
|
1092
|
-
} catch (error) {
|
|
1093
|
-
logException(error, "agent.invocation.result.recovery.failed", { "app.agent.invocation_id": invocation.invocationId });
|
|
1094
|
-
}
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
1055
|
/** Run the core heartbeat phases. */
|
|
1098
1056
|
async function runHeartbeat(args) {
|
|
1099
1057
|
const queue = args.conversationWorkQueue ?? getVercelConversationWorkQueue();
|
|
@@ -1110,14 +1068,6 @@ async function runHeartbeat(args) {
|
|
|
1110
1068
|
conversationWorkQueue: queue,
|
|
1111
1069
|
nowMs: args.nowMs
|
|
1112
1070
|
});
|
|
1113
|
-
await recoverPendingAgentInvocationMailboxAppends({
|
|
1114
|
-
conversationWorkQueue: queue,
|
|
1115
|
-
nowMs: args.nowMs
|
|
1116
|
-
});
|
|
1117
|
-
await recoverPendingAgentInvocationResults({
|
|
1118
|
-
conversationWorkQueue: queue,
|
|
1119
|
-
nowMs: args.nowMs
|
|
1120
|
-
});
|
|
1121
1071
|
try {
|
|
1122
1072
|
const dispatchCount = await runScheduledAutomationHeartbeat({
|
|
1123
1073
|
conversationWorkQueue: queue,
|
|
@@ -1133,6 +1083,11 @@ async function runHeartbeat(args) {
|
|
|
1133
1083
|
} catch (error) {
|
|
1134
1084
|
logException(error, "inbox_snoozes.heartbeat.failed");
|
|
1135
1085
|
}
|
|
1086
|
+
try {
|
|
1087
|
+
await runInboxItemPushTimers(getDb(), args.nowMs);
|
|
1088
|
+
} catch (error) {
|
|
1089
|
+
logException(error, "inbox_item_push.heartbeat.failed");
|
|
1090
|
+
}
|
|
1136
1091
|
try {
|
|
1137
1092
|
await syncAutomationAlerts(getDb(), args.nowMs);
|
|
1138
1093
|
} catch (error) {
|
|
@@ -1211,6 +1166,10 @@ async function GET$3(request, waitUntil, options) {
|
|
|
1211
1166
|
return new Response("Accepted", { status: 202 });
|
|
1212
1167
|
}
|
|
1213
1168
|
// src/chat/conversations/sql/purge.ts
|
|
1169
|
+
const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
1170
|
+
parentConversationId: text("parent_conversation_id").notNull(),
|
|
1171
|
+
childConversationId: text("child_conversation_id").notNull()
|
|
1172
|
+
});
|
|
1214
1173
|
/** Discover a root and its current descendants via `parent_conversation_id`. */
|
|
1215
1174
|
async function discoverConversationTree(executor, root) {
|
|
1216
1175
|
const all = /* @__PURE__ */ new Map([[root.conversationId, root]]);
|
|
@@ -1893,7 +1852,7 @@ async function act(args) {
|
|
|
1893
1852
|
});
|
|
1894
1853
|
const delivery = {
|
|
1895
1854
|
queue: services.queue,
|
|
1896
|
-
show:
|
|
1855
|
+
show: createInboxItemShow(() => services.adapter)
|
|
1897
1856
|
};
|
|
1898
1857
|
let recordOnly = args.action === "dismiss";
|
|
1899
1858
|
let item;
|
|
@@ -2755,7 +2714,7 @@ async function routeParsedMessage(args) {
|
|
|
2755
2714
|
});
|
|
2756
2715
|
return;
|
|
2757
2716
|
}
|
|
2758
|
-
if (route === "mention"
|
|
2717
|
+
if (route === "mention" && await resumeConversationDelivery(conversationId)) await pushConversationInboxItemsNow(conversationId);
|
|
2759
2718
|
if (isSubscribed && !isExperimentalFeatureEnabled("passive-routing")) {
|
|
2760
2719
|
await saveSkippedSlackMessage({
|
|
2761
2720
|
conversationId,
|
|
@@ -2782,7 +2741,7 @@ async function routeParsedMessage(args) {
|
|
|
2782
2741
|
conversationId,
|
|
2783
2742
|
delivery: {
|
|
2784
2743
|
queue: args.queue,
|
|
2785
|
-
show:
|
|
2744
|
+
show: createInboxItemShow(() => args.adapter)
|
|
2786
2745
|
},
|
|
2787
2746
|
resolveUser: async () => {
|
|
2788
2747
|
const teamId = args.installation.teamId;
|
|
@@ -3120,7 +3079,6 @@ async function POST(request, waitUntil, services) {
|
|
|
3120
3079
|
waitUntil
|
|
3121
3080
|
}));
|
|
3122
3081
|
}
|
|
3123
|
-
const CONVERSATION_WORK_DEV_CONSUMER_GROUP = "junior_conversation_work_dev";
|
|
3124
3082
|
/** Parse the signed callback body before conversation work reaches the worker. */
|
|
3125
3083
|
function parseConversationQueueMessage(message) {
|
|
3126
3084
|
const parsed = conversationQueueMessageSchema.safeParse(message);
|
|
@@ -3206,7 +3164,6 @@ function logConversationQueueMessageRejected(reason, metadata, error) {
|
|
|
3206
3164
|
}
|
|
3207
3165
|
function conversationWorkCallback(options) {
|
|
3208
3166
|
return queueCallback({
|
|
3209
|
-
consumerGroup: CONVERSATION_WORK_DEV_CONSUMER_GROUP,
|
|
3210
3167
|
maxDeliveries: null,
|
|
3211
3168
|
onRejected: logConversationQueueMessageRejected,
|
|
3212
3169
|
permanentError: (error) => isConversationQueueMessageRejectedError(error) ? error.reason : void 0,
|
|
@@ -3223,7 +3180,6 @@ function conversationWorkCallback(options) {
|
|
|
3223
3180
|
run: async (message, metadata) => {
|
|
3224
3181
|
await processConversationQueueMessage(message, options, metadata);
|
|
3225
3182
|
},
|
|
3226
|
-
topic: resolveConversationWorkQueueTopic(options),
|
|
3227
3183
|
verify: verifyConversationQueueMessage,
|
|
3228
3184
|
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds ?? resolveConversationWorkVisibilityTimeoutSeconds()
|
|
3229
3185
|
});
|
|
@@ -3232,17 +3188,8 @@ function conversationWorkCallback(options) {
|
|
|
3232
3188
|
function createVercelConversationWorkCallback(options) {
|
|
3233
3189
|
return conversationWorkCallback(options).create();
|
|
3234
3190
|
}
|
|
3235
|
-
/** Return the queue consumer for conversation work, for a pulling queue worker. */
|
|
3236
|
-
function conversationWorkQueueConsumer(options) {
|
|
3237
|
-
return conversationWorkCallback(options).consumer;
|
|
3238
|
-
}
|
|
3239
|
-
/** Register the Vercel Queue local-dev consumer for Nitro's central route dispatcher. */
|
|
3240
|
-
function registerVercelConversationWorkDevConsumer(options) {
|
|
3241
|
-
return conversationWorkCallback(options).registerDev();
|
|
3242
|
-
}
|
|
3243
3191
|
// src/chat/sandbox/snapshot/job-callback.ts
|
|
3244
3192
|
/** Receive queue messages for Workspace snapshot builds. */
|
|
3245
|
-
const WORKSPACE_SNAPSHOT_JOB_DEV_CONSUMER_GROUP = "junior_workspace_snapshots_dev";
|
|
3246
3193
|
function logWorkspaceSnapshotJobRejected(reason, metadata) {
|
|
3247
3194
|
logWarn("workspace.snapshot.job.queue_message.rejected", {
|
|
3248
3195
|
"app.queue.consumer_group": metadata.consumerGroup,
|
|
@@ -3254,11 +3201,9 @@ function logWorkspaceSnapshotJobRejected(reason, metadata) {
|
|
|
3254
3201
|
}
|
|
3255
3202
|
function workspaceSnapshotJobCallback() {
|
|
3256
3203
|
return queueCallback({
|
|
3257
|
-
consumerGroup: WORKSPACE_SNAPSHOT_JOB_DEV_CONSUMER_GROUP,
|
|
3258
3204
|
maxDeliveries: null,
|
|
3259
3205
|
onRejected: logWorkspaceSnapshotJobRejected,
|
|
3260
3206
|
run: async (message) => await processWorkspaceSnapshotJob(message),
|
|
3261
|
-
topic: WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC,
|
|
3262
3207
|
verify: verifyWorkspaceSnapshotJobMessage
|
|
3263
3208
|
});
|
|
3264
3209
|
}
|
|
@@ -3266,17 +3211,8 @@ function workspaceSnapshotJobCallback() {
|
|
|
3266
3211
|
function createVercelWorkspaceSnapshotJobCallback() {
|
|
3267
3212
|
return workspaceSnapshotJobCallback().create();
|
|
3268
3213
|
}
|
|
3269
|
-
/** Return the queue consumer for snapshot builds, for a pulling queue worker. */
|
|
3270
|
-
function workspaceSnapshotJobQueueConsumer() {
|
|
3271
|
-
return workspaceSnapshotJobCallback().consumer;
|
|
3272
|
-
}
|
|
3273
|
-
/** Receive snapshot build messages during local development. */
|
|
3274
|
-
function registerVercelWorkspaceSnapshotJobDevConsumer() {
|
|
3275
|
-
return workspaceSnapshotJobCallback().registerDev();
|
|
3276
|
-
}
|
|
3277
3214
|
// src/chat/services/background-compaction-callback.ts
|
|
3278
3215
|
/** Receive background compaction jobs from the queue. */
|
|
3279
|
-
const BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP = "junior_context_compaction_dev";
|
|
3280
3216
|
const BACKGROUND_COMPACTION_MAX_DELIVERIES = 3;
|
|
3281
3217
|
function logRejected(reason, metadata) {
|
|
3282
3218
|
logWarn("context_compaction.queue_message.rejected", {
|
|
@@ -3289,11 +3225,9 @@ function logRejected(reason, metadata) {
|
|
|
3289
3225
|
}
|
|
3290
3226
|
function backgroundCompactionCallback() {
|
|
3291
3227
|
return queueCallback({
|
|
3292
|
-
consumerGroup: BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP,
|
|
3293
3228
|
maxDeliveries: BACKGROUND_COMPACTION_MAX_DELIVERIES,
|
|
3294
3229
|
onRejected: logRejected,
|
|
3295
3230
|
run: async (message, metadata) => await processBackgroundCompaction(message, { enqueuedAtMs: metadata.createdAt.getTime() }),
|
|
3296
|
-
topic: BACKGROUND_COMPACTION_QUEUE_TOPIC,
|
|
3297
3231
|
verify: verifyBackgroundCompactionMessage
|
|
3298
3232
|
});
|
|
3299
3233
|
}
|
|
@@ -3301,14 +3235,6 @@ function backgroundCompactionCallback() {
|
|
|
3301
3235
|
function createVercelBackgroundCompactionCallback() {
|
|
3302
3236
|
return backgroundCompactionCallback().create();
|
|
3303
3237
|
}
|
|
3304
|
-
/** Return the queue consumer for background compaction, for a pulling worker. */
|
|
3305
|
-
function backgroundCompactionQueueConsumer() {
|
|
3306
|
-
return backgroundCompactionCallback().consumer;
|
|
3307
|
-
}
|
|
3308
|
-
/** Receive background compaction jobs during local development. */
|
|
3309
|
-
function registerVercelBackgroundCompactionDevConsumer() {
|
|
3310
|
-
return backgroundCompactionCallback().registerDev();
|
|
3311
|
-
}
|
|
3312
3238
|
// src/handlers/artifacts.ts
|
|
3313
3239
|
/** Serve one content-addressed public artifact without authentication. */
|
|
3314
3240
|
async function publicArtifactGET(args) {
|
|
@@ -5018,6 +4944,17 @@ const mcpClientSchema = z.object({
|
|
|
5018
4944
|
const invalidClientSchema = z.object({ invalid: z.literal(true) }).strict();
|
|
5019
4945
|
const cachedClientSchema = z.union([mcpClientSchema, invalidClientSchema]);
|
|
5020
4946
|
/**
|
|
4947
|
+
* Junior's own iOS app (`apps/ios`). Every Junior knows it, so sign-in does
|
|
4948
|
+
* not depend on a hosted document. Its redirect uses the app's URL scheme,
|
|
4949
|
+
* which the browser sheet gives back only to the app that opened it. The
|
|
4950
|
+
* app sends this client ID, so it must never change.
|
|
4951
|
+
*/
|
|
4952
|
+
const JUNIOR_IOS_CLIENT = {
|
|
4953
|
+
clientId: "https://junior.sentry.dev/clients/ios",
|
|
4954
|
+
name: "iOS app",
|
|
4955
|
+
redirectUris: ["junior-ios://oauth/callback"]
|
|
4956
|
+
};
|
|
4957
|
+
/**
|
|
5021
4958
|
* Parse a CIMD client ID. It must be a canonical `https:` URL with a path,
|
|
5022
4959
|
* no fragment, no credentials, and no loopback or private IP host.
|
|
5023
4960
|
*/
|
|
@@ -5073,11 +5010,12 @@ function fetchClientMetadataDocument(url) {
|
|
|
5073
5010
|
});
|
|
5074
5011
|
}
|
|
5075
5012
|
/**
|
|
5076
|
-
* Resolve a client from its CIMD URL. Return
|
|
5077
|
-
* its document is invalid. Valid documents
|
|
5078
|
-
* failed fetches for 1 minute.
|
|
5013
|
+
* Resolve a client: Junior's iOS app, or a client from its CIMD URL. Return
|
|
5014
|
+
* `undefined` when the client ID or its document is invalid. Valid documents
|
|
5015
|
+
* are cached for 5 minutes, and failed fetches for 1 minute.
|
|
5079
5016
|
*/
|
|
5080
5017
|
async function resolveMcpClient(state, clientId) {
|
|
5018
|
+
if (clientId === JUNIOR_IOS_CLIENT.clientId) return JUNIOR_IOS_CLIENT;
|
|
5081
5019
|
const url = parseClientId(clientId);
|
|
5082
5020
|
if (!url) return void 0;
|
|
5083
5021
|
const key = mcpStateKey("client", sha256Hex(clientId));
|
|
@@ -5103,9 +5041,12 @@ function isLoopbackHttp(url) {
|
|
|
5103
5041
|
* Return true when a requested redirect URI is allowed for a client. The URI
|
|
5104
5042
|
* must be `https:` or loopback `http:`, and must equal a registered URI. A
|
|
5105
5043
|
* loopback URI may use any port (RFC 8252 section 7.3), because native
|
|
5106
|
-
* clients such as Claude Code listen on a random port.
|
|
5044
|
+
* clients such as Claude Code listen on a random port. Junior's iOS app uses
|
|
5045
|
+
* exactly its registered URI.
|
|
5107
5046
|
*/
|
|
5108
|
-
function redirectUriMatches(
|
|
5047
|
+
function redirectUriMatches(client, requested) {
|
|
5048
|
+
if (client.clientId === JUNIOR_IOS_CLIENT.clientId) return JUNIOR_IOS_CLIENT.redirectUris.includes(requested);
|
|
5049
|
+
const registered = client.redirectUris;
|
|
5109
5050
|
const url = URL.parse(requested);
|
|
5110
5051
|
if (!url || requested.includes("#") || url.protocol !== "https:" && !isLoopbackHttp(url)) return false;
|
|
5111
5052
|
return registered.some((entry) => {
|
|
@@ -5121,7 +5062,7 @@ function redirectUriMatches(registered, requested) {
|
|
|
5121
5062
|
* other origins.
|
|
5122
5063
|
*/
|
|
5123
5064
|
function renderMcpPage(page) {
|
|
5124
|
-
const formAction = ["'self'", ...page.
|
|
5065
|
+
const formAction = ["'self'", ...page.formActionSource ? [page.formActionSource] : []];
|
|
5125
5066
|
const message = ` <p>${escapeHtml(page.message)}</p>`;
|
|
5126
5067
|
return renderHtmlPage({
|
|
5127
5068
|
bodyHtml: page.bodyHtml ? `${message}\n${page.bodyHtml}` : message,
|
|
@@ -5154,7 +5095,7 @@ const MCP_SCOPES = [
|
|
|
5154
5095
|
/** What each scope lets the client do, as the consent page says it. */
|
|
5155
5096
|
const MCP_SCOPE_DESCRIPTIONS = {
|
|
5156
5097
|
"conversations:read": "List and read the conversations that you started or take part in",
|
|
5157
|
-
"conversations:manage": "Archive, pin, and mark your conversations read, stop a running Turn, and cancel queued messages",
|
|
5098
|
+
"conversations:manage": "Archive, pin, rename, and mark your conversations read, stop a running Turn, and cancel queued messages",
|
|
5158
5099
|
"conversations:write": "Start conversations and send messages as you. Each message starts agent work",
|
|
5159
5100
|
"inbox_items:read": "List and read your inbox items",
|
|
5160
5101
|
"automations:read": "List and read the automations that you can see"
|
|
@@ -5290,7 +5231,7 @@ async function handleMcpAuthorize(args) {
|
|
|
5290
5231
|
const redirectUri = params.get("redirect_uri") ?? "";
|
|
5291
5232
|
const client = await resolveMcpClient(args.state, clientId);
|
|
5292
5233
|
if (!client) return invalidClientPage("The client ID is not a valid client metadata document URL.");
|
|
5293
|
-
if (!redirectUriMatches(client
|
|
5234
|
+
if (!redirectUriMatches(client, redirectUri)) return invalidClientPage("The redirect URI is not registered by this client.");
|
|
5294
5235
|
const oauthState = params.get("state") ?? void 0;
|
|
5295
5236
|
const fail = (error, description) => authorizationRedirect({
|
|
5296
5237
|
issuer: args.urls.issuer,
|
|
@@ -5593,6 +5534,10 @@ function blockedPage() {
|
|
|
5593
5534
|
title: "Request blocked"
|
|
5594
5535
|
});
|
|
5595
5536
|
}
|
|
5537
|
+
function formActionSource(redirectUri) {
|
|
5538
|
+
const url = new URL(redirectUri);
|
|
5539
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : url.protocol;
|
|
5540
|
+
}
|
|
5596
5541
|
function consentPage(args) {
|
|
5597
5542
|
const clientHost = new URL(args.authorization.clientId).host;
|
|
5598
5543
|
const clientName = args.authorization.clientName ?? clientHost;
|
|
@@ -5607,7 +5552,7 @@ function consentPage(args) {
|
|
|
5607
5552
|
<button type="submit" name="action" value="deny">Deny</button>
|
|
5608
5553
|
<button type="submit" name="action" value="approve" class="primary">Allow</button>
|
|
5609
5554
|
</form>`,
|
|
5610
|
-
|
|
5555
|
+
formActionSource: formActionSource(args.authorization.redirectUri),
|
|
5611
5556
|
message: `${clientName} wants to connect to ${args.agentName}.`,
|
|
5612
5557
|
status: 200,
|
|
5613
5558
|
title: `Connect ${clientName}`
|
|
@@ -6891,6 +6836,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
6891
6836
|
"/api/inbox/*",
|
|
6892
6837
|
"/api/inbox-items",
|
|
6893
6838
|
"/api/inbox-items/*",
|
|
6839
|
+
"/api/search",
|
|
6894
6840
|
"/api/personal-tokens",
|
|
6895
6841
|
"/api/personal-tokens/*",
|
|
6896
6842
|
"/api/service-accounts",
|
|
@@ -7050,23 +6996,6 @@ function mountRoutes(app, routes) {
|
|
|
7050
6996
|
else if (explicitMethods.length > 0) app.on(explicitMethods, route.path, handler);
|
|
7051
6997
|
}
|
|
7052
6998
|
}
|
|
7053
|
-
async function startQueueWorker(consumers, backgroundWork) {
|
|
7054
|
-
const provider = getQueueProvider();
|
|
7055
|
-
if (!provider.startWorker) throw new Error(`The ${provider.messagingSystem} queue provider has no queue worker`);
|
|
7056
|
-
const worker = await provider.startWorker(consumers);
|
|
7057
|
-
return { close: async () => {
|
|
7058
|
-
try {
|
|
7059
|
-
await worker.close();
|
|
7060
|
-
} finally {
|
|
7061
|
-
while (backgroundWork.size > 0) await Promise.allSettled(backgroundWork);
|
|
7062
|
-
try {
|
|
7063
|
-
await disconnectStateAdapter();
|
|
7064
|
-
} finally {
|
|
7065
|
-
await closeDb();
|
|
7066
|
-
}
|
|
7067
|
-
}
|
|
7068
|
-
} };
|
|
7069
|
-
}
|
|
7070
6999
|
/** Create a Hono app with all Junior routes. */
|
|
7071
7000
|
async function createApp(options) {
|
|
7072
7001
|
const virtualConfig = await resolveVirtualConfig();
|
|
@@ -7139,7 +7068,7 @@ async function createApp(options) {
|
|
|
7139
7068
|
pluginRoutes = getPluginRoutes({
|
|
7140
7069
|
dispatchForIdentity,
|
|
7141
7070
|
events,
|
|
7142
|
-
showInboxItem:
|
|
7071
|
+
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7143
7072
|
});
|
|
7144
7073
|
if (dashboard && !dashboard.disabled) {
|
|
7145
7074
|
pluginApiRoutes = getPluginApiRoutes();
|
|
@@ -7172,7 +7101,6 @@ async function createApp(options) {
|
|
|
7172
7101
|
sandbox: { tracePropagation },
|
|
7173
7102
|
visionContext: { attachmentStorage }
|
|
7174
7103
|
};
|
|
7175
|
-
const backgroundWork = /* @__PURE__ */ new Set();
|
|
7176
7104
|
let conversationWorkOptions;
|
|
7177
7105
|
const getConversationWorkOptions = () => {
|
|
7178
7106
|
conversationWorkOptions ??= options?.conversationWork ?? createProductionConversationWorkOptions({
|
|
@@ -7180,11 +7108,7 @@ async function createApp(options) {
|
|
|
7180
7108
|
queue: conversationWorkQueue,
|
|
7181
7109
|
sendPluginTask,
|
|
7182
7110
|
services: runtimeServiceOverrides,
|
|
7183
|
-
waitUntil
|
|
7184
|
-
backgroundWork.add(task);
|
|
7185
|
-
task.finally(() => backgroundWork.delete(task)).catch(() => void 0);
|
|
7186
|
-
waitUntil(task);
|
|
7187
|
-
}
|
|
7111
|
+
waitUntil
|
|
7188
7112
|
});
|
|
7189
7113
|
return conversationWorkOptions;
|
|
7190
7114
|
};
|
|
@@ -7325,14 +7249,7 @@ async function createApp(options) {
|
|
|
7325
7249
|
});
|
|
7326
7250
|
let agentContinuePOST;
|
|
7327
7251
|
let pluginTaskPOST;
|
|
7328
|
-
|
|
7329
|
-
registerVercelConversationWorkDevConsumer(getConversationWorkOptions());
|
|
7330
|
-
registerVercelPluginTaskDevConsumer();
|
|
7331
|
-
registerVercelWorkspaceSnapshotJobDevConsumer();
|
|
7332
|
-
registerVercelCacheWarmupDevConsumer();
|
|
7333
|
-
registerVercelBackgroundCompactionDevConsumer();
|
|
7334
|
-
}
|
|
7335
|
-
app.post("/api/internal/agent/continue", (c) => {
|
|
7252
|
+
app.post(JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, (c) => {
|
|
7336
7253
|
agentContinuePOST ??= createVercelConversationWorkCallback(getConversationWorkOptions());
|
|
7337
7254
|
return agentContinuePOST(c.req.raw);
|
|
7338
7255
|
});
|
|
@@ -7360,7 +7277,7 @@ async function createApp(options) {
|
|
|
7360
7277
|
conversationWorkQueue,
|
|
7361
7278
|
dispatchForIdentity,
|
|
7362
7279
|
events,
|
|
7363
|
-
showInboxItem:
|
|
7280
|
+
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7364
7281
|
});
|
|
7365
7282
|
});
|
|
7366
7283
|
app.get("/api/internal/retention", (c) => {
|
|
@@ -7375,12 +7292,6 @@ async function createApp(options) {
|
|
|
7375
7292
|
app.post("/api/webhooks/:platform", (c) => {
|
|
7376
7293
|
return new Response(`Unknown platform: ${c.req.param("platform")}`, { status: 404 });
|
|
7377
7294
|
});
|
|
7378
|
-
return
|
|
7379
|
-
conversationWorkQueueConsumer(getConversationWorkOptions()),
|
|
7380
|
-
pluginTaskQueueConsumer(),
|
|
7381
|
-
workspaceSnapshotJobQueueConsumer(),
|
|
7382
|
-
cacheWarmupQueueConsumer(),
|
|
7383
|
-
backgroundCompactionQueueConsumer()
|
|
7384
|
-
], backgroundWork) });
|
|
7295
|
+
return app;
|
|
7385
7296
|
}
|
|
7386
7297
|
export { JUNIOR_VERSION, createApp, defineJuniorPlugins };
|