@sentry/junior 0.316.0 → 0.318.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/{admin-QYiDMnsu.js → admin-UOHix_5P.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-DeYymwh2.js} +13494 -13135
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-DH8bx7jU.js} +5 -5
- package/dist/api/schema.d.ts +600 -130
- package/dist/api/schema.js +6 -6
- package/dist/api.js +228 -214
- package/dist/{app-BhvzRD__.d.ts → app-DKAOuaoC.d.ts} +33 -18
- package/dist/app.d.ts +1 -1
- package/dist/app.js +193 -177
- package/dist/{thread-context-fiMNylbg.js → auth-pause-state-f9hJM_zO.js} +6 -59
- package/dist/catalog-runtime-BfdAnztW.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-Bref7aPI.js → channel-access-A0de5lRv.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-D3Wd7f5n.js} +6 -5
- package/dist/{child-message--2G3Ft26.js → child-message-peFWLcCZ.js} +2 -6
- package/dist/cli/chat.js +38 -30
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +4 -2
- package/dist/cli/upgrade.js +5 -3
- package/dist/context-BKF_5zzI.js +1833 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-YxwMQVeR.js} +3 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed-Cj7IuBtM.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-Cr_dNW1p.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-Bru4w_FD.js} +196 -80
- package/dist/{create-DUJBXr6E.js → create-Btl1y1rq.js} +12 -11
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-DTarZ63K.js} +20 -15
- package/dist/{db-DhzvUY23.js → db-of6e3sGt.js} +20724 -27256
- package/dist/{deployment-BhvrhQeh.js → deployment-C0qXa0FD.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-C_QL_bMQ.js} +304 -56
- package/dist/{html-B_12WjKT.js → html-9_pS9SjY.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-B2XEvpif.js} +392 -26
- package/dist/{lineage-D3AZAJVe.js → lineage-nh4z9iQN.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-HRP3TIRl.js} +238 -550
- package/dist/{logging-B8KEJegM.js → logging-BnOG0qz2.js} +4 -50
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-Byrry9o1.js} +4807 -7102
- package/dist/{list-mkB_GU8R.js → markers-CTTtJqYn.js} +171 -124
- package/dist/{message-B5fKDYzz.js → message-BRUuLgrY.js} +13 -24
- package/dist/{model-input-CuMWy37l.js → model-input-CFC62mf-.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +21 -7
- package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CjnnUr4o.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-BvHFH0fV.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-iHw1uu32.js +4657 -0
- package/dist/{transcript-CCi7323k.js → prompt-DEkStuxG.js} +92 -98
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-Cl7Labpe.js +3279 -0
- package/dist/reports-C1d9azyV.js +195 -0
- package/dist/{resolve-D5JVvv6A.js → resolve-DC6zBuDV.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-DxewDuXb.js} +27 -118
- package/dist/run-conversation-Cz2ubZK-.js +337 -0
- package/dist/{runner-BzAES5W3.js → runner-99YxVN_r.js} +10 -18
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-CgoX5CTI.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-BTojNBr5.js} +48 -86
- package/dist/sender-actors-77zTQbSG.js +84 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-YDCPSByj.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-CleC0Hze.js} +6 -5
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-BNQLC12R.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-DuZfodPa.js} +5 -5
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-Ci6Ck4gk.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-BJ9Up3bG.js} +30 -53
- package/dist/topics-BoCkoPJJ.js +21 -0
- package/dist/turn-membership-VT7XZh-L.js +856 -0
- package/dist/{turn-wake-BjDW7x-5.js → turn-wake-C7HeLHAM.js} +3 -4
- package/dist/{media-BebquhET.js → types-DCzTAA63.js} +629 -593
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-Cb9c1k9q.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-BiUmWPhy.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-VEXiEcZu.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-ChWYQdhm.js} +5 -4
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
- package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
- package/package.json +5 -5
- package/dist/people-CUtFApfL.js +0 -81
- package/dist/start-conversation-B-LIqqNi.js +0 -162
- package/dist/turn-session-routing-D15orfwy.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
package/dist/app.js
CHANGED
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { E as parseSlackChannelId, F as slackMessageTsFromMs, G as loadConfig, I as slackMessageTsSchema, K as parseEnvList, L as botConfig, M as slackTeamIdSchema, P as parseSlackMessageTs, R as getChatConfig, S as MUTATION_LOCK_TTL_MS, T as withLock, W as installChatConfig, c as createSlackActor, j as slackChannelIdSchema, p as parseActorUserId, w as fenceLock, y as getStateAdapter } from "./context-BKF_5zzI.js";
|
|
2
|
+
import { Ad as juniorTurnOutbox, Ci as postSlackEphemeralMessage, Dt as validatePlugins, Ea as automationVersionOf, En as pruneActiveConversation, Et as setPlugins, Fr as verifyConversationQueueMessage, Ga as refreshAutomationLastRun, Hn as resolveSlackInboxItemCardConversationId, Hs as getWorkspaceTeamId, Jn as parseSlackInboxItemFormTarget, Jo as subjectKey, Jr as annotationKeyDigest, Kc as deleteExpiredInboxSnoozes, Kn as buildSlackInboxItemModal, Lr as conversationQueueMessageSchema, Ms as getSlackClient, Nr as getVercelConversationWorkQueue, O as withConversationMutationLock, Oi as slackEntitySchema, Pa as existingConversationId, Pi as slackMention, Po as takeDueTimerWatches, Pr as resolveConversationWorkTopic, Q as canActOnInboxItem, Qa as syncAutomationAlerts, R as conversationCostOf, Rd as juniorQuestions, Rn as createInboxItemShow, Rr as isConversationQueueMessageRejectedError, Sf as juniorDestinations, Si as openSlackModal, Sn as hasRunnableConversationWork, St as inboxItemVisibility, Su as createConversationEmbedder, Tc as searchInboxItems, Un as syncInboxItemSlackCards, Ur as getQueueProvider, Us as runWithWorkspaceTeamId, Ut as appendAndEnqueueInboundMessage, Vd as juniorAutomationRuns, Vn as runInboxItemPushTimers, Wd as juniorAutomations, Wn as findSlackThreadOwnerId, Xn as parseSlackUserInputSubmission, Xr as runWithSlackInstallation, Xs as resolveViewerUser, Yd as juniorInboxItems, Yr as decodeAnnotationRef, Zd as juniorAgentBindings, Zr as verifySlackSignature, Zt as clearExpiredConversationLease, _i as notifyAutomationBlocked, a as getDb, af as juniorTurns, an as getConversationWorkState, ar as createVercelPluginTaskCallback, bd as touchConversationDetail, bu as isEventEmbeddingsEnabled, ca as readScheduledAutomation, co as SLACK_EVENT_NAMESPACE, cr as sendVercelPluginTask, cu as embedConversationEvents, da as scheduledRunId, di as listPendingDispatchMailboxAppends, dl as projectConversationMessages, ec as resolveActorIdentityId, ef as juniorConversationEventLexemes, er as createPluginEventPublisher, et as canAnswerInboxItem, fa as withScheduledAutomationLock, fs as isPublicConversation, hf as juniorConversations, hi as markDispatchFailed, ht as isPluginInboxItem, i as getConversationStore, if as juniorConversationEvents, ii as getDispatchConversationId, in as getConversation, is as listConversationAnnotations, jc as itemQuestion, jd as juniorTurnInbox, ki as slackExternalRefIdSchema, lr as queueCallback, lt as inboxItemReaderForUser, lu as eventIndexLockKey, m as deleteMessageLinks, mu as storeConversationEventLexemes, n as getConversationEventStore, nf as juniorConversationEmbeddings, ni as confirmDispatchMailboxAppend, nl as getDashboardInboxItemLink, nr as getPluginRoutes, o as getSqlExecutor, oa as listScheduledAutomationsForTeam, qn as parseSlackInboxItemClick, qr as renderSlackObjectCard, qs as readActorIdentity, rn as ensureConversationWake, rt as inboxItemAddedByAnyAutomation, sc as recordGoogleSignIn, si as getDispatchRecord, sl as getDashboardTaskLink, sn as listActiveConversationIds, su as EVENT_INDEX_LOCK_TTL_MS, tf as juniorConversationEventEmbeddings, tl as getDashboardConversationLink, tr as getPluginApiRoutes, ts as resumeConversationDelivery, u as isPostgresErrorCode, ua as saveScheduledAutomationInLock, ui as isTerminalDispatchStatus, uo as slackChannelMessageEvent, ut as inboxItemReaderForUserInConversation, v as withConversationEventLock, vn as CONVERSATION_WORK_STALE_ENQUEUE_MS, vr as canAddConversationMessages, wn as isInvalidConversationRecordError, wr as readConversationAccessFromSql, wt as getRegistrations, xd as createSlackDestination, xt as inboxItemOwnerConversationId, xu as backfillConversationEmbeddings, yc as dismissOpenInboxItems, zc as parseAvatarUrl, zn as pushConversationInboxItemsNow } from "./db-of6e3sGt.js";
|
|
3
|
+
import { C as withContext, D as GOOGLE_IDENTITY_PROVIDER, T as withSpan, f as logException, k as normalizeIdentityEmail, m as logWarn, n as createRequestContext, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
|
|
4
|
+
import { A as vercelBackgroundCompactionQueue, At as parseSlackThreadId, Ft as unpublishedArtifactHeaders, K as stopConversation, N as createVercelCacheWarmupCallback, Nt as publicArtifactHeaders, Pt as readPublicArtifact, Qt as automationCardStatus, W as markConversationRead, Wt as ViewerTaskNotFoundError, X as inboxItemChangeRecord, Y as deliverInboxItemChange, Yt as readViewerAutomationSummary, Z as renderInboxItemMessage, Zt as readViewerAutomations, ct as appendAndEnqueueWebMessage, d as logScheduledAutomationRunSkipped, en as findAutomationSkill, f as scheduledAutomationRunAttributes, ft as recordWebConversationActivity, gt as collectAttachmentUploadGarbage, j as verifyBackgroundCompactionMessage, k as processBackgroundCompaction, lt as conversationTurnIdForMessage, n as executeAgentRun, nn as effectiveTaskOutcomes, pt as webActorFromUser, qt as readViewerAutomationExecutions, t as createAgentRunner, tn as missingAutomationSkillReason, ut as createAndEnqueueConversation } from "./agent-runner-DeYymwh2.js";
|
|
5
|
+
import { A as createUserTokenStore, C as clearSandboxEgressSignals, D as parseSandboxEgressCredentialToken, P as normalizeSandboxEgressTracePropagationDomains, T as consumeSandboxEgressPermissionDeniedSignal, c as isVercelSandboxEgressRequest, l as proxyVercelSandboxEgressRequest, w as consumeSandboxEgressAuthRequiredSignal } from "./profile-iHw1uu32.js";
|
|
6
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
|
|
7
|
+
import { $ as reviewItemChange, At as createProductionSlackWebhookServices, B as mcpIdempotencyKeySchema, Bt as startProcessingReaction, Dt as isPublicAddress, F as mcpAuthorizationSchema$1, Ft as normalizeIncomingSlackThreadId, G as readMcpPendingWork, H as mcpMessageTextSchema, Ht as parseContent, I as mcpConversation, It as withNormalizedThreadId, K as readMcpPendingWorkAfterSend, Kt as readConversationRecordFromSql, L as mcpConversationIdSchema, Lt as recordSkippedConversationMessage, Mt as buildSlackInboundMessage, Nt as clearSlackPendingReactions, Ot as publicAddressLookup, P as mcpAcceptedMessageSchema, Pt as slackInboundMessageId, Q as readInboxItemForUser, R as mcpConversationSchema, Rt as createSlackWebApiStatusSender, St as readObjectLinkTypes, U as mcpMessages, Ut as SubscribedReplyReason, V as mcpMessageSchema, Vt as stripLeadingBotMention, W as mcpPendingMessagesSchema, Wt as getThreadStopDecision, X as actOnInboxItem, Y as InboxItemActionError, Z as closeInboxItemsAnsweredByReply, _ as createConversationForViewer, _t as backfillCacheWarmingGaps, a as resolveInboxItemSubjects, b as encodeConversationCursor, ct as listOpenAutomationQuestions, dt as getScheduledAutomationDispatch, et as createEventAppPublisher, ft as runInboxSnoozeTimers, g as appendConversationMessageForViewer, ht as runSavingsRefillSlice, jt as getProductionSlackAdapter, kt as createProductionConversationWorkOptions, lt as createHeartbeatContext, n as readConversationFeed, nt as runAutoArchiveSweep, o as readConversationDetail, ot as automationReplyAttribution, st as settleEventAutomationRuns, tt as ingestEventAutomations, ut as dispatchScheduledAutomation, vt as GET$4, w as conversationOperations, y as decodeConversationCursor, z as mcpCursorSchema, zt as bindMessageAuthorIdentityId } from "./list-HRP3TIRl.js";
|
|
8
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BiUmWPhy.js";
|
|
9
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-D_Ru4CWc.js";
|
|
10
|
+
import { n as processWorkspaceSnapshotJob, o as ingestEvent, r as verifyWorkspaceSnapshotJobMessage } from "./job-runner-B2XEvpif.js";
|
|
11
|
+
import { o as enqueueAgentDispatch, s as failStoppedDispatch } from "./run-conversation-Cz2ubZK-.js";
|
|
12
|
+
import { I as findTrustedUser, It as renderTaskInput, L as isAllowedDomain, Nn as appendConversationMessages, R as isTrustedSlackAuthor, Rn as settleConversationTitleWork, gt as coerceThreadConversationState, rn as isExperimentalFeatureEnabled, t as getAuthPausedConversationTurnId, z as parseEmail } from "./mailbox-turn-Byrry9o1.js";
|
|
13
|
+
import { Bt as annotationCard, Dn as automationTaskSchema, Nn as getNextRunAtMs, On as automationTaskText, _ as automationListQuerySchema, _n as buttonUserInputField, fn as inboxItemQuestion, p as automationExecutionStatusSchema, rn as scheduledRunSchema } from "./types-DCzTAA63.js";
|
|
14
|
+
import { t as createEndStoppedChildWork } from "./result-DxewDuXb.js";
|
|
15
|
+
import { l as collectAttachmentGarbage, p as requestAttachmentDeletion, y as getAttachmentStorage } from "./turn-membership-VT7XZh-L.js";
|
|
16
|
+
import { h as createPluginLogger } from "./prompt-DEkStuxG.js";
|
|
13
17
|
import { i as getActiveSpan, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
14
|
-
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
18
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-DTarZ63K.js";
|
|
15
19
|
import { t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
16
|
-
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-
|
|
17
|
-
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-
|
|
18
|
-
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-
|
|
19
|
-
import {
|
|
20
|
-
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_DELIVERY_CALLBACK_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./deployment-
|
|
21
|
-
import {
|
|
22
|
-
import { t as
|
|
23
|
-
import { t as
|
|
24
|
-
import { t as
|
|
25
|
-
import { f as
|
|
26
|
-
import {
|
|
27
|
-
import { t as
|
|
28
|
-
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed-B84pMjHo.js";
|
|
20
|
+
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
21
|
+
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-BNQLC12R.js";
|
|
22
|
+
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-9_pS9SjY.js";
|
|
23
|
+
import { s as joinPublicChannel } from "./channel-access-A0de5lRv.js";
|
|
24
|
+
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_DELIVERY_CALLBACK_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./deployment-C0qXa0FD.js";
|
|
25
|
+
import { t as processConversationWork } from "./worker-ChWYQdhm.js";
|
|
26
|
+
import { t as bindMessageAgent } from "./message-BRUuLgrY.js";
|
|
27
|
+
import { t as bindSpawnAgent } from "./spawn-DuZfodPa.js";
|
|
28
|
+
import { l as readConversationLastEventSeq, o as readConversationEventPage, s as readConversationEventPageAfter, t as processPluginTask, u as readConversationMessageEventSeq } from "./task-runner-BJ9Up3bG.js";
|
|
29
|
+
import { c as replyText, d as publishTurnStep, f as countMetric, i as turnStepConsumer, l as createDeliveryConsumer, n as turnTools, o as findStalledTurns, p as withSpan$1, r as createGatewayModelClient, s as findStalledDeliveries, t as createEngineContext, u as publishDelivery } from "./engine-context-C_QL_bMQ.js";
|
|
30
|
+
import { t as JUNIOR_VERSION } from "./version-VEXiEcZu.js";
|
|
31
|
+
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed-Cj7IuBtM.js";
|
|
29
32
|
import { t as isMissingVirtualModule } from "./virtual-module-BeKA_EII.js";
|
|
30
33
|
import { createRequire } from "node:module";
|
|
31
34
|
import { Hono } from "hono";
|
|
32
35
|
import * as z from "zod";
|
|
33
|
-
import {
|
|
34
|
-
import { destinationSchema, eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
35
|
-
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, notExists, or, sql } from "drizzle-orm";
|
|
36
|
+
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, notExists, or, sql } from "drizzle-orm";
|
|
36
37
|
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
38
|
+
import { destinationSchema, eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
39
|
+
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
40
|
+
import { pathToFileURL } from "node:url";
|
|
37
41
|
import { Message, ThreadImpl } from "chat";
|
|
38
42
|
import net from "node:net";
|
|
39
|
-
import { pathToFileURL } from "node:url";
|
|
40
43
|
import { decodeJwt } from "jose";
|
|
41
44
|
import { HTTPException } from "hono/http-exception";
|
|
42
45
|
import https from "node:https";
|
|
@@ -403,7 +406,7 @@ async function writeRun(db, run, automationVersion) {
|
|
|
403
406
|
automationId: stored.taskId,
|
|
404
407
|
claimedAtMs: stored.claimedAtMs,
|
|
405
408
|
completedAtMs: stored.completedAtMs ?? null,
|
|
406
|
-
|
|
409
|
+
...dispatchConversationId ? { conversationId: existingConversationId(dispatchConversationId) } : void 0,
|
|
407
410
|
costMicroUsd: dispatchConversationId ? conversationCostOf(dispatchConversationId) : null,
|
|
408
411
|
dispatchId: stored.dispatchId ?? null,
|
|
409
412
|
errorMessage: stored.errorMessage ?? null,
|
|
@@ -696,12 +699,16 @@ const SCHEDULED_AUTOMATION_HEARTBEAT_LIMIT = 10;
|
|
|
696
699
|
function singleLineMetadataValue(value) {
|
|
697
700
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
698
701
|
}
|
|
699
|
-
/**
|
|
700
|
-
|
|
702
|
+
/**
|
|
703
|
+
* Render the due scheduled automation as plain agent input, with the open
|
|
704
|
+
* questions of its earlier runs.
|
|
705
|
+
*/
|
|
706
|
+
async function buildDispatchInput(db, task) {
|
|
701
707
|
return renderTaskInput({
|
|
702
708
|
creator: slackMention(task.createdBy.slackUserId),
|
|
703
709
|
instructions: automationTaskText(task.task),
|
|
704
710
|
...task.task.kind === "skill" ? { skill: task.task.skill } : void 0,
|
|
711
|
+
openQuestions: await listOpenAutomationQuestions(db, task.id),
|
|
705
712
|
outcomes: effectiveTaskOutcomes(task.outcomes, task.destination)
|
|
706
713
|
});
|
|
707
714
|
}
|
|
@@ -939,7 +946,7 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
939
946
|
} } : void 0,
|
|
940
947
|
destination: task.destination,
|
|
941
948
|
destinationVisibility: task.conversationAccess.visibility,
|
|
942
|
-
input: buildDispatchInput(task),
|
|
949
|
+
input: await buildDispatchInput(db, task),
|
|
943
950
|
...skill ? { skill } : void 0,
|
|
944
951
|
metadata: buildDispatchMetadata({
|
|
945
952
|
nowMs: args.nowMs,
|
|
@@ -1136,7 +1143,7 @@ async function runHeartbeat(args) {
|
|
|
1136
1143
|
// src/handlers/scheduler-auth.ts
|
|
1137
1144
|
/** Check the bearer secret that internal cron requests must send. */
|
|
1138
1145
|
function verifySchedulerRequest(request) {
|
|
1139
|
-
const secret =
|
|
1146
|
+
const secret = getChatConfig().secrets.schedulerSecret;
|
|
1140
1147
|
if (!secret) return false;
|
|
1141
1148
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1142
1149
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -1165,11 +1172,26 @@ async function GET$3(request, waitUntil, options) {
|
|
|
1165
1172
|
}));
|
|
1166
1173
|
return new Response("Accepted", { status: 202 });
|
|
1167
1174
|
}
|
|
1175
|
+
// src/chat/plugins/purge-conversations.ts
|
|
1176
|
+
/**
|
|
1177
|
+
* Run the `purgeConversations` hooks in the purge transaction `db`, one
|
|
1178
|
+
* plugin after another. A hook that fails fails the purge, so no plugin
|
|
1179
|
+
* keeps content of a purged transcript.
|
|
1180
|
+
*/
|
|
1181
|
+
async function purgePluginConversationContent(db, conversationIds) {
|
|
1182
|
+
for (const plugin of getRegistrations()) {
|
|
1183
|
+
const hook = plugin.hooks?.purgeConversations;
|
|
1184
|
+
if (!hook) continue;
|
|
1185
|
+
const name = plugin.manifest.name;
|
|
1186
|
+
await hook({
|
|
1187
|
+
conversationIds,
|
|
1188
|
+
db,
|
|
1189
|
+
log: createPluginLogger(name),
|
|
1190
|
+
plugin: { name }
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1168
1194
|
// 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
|
-
});
|
|
1173
1195
|
const juniorConversationBriefs = pgTable("junior_conversation_briefs", { conversationId: text("conversation_id").notNull() });
|
|
1174
1196
|
/** Discover a root and its current descendants via `parent_conversation_id`. */
|
|
1175
1197
|
async function discoverConversationTree(executor, root) {
|
|
@@ -1224,26 +1246,16 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1224
1246
|
select 1 from junior_conversation_events events
|
|
1225
1247
|
where events.conversation_id = tree.conversation_id
|
|
1226
1248
|
)
|
|
1227
|
-
or exists (
|
|
1228
|
-
select 1 from junior_agent_invocations invocations
|
|
1229
|
-
where invocations.parent_conversation_id = tree.conversation_id
|
|
1230
|
-
or invocations.child_conversation_id = tree.conversation_id
|
|
1231
|
-
)
|
|
1232
1249
|
or exists (
|
|
1233
1250
|
select 1 from junior_agent_bindings bindings
|
|
1234
1251
|
where bindings.parent_conversation_id = tree.conversation_id
|
|
1235
1252
|
or bindings.child_conversation_id = tree.conversation_id
|
|
1236
1253
|
)
|
|
1237
1254
|
or exists (
|
|
1238
|
-
select 1 from
|
|
1239
|
-
where
|
|
1240
|
-
and
|
|
1241
|
-
and
|
|
1242
|
-
and inbox_items.automation_id is null
|
|
1243
|
-
)
|
|
1244
|
-
or exists (
|
|
1245
|
-
select 1 from junior_todos todos
|
|
1246
|
-
where todos.conversation_id = tree.conversation_id
|
|
1255
|
+
select 1 from ${juniorInboxItems}
|
|
1256
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1257
|
+
and ${juniorInboxItems.status} = 'open'
|
|
1258
|
+
and not ${inboxItemAddedByAnyAutomation()}
|
|
1247
1259
|
)
|
|
1248
1260
|
or exists (
|
|
1249
1261
|
select 1 from junior_turns turns
|
|
@@ -1270,13 +1282,12 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1270
1282
|
where embeddings.conversation_id = tree.conversation_id
|
|
1271
1283
|
)
|
|
1272
1284
|
or exists (
|
|
1273
|
-
select 1 from
|
|
1274
|
-
where
|
|
1275
|
-
and
|
|
1276
|
-
and inbox_items.visibility = 'private'
|
|
1285
|
+
select 1 from ${juniorInboxItems}
|
|
1286
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1287
|
+
and ${inboxItemVisibility()} = 'private'
|
|
1277
1288
|
and (
|
|
1278
|
-
|
|
1279
|
-
or
|
|
1289
|
+
${juniorInboxItems.status} <> 'open'
|
|
1290
|
+
or not ${inboxItemAddedByAnyAutomation()}
|
|
1280
1291
|
)
|
|
1281
1292
|
)
|
|
1282
1293
|
or exists (
|
|
@@ -1304,8 +1315,9 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1304
1315
|
* event rows for the given conversation and every descendant, stamp
|
|
1305
1316
|
* `transcript_purged_at`, and — for non-public content — null the raw-payload
|
|
1306
1317
|
* metadata (`title`, `channel_name`, legacy actor JSON) so purged private
|
|
1307
|
-
* conversations keep only safe metadata.
|
|
1308
|
-
* deliveries
|
|
1318
|
+
* conversations keep only safe metadata. Turns, Turn inputs and
|
|
1319
|
+
* deliveries, and the data that plugins keep for these conversations go
|
|
1320
|
+
* with the transcript.
|
|
1309
1321
|
* Non-public content also loses its summary, Conversation embedding, legacy
|
|
1310
1322
|
* Briefs, and the Inbox items that it added. The metadata rows themselves
|
|
1311
1323
|
* survive.
|
|
@@ -1354,14 +1366,13 @@ async function purgeConversationTree(executor, args) {
|
|
|
1354
1366
|
await deleteMessageLinks(executor, ids);
|
|
1355
1367
|
await executor.db().delete(juniorTurnInbox).where(inArray(juniorTurnInbox.conversationId, ids));
|
|
1356
1368
|
await executor.db().delete(juniorTurns).where(inArray(juniorTurns.conversationId, ids));
|
|
1357
|
-
await executor.db().delete(juniorAgentInvocations).where(or(inArray(juniorAgentInvocations.parentConversationId, ids), inArray(juniorAgentInvocations.childConversationId, ids)));
|
|
1358
1369
|
await executor.db().delete(juniorAgentBindings).where(or(inArray(juniorAgentBindings.parentConversationId, ids), inArray(juniorAgentBindings.childConversationId, ids)));
|
|
1359
1370
|
await dismissOpenInboxItems(executor.db(), {
|
|
1360
1371
|
ownerConversationIds: ids,
|
|
1361
1372
|
nowMs: args.nowMs,
|
|
1362
1373
|
reason: "Conversation purged"
|
|
1363
1374
|
});
|
|
1364
|
-
await
|
|
1375
|
+
await purgePluginConversationContent(executor.db(), ids);
|
|
1365
1376
|
await requestAttachmentDeletion(executor, ids, args.nowMs);
|
|
1366
1377
|
const scrubMetadata = args.retention ? !isPublic : resolvedScrubMetadata;
|
|
1367
1378
|
await executor.db().update(juniorConversations).set({
|
|
@@ -1377,7 +1388,8 @@ async function purgeConversationTree(executor, args) {
|
|
|
1377
1388
|
if (scrubMetadata) {
|
|
1378
1389
|
await executor.db().delete(juniorConversationBriefs).where(inArray(juniorConversationBriefs.conversationId, ids));
|
|
1379
1390
|
await executor.db().delete(juniorConversationEmbeddings).where(inArray(juniorConversationEmbeddings.conversationId, ids));
|
|
1380
|
-
await executor.db().delete(juniorInboxItems).where(and(
|
|
1391
|
+
await executor.db().delete(juniorInboxItems).where(and(inArray(inboxItemOwnerConversationId(), ids), eq(inboxItemVisibility(), "private"), or(ne(juniorInboxItems.status, "open"), not(inboxItemAddedByAnyAutomation()))));
|
|
1392
|
+
await executor.db().delete(juniorQuestions).where(and(inArray(juniorQuestions.conversationId, ids), notExists(executor.db().select({ id: juniorInboxItems.id }).from(juniorInboxItems).where(itemQuestion))));
|
|
1381
1393
|
}
|
|
1382
1394
|
await touchConversationDetail(executor.db(), ids);
|
|
1383
1395
|
return {
|
|
@@ -1566,7 +1578,7 @@ async function handleSandboxEgressRoute(request, tracePropagationDomains, next)
|
|
|
1566
1578
|
const SANDBOX_EGRESS_TOKEN_HEADER = "x-junior-sandbox-egress-token";
|
|
1567
1579
|
function isLoopbackDevelopmentRequest(request) {
|
|
1568
1580
|
const hostname = new URL(request.url).hostname;
|
|
1569
|
-
return
|
|
1581
|
+
return getChatConfig().development.enabled && (hostname === "127.0.0.1" || hostname === "localhost");
|
|
1570
1582
|
}
|
|
1571
1583
|
/** Clear command-scoped sandbox egress signals through the loopback dev server. */
|
|
1572
1584
|
async function DELETE(request) {
|
|
@@ -1984,7 +1996,8 @@ async function handleSlackInboxItemClick(args) {
|
|
|
1984
1996
|
...common,
|
|
1985
1997
|
action: "submit",
|
|
1986
1998
|
answer: (item) => {
|
|
1987
|
-
const
|
|
1999
|
+
const request = inboxItemQuestion(item.request);
|
|
2000
|
+
const field = request && buttonUserInputField(request);
|
|
1988
2001
|
if (!field?.options.some((option) => option.label === click.label)) throw new InboxItemActionError("conflict", "This card changed. Use the updated card.");
|
|
1989
2002
|
return {
|
|
1990
2003
|
requestId: item.id,
|
|
@@ -2003,13 +2016,16 @@ async function handleSlackInboxItemSubmission(args) {
|
|
|
2003
2016
|
if (!view?.id || !formTarget || !channelId || !messageTs || !threadTs) throw new Error("Slack inbox item form submission is incomplete");
|
|
2004
2017
|
await act({
|
|
2005
2018
|
action: "submit",
|
|
2006
|
-
answer: (item) =>
|
|
2007
|
-
request
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2019
|
+
answer: (item) => {
|
|
2020
|
+
const request = inboxItemQuestion(item.request);
|
|
2021
|
+
return request ? parseSlackUserInputSubmission({
|
|
2022
|
+
request,
|
|
2023
|
+
requestId: item.id,
|
|
2024
|
+
values: view.state?.values ?? {}
|
|
2025
|
+
}) : {
|
|
2026
|
+
requestId: item.id,
|
|
2027
|
+
values: {}
|
|
2028
|
+
};
|
|
2013
2029
|
},
|
|
2014
2030
|
inputTs: slackMessageTsFromMs(Date.now()),
|
|
2015
2031
|
itemId: formTarget.itemId,
|
|
@@ -3107,7 +3123,7 @@ function resolveConversationWorkVisibilityTimeoutSeconds(functionMaxDurationSeco
|
|
|
3107
3123
|
*/
|
|
3108
3124
|
function queueProcessAttributes(metadata, nowMs) {
|
|
3109
3125
|
return {
|
|
3110
|
-
"messaging.destination.name": metadata?.topicName ??
|
|
3126
|
+
"messaging.destination.name": metadata?.topicName ?? resolveConversationWorkTopic(),
|
|
3111
3127
|
"messaging.system": getQueueProvider().messagingSystem,
|
|
3112
3128
|
...metadata && {
|
|
3113
3129
|
"messaging.message.id": metadata.messageId,
|
|
@@ -3159,7 +3175,7 @@ async function consumeConversationQueueMessage(message, options) {
|
|
|
3159
3175
|
createdAt: new Date(nowMs),
|
|
3160
3176
|
deliveryCount: 1,
|
|
3161
3177
|
messageId: options.messageId,
|
|
3162
|
-
topicName:
|
|
3178
|
+
topicName: resolveConversationWorkTopic(options.topic)
|
|
3163
3179
|
});
|
|
3164
3180
|
}
|
|
3165
3181
|
function logConversationQueueMessageRejected(reason, metadata, error) {
|
|
@@ -3476,9 +3492,11 @@ function createIdentityDispatcher(args) {
|
|
|
3476
3492
|
}
|
|
3477
3493
|
// src/api/acp/conversations.ts
|
|
3478
3494
|
const EVENT_PAGE_SIZE = 50;
|
|
3495
|
+
async function readAccess(conversationId, user) {
|
|
3496
|
+
return (await readConversationAccessFromSql(getDb(), [conversationId], user)).get(conversationId);
|
|
3497
|
+
}
|
|
3479
3498
|
async function hasConversationAccess(conversationId, user) {
|
|
3480
|
-
|
|
3481
|
-
return Boolean(access?.isParticipant);
|
|
3499
|
+
return Boolean((await readAccess(conversationId, user))?.isParticipant);
|
|
3482
3500
|
}
|
|
3483
3501
|
/** Return whether one Turn can return its terminal result without racing cleanup. */
|
|
3484
3502
|
async function turnTerminalIsReady(args) {
|
|
@@ -3528,9 +3546,8 @@ function createAcpConversations(options) {
|
|
|
3528
3546
|
return await hasConversationAccess(conversationId, user);
|
|
3529
3547
|
},
|
|
3530
3548
|
async prompt({ conversationId, idempotencyKey, text, user }) {
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
if (conversation && !await spaceTakesMessagesFrom(conversation, user.id)) return { status: "space_closed" };
|
|
3549
|
+
const access = await readAccess(conversationId, user);
|
|
3550
|
+
if (!canAddConversationMessages(access)) return { status: "not_found" };
|
|
3534
3551
|
const currentCursor = await latestEventCursor(options.eventStore, conversationId);
|
|
3535
3552
|
if (await getAuthPausedConversationTurnId(conversationId)) return { status: "active" };
|
|
3536
3553
|
const result = await appendAndEnqueueWebMessage({
|
|
@@ -4795,7 +4812,6 @@ async function acceptPrompt(args) {
|
|
|
4795
4812
|
});
|
|
4796
4813
|
if (result.status === "not_found") throw acp.RequestError.resourceNotFound(params.sessionId);
|
|
4797
4814
|
if (result.status === "active") throw acp.RequestError.invalidParams({ field: "sessionId" }, "This ACP session already has an active prompt");
|
|
4798
|
-
if (result.status === "space_closed") throw acp.RequestError.invalidParams({ field: "sessionId" }, "Only members of a Space that is not archived can message its Lead");
|
|
4799
4815
|
return {
|
|
4800
4816
|
output: {
|
|
4801
4817
|
afterSeq: result.afterCursor,
|
|
@@ -6127,23 +6143,31 @@ const mcpInboxItemSchema = z.object({
|
|
|
6127
6143
|
updatedAt: z.string(),
|
|
6128
6144
|
url: z.string().optional().describe("Dashboard link to answer it.")
|
|
6129
6145
|
}).strict();
|
|
6130
|
-
/**
|
|
6131
|
-
|
|
6146
|
+
/**
|
|
6147
|
+
* Map an Inbox item to its MCP view for one user. A subject shows only when
|
|
6148
|
+
* it is a web link. Its title comes from the user's card of the link
|
|
6149
|
+
* (`resolveInboxItemSubjects`).
|
|
6150
|
+
*/
|
|
6151
|
+
function mcpInboxItem(item, userId, views) {
|
|
6132
6152
|
const url = getDashboardInboxItemLink(item.id);
|
|
6153
|
+
const view = views.get(subjectKey(item.subject));
|
|
6154
|
+
const question = inboxItemQuestion(item.request);
|
|
6155
|
+
const subjectUrl = view?.url;
|
|
6156
|
+
const subjectTitle = view?.object?.title;
|
|
6133
6157
|
return {
|
|
6134
6158
|
id: item.id,
|
|
6135
6159
|
kind: item.kind,
|
|
6136
6160
|
status: item.status,
|
|
6137
6161
|
title: item.title,
|
|
6138
6162
|
body: item.body,
|
|
6139
|
-
...
|
|
6163
|
+
...question ? { question: question.question } : void 0,
|
|
6140
6164
|
assignees: item.assignedToEveryone ? [] : item.assignees.map((person) => person.displayName ?? person.email),
|
|
6141
6165
|
canAct: canActOnInboxItem(item, userId),
|
|
6142
6166
|
conversationIds: item.conversationIds,
|
|
6143
|
-
...
|
|
6167
|
+
...subjectUrl ? { subject: {
|
|
6144
6168
|
id: item.subject.id,
|
|
6145
|
-
...
|
|
6146
|
-
|
|
6169
|
+
...subjectTitle ? { title: subjectTitle } : void 0,
|
|
6170
|
+
url: subjectUrl
|
|
6147
6171
|
} } : void 0,
|
|
6148
6172
|
createdAt: item.createdAt.toISOString(),
|
|
6149
6173
|
updatedAt: item.updatedAt.toISOString(),
|
|
@@ -6166,7 +6190,9 @@ function registerGetInboxItemTool(server, { user }) {
|
|
|
6166
6190
|
}
|
|
6167
6191
|
}, async ({ id }) => {
|
|
6168
6192
|
try {
|
|
6169
|
-
|
|
6193
|
+
const item = await readInboxItemForUser(user, id);
|
|
6194
|
+
const cards = await resolveInboxItemSubjects(user, [item]);
|
|
6195
|
+
return mcpToolResult({ item: mcpInboxItem(item, user.id, cards) });
|
|
6170
6196
|
} catch (error) {
|
|
6171
6197
|
if (error instanceof InboxItemActionError) return mcpToolError(error.message);
|
|
6172
6198
|
throw error;
|
|
@@ -6344,8 +6370,10 @@ function registerSearchInboxItemsTool(server, { user }) {
|
|
|
6344
6370
|
...q ? { query: q } : void 0,
|
|
6345
6371
|
statuses: ["open"]
|
|
6346
6372
|
});
|
|
6373
|
+
const page = items.slice(0, limit);
|
|
6374
|
+
const cards = await resolveInboxItemSubjects(user, page);
|
|
6347
6375
|
return mcpToolResult({
|
|
6348
|
-
items:
|
|
6376
|
+
items: page.map((item) => mcpInboxItem(item, user.id, cards)),
|
|
6349
6377
|
truncated: items.length > limit
|
|
6350
6378
|
});
|
|
6351
6379
|
});
|
|
@@ -6676,43 +6704,6 @@ async function handleAcpAuthorizationPage(args) {
|
|
|
6676
6704
|
});
|
|
6677
6705
|
return renderResult(args.agentName, result);
|
|
6678
6706
|
}
|
|
6679
|
-
// src/chat/sign-in/allowlist.ts
|
|
6680
|
-
/**
|
|
6681
|
-
* Read the domain list that may use Junior. Slack authors must have a Slack
|
|
6682
|
-
* profile email on one of them, and dashboard Google sign-ins must come from
|
|
6683
|
-
* a Google Workspace account whose `hd` claim is one of them. Slack and the
|
|
6684
|
-
* dashboard share one list. `chat/identities/trust` decides who matches.
|
|
6685
|
-
*/
|
|
6686
|
-
/** Read a list env var: a JSON string array or comma-separated values. */
|
|
6687
|
-
function readEnvList(name) {
|
|
6688
|
-
const value = process.env[name]?.trim();
|
|
6689
|
-
if (!value) return void 0;
|
|
6690
|
-
if (!value.startsWith("[")) return value.split(",");
|
|
6691
|
-
let parsed;
|
|
6692
|
-
try {
|
|
6693
|
-
parsed = JSON.parse(value);
|
|
6694
|
-
} catch (error) {
|
|
6695
|
-
throw new Error(`${name} must be a JSON string array`, { cause: error });
|
|
6696
|
-
}
|
|
6697
|
-
const list = z.array(z.string()).safeParse(parsed);
|
|
6698
|
-
if (!list.success) throw new Error(`${name} must be a JSON string array`);
|
|
6699
|
-
return list.data;
|
|
6700
|
-
}
|
|
6701
|
-
/**
|
|
6702
|
-
* Resolve the allowed domains: the `createApp` option when set, else
|
|
6703
|
-
* `JUNIOR_ALLOWED_DOMAINS`. An empty list allows every domain.
|
|
6704
|
-
*/
|
|
6705
|
-
function resolveAllowedDomains(allowedDomains) {
|
|
6706
|
-
return [...new Set((allowedDomains ?? readEnvList("JUNIOR_ALLOWED_DOMAINS") ?? []).map((value) => value.trim().toLowerCase()).filter(Boolean))];
|
|
6707
|
-
}
|
|
6708
|
-
/**
|
|
6709
|
-
* Fail startup on the removed Google-specific names. Ignoring them would
|
|
6710
|
-
* leave the list empty, which lets every Slack workspace member in.
|
|
6711
|
-
*/
|
|
6712
|
-
function assertNoLegacyAllowedDomains(dashboardOptionKeys) {
|
|
6713
|
-
if (dashboardOptionKeys.includes("allowedGoogleDomains")) throw new Error("dashboard.allowedGoogleDomains was removed; set createApp({ allowedDomains }) instead");
|
|
6714
|
-
if (process.env["JUNIOR_DASHBOARD_GOOGLE_DOMAINS"]?.trim()) throw new Error("JUNIOR_DASHBOARD_GOOGLE_DOMAINS was removed; set JUNIOR_ALLOWED_DOMAINS instead");
|
|
6715
|
-
}
|
|
6716
6707
|
// src/chat/sign-in/auth.ts
|
|
6717
6708
|
/**
|
|
6718
6709
|
* Google sign-in session for the dashboard.
|
|
@@ -6760,15 +6751,15 @@ function trimSlashes(value, leading) {
|
|
|
6760
6751
|
function withHttps(host) {
|
|
6761
6752
|
return host.startsWith("https://") || host.startsWith("http://") ? host : `https://${host}`;
|
|
6762
6753
|
}
|
|
6763
|
-
/** Resolve sign-in settings from dashboard options and
|
|
6754
|
+
/** Resolve sign-in settings from dashboard options and config. */
|
|
6764
6755
|
function resolveSignInAuthConfig(agentName, allowedDomains, options = {}) {
|
|
6765
6756
|
return {
|
|
6766
6757
|
agentName,
|
|
6767
6758
|
allowedDomains,
|
|
6768
6759
|
authPath: `/${trimSlashes(options.authPath?.trim() || DEFAULT_AUTH_PATH, true)}`,
|
|
6769
|
-
baseURL: trimSlashes(withHttps(options.baseURL?.trim() ||
|
|
6760
|
+
baseURL: trimSlashes(withHttps(options.baseURL?.trim() || getChatConfig().deployment.baseUrl || "http://localhost:3000"), false),
|
|
6770
6761
|
sessionMaxAgeSeconds: options.sessionMaxAgeSeconds,
|
|
6771
|
-
trustedOrigins: options.trustedOrigins ??
|
|
6762
|
+
trustedOrigins: options.trustedOrigins ?? parseEnvList("JUNIOR_DASHBOARD_TRUSTED_ORIGINS", getChatConfig().signIn.trustedOrigins) ?? []
|
|
6772
6763
|
};
|
|
6773
6764
|
}
|
|
6774
6765
|
function required(value, name) {
|
|
@@ -6776,7 +6767,7 @@ function required(value, name) {
|
|
|
6776
6767
|
return value.trim();
|
|
6777
6768
|
}
|
|
6778
6769
|
function createBetterAuth(config) {
|
|
6779
|
-
const secret = required(config.secret ??
|
|
6770
|
+
const secret = required(config.secret ?? getChatConfig().signIn.secret, "JUNIOR_SECRET or BETTER_AUTH_SECRET");
|
|
6780
6771
|
const sessionMaxAgeSeconds = config.sessionMaxAgeSeconds ?? DEFAULT_SESSION_MAX_AGE_SECONDS;
|
|
6781
6772
|
const { allowedDomains } = config;
|
|
6782
6773
|
const hostedDomain = allowedDomains.length === 0 ? void 0 : allowedDomains.length === 1 ? allowedDomains[0] : "*";
|
|
@@ -6787,8 +6778,8 @@ function createBetterAuth(config) {
|
|
|
6787
6778
|
secret,
|
|
6788
6779
|
trustedOrigins: config.trustedOrigins,
|
|
6789
6780
|
socialProviders: { google: {
|
|
6790
|
-
clientId: required(config.googleClientId ??
|
|
6791
|
-
clientSecret: required(config.googleClientSecret ??
|
|
6781
|
+
clientId: required(config.googleClientId ?? getChatConfig().signIn.googleClientId, "GOOGLE_CLIENT_ID"),
|
|
6782
|
+
clientSecret: required(config.googleClientSecret ?? getChatConfig().signIn.googleClientSecret, "GOOGLE_CLIENT_SECRET"),
|
|
6792
6783
|
hd: hostedDomain,
|
|
6793
6784
|
prompt: "select_account",
|
|
6794
6785
|
disableIdTokenSignIn: true,
|
|
@@ -6886,6 +6877,16 @@ function createSignInAuth(config) {
|
|
|
6886
6877
|
}
|
|
6887
6878
|
};
|
|
6888
6879
|
}
|
|
6880
|
+
// src/chat/sign-in/allowlist.ts
|
|
6881
|
+
/**
|
|
6882
|
+
* Fail startup on the removed Google-specific option. Ignoring it would
|
|
6883
|
+
* leave the allowed domain list empty, which lets every Slack workspace
|
|
6884
|
+
* member in. `loadConfig` resolves the list and rejects the removed env var
|
|
6885
|
+
* the same way.
|
|
6886
|
+
*/
|
|
6887
|
+
function assertNoLegacyAllowedDomains(dashboardOptionKeys) {
|
|
6888
|
+
if (dashboardOptionKeys.includes("allowedGoogleDomains")) throw new Error("dashboard.allowedGoogleDomains was removed; set createApp({ allowedDomains }) instead");
|
|
6889
|
+
}
|
|
6889
6890
|
// src/dashboard-routes.ts
|
|
6890
6891
|
const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
6891
6892
|
/**
|
|
@@ -6895,8 +6896,7 @@ const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
|
6895
6896
|
*/
|
|
6896
6897
|
function dashboardRequiresSignIn(dashboard) {
|
|
6897
6898
|
if (!dashboard || dashboard.disabled) return false;
|
|
6898
|
-
|
|
6899
|
-
return process.env["JUNIOR_DASHBOARD_AUTH_REQUIRED"]?.trim() !== "false";
|
|
6899
|
+
return dashboard.authRequired ?? getChatConfig().signIn.dashboardAuthRequired;
|
|
6900
6900
|
}
|
|
6901
6901
|
/** Mount the dashboard app on the dashboard-owned host paths. */
|
|
6902
6902
|
async function createDashboardRouteRegistrations(args) {
|
|
@@ -7101,14 +7101,6 @@ function validateDashboardRouteOwnership(args) {
|
|
|
7101
7101
|
for (const route of args.routes) if (dashboardOwnedRoutePath(route.path, args.dashboard, args.authenticatedRoutes) || (args.coreRoutePaths ?? []).some((path) => routePatternOverlaps(path, route.path))) throw new Error(`Plugin "${route.pluginName}" route "${route.path}" conflicts with core dashboard routes`);
|
|
7102
7102
|
}
|
|
7103
7103
|
// src/app.ts
|
|
7104
|
-
/** Resolve the public deployment URL used by ACP and MCP browser authorization. */
|
|
7105
|
-
function resolvePublicBaseURL(dashboard) {
|
|
7106
|
-
const configured = dashboard?.baseURL?.trim() || process.env["JUNIOR_BASE_URL"]?.trim();
|
|
7107
|
-
if (configured) return configured;
|
|
7108
|
-
const vercelURL = process.env["VERCEL_PROJECT_PRODUCTION_URL"]?.trim() || process.env["VERCEL_URL"]?.trim();
|
|
7109
|
-
if (!vercelURL) return void 0;
|
|
7110
|
-
return vercelURL.startsWith("https://") || vercelURL.startsWith("http://") ? vercelURL : `https://${vercelURL}`;
|
|
7111
|
-
}
|
|
7112
7104
|
/** Build a `WaitUntilFn`, preferring Vercel's lifetime extension when available. */
|
|
7113
7105
|
async function defaultWaitUntil() {
|
|
7114
7106
|
try {
|
|
@@ -7141,6 +7133,51 @@ async function resolveVirtualConfig() {
|
|
|
7141
7133
|
return;
|
|
7142
7134
|
}
|
|
7143
7135
|
}
|
|
7136
|
+
/** Config values that createApp options and the build set over env. */
|
|
7137
|
+
function appConfigInput(options, virtualConfig) {
|
|
7138
|
+
const dashboard = options?.dashboard ?? virtualConfig?.dashboard;
|
|
7139
|
+
return {
|
|
7140
|
+
bot: {
|
|
7141
|
+
modelId: options?.modelId,
|
|
7142
|
+
decisionModelId: options?.decisionModelId,
|
|
7143
|
+
embeddingModelId: options?.embeddingModelId,
|
|
7144
|
+
fastModelId: options?.fastModelId,
|
|
7145
|
+
rerankingModelId: options?.rerankingModelId,
|
|
7146
|
+
guardianModelId: options?.guardianModelId,
|
|
7147
|
+
imageGenerationModelId: options?.imageGenerationModelId,
|
|
7148
|
+
transcriptionModelId: options?.transcriptionModelId,
|
|
7149
|
+
visionModelId: options?.visionModelId,
|
|
7150
|
+
webSearchModelId: options?.webSearchModelId,
|
|
7151
|
+
refusalFallbackModelId: options?.refusalFallbackModelId,
|
|
7152
|
+
userName: virtualConfig?.botName
|
|
7153
|
+
},
|
|
7154
|
+
configDefaults: options?.configDefaults,
|
|
7155
|
+
dashboard: dashboard && {
|
|
7156
|
+
basePath: dashboard.basePath,
|
|
7157
|
+
baseURL: dashboard.baseURL,
|
|
7158
|
+
disabled: dashboard.disabled
|
|
7159
|
+
},
|
|
7160
|
+
deployment: { configuredBaseUrl: dashboard?.baseURL?.trim() || void 0 },
|
|
7161
|
+
eventEmbeddings: options?.eventEmbeddings,
|
|
7162
|
+
experimental: options?.experimental,
|
|
7163
|
+
functionMaxDurationSeconds: virtualConfig?.functionMaxDurationSeconds,
|
|
7164
|
+
limits: options?.limits,
|
|
7165
|
+
memory: {
|
|
7166
|
+
disableExtraction: options?.memory?.disableExtraction,
|
|
7167
|
+
disableRecall: options?.memory?.disableRecall,
|
|
7168
|
+
modelId: options?.memory?.modelId?.trim() || void 0
|
|
7169
|
+
},
|
|
7170
|
+
sandbox: { vcpus: options?.sandbox?.vcpus },
|
|
7171
|
+
slack: {
|
|
7172
|
+
completedReactionEmoji: options?.slack?.completedReactionEmoji,
|
|
7173
|
+
processingReactionEmoji: options?.slack?.processingReactionEmoji
|
|
7174
|
+
},
|
|
7175
|
+
trust: {
|
|
7176
|
+
allowedBotUserIds: options?.slack?.allowedBotUserIds,
|
|
7177
|
+
allowedDomains: options?.allowedDomains
|
|
7178
|
+
}
|
|
7179
|
+
};
|
|
7180
|
+
}
|
|
7144
7181
|
function hasConfiguredPluginCatalog(config) {
|
|
7145
7182
|
if (!config) return false;
|
|
7146
7183
|
return Boolean(config.inlineManifests?.length || config.packages?.length || Object.keys(config.manifests ?? {}).length);
|
|
@@ -7189,27 +7226,13 @@ async function createApp(options) {
|
|
|
7189
7226
|
validatePlugins(plugins);
|
|
7190
7227
|
getDb();
|
|
7191
7228
|
const shouldValidatePluginCatalog = hasConfiguredPluginCatalog(pluginConfig) || Boolean(configuredPlugins?.registrations.length) || Boolean(Object.keys(options?.configDefaults ?? {}).length);
|
|
7192
|
-
const previousRuntimeConfig = snapshotRuntimeConfig();
|
|
7193
7229
|
const previousPluginCatalogConfig = pluginCatalogRuntime.setConfig(pluginConfig);
|
|
7194
7230
|
const previousPlugins = setPlugins(plugins);
|
|
7195
|
-
|
|
7196
|
-
const
|
|
7197
|
-
const previousExperimentalFeatures = getExperimentalFeatures();
|
|
7198
|
-
const previousEventEmbeddingsConfig = setEventEmbeddingsConfig(options?.eventEmbeddings);
|
|
7199
|
-
const previousMemoryConfig = setMemoryConfig(options?.memory);
|
|
7200
|
-
const previousDashboardLinkOptions = setDashboardConversationLinkOptions(dashboard);
|
|
7201
|
-
let previousTrustConfig;
|
|
7202
|
-
const restoreRuntimeConfig$1 = () => {
|
|
7203
|
-
if (previousTrustConfig) setTrustConfig(previousTrustConfig);
|
|
7231
|
+
let restoreChatConfig;
|
|
7232
|
+
const restoreRuntimeConfig = () => {
|
|
7204
7233
|
pluginCatalogRuntime.setConfig(previousPluginCatalogConfig);
|
|
7205
7234
|
setPlugins(previousPlugins);
|
|
7206
|
-
|
|
7207
|
-
restoreRuntimeConfig(previousRuntimeConfig);
|
|
7208
|
-
setSandboxResourceConfig(previousSandboxResources);
|
|
7209
|
-
setExperimentalFeatures(previousExperimentalFeatures);
|
|
7210
|
-
setEventEmbeddingsConfig(previousEventEmbeddingsConfig);
|
|
7211
|
-
setMemoryConfig(previousMemoryConfig);
|
|
7212
|
-
setDashboardConversationLinkOptions(previousDashboardLinkOptions);
|
|
7235
|
+
restoreChatConfig?.();
|
|
7213
7236
|
};
|
|
7214
7237
|
let pluginRoutes = [];
|
|
7215
7238
|
let pluginApiRoutes = [];
|
|
@@ -7223,21 +7246,14 @@ async function createApp(options) {
|
|
|
7223
7246
|
let dispatchForIdentity;
|
|
7224
7247
|
try {
|
|
7225
7248
|
sandboxEgressTracePropagationDomains = normalizeSandboxEgressTracePropagationDomains(options?.sandbox?.egressTracePropagationDomains);
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7249
|
+
const previousChatConfig = installChatConfig(loadConfig({
|
|
7250
|
+
env: process.env,
|
|
7251
|
+
options: appConfigInput(options, virtualConfig)
|
|
7252
|
+
}));
|
|
7253
|
+
restoreChatConfig = () => installChatConfig(previousChatConfig);
|
|
7229
7254
|
warnUnregisteredConfigDefaults(options?.configDefaults);
|
|
7230
|
-
resetRuntimeConfig(virtualConfig?.functionMaxDurationSeconds);
|
|
7231
|
-
setBotModelConfig(options ?? {});
|
|
7232
|
-
setBotName(virtualConfig?.botName);
|
|
7233
|
-
setRuntimeLimits(options?.limits);
|
|
7234
|
-
setSlackReactionConfig(options?.slack ?? {});
|
|
7235
7255
|
assertNoLegacyAllowedDomains(Object.keys(dashboard ?? {}));
|
|
7236
|
-
allowedDomains =
|
|
7237
|
-
previousTrustConfig = setTrustConfig({
|
|
7238
|
-
allowedBotUserIds: options?.slack?.allowedBotUserIds ?? [],
|
|
7239
|
-
allowedDomains
|
|
7240
|
-
});
|
|
7256
|
+
allowedDomains = getChatConfig().trust.allowedDomains;
|
|
7241
7257
|
if (allowedDomains.length === 0) logWarn("app.allowed_domains.unset", { "app.reason": "allowedDomains is empty, so any Slack workspace member can use the bot" });
|
|
7242
7258
|
dispatchForIdentity = createIdentityDispatcher({ conversationWorkQueue: () => conversationWorkQueue });
|
|
7243
7259
|
if (dashboard && !dashboard.disabled) signInConfig = resolveSignInAuthConfig(botConfig.userName, allowedDomains, dashboard);
|
|
@@ -7257,7 +7273,7 @@ async function createApp(options) {
|
|
|
7257
7273
|
readObjectLinkTypes(plugins);
|
|
7258
7274
|
}
|
|
7259
7275
|
} catch (error) {
|
|
7260
|
-
restoreRuntimeConfig
|
|
7276
|
+
restoreRuntimeConfig();
|
|
7261
7277
|
throw error;
|
|
7262
7278
|
}
|
|
7263
7279
|
const waitUntil = options?.waitUntil ?? await defaultWaitUntil();
|
|
@@ -7309,7 +7325,7 @@ async function createApp(options) {
|
|
|
7309
7325
|
handleRequest: createAcpHttpHandler({
|
|
7310
7326
|
...dashboard && !dashboard.disabled ? { browserAuth: {
|
|
7311
7327
|
agentName: botConfig.userName,
|
|
7312
|
-
baseURL:
|
|
7328
|
+
baseURL: getChatConfig().deployment.baseUrl
|
|
7313
7329
|
} } : void 0,
|
|
7314
7330
|
conversations: createAcpConversations({
|
|
7315
7331
|
conversationStore: work.conversationStore,
|
|
@@ -7333,7 +7349,7 @@ async function createApp(options) {
|
|
|
7333
7349
|
const mcpConsentRoute = {
|
|
7334
7350
|
handler: (request, user) => handleMcpConsentPage({
|
|
7335
7351
|
agentName: botConfig.userName,
|
|
7336
|
-
baseURL:
|
|
7352
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7337
7353
|
request,
|
|
7338
7354
|
state: getMcpState(),
|
|
7339
7355
|
user
|
|
@@ -7359,7 +7375,7 @@ async function createApp(options) {
|
|
|
7359
7375
|
routes: pluginRoutes
|
|
7360
7376
|
});
|
|
7361
7377
|
} catch (error) {
|
|
7362
|
-
restoreRuntimeConfig
|
|
7378
|
+
restoreRuntimeConfig();
|
|
7363
7379
|
throw error;
|
|
7364
7380
|
}
|
|
7365
7381
|
const signInAuth = signInConfig ? createSignInAuth(signInConfig) : void 0;
|
|
@@ -7392,7 +7408,7 @@ async function createApp(options) {
|
|
|
7392
7408
|
], MCP_ROUTE_PATHS, (c) => {
|
|
7393
7409
|
handleMcpRequest ??= createMcpHttpHandler({
|
|
7394
7410
|
allowedDomains,
|
|
7395
|
-
baseURL:
|
|
7411
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7396
7412
|
attachmentStorage,
|
|
7397
7413
|
queue: conversationWorkQueue,
|
|
7398
7414
|
state: getMcpState()
|