@sentry/junior 0.312.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-iIq7ihf7.js → adapter-JARQvoLw.js} +1 -2
- package/dist/{adapter-context-BRjEWRy1.js → adapter-context-B4BrJZuS.js} +2 -2
- package/dist/{admin-DhInw5K9.js → admin-BXGAySz0.js} +1 -1
- package/dist/{agent-runner-C9iDurwX.js → agent-runner-qZU5TR8i.js} +865 -138
- 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 +340 -106
- package/dist/{app-DRFrC8Mw.d.ts → app-D7tKnw9a.d.ts} +4 -21
- package/dist/app.d.ts +2 -2
- package/dist/app.js +80 -171
- package/dist/{background-compaction-queue-DrKi7w3d.js → background-compaction-queue-C_uIBUvS.js} +6 -17
- package/dist/{callback-mFlTUWWx.js → callback-C8SdXCwr.js} +4 -11
- package/dist/{catalog-runtime-D7xapBAX.js → catalog-runtime-BLKtnUL3.js} +1 -1
- package/dist/{channel-access-CJGfNTdn.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-kXB2Y5tl.js → config-BIfHKNXN.js} +40 -35
- package/dist/{continue-in-slack-O6pV5004.js → continue-in-slack-fnmD2Ifb.js} +5 -7
- package/dist/{conversation-feed-uNOv_x68.js → conversation-feed-DdFQuQDR.js} +13 -2
- package/dist/{logging-dQ9ZRGQ8.js → conversation-privacy-DtZhI91r.js} +188 -2
- package/dist/{conversation-turn-CeLbHqdw.js → conversation-turn-DScuDYmN.js} +465 -62
- package/dist/create-CrNt4Ewu.js +212 -0
- package/dist/{credential-sync-I8VBGk05.js → credential-sync-CtqsGjj1.js} +14 -18
- package/dist/{credentialed-Cb6E2phL.js → credentialed-dWRA3-oJ.js} +911 -429
- package/dist/{db-LAyyX8tk.js → db-BTmLKZrp.js} +2245 -50
- package/dist/{db-BbC5stfa.d.ts → db-DcmzbA55.d.ts} +2 -2
- package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
- package/dist/{html-BCZ3Xtb_.js → html-B8rBt7F4.js} +5 -7
- package/dist/{install-DCFJFkC0.js → install-OtFboxOM.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-B_m-4TJw.js → lineage-EULJkGO1.js} +1 -2
- package/dist/{list-CN2QA2R9.js → list-C5400AlJ.js} +284 -113
- package/dist/{thread-state-DhPndWi1.js → mailbox-turn-DL3Lvsm0.js} +4830 -485
- package/dist/markers-DUP8aBOp.js +323 -0
- package/dist/{media-CYm1QD8T.js → media-FYM-Bl3H.js} +42 -14
- package/dist/{message-DSXGj1hM.js → message-DuDelZFr.js} +16 -15
- package/dist/{model-input--TrP9hYV.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-DHCZC6B4.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
- package/dist/{oauth-relay-pPMGnDZt.js → oauth-relay-PwPMdZJv.js} +1 -1
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{registry-CZOzddwu.js → registry-D6kS6xYH.js} +1402 -64
- package/dist/{statuses-_cRJHXK7.js → reporting-window-C4dbzDiR.js} +1 -27
- package/dist/{resolve-cKOQ14Dh.js → resolve-D8CPJcNK.js} +3 -3
- package/dist/result-D090hxr5.js +402 -0
- package/dist/{runner-DBfUW44l.js → runner-BU7fgrm-.js} +7 -8
- package/dist/{sandbox-egress-signals-BVF_xAm1.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
- package/dist/{schema-Bk9Nm2E8.js → schema-7gW9vBpJ.js} +91 -10
- package/dist/{schema-BEHKxr4I.d.ts → schema-BB6E0wyV.d.ts} +2105 -2753
- package/dist/{service-account-CVYsFjty.js → service-account-plA-uzIB.js} +6 -5
- package/dist/{skills-VTnhAJWm.js → skills-CIosT6bS.js} +3 -3
- package/dist/{slack-conversation-unfurl-fuLnF1jE.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
- package/dist/spawn-DRjdzh3R.js +46 -0
- package/dist/{start-conversation-CEn2KH1A.js → start-conversation-a4NXH4X9.js} +13 -202
- package/dist/{store-DFZaN-Ix.js → store-BuhF1QDm.js} +2 -4
- package/dist/{task-queue-Cx4Lmjyk.js → task-queue-CrRjFzOh.js} +5 -16
- package/dist/{task-runner-CbTwFA6k.js → task-runner-C-pXsgHM.js} +105 -51
- package/dist/{thread-context-BkAZDTX2.js → thread-context-CDX4dSZd.js} +8 -10
- 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-nIzMtAVJ.js → validation-bTq88sya.js} +1 -1
- package/dist/{vercel-queue-hW90XzbG.js → vercel-queue-nL0Hq3hr.js} +32 -147
- package/dist/{version-Brbtz4Qf.js → version-DGUa1dZK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-BDA5myRK.js → warmup-CCOuIwAS.js} +831 -3254
- package/dist/{worker-D63RcaVD.js → worker-AkZg7Dg1.js} +5 -6
- package/migrations/0158_keep_legacy_archive_columns.sql +5 -0
- package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -0
- 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/0158_snapshot.json +6515 -0
- package/migrations/meta/0159_snapshot.json +6515 -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 +84 -0
- package/package.json +9 -18
- package/skills/design-automation-skill/SKILL.md +2 -3
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/child-message-DcsritGf.js +0 -179
- package/dist/conversation-privacy-L4ja1_W6.js +0 -189
- package/dist/executor-SCub-fAq.js +0 -1860
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/ingest-BDf3D50j.js +0 -3836
- package/dist/result-DcvEOe1r.js +0 -574
- package/dist/result-event-type-BdIJuZxg.js +0 -48
- package/dist/service-account-Ts4ulcrV.js +0 -931
- package/dist/spawn-vxAarlX5.js +0 -73
- package/dist/state-C1P3_Ywk.js +0 -161
|
@@ -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,48 +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 { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-DcvEOe1r.js";
|
|
20
|
-
import { o as requestAttachmentDeletion, t as collectAttachmentGarbage } from "./store-DFZaN-Ix.js";
|
|
21
|
-
import { c as conversationTurnIdForMessage, d as recordWebConversationActivity, f as webActorFromUser, h as collectAttachmentUploadGarbage, l as createAndEnqueueConversation, s as appendAndEnqueueWebMessage } from "./start-conversation-CEn2KH1A.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";
|
|
22
19
|
import { i as getActiveSpan, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
23
|
-
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";
|
|
24
21
|
import { t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
25
22
|
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { s as joinPublicChannel } from "./channel-access-
|
|
31
|
-
import { t as queueCallback } from "./callback-
|
|
32
|
-
import { t as processConversationWork } from "./worker-
|
|
33
|
-
import { t as bindMessageAgent } from "./message-
|
|
34
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
35
|
-
import { a as
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
39
|
-
import { b as conversationPendingMessageDeliverySchema, t as conversationFeedQuerySchema } from "./conversation-feed-
|
|
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";
|
|
40
37
|
import { createRequire } from "node:module";
|
|
41
38
|
import { Hono } from "hono";
|
|
42
39
|
import * as z from "zod";
|
|
43
40
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
44
41
|
import { eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
45
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";
|
|
46
44
|
import { pathToFileURL } from "node:url";
|
|
47
45
|
import { Message, ThreadImpl } from "chat";
|
|
48
46
|
import net from "node:net";
|
|
@@ -988,7 +986,6 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
988
986
|
const DEFAULT_PLUGIN_LIMIT = 25;
|
|
989
987
|
const PLUGIN_HEARTBEAT_TIMEOUT_MS = 25e3;
|
|
990
988
|
const DISPATCH_MAILBOX_APPEND_LIMIT = 100;
|
|
991
|
-
const AGENT_INVOCATION_MAILBOX_APPEND_LIMIT = 100;
|
|
992
989
|
async function runWithTimeout(promise, timeoutMs) {
|
|
993
990
|
let timeout;
|
|
994
991
|
try {
|
|
@@ -1055,47 +1052,6 @@ async function recoverPendingDispatchMailboxAppends(args) {
|
|
|
1055
1052
|
logException(error, "dispatch.mailbox.append_recovery.failed", { "app.dispatch.id": id });
|
|
1056
1053
|
}
|
|
1057
1054
|
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Run `work` for each item. Items for one mailbox run one at a time in list
|
|
1060
|
-
* order, so its appends keep that order. Different mailboxes run at once.
|
|
1061
|
-
*/
|
|
1062
|
-
async function runPerMailbox(items, mailboxOf, work) {
|
|
1063
|
-
const byMailbox = /* @__PURE__ */ new Map();
|
|
1064
|
-
for (const item of items) {
|
|
1065
|
-
const mailbox = mailboxOf(item);
|
|
1066
|
-
byMailbox.set(mailbox, [...byMailbox.get(mailbox) ?? [], item]);
|
|
1067
|
-
}
|
|
1068
|
-
await mapBounded([...byMailbox.values()], async (group) => {
|
|
1069
|
-
for (const item of group) await work(item);
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
/** Repair invocation creation that stopped before its idempotent mailbox append. */
|
|
1073
|
-
async function recoverPendingAgentInvocationMailboxAppends(args) {
|
|
1074
|
-
await runPerMailbox(await listPendingAgentInvocationMailboxAppends(AGENT_INVOCATION_MAILBOX_APPEND_LIMIT), (invocation) => invocation.childConversationId, async (invocation) => {
|
|
1075
|
-
try {
|
|
1076
|
-
await enqueueAgentInvocation(invocation, {
|
|
1077
|
-
nowMs: args.nowMs,
|
|
1078
|
-
queue: args.conversationWorkQueue
|
|
1079
|
-
});
|
|
1080
|
-
} catch (error) {
|
|
1081
|
-
logException(error, "agent.invocation.mailbox.append_recovery.failed", { "app.agent.invocation_id": invocation.invocationId });
|
|
1082
|
-
}
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
/** Repair terminal agent invocation results that never reached their parent. */
|
|
1086
|
-
async function recoverPendingAgentInvocationResults(args) {
|
|
1087
|
-
await runPerMailbox(await listPendingAgentInvocationResults(AGENT_INVOCATION_MAILBOX_APPEND_LIMIT), (invocation) => invocation.parentConversationId, async (invocation) => {
|
|
1088
|
-
try {
|
|
1089
|
-
await recordSubagentEnded(invocation);
|
|
1090
|
-
await enqueueAgentInvocationResult(invocation, {
|
|
1091
|
-
nowMs: args.nowMs,
|
|
1092
|
-
queue: args.conversationWorkQueue
|
|
1093
|
-
});
|
|
1094
|
-
} catch (error) {
|
|
1095
|
-
logException(error, "agent.invocation.result.recovery.failed", { "app.agent.invocation_id": invocation.invocationId });
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
1055
|
/** Run the core heartbeat phases. */
|
|
1100
1056
|
async function runHeartbeat(args) {
|
|
1101
1057
|
const queue = args.conversationWorkQueue ?? getVercelConversationWorkQueue();
|
|
@@ -1112,14 +1068,6 @@ async function runHeartbeat(args) {
|
|
|
1112
1068
|
conversationWorkQueue: queue,
|
|
1113
1069
|
nowMs: args.nowMs
|
|
1114
1070
|
});
|
|
1115
|
-
await recoverPendingAgentInvocationMailboxAppends({
|
|
1116
|
-
conversationWorkQueue: queue,
|
|
1117
|
-
nowMs: args.nowMs
|
|
1118
|
-
});
|
|
1119
|
-
await recoverPendingAgentInvocationResults({
|
|
1120
|
-
conversationWorkQueue: queue,
|
|
1121
|
-
nowMs: args.nowMs
|
|
1122
|
-
});
|
|
1123
1071
|
try {
|
|
1124
1072
|
const dispatchCount = await runScheduledAutomationHeartbeat({
|
|
1125
1073
|
conversationWorkQueue: queue,
|
|
@@ -1135,6 +1083,11 @@ async function runHeartbeat(args) {
|
|
|
1135
1083
|
} catch (error) {
|
|
1136
1084
|
logException(error, "inbox_snoozes.heartbeat.failed");
|
|
1137
1085
|
}
|
|
1086
|
+
try {
|
|
1087
|
+
await runInboxItemPushTimers(getDb(), args.nowMs);
|
|
1088
|
+
} catch (error) {
|
|
1089
|
+
logException(error, "inbox_item_push.heartbeat.failed");
|
|
1090
|
+
}
|
|
1138
1091
|
try {
|
|
1139
1092
|
await syncAutomationAlerts(getDb(), args.nowMs);
|
|
1140
1093
|
} catch (error) {
|
|
@@ -1213,6 +1166,10 @@ async function GET$3(request, waitUntil, options) {
|
|
|
1213
1166
|
return new Response("Accepted", { status: 202 });
|
|
1214
1167
|
}
|
|
1215
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
|
+
});
|
|
1216
1173
|
/** Discover a root and its current descendants via `parent_conversation_id`. */
|
|
1217
1174
|
async function discoverConversationTree(executor, root) {
|
|
1218
1175
|
const all = /* @__PURE__ */ new Map([[root.conversationId, root]]);
|
|
@@ -1895,7 +1852,7 @@ async function act(args) {
|
|
|
1895
1852
|
});
|
|
1896
1853
|
const delivery = {
|
|
1897
1854
|
queue: services.queue,
|
|
1898
|
-
show:
|
|
1855
|
+
show: createInboxItemShow(() => services.adapter)
|
|
1899
1856
|
};
|
|
1900
1857
|
let recordOnly = args.action === "dismiss";
|
|
1901
1858
|
let item;
|
|
@@ -2757,7 +2714,7 @@ async function routeParsedMessage(args) {
|
|
|
2757
2714
|
});
|
|
2758
2715
|
return;
|
|
2759
2716
|
}
|
|
2760
|
-
if (route === "mention"
|
|
2717
|
+
if (route === "mention" && await resumeConversationDelivery(conversationId)) await pushConversationInboxItemsNow(conversationId);
|
|
2761
2718
|
if (isSubscribed && !isExperimentalFeatureEnabled("passive-routing")) {
|
|
2762
2719
|
await saveSkippedSlackMessage({
|
|
2763
2720
|
conversationId,
|
|
@@ -2784,7 +2741,7 @@ async function routeParsedMessage(args) {
|
|
|
2784
2741
|
conversationId,
|
|
2785
2742
|
delivery: {
|
|
2786
2743
|
queue: args.queue,
|
|
2787
|
-
show:
|
|
2744
|
+
show: createInboxItemShow(() => args.adapter)
|
|
2788
2745
|
},
|
|
2789
2746
|
resolveUser: async () => {
|
|
2790
2747
|
const teamId = args.installation.teamId;
|
|
@@ -3122,7 +3079,6 @@ async function POST(request, waitUntil, services) {
|
|
|
3122
3079
|
waitUntil
|
|
3123
3080
|
}));
|
|
3124
3081
|
}
|
|
3125
|
-
const CONVERSATION_WORK_DEV_CONSUMER_GROUP = "junior_conversation_work_dev";
|
|
3126
3082
|
/** Parse the signed callback body before conversation work reaches the worker. */
|
|
3127
3083
|
function parseConversationQueueMessage(message) {
|
|
3128
3084
|
const parsed = conversationQueueMessageSchema.safeParse(message);
|
|
@@ -3208,7 +3164,6 @@ function logConversationQueueMessageRejected(reason, metadata, error) {
|
|
|
3208
3164
|
}
|
|
3209
3165
|
function conversationWorkCallback(options) {
|
|
3210
3166
|
return queueCallback({
|
|
3211
|
-
consumerGroup: CONVERSATION_WORK_DEV_CONSUMER_GROUP,
|
|
3212
3167
|
maxDeliveries: null,
|
|
3213
3168
|
onRejected: logConversationQueueMessageRejected,
|
|
3214
3169
|
permanentError: (error) => isConversationQueueMessageRejectedError(error) ? error.reason : void 0,
|
|
@@ -3225,7 +3180,6 @@ function conversationWorkCallback(options) {
|
|
|
3225
3180
|
run: async (message, metadata) => {
|
|
3226
3181
|
await processConversationQueueMessage(message, options, metadata);
|
|
3227
3182
|
},
|
|
3228
|
-
topic: resolveConversationWorkQueueTopic(options),
|
|
3229
3183
|
verify: verifyConversationQueueMessage,
|
|
3230
3184
|
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds ?? resolveConversationWorkVisibilityTimeoutSeconds()
|
|
3231
3185
|
});
|
|
@@ -3234,17 +3188,8 @@ function conversationWorkCallback(options) {
|
|
|
3234
3188
|
function createVercelConversationWorkCallback(options) {
|
|
3235
3189
|
return conversationWorkCallback(options).create();
|
|
3236
3190
|
}
|
|
3237
|
-
/** Return the queue consumer for conversation work, for a pulling queue worker. */
|
|
3238
|
-
function conversationWorkQueueConsumer(options) {
|
|
3239
|
-
return conversationWorkCallback(options).consumer;
|
|
3240
|
-
}
|
|
3241
|
-
/** Register the Vercel Queue local-dev consumer for Nitro's central route dispatcher. */
|
|
3242
|
-
function registerVercelConversationWorkDevConsumer(options) {
|
|
3243
|
-
return conversationWorkCallback(options).registerDev();
|
|
3244
|
-
}
|
|
3245
3191
|
// src/chat/sandbox/snapshot/job-callback.ts
|
|
3246
3192
|
/** Receive queue messages for Workspace snapshot builds. */
|
|
3247
|
-
const WORKSPACE_SNAPSHOT_JOB_DEV_CONSUMER_GROUP = "junior_workspace_snapshots_dev";
|
|
3248
3193
|
function logWorkspaceSnapshotJobRejected(reason, metadata) {
|
|
3249
3194
|
logWarn("workspace.snapshot.job.queue_message.rejected", {
|
|
3250
3195
|
"app.queue.consumer_group": metadata.consumerGroup,
|
|
@@ -3256,11 +3201,9 @@ function logWorkspaceSnapshotJobRejected(reason, metadata) {
|
|
|
3256
3201
|
}
|
|
3257
3202
|
function workspaceSnapshotJobCallback() {
|
|
3258
3203
|
return queueCallback({
|
|
3259
|
-
consumerGroup: WORKSPACE_SNAPSHOT_JOB_DEV_CONSUMER_GROUP,
|
|
3260
3204
|
maxDeliveries: null,
|
|
3261
3205
|
onRejected: logWorkspaceSnapshotJobRejected,
|
|
3262
3206
|
run: async (message) => await processWorkspaceSnapshotJob(message),
|
|
3263
|
-
topic: WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC,
|
|
3264
3207
|
verify: verifyWorkspaceSnapshotJobMessage
|
|
3265
3208
|
});
|
|
3266
3209
|
}
|
|
@@ -3268,17 +3211,8 @@ function workspaceSnapshotJobCallback() {
|
|
|
3268
3211
|
function createVercelWorkspaceSnapshotJobCallback() {
|
|
3269
3212
|
return workspaceSnapshotJobCallback().create();
|
|
3270
3213
|
}
|
|
3271
|
-
/** Return the queue consumer for snapshot builds, for a pulling queue worker. */
|
|
3272
|
-
function workspaceSnapshotJobQueueConsumer() {
|
|
3273
|
-
return workspaceSnapshotJobCallback().consumer;
|
|
3274
|
-
}
|
|
3275
|
-
/** Receive snapshot build messages during local development. */
|
|
3276
|
-
function registerVercelWorkspaceSnapshotJobDevConsumer() {
|
|
3277
|
-
return workspaceSnapshotJobCallback().registerDev();
|
|
3278
|
-
}
|
|
3279
3214
|
// src/chat/services/background-compaction-callback.ts
|
|
3280
3215
|
/** Receive background compaction jobs from the queue. */
|
|
3281
|
-
const BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP = "junior_context_compaction_dev";
|
|
3282
3216
|
const BACKGROUND_COMPACTION_MAX_DELIVERIES = 3;
|
|
3283
3217
|
function logRejected(reason, metadata) {
|
|
3284
3218
|
logWarn("context_compaction.queue_message.rejected", {
|
|
@@ -3291,11 +3225,9 @@ function logRejected(reason, metadata) {
|
|
|
3291
3225
|
}
|
|
3292
3226
|
function backgroundCompactionCallback() {
|
|
3293
3227
|
return queueCallback({
|
|
3294
|
-
consumerGroup: BACKGROUND_COMPACTION_DEV_CONSUMER_GROUP,
|
|
3295
3228
|
maxDeliveries: BACKGROUND_COMPACTION_MAX_DELIVERIES,
|
|
3296
3229
|
onRejected: logRejected,
|
|
3297
3230
|
run: async (message, metadata) => await processBackgroundCompaction(message, { enqueuedAtMs: metadata.createdAt.getTime() }),
|
|
3298
|
-
topic: BACKGROUND_COMPACTION_QUEUE_TOPIC,
|
|
3299
3231
|
verify: verifyBackgroundCompactionMessage
|
|
3300
3232
|
});
|
|
3301
3233
|
}
|
|
@@ -3303,14 +3235,6 @@ function backgroundCompactionCallback() {
|
|
|
3303
3235
|
function createVercelBackgroundCompactionCallback() {
|
|
3304
3236
|
return backgroundCompactionCallback().create();
|
|
3305
3237
|
}
|
|
3306
|
-
/** Return the queue consumer for background compaction, for a pulling worker. */
|
|
3307
|
-
function backgroundCompactionQueueConsumer() {
|
|
3308
|
-
return backgroundCompactionCallback().consumer;
|
|
3309
|
-
}
|
|
3310
|
-
/** Receive background compaction jobs during local development. */
|
|
3311
|
-
function registerVercelBackgroundCompactionDevConsumer() {
|
|
3312
|
-
return backgroundCompactionCallback().registerDev();
|
|
3313
|
-
}
|
|
3314
3238
|
// src/handlers/artifacts.ts
|
|
3315
3239
|
/** Serve one content-addressed public artifact without authentication. */
|
|
3316
3240
|
async function publicArtifactGET(args) {
|
|
@@ -5020,6 +4944,17 @@ const mcpClientSchema = z.object({
|
|
|
5020
4944
|
const invalidClientSchema = z.object({ invalid: z.literal(true) }).strict();
|
|
5021
4945
|
const cachedClientSchema = z.union([mcpClientSchema, invalidClientSchema]);
|
|
5022
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
|
+
/**
|
|
5023
4958
|
* Parse a CIMD client ID. It must be a canonical `https:` URL with a path,
|
|
5024
4959
|
* no fragment, no credentials, and no loopback or private IP host.
|
|
5025
4960
|
*/
|
|
@@ -5075,11 +5010,12 @@ function fetchClientMetadataDocument(url) {
|
|
|
5075
5010
|
});
|
|
5076
5011
|
}
|
|
5077
5012
|
/**
|
|
5078
|
-
* Resolve a client from its CIMD URL. Return
|
|
5079
|
-
* its document is invalid. Valid documents
|
|
5080
|
-
* 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.
|
|
5081
5016
|
*/
|
|
5082
5017
|
async function resolveMcpClient(state, clientId) {
|
|
5018
|
+
if (clientId === JUNIOR_IOS_CLIENT.clientId) return JUNIOR_IOS_CLIENT;
|
|
5083
5019
|
const url = parseClientId(clientId);
|
|
5084
5020
|
if (!url) return void 0;
|
|
5085
5021
|
const key = mcpStateKey("client", sha256Hex(clientId));
|
|
@@ -5105,9 +5041,12 @@ function isLoopbackHttp(url) {
|
|
|
5105
5041
|
* Return true when a requested redirect URI is allowed for a client. The URI
|
|
5106
5042
|
* must be `https:` or loopback `http:`, and must equal a registered URI. A
|
|
5107
5043
|
* loopback URI may use any port (RFC 8252 section 7.3), because native
|
|
5108
|
-
* 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.
|
|
5109
5046
|
*/
|
|
5110
|
-
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;
|
|
5111
5050
|
const url = URL.parse(requested);
|
|
5112
5051
|
if (!url || requested.includes("#") || url.protocol !== "https:" && !isLoopbackHttp(url)) return false;
|
|
5113
5052
|
return registered.some((entry) => {
|
|
@@ -5123,7 +5062,7 @@ function redirectUriMatches(registered, requested) {
|
|
|
5123
5062
|
* other origins.
|
|
5124
5063
|
*/
|
|
5125
5064
|
function renderMcpPage(page) {
|
|
5126
|
-
const formAction = ["'self'", ...page.
|
|
5065
|
+
const formAction = ["'self'", ...page.formActionSource ? [page.formActionSource] : []];
|
|
5127
5066
|
const message = ` <p>${escapeHtml(page.message)}</p>`;
|
|
5128
5067
|
return renderHtmlPage({
|
|
5129
5068
|
bodyHtml: page.bodyHtml ? `${message}\n${page.bodyHtml}` : message,
|
|
@@ -5156,7 +5095,7 @@ const MCP_SCOPES = [
|
|
|
5156
5095
|
/** What each scope lets the client do, as the consent page says it. */
|
|
5157
5096
|
const MCP_SCOPE_DESCRIPTIONS = {
|
|
5158
5097
|
"conversations:read": "List and read the conversations that you started or take part in",
|
|
5159
|
-
"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",
|
|
5160
5099
|
"conversations:write": "Start conversations and send messages as you. Each message starts agent work",
|
|
5161
5100
|
"inbox_items:read": "List and read your inbox items",
|
|
5162
5101
|
"automations:read": "List and read the automations that you can see"
|
|
@@ -5292,7 +5231,7 @@ async function handleMcpAuthorize(args) {
|
|
|
5292
5231
|
const redirectUri = params.get("redirect_uri") ?? "";
|
|
5293
5232
|
const client = await resolveMcpClient(args.state, clientId);
|
|
5294
5233
|
if (!client) return invalidClientPage("The client ID is not a valid client metadata document URL.");
|
|
5295
|
-
if (!redirectUriMatches(client
|
|
5234
|
+
if (!redirectUriMatches(client, redirectUri)) return invalidClientPage("The redirect URI is not registered by this client.");
|
|
5296
5235
|
const oauthState = params.get("state") ?? void 0;
|
|
5297
5236
|
const fail = (error, description) => authorizationRedirect({
|
|
5298
5237
|
issuer: args.urls.issuer,
|
|
@@ -5595,6 +5534,10 @@ function blockedPage() {
|
|
|
5595
5534
|
title: "Request blocked"
|
|
5596
5535
|
});
|
|
5597
5536
|
}
|
|
5537
|
+
function formActionSource(redirectUri) {
|
|
5538
|
+
const url = new URL(redirectUri);
|
|
5539
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : url.protocol;
|
|
5540
|
+
}
|
|
5598
5541
|
function consentPage(args) {
|
|
5599
5542
|
const clientHost = new URL(args.authorization.clientId).host;
|
|
5600
5543
|
const clientName = args.authorization.clientName ?? clientHost;
|
|
@@ -5609,7 +5552,7 @@ function consentPage(args) {
|
|
|
5609
5552
|
<button type="submit" name="action" value="deny">Deny</button>
|
|
5610
5553
|
<button type="submit" name="action" value="approve" class="primary">Allow</button>
|
|
5611
5554
|
</form>`,
|
|
5612
|
-
|
|
5555
|
+
formActionSource: formActionSource(args.authorization.redirectUri),
|
|
5613
5556
|
message: `${clientName} wants to connect to ${args.agentName}.`,
|
|
5614
5557
|
status: 200,
|
|
5615
5558
|
title: `Connect ${clientName}`
|
|
@@ -6893,6 +6836,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
6893
6836
|
"/api/inbox/*",
|
|
6894
6837
|
"/api/inbox-items",
|
|
6895
6838
|
"/api/inbox-items/*",
|
|
6839
|
+
"/api/search",
|
|
6896
6840
|
"/api/personal-tokens",
|
|
6897
6841
|
"/api/personal-tokens/*",
|
|
6898
6842
|
"/api/service-accounts",
|
|
@@ -7052,23 +6996,6 @@ function mountRoutes(app, routes) {
|
|
|
7052
6996
|
else if (explicitMethods.length > 0) app.on(explicitMethods, route.path, handler);
|
|
7053
6997
|
}
|
|
7054
6998
|
}
|
|
7055
|
-
async function startQueueWorker(consumers, backgroundWork) {
|
|
7056
|
-
const provider = getQueueProvider();
|
|
7057
|
-
if (!provider.startWorker) throw new Error(`The ${provider.messagingSystem} queue provider has no queue worker`);
|
|
7058
|
-
const worker = await provider.startWorker(consumers);
|
|
7059
|
-
return { close: async () => {
|
|
7060
|
-
try {
|
|
7061
|
-
await worker.close();
|
|
7062
|
-
} finally {
|
|
7063
|
-
while (backgroundWork.size > 0) await Promise.allSettled(backgroundWork);
|
|
7064
|
-
try {
|
|
7065
|
-
await disconnectStateAdapter();
|
|
7066
|
-
} finally {
|
|
7067
|
-
await closeDb();
|
|
7068
|
-
}
|
|
7069
|
-
}
|
|
7070
|
-
} };
|
|
7071
|
-
}
|
|
7072
6999
|
/** Create a Hono app with all Junior routes. */
|
|
7073
7000
|
async function createApp(options) {
|
|
7074
7001
|
const virtualConfig = await resolveVirtualConfig();
|
|
@@ -7141,7 +7068,7 @@ async function createApp(options) {
|
|
|
7141
7068
|
pluginRoutes = getPluginRoutes({
|
|
7142
7069
|
dispatchForIdentity,
|
|
7143
7070
|
events,
|
|
7144
|
-
showInboxItem:
|
|
7071
|
+
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7145
7072
|
});
|
|
7146
7073
|
if (dashboard && !dashboard.disabled) {
|
|
7147
7074
|
pluginApiRoutes = getPluginApiRoutes();
|
|
@@ -7174,7 +7101,6 @@ async function createApp(options) {
|
|
|
7174
7101
|
sandbox: { tracePropagation },
|
|
7175
7102
|
visionContext: { attachmentStorage }
|
|
7176
7103
|
};
|
|
7177
|
-
const backgroundWork = /* @__PURE__ */ new Set();
|
|
7178
7104
|
let conversationWorkOptions;
|
|
7179
7105
|
const getConversationWorkOptions = () => {
|
|
7180
7106
|
conversationWorkOptions ??= options?.conversationWork ?? createProductionConversationWorkOptions({
|
|
@@ -7182,11 +7108,7 @@ async function createApp(options) {
|
|
|
7182
7108
|
queue: conversationWorkQueue,
|
|
7183
7109
|
sendPluginTask,
|
|
7184
7110
|
services: runtimeServiceOverrides,
|
|
7185
|
-
waitUntil
|
|
7186
|
-
backgroundWork.add(task);
|
|
7187
|
-
task.finally(() => backgroundWork.delete(task)).catch(() => void 0);
|
|
7188
|
-
waitUntil(task);
|
|
7189
|
-
}
|
|
7111
|
+
waitUntil
|
|
7190
7112
|
});
|
|
7191
7113
|
return conversationWorkOptions;
|
|
7192
7114
|
};
|
|
@@ -7327,14 +7249,7 @@ async function createApp(options) {
|
|
|
7327
7249
|
});
|
|
7328
7250
|
let agentContinuePOST;
|
|
7329
7251
|
let pluginTaskPOST;
|
|
7330
|
-
|
|
7331
|
-
registerVercelConversationWorkDevConsumer(getConversationWorkOptions());
|
|
7332
|
-
registerVercelPluginTaskDevConsumer();
|
|
7333
|
-
registerVercelWorkspaceSnapshotJobDevConsumer();
|
|
7334
|
-
registerVercelCacheWarmupDevConsumer();
|
|
7335
|
-
registerVercelBackgroundCompactionDevConsumer();
|
|
7336
|
-
}
|
|
7337
|
-
app.post("/api/internal/agent/continue", (c) => {
|
|
7252
|
+
app.post(JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, (c) => {
|
|
7338
7253
|
agentContinuePOST ??= createVercelConversationWorkCallback(getConversationWorkOptions());
|
|
7339
7254
|
return agentContinuePOST(c.req.raw);
|
|
7340
7255
|
});
|
|
@@ -7362,7 +7277,7 @@ async function createApp(options) {
|
|
|
7362
7277
|
conversationWorkQueue,
|
|
7363
7278
|
dispatchForIdentity,
|
|
7364
7279
|
events,
|
|
7365
|
-
showInboxItem:
|
|
7280
|
+
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7366
7281
|
});
|
|
7367
7282
|
});
|
|
7368
7283
|
app.get("/api/internal/retention", (c) => {
|
|
@@ -7377,12 +7292,6 @@ async function createApp(options) {
|
|
|
7377
7292
|
app.post("/api/webhooks/:platform", (c) => {
|
|
7378
7293
|
return new Response(`Unknown platform: ${c.req.param("platform")}`, { status: 404 });
|
|
7379
7294
|
});
|
|
7380
|
-
return
|
|
7381
|
-
conversationWorkQueueConsumer(getConversationWorkOptions()),
|
|
7382
|
-
pluginTaskQueueConsumer(),
|
|
7383
|
-
workspaceSnapshotJobQueueConsumer(),
|
|
7384
|
-
cacheWarmupQueueConsumer(),
|
|
7385
|
-
backgroundCompactionQueueConsumer()
|
|
7386
|
-
], backgroundWork) });
|
|
7295
|
+
return app;
|
|
7387
7296
|
}
|
|
7388
7297
|
export { JUNIOR_VERSION, createApp, defineJuniorPlugins };
|