@sentry/junior 0.315.0 → 0.317.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-5jUYY46p.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-AjrEV6Qe.js} +13532 -12811
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-B_YIZcgf.js} +10 -37
- package/dist/api/schema.d.ts +609 -104
- package/dist/api/schema.js +6 -6
- package/dist/api.js +373 -469
- package/dist/{app-D_bAXRDe.d.ts → app-MoNAsVV5.d.ts} +52 -28
- package/dist/app.d.ts +1 -1
- package/dist/app.js +177 -132
- package/dist/catalog-runtime-DfSpJZdY.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-BlSGE44V.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- 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 +5 -2
- package/dist/cli/upgrade.js +27 -5
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed--9S0_PXL.js} +9 -4
- package/dist/{proxy-path-Dc-0jXGi.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-BUE_7xaN.js} +102 -172
- package/dist/{create-BOycVH9h.js → create-DoDIYgtZ.js} +12 -10
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DXTOYRzR.js → db-BFmyYZtJ.js} +20276 -27398
- package/dist/{deployment-CG3TchWh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-dyWlfNdD.js → engine-context-CgQ7mlHt.js} +264 -50
- package/dist/{html-CfXEwl_h.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-CySgpi9v.js → job-runner-A1lCkybD.js} +397 -22
- package/dist/{lineage-tRTOcrsL.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-Bxvg5wXf.js} +260 -698
- package/dist/{logging-czs0nqLC.js → logging--smS7XRK.js} +2 -2
- package/dist/{mailbox-turn-79Nv1JXv.js → mailbox-turn-uSXhUFc9.js} +648 -2957
- package/dist/{message-BTox2Cmb.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-IRGa98V7.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{parent-result-Dg6P6roR.js → parent-result-Ck1rFYRQ.js} +93 -106
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-BHhJVY0P.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-BUFkmxkT.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-DfATzX77.js → result-Bta_dlWa.js} +42 -117
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-CmKP3inb.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-DfqrHACA.js} +67 -84
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-CxTX7nnR.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-BlHUDj7k.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-CiXy0eNR.js} +91 -70
- package/dist/{task-runner-DcdQJd9e.js → task-runner-C9Yc2_ae.js} +35 -49
- package/dist/{thread-context-DF5uDcWN.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-Cr9pGkzr.js → types-C4iC-IMC.js} +819 -777
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-CJyuOPD2.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- 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/package.json +5 -5
- package/skills/jr-rpc/SKILL.md +3 -5
- package/dist/direct-url-BYgYfuIy.js +0 -22
- package/dist/markers-CE0HMXWT.js +0 -67
- package/dist/people-Cegp1Iwq.js +0 -81
- package/dist/start-conversation-Uh8Sk1EF.js +0 -162
- package/dist/turn-session-routing-GtetHsdO.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,43 +1,46 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { a as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
1
|
+
import { $c as deleteExpiredInboxSnoozes, $d as juniorTurns, $i as listScheduledAutomationsForTeam, $n as getPluginApiRoutes, Bn as resolveSlackInboxItemCardConversationId, Br as getQueueProvider, Ci as slackExternalRefIdSchema, Cl as getDashboardConversationLink, Cs as createSlackActor, Da as existingConversationId, Do as takeDueTimerWatches, Ds as parseActorUserId, Du as setEventEmbeddingsConfig, Ec as dismissOpenInboxItems, Eu as isEventEmbeddingsEnabled, Fd as juniorAutomationRuns, Fl as setMemoryConfig, Fr as isConversationQueueMessageRejectedError, Ga as syncAutomationAlerts, Gd as juniorAgentBindings, Gn as parseSlackInboxItemClick, Gr as verifySlackSignature, Hn as findSlackThreadOwnerId, Hr as annotationKeyDigest, I as conversationCostOf, In as createInboxItemShow, Jd as juniorConversationEventLexemes, Jn as parseSlackUserInputSubmission, Kc as parseAvatarUrl, Kn as parseSlackInboxItemFormTarget, Ku as getStateAdapter, Ln as pushConversationInboxItemsNow, Mc as searchInboxItems, Md as juniorQuestions, Mr as verifyConversationQueueMessage, Nl as setDashboardConversationLinkOptions, O as withConversationMutationLock, Oi as slackMention, Ou as backfillConversationEmbeddings, Pl as projectConversationMessages, Pr as conversationQueueMessageSchema, Q as canAnswerInboxItem, Qd as juniorConversationEvents, Qn as createPluginEventPublisher, Qr as getDispatchConversationId, Ra as refreshAutomationLastRun, Rc as itemQuestion, Rd as juniorAutomations, Si as slackEntitySchema, Sn as isInvalidConversationRecordError, Sr as readConversationAccessFromSql, St as getRegistrations, Td as juniorTurnInbox, Tt as validatePlugins, Ud as juniorInboxItems, Ur as decodeAnnotationRef, Vn as syncInboxItemSlackCards, Vr as renderSlackObjectCard, Vt as appendAndEnqueueInboundMessage, Wn as buildSlackInboxItemModal, Wr as runWithSlackInstallation, X as canActOnInboxItem, Xd as juniorConversationEmbeddings, Xr as confirmDispatchMailboxAppend, Xs as runWithWorkspaceTeamId, Yd as juniorConversationEventEmbeddings, Ys as getWorkspaceTeamId, Yt as clearExpiredConversationLease, _d as slackMessageTsFromMs, _i as postSlackEphemeralMessage, a as getDb, aa as withScheduledAutomationLock, ad as createSlackDestination, ai as listPendingDispatchMailboxAppends, an as listActiveConversationIds, bf as getConfigDefaults, bn as hasRunnableConversationWork, bt as inboxItemVisibility, cd as parseSlackChannelId, cs as isPublicConversation, ct as inboxItemReaderForUserInConversation, di as notifyAutomationBlocked, ec as readActorIdentity, er as getPluginRoutes, es as resumeConversationDelivery, fu as EVENT_INDEX_LOCK_TTL_MS, gd as parseSlackMessageTs, gf as juniorDestinations, gi as openSlackModal, gn as CONVERSATION_WORK_STALE_ENQUEUE_MS, gr as canAddConversationMessages, i as getConversationStore, ia as scheduledRunId, id as touchConversationDetail, ii as isTerminalDispatchStatus, jr as getVercelConversationWorkQueue, kl as getDashboardTaskLink, ku as createConversationEmbedder, lf as juniorConversations, li as markDispatchFailed, m as deleteMessageLinks, mc as recordGoogleSignIn, md as slackTeamIdSchema, mu as eventIndexLockKey, n as getConversationEventStore, nn as getConversation, o as getSqlExecutor, or as sendVercelPluginTask, pd as slackChannelIdSchema, pt as isPluginInboxItem, pu as embedConversationEvents, qo as subjectKey, ra as saveScheduledAutomationInLock, rc as resolveViewerUser, rn as getConversationWorkState, ro as slackChannelMessageEvent, rr as createVercelPluginTaskCallback, rs as listConversationAnnotations, sc as resolveActorIdentityId, sr as queueCallback, st as inboxItemReaderForUser, ta as readScheduledAutomation, ti as getDispatchRecord, tn as ensureConversationWake, to as SLACK_EVENT_NAMESPACE, tt as inboxItemAddedByAnyAutomation, u as isPostgresErrorCode, v as withConversationEventLock, vd as slackMessageTsSchema, wd as juniorTurnOutbox, wl as getDashboardInboxItemLink, wn as pruneActiveConversation, wt as setPlugins, xf as setConfigDefaults, ya as automationVersionOf, yt as inboxItemOwnerConversationId, yu as storeConversationEventLexemes, zn as runInboxItemPushTimers, zs as getSlackClient } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { N as fenceLock, P as withLock, c as installChatConfig, j as MUTATION_LOCK_TTL_MS, l as loadConfig, n as getChatConfig, t as botConfig } from "./config-CHQ8X251.js";
|
|
3
|
+
import { E as withSpan, N as normalizeIdentityEmail, T as withLogContext, b as setSpanAttributes, h as logWarn, j as GOOGLE_IDENTITY_PROVIDER, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging--smS7XRK.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, d as logScheduledAutomationRunSkipped, dt as createAndEnqueueConversation, en as findAutomationSkill, f as scheduledAutomationRunAttributes, gt as collectAttachmentUploadGarbage, j as verifyBackgroundCompactionMessage, k as processBackgroundCompaction, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, nn as effectiveTaskOutcomes, pt as recordWebConversationActivity, qt as readViewerAutomationExecutions, t as createAgentRunner, tn as missingAutomationSkillReason, ut as conversationTurnIdForMessage } from "./agent-runner-AjrEV6Qe.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-BQ-iBDsZ.js";
|
|
6
|
+
import { I as findTrustedUser, L as isAllowedDomain, Ln as settleConversationTitleWork, Mn as appendConversationMessages, Nt as renderTaskInput, R as isTrustedSlackAuthor, V as setTrustConfig, _t as coerceThreadConversationState, en as getExperimentalFeatures, nn as setExperimentalFeatures, t as getAuthPausedConversationTurnId, tn as isExperimentalFeatureEnabled, z as parseEmail } from "./mailbox-turn-uSXhUFc9.js";
|
|
7
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
|
|
8
|
+
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-Bxvg5wXf.js";
|
|
9
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-8gjfR91V.js";
|
|
10
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-D_Ru4CWc.js";
|
|
11
|
+
import { n as processWorkspaceSnapshotJob, o as ingestEvent, r as verifyWorkspaceSnapshotJobMessage } from "./job-runner-A1lCkybD.js";
|
|
12
|
+
import { o as enqueueAgentDispatch, s as failStoppedDispatch } from "./run-conversation-DL6ru7iW.js";
|
|
13
|
+
import { Bn as getNextRunAtMs, Bt as annotationCard, Fn as automationTaskText, Pn as automationTaskSchema, _ as automationListQuerySchema, _n as buttonUserInputField, fn as inboxItemQuestion, p as automationExecutionStatusSchema, rn as scheduledRunSchema } from "./types-C4iC-IMC.js";
|
|
14
|
+
import { t as createEndStoppedChildWork } from "./result-Bta_dlWa.js";
|
|
15
|
+
import { l as collectAttachmentGarbage, p as requestAttachmentDeletion, y as getAttachmentStorage } from "./turn-membership-CENFf3kI.js";
|
|
16
|
+
import { h as createPluginLogger } from "./prompt-Dv7gkpD6.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-BJOqGnjV.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
|
|
21
|
-
import { a as
|
|
22
|
-
import {
|
|
23
|
-
import { t as
|
|
24
|
-
import { t as
|
|
25
|
-
import { t as
|
|
26
|
-
import { f as
|
|
27
|
-
import {
|
|
28
|
-
import { t as
|
|
29
|
-
import { E as conversationPendingMessageDeliverySchema, d as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed-Sl8lKKmR.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-DxVmhbGP.js";
|
|
22
|
+
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-B3VKTGbJ.js";
|
|
23
|
+
import { s as joinPublicChannel } from "./channel-access-j-YAVYK4.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-DXq9ZLU4.js";
|
|
25
|
+
import { a as resolveConversationWorkQueueTopic } from "./topics-SRN7IVX-.js";
|
|
26
|
+
import { t as processConversationWork } from "./worker-BqMQQNRk.js";
|
|
27
|
+
import { t as bindMessageAgent } from "./message-BNenhsmB.js";
|
|
28
|
+
import { t as bindSpawnAgent } from "./spawn-frczVPIr.js";
|
|
29
|
+
import { l as readConversationLastEventSeq, o as readConversationEventPage, s as readConversationEventPageAfter, t as processPluginTask, u as readConversationMessageEventSeq } from "./task-runner-C9Yc2_ae.js";
|
|
30
|
+
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-CgQ7mlHt.js";
|
|
31
|
+
import { t as JUNIOR_VERSION } from "./version-BeZhWWBE.js";
|
|
32
|
+
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed--9S0_PXL.js";
|
|
30
33
|
import { t as isMissingVirtualModule } from "./virtual-module-BeKA_EII.js";
|
|
31
34
|
import { createRequire } from "node:module";
|
|
32
35
|
import { Hono } from "hono";
|
|
33
36
|
import * as z from "zod";
|
|
34
37
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
35
38
|
import { destinationSchema, eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
36
|
-
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, notExists, or, sql } from "drizzle-orm";
|
|
39
|
+
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, notExists, or, sql } from "drizzle-orm";
|
|
37
40
|
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
41
|
+
import { pathToFileURL } from "node:url";
|
|
38
42
|
import { Message, ThreadImpl } from "chat";
|
|
39
43
|
import net from "node:net";
|
|
40
|
-
import { pathToFileURL } from "node:url";
|
|
41
44
|
import { decodeJwt } from "jose";
|
|
42
45
|
import { HTTPException } from "hono/http-exception";
|
|
43
46
|
import https from "node:https";
|
|
@@ -404,7 +407,7 @@ async function writeRun(db, run, automationVersion) {
|
|
|
404
407
|
automationId: stored.taskId,
|
|
405
408
|
claimedAtMs: stored.claimedAtMs,
|
|
406
409
|
completedAtMs: stored.completedAtMs ?? null,
|
|
407
|
-
|
|
410
|
+
...dispatchConversationId ? { conversationId: existingConversationId(dispatchConversationId) } : void 0,
|
|
408
411
|
costMicroUsd: dispatchConversationId ? conversationCostOf(dispatchConversationId) : null,
|
|
409
412
|
dispatchId: stored.dispatchId ?? null,
|
|
410
413
|
errorMessage: stored.errorMessage ?? null,
|
|
@@ -697,12 +700,16 @@ const SCHEDULED_AUTOMATION_HEARTBEAT_LIMIT = 10;
|
|
|
697
700
|
function singleLineMetadataValue(value) {
|
|
698
701
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
699
702
|
}
|
|
700
|
-
/**
|
|
701
|
-
|
|
703
|
+
/**
|
|
704
|
+
* Render the due scheduled automation as plain agent input, with the open
|
|
705
|
+
* questions of its earlier runs.
|
|
706
|
+
*/
|
|
707
|
+
async function buildDispatchInput(db, task) {
|
|
702
708
|
return renderTaskInput({
|
|
703
709
|
creator: slackMention(task.createdBy.slackUserId),
|
|
704
710
|
instructions: automationTaskText(task.task),
|
|
705
711
|
...task.task.kind === "skill" ? { skill: task.task.skill } : void 0,
|
|
712
|
+
openQuestions: await listOpenAutomationQuestions(db, task.id),
|
|
706
713
|
outcomes: effectiveTaskOutcomes(task.outcomes, task.destination)
|
|
707
714
|
});
|
|
708
715
|
}
|
|
@@ -940,7 +947,7 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
940
947
|
} } : void 0,
|
|
941
948
|
destination: task.destination,
|
|
942
949
|
destinationVisibility: task.conversationAccess.visibility,
|
|
943
|
-
input: buildDispatchInput(task),
|
|
950
|
+
input: await buildDispatchInput(db, task),
|
|
944
951
|
...skill ? { skill } : void 0,
|
|
945
952
|
metadata: buildDispatchMetadata({
|
|
946
953
|
nowMs: args.nowMs,
|
|
@@ -1137,7 +1144,7 @@ async function runHeartbeat(args) {
|
|
|
1137
1144
|
// src/handlers/scheduler-auth.ts
|
|
1138
1145
|
/** Check the bearer secret that internal cron requests must send. */
|
|
1139
1146
|
function verifySchedulerRequest(request) {
|
|
1140
|
-
const secret =
|
|
1147
|
+
const secret = getChatConfig().secrets.schedulerSecret;
|
|
1141
1148
|
if (!secret) return false;
|
|
1142
1149
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1143
1150
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -1166,11 +1173,26 @@ async function GET$3(request, waitUntil, options) {
|
|
|
1166
1173
|
}));
|
|
1167
1174
|
return new Response("Accepted", { status: 202 });
|
|
1168
1175
|
}
|
|
1176
|
+
// src/chat/plugins/purge-conversations.ts
|
|
1177
|
+
/**
|
|
1178
|
+
* Run the `purgeConversations` hooks in the purge transaction `db`, one
|
|
1179
|
+
* plugin after another. A hook that fails fails the purge, so no plugin
|
|
1180
|
+
* keeps content of a purged transcript.
|
|
1181
|
+
*/
|
|
1182
|
+
async function purgePluginConversationContent(db, conversationIds) {
|
|
1183
|
+
for (const plugin of getRegistrations()) {
|
|
1184
|
+
const hook = plugin.hooks?.purgeConversations;
|
|
1185
|
+
if (!hook) continue;
|
|
1186
|
+
const name = plugin.manifest.name;
|
|
1187
|
+
await hook({
|
|
1188
|
+
conversationIds,
|
|
1189
|
+
db,
|
|
1190
|
+
log: createPluginLogger(name),
|
|
1191
|
+
plugin: { name }
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1169
1195
|
// src/chat/conversations/sql/purge.ts
|
|
1170
|
-
const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
1171
|
-
parentConversationId: text("parent_conversation_id").notNull(),
|
|
1172
|
-
childConversationId: text("child_conversation_id").notNull()
|
|
1173
|
-
});
|
|
1174
1196
|
const juniorConversationBriefs = pgTable("junior_conversation_briefs", { conversationId: text("conversation_id").notNull() });
|
|
1175
1197
|
/** Discover a root and its current descendants via `parent_conversation_id`. */
|
|
1176
1198
|
async function discoverConversationTree(executor, root) {
|
|
@@ -1200,7 +1222,7 @@ async function discoverConversationTree(executor, root) {
|
|
|
1200
1222
|
async function selectExpiredRoots(executor, args) {
|
|
1201
1223
|
const publicCutoff = new Date(args.nowMs - args.publicWindowMs).toISOString();
|
|
1202
1224
|
const privateCutoff = new Date(args.nowMs - args.privateWindowMs).toISOString();
|
|
1203
|
-
const cutoff = sql`case when ${
|
|
1225
|
+
const cutoff = sql`case when ${isPublicConversation(juniorConversations)} then ${publicCutoff}::timestamptz else ${privateCutoff}::timestamptz end`;
|
|
1204
1226
|
const effectiveLastActivityAt = sql`(
|
|
1205
1227
|
with recursive conversation_tree(conversation_id, last_activity_at) as (
|
|
1206
1228
|
select ${juniorConversations.conversationId}, ${juniorConversations.lastActivityAt}
|
|
@@ -1225,26 +1247,16 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1225
1247
|
select 1 from junior_conversation_events events
|
|
1226
1248
|
where events.conversation_id = tree.conversation_id
|
|
1227
1249
|
)
|
|
1228
|
-
or exists (
|
|
1229
|
-
select 1 from junior_agent_invocations invocations
|
|
1230
|
-
where invocations.parent_conversation_id = tree.conversation_id
|
|
1231
|
-
or invocations.child_conversation_id = tree.conversation_id
|
|
1232
|
-
)
|
|
1233
1250
|
or exists (
|
|
1234
1251
|
select 1 from junior_agent_bindings bindings
|
|
1235
1252
|
where bindings.parent_conversation_id = tree.conversation_id
|
|
1236
1253
|
or bindings.child_conversation_id = tree.conversation_id
|
|
1237
1254
|
)
|
|
1238
1255
|
or exists (
|
|
1239
|
-
select 1 from
|
|
1240
|
-
where
|
|
1241
|
-
and
|
|
1242
|
-
and
|
|
1243
|
-
and inbox_items.automation_id is null
|
|
1244
|
-
)
|
|
1245
|
-
or exists (
|
|
1246
|
-
select 1 from junior_todos todos
|
|
1247
|
-
where todos.conversation_id = tree.conversation_id
|
|
1256
|
+
select 1 from ${juniorInboxItems}
|
|
1257
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1258
|
+
and ${juniorInboxItems.status} = 'open'
|
|
1259
|
+
and not ${inboxItemAddedByAnyAutomation()}
|
|
1248
1260
|
)
|
|
1249
1261
|
or exists (
|
|
1250
1262
|
select 1 from junior_turns turns
|
|
@@ -1255,7 +1267,7 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1255
1267
|
where inbox.conversation_id = tree.conversation_id
|
|
1256
1268
|
)
|
|
1257
1269
|
or (
|
|
1258
|
-
${
|
|
1270
|
+
${isPublicConversation(juniorConversations)} is not true
|
|
1259
1271
|
and (
|
|
1260
1272
|
exists (
|
|
1261
1273
|
select 1 from junior_conversation_briefs briefs
|
|
@@ -1271,13 +1283,12 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1271
1283
|
where embeddings.conversation_id = tree.conversation_id
|
|
1272
1284
|
)
|
|
1273
1285
|
or exists (
|
|
1274
|
-
select 1 from
|
|
1275
|
-
where
|
|
1276
|
-
and
|
|
1277
|
-
and inbox_items.visibility = 'private'
|
|
1286
|
+
select 1 from ${juniorInboxItems}
|
|
1287
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1288
|
+
and ${inboxItemVisibility()} = 'private'
|
|
1278
1289
|
and (
|
|
1279
|
-
|
|
1280
|
-
or
|
|
1290
|
+
${juniorInboxItems.status} <> 'open'
|
|
1291
|
+
or not ${inboxItemAddedByAnyAutomation()}
|
|
1281
1292
|
)
|
|
1282
1293
|
)
|
|
1283
1294
|
or exists (
|
|
@@ -1294,8 +1305,8 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1294
1305
|
)`;
|
|
1295
1306
|
return (await executor.db().select({
|
|
1296
1307
|
conversationId: juniorConversations.conversationId,
|
|
1297
|
-
visibility:
|
|
1298
|
-
}).from(juniorConversations).
|
|
1308
|
+
visibility: juniorConversations.visibility
|
|
1309
|
+
}).from(juniorConversations).where(and(isNull(juniorConversations.parentConversationId), sql`${effectiveLastActivityAt} < ${cutoff}`, hasTreeWork)).orderBy(asc(effectiveLastActivityAt), asc(juniorConversations.conversationId)).limit(Math.max(0, args.limit))).map((row) => ({
|
|
1299
1310
|
conversationId: row.conversationId,
|
|
1300
1311
|
visibility: row.visibility
|
|
1301
1312
|
}));
|
|
@@ -1305,8 +1316,9 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1305
1316
|
* event rows for the given conversation and every descendant, stamp
|
|
1306
1317
|
* `transcript_purged_at`, and — for non-public content — null the raw-payload
|
|
1307
1318
|
* metadata (`title`, `channel_name`, legacy actor JSON) so purged private
|
|
1308
|
-
* conversations keep only safe metadata.
|
|
1309
|
-
* deliveries
|
|
1319
|
+
* conversations keep only safe metadata. Turns, Turn inputs and
|
|
1320
|
+
* deliveries, and the data that plugins keep for these conversations go
|
|
1321
|
+
* with the transcript.
|
|
1310
1322
|
* Non-public content also loses its summary, Conversation embedding, legacy
|
|
1311
1323
|
* Briefs, and the Inbox items that it added. The metadata rows themselves
|
|
1312
1324
|
* survive.
|
|
@@ -1326,15 +1338,15 @@ async function purgeConversationTree(executor, args) {
|
|
|
1326
1338
|
for (const conversation of tree.slice(1)) await withConversationEventLock(executor, conversation.conversationId, async () => void 0);
|
|
1327
1339
|
const root = (await executor.db().select({
|
|
1328
1340
|
conversationId: juniorConversations.conversationId,
|
|
1329
|
-
|
|
1330
|
-
|
|
1341
|
+
parentConversationId: juniorConversations.parentConversationId,
|
|
1342
|
+
visibility: juniorConversations.visibility
|
|
1331
1343
|
}).from(juniorConversations).where(eq(juniorConversations.conversationId, args.rootConversationId)).for("update"))[0];
|
|
1332
1344
|
if (!root || args.retention && root.parentConversationId !== null) return {
|
|
1333
1345
|
purged: false,
|
|
1334
1346
|
conversations: 0
|
|
1335
1347
|
};
|
|
1336
|
-
const
|
|
1337
|
-
const
|
|
1348
|
+
const isPublic = root.visibility === "public";
|
|
1349
|
+
const resolvedScrubMetadata = args.scrubMetadataFromRootVisibility ? !isPublic : args.scrubMetadata;
|
|
1338
1350
|
const ids = tree.map((conversation) => conversation.conversationId);
|
|
1339
1351
|
if (args.retention) {
|
|
1340
1352
|
const currentActivity = await executor.db().select({
|
|
@@ -1355,14 +1367,13 @@ async function purgeConversationTree(executor, args) {
|
|
|
1355
1367
|
await deleteMessageLinks(executor, ids);
|
|
1356
1368
|
await executor.db().delete(juniorTurnInbox).where(inArray(juniorTurnInbox.conversationId, ids));
|
|
1357
1369
|
await executor.db().delete(juniorTurns).where(inArray(juniorTurns.conversationId, ids));
|
|
1358
|
-
await executor.db().delete(juniorAgentInvocations).where(or(inArray(juniorAgentInvocations.parentConversationId, ids), inArray(juniorAgentInvocations.childConversationId, ids)));
|
|
1359
1370
|
await executor.db().delete(juniorAgentBindings).where(or(inArray(juniorAgentBindings.parentConversationId, ids), inArray(juniorAgentBindings.childConversationId, ids)));
|
|
1360
1371
|
await dismissOpenInboxItems(executor.db(), {
|
|
1361
1372
|
ownerConversationIds: ids,
|
|
1362
1373
|
nowMs: args.nowMs,
|
|
1363
1374
|
reason: "Conversation purged"
|
|
1364
1375
|
});
|
|
1365
|
-
await
|
|
1376
|
+
await purgePluginConversationContent(executor.db(), ids);
|
|
1366
1377
|
await requestAttachmentDeletion(executor, ids, args.nowMs);
|
|
1367
1378
|
const scrubMetadata = args.retention ? !isPublic : resolvedScrubMetadata;
|
|
1368
1379
|
await executor.db().update(juniorConversations).set({
|
|
@@ -1378,7 +1389,8 @@ async function purgeConversationTree(executor, args) {
|
|
|
1378
1389
|
if (scrubMetadata) {
|
|
1379
1390
|
await executor.db().delete(juniorConversationBriefs).where(inArray(juniorConversationBriefs.conversationId, ids));
|
|
1380
1391
|
await executor.db().delete(juniorConversationEmbeddings).where(inArray(juniorConversationEmbeddings.conversationId, ids));
|
|
1381
|
-
await executor.db().delete(juniorInboxItems).where(and(
|
|
1392
|
+
await executor.db().delete(juniorInboxItems).where(and(inArray(inboxItemOwnerConversationId(), ids), eq(inboxItemVisibility(), "private"), or(ne(juniorInboxItems.status, "open"), not(inboxItemAddedByAnyAutomation()))));
|
|
1393
|
+
await executor.db().delete(juniorQuestions).where(and(inArray(juniorQuestions.conversationId, ids), notExists(executor.db().select({ id: juniorInboxItems.id }).from(juniorInboxItems).where(itemQuestion))));
|
|
1382
1394
|
}
|
|
1383
1395
|
await touchConversationDetail(executor.db(), ids);
|
|
1384
1396
|
return {
|
|
@@ -1985,7 +1997,8 @@ async function handleSlackInboxItemClick(args) {
|
|
|
1985
1997
|
...common,
|
|
1986
1998
|
action: "submit",
|
|
1987
1999
|
answer: (item) => {
|
|
1988
|
-
const
|
|
2000
|
+
const request = inboxItemQuestion(item.request);
|
|
2001
|
+
const field = request && buttonUserInputField(request);
|
|
1989
2002
|
if (!field?.options.some((option) => option.label === click.label)) throw new InboxItemActionError("conflict", "This card changed. Use the updated card.");
|
|
1990
2003
|
return {
|
|
1991
2004
|
requestId: item.id,
|
|
@@ -2004,13 +2017,16 @@ async function handleSlackInboxItemSubmission(args) {
|
|
|
2004
2017
|
if (!view?.id || !formTarget || !channelId || !messageTs || !threadTs) throw new Error("Slack inbox item form submission is incomplete");
|
|
2005
2018
|
await act({
|
|
2006
2019
|
action: "submit",
|
|
2007
|
-
answer: (item) =>
|
|
2008
|
-
request
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2020
|
+
answer: (item) => {
|
|
2021
|
+
const request = inboxItemQuestion(item.request);
|
|
2022
|
+
return request ? parseSlackUserInputSubmission({
|
|
2023
|
+
request,
|
|
2024
|
+
requestId: item.id,
|
|
2025
|
+
values: view.state?.values ?? {}
|
|
2026
|
+
}) : {
|
|
2027
|
+
requestId: item.id,
|
|
2028
|
+
values: {}
|
|
2029
|
+
};
|
|
2014
2030
|
},
|
|
2015
2031
|
inputTs: slackMessageTsFromMs(Date.now()),
|
|
2016
2032
|
itemId: formTarget.itemId,
|
|
@@ -3477,9 +3493,11 @@ function createIdentityDispatcher(args) {
|
|
|
3477
3493
|
}
|
|
3478
3494
|
// src/api/acp/conversations.ts
|
|
3479
3495
|
const EVENT_PAGE_SIZE = 50;
|
|
3496
|
+
async function readAccess(conversationId, user) {
|
|
3497
|
+
return (await readConversationAccessFromSql(getDb(), [conversationId], user)).get(conversationId);
|
|
3498
|
+
}
|
|
3480
3499
|
async function hasConversationAccess(conversationId, user) {
|
|
3481
|
-
|
|
3482
|
-
return Boolean(access?.isParticipant);
|
|
3500
|
+
return Boolean((await readAccess(conversationId, user))?.isParticipant);
|
|
3483
3501
|
}
|
|
3484
3502
|
/** Return whether one Turn can return its terminal result without racing cleanup. */
|
|
3485
3503
|
async function turnTerminalIsReady(args) {
|
|
@@ -3529,9 +3547,8 @@ function createAcpConversations(options) {
|
|
|
3529
3547
|
return await hasConversationAccess(conversationId, user);
|
|
3530
3548
|
},
|
|
3531
3549
|
async prompt({ conversationId, idempotencyKey, text, user }) {
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
if (conversation && !await spaceTakesMessagesFrom(conversation, user.id)) return { status: "space_closed" };
|
|
3550
|
+
const access = await readAccess(conversationId, user);
|
|
3551
|
+
if (!access?.isParticipant || !canAddConversationMessages(access)) return { status: "not_found" };
|
|
3535
3552
|
const currentCursor = await latestEventCursor(options.eventStore, conversationId);
|
|
3536
3553
|
if (await getAuthPausedConversationTurnId(conversationId)) return { status: "active" };
|
|
3537
3554
|
const result = await appendAndEnqueueWebMessage({
|
|
@@ -4796,7 +4813,6 @@ async function acceptPrompt(args) {
|
|
|
4796
4813
|
});
|
|
4797
4814
|
if (result.status === "not_found") throw acp.RequestError.resourceNotFound(params.sessionId);
|
|
4798
4815
|
if (result.status === "active") throw acp.RequestError.invalidParams({ field: "sessionId" }, "This ACP session already has an active prompt");
|
|
4799
|
-
if (result.status === "space_closed") throw acp.RequestError.invalidParams({ field: "sessionId" }, "Only members of a Space that is not archived can message its Lead");
|
|
4800
4816
|
return {
|
|
4801
4817
|
output: {
|
|
4802
4818
|
afterSeq: result.afterCursor,
|
|
@@ -6128,23 +6144,31 @@ const mcpInboxItemSchema = z.object({
|
|
|
6128
6144
|
updatedAt: z.string(),
|
|
6129
6145
|
url: z.string().optional().describe("Dashboard link to answer it.")
|
|
6130
6146
|
}).strict();
|
|
6131
|
-
/**
|
|
6132
|
-
|
|
6147
|
+
/**
|
|
6148
|
+
* Map an Inbox item to its MCP view for one user. A subject shows only when
|
|
6149
|
+
* it is a web link. Its title comes from the user's card of the link
|
|
6150
|
+
* (`resolveInboxItemSubjects`).
|
|
6151
|
+
*/
|
|
6152
|
+
function mcpInboxItem(item, userId, views) {
|
|
6133
6153
|
const url = getDashboardInboxItemLink(item.id);
|
|
6154
|
+
const view = views.get(subjectKey(item.subject));
|
|
6155
|
+
const question = inboxItemQuestion(item.request);
|
|
6156
|
+
const subjectUrl = view?.url;
|
|
6157
|
+
const subjectTitle = view?.object?.title;
|
|
6134
6158
|
return {
|
|
6135
6159
|
id: item.id,
|
|
6136
6160
|
kind: item.kind,
|
|
6137
6161
|
status: item.status,
|
|
6138
6162
|
title: item.title,
|
|
6139
6163
|
body: item.body,
|
|
6140
|
-
...
|
|
6164
|
+
...question ? { question: question.question } : void 0,
|
|
6141
6165
|
assignees: item.assignedToEveryone ? [] : item.assignees.map((person) => person.displayName ?? person.email),
|
|
6142
6166
|
canAct: canActOnInboxItem(item, userId),
|
|
6143
6167
|
conversationIds: item.conversationIds,
|
|
6144
|
-
...
|
|
6168
|
+
...subjectUrl ? { subject: {
|
|
6145
6169
|
id: item.subject.id,
|
|
6146
|
-
...
|
|
6147
|
-
|
|
6170
|
+
...subjectTitle ? { title: subjectTitle } : void 0,
|
|
6171
|
+
url: subjectUrl
|
|
6148
6172
|
} } : void 0,
|
|
6149
6173
|
createdAt: item.createdAt.toISOString(),
|
|
6150
6174
|
updatedAt: item.updatedAt.toISOString(),
|
|
@@ -6167,7 +6191,9 @@ function registerGetInboxItemTool(server, { user }) {
|
|
|
6167
6191
|
}
|
|
6168
6192
|
}, async ({ id }) => {
|
|
6169
6193
|
try {
|
|
6170
|
-
|
|
6194
|
+
const item = await readInboxItemForUser(user, id);
|
|
6195
|
+
const cards = await resolveInboxItemSubjects(user, [item]);
|
|
6196
|
+
return mcpToolResult({ item: mcpInboxItem(item, user.id, cards) });
|
|
6171
6197
|
} catch (error) {
|
|
6172
6198
|
if (error instanceof InboxItemActionError) return mcpToolError(error.message);
|
|
6173
6199
|
throw error;
|
|
@@ -6345,8 +6371,10 @@ function registerSearchInboxItemsTool(server, { user }) {
|
|
|
6345
6371
|
...q ? { query: q } : void 0,
|
|
6346
6372
|
statuses: ["open"]
|
|
6347
6373
|
});
|
|
6374
|
+
const page = items.slice(0, limit);
|
|
6375
|
+
const cards = await resolveInboxItemSubjects(user, page);
|
|
6348
6376
|
return mcpToolResult({
|
|
6349
|
-
items:
|
|
6377
|
+
items: page.map((item) => mcpInboxItem(item, user.id, cards)),
|
|
6350
6378
|
truncated: items.length > limit
|
|
6351
6379
|
});
|
|
6352
6380
|
});
|
|
@@ -6684,9 +6712,9 @@ async function handleAcpAuthorizationPage(args) {
|
|
|
6684
6712
|
* a Google Workspace account whose `hd` claim is one of them. Slack and the
|
|
6685
6713
|
* dashboard share one list. `chat/identities/trust` decides who matches.
|
|
6686
6714
|
*/
|
|
6687
|
-
/**
|
|
6688
|
-
function
|
|
6689
|
-
const value =
|
|
6715
|
+
/** Parse a list env var value: a JSON string array or comma-separated values. */
|
|
6716
|
+
function parseEnvList(name, rawValue) {
|
|
6717
|
+
const value = rawValue?.trim();
|
|
6690
6718
|
if (!value) return void 0;
|
|
6691
6719
|
if (!value.startsWith("[")) return value.split(",");
|
|
6692
6720
|
let parsed;
|
|
@@ -6704,15 +6732,15 @@ function readEnvList(name) {
|
|
|
6704
6732
|
* `JUNIOR_ALLOWED_DOMAINS`. An empty list allows every domain.
|
|
6705
6733
|
*/
|
|
6706
6734
|
function resolveAllowedDomains(allowedDomains) {
|
|
6707
|
-
return [...new Set((allowedDomains ??
|
|
6735
|
+
return [...new Set((allowedDomains ?? parseEnvList("JUNIOR_ALLOWED_DOMAINS", getChatConfig().signIn.allowedDomains) ?? []).map((value) => value.trim().toLowerCase()).filter(Boolean))];
|
|
6708
6736
|
}
|
|
6709
6737
|
/**
|
|
6710
|
-
* Fail startup on the removed Google-specific
|
|
6738
|
+
* Fail startup on the removed Google-specific option. Ignoring it would
|
|
6711
6739
|
* leave the list empty, which lets every Slack workspace member in.
|
|
6740
|
+
* `loadConfig` rejects the removed env var the same way.
|
|
6712
6741
|
*/
|
|
6713
6742
|
function assertNoLegacyAllowedDomains(dashboardOptionKeys) {
|
|
6714
6743
|
if (dashboardOptionKeys.includes("allowedGoogleDomains")) throw new Error("dashboard.allowedGoogleDomains was removed; set createApp({ allowedDomains }) instead");
|
|
6715
|
-
if (process.env["JUNIOR_DASHBOARD_GOOGLE_DOMAINS"]?.trim()) throw new Error("JUNIOR_DASHBOARD_GOOGLE_DOMAINS was removed; set JUNIOR_ALLOWED_DOMAINS instead");
|
|
6716
6744
|
}
|
|
6717
6745
|
// src/chat/sign-in/auth.ts
|
|
6718
6746
|
/**
|
|
@@ -6761,15 +6789,15 @@ function trimSlashes(value, leading) {
|
|
|
6761
6789
|
function withHttps(host) {
|
|
6762
6790
|
return host.startsWith("https://") || host.startsWith("http://") ? host : `https://${host}`;
|
|
6763
6791
|
}
|
|
6764
|
-
/** Resolve sign-in settings from dashboard options and
|
|
6792
|
+
/** Resolve sign-in settings from dashboard options and config. */
|
|
6765
6793
|
function resolveSignInAuthConfig(agentName, allowedDomains, options = {}) {
|
|
6766
6794
|
return {
|
|
6767
6795
|
agentName,
|
|
6768
6796
|
allowedDomains,
|
|
6769
6797
|
authPath: `/${trimSlashes(options.authPath?.trim() || DEFAULT_AUTH_PATH, true)}`,
|
|
6770
|
-
baseURL: trimSlashes(withHttps(options.baseURL?.trim() ||
|
|
6798
|
+
baseURL: trimSlashes(withHttps(options.baseURL?.trim() || getChatConfig().deployment.baseUrl || "http://localhost:3000"), false),
|
|
6771
6799
|
sessionMaxAgeSeconds: options.sessionMaxAgeSeconds,
|
|
6772
|
-
trustedOrigins: options.trustedOrigins ??
|
|
6800
|
+
trustedOrigins: options.trustedOrigins ?? parseEnvList("JUNIOR_DASHBOARD_TRUSTED_ORIGINS", getChatConfig().signIn.trustedOrigins) ?? []
|
|
6773
6801
|
};
|
|
6774
6802
|
}
|
|
6775
6803
|
function required(value, name) {
|
|
@@ -6777,7 +6805,7 @@ function required(value, name) {
|
|
|
6777
6805
|
return value.trim();
|
|
6778
6806
|
}
|
|
6779
6807
|
function createBetterAuth(config) {
|
|
6780
|
-
const secret = required(config.secret ??
|
|
6808
|
+
const secret = required(config.secret ?? getChatConfig().signIn.secret, "JUNIOR_SECRET or BETTER_AUTH_SECRET");
|
|
6781
6809
|
const sessionMaxAgeSeconds = config.sessionMaxAgeSeconds ?? DEFAULT_SESSION_MAX_AGE_SECONDS;
|
|
6782
6810
|
const { allowedDomains } = config;
|
|
6783
6811
|
const hostedDomain = allowedDomains.length === 0 ? void 0 : allowedDomains.length === 1 ? allowedDomains[0] : "*";
|
|
@@ -6788,8 +6816,8 @@ function createBetterAuth(config) {
|
|
|
6788
6816
|
secret,
|
|
6789
6817
|
trustedOrigins: config.trustedOrigins,
|
|
6790
6818
|
socialProviders: { google: {
|
|
6791
|
-
clientId: required(config.googleClientId ??
|
|
6792
|
-
clientSecret: required(config.googleClientSecret ??
|
|
6819
|
+
clientId: required(config.googleClientId ?? getChatConfig().signIn.googleClientId, "GOOGLE_CLIENT_ID"),
|
|
6820
|
+
clientSecret: required(config.googleClientSecret ?? getChatConfig().signIn.googleClientSecret, "GOOGLE_CLIENT_SECRET"),
|
|
6793
6821
|
hd: hostedDomain,
|
|
6794
6822
|
prompt: "select_account",
|
|
6795
6823
|
disableIdTokenSignIn: true,
|
|
@@ -6896,8 +6924,7 @@ const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
|
6896
6924
|
*/
|
|
6897
6925
|
function dashboardRequiresSignIn(dashboard) {
|
|
6898
6926
|
if (!dashboard || dashboard.disabled) return false;
|
|
6899
|
-
|
|
6900
|
-
return process.env["JUNIOR_DASHBOARD_AUTH_REQUIRED"]?.trim() !== "false";
|
|
6927
|
+
return dashboard.authRequired ?? getChatConfig().signIn.dashboardAuthRequired;
|
|
6901
6928
|
}
|
|
6902
6929
|
/** Mount the dashboard app on the dashboard-owned host paths. */
|
|
6903
6930
|
async function createDashboardRouteRegistrations(args) {
|
|
@@ -7010,7 +7037,6 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
7010
7037
|
"/api/objects",
|
|
7011
7038
|
"/api/stats",
|
|
7012
7039
|
"/api/versions",
|
|
7013
|
-
"/api/versions/*",
|
|
7014
7040
|
"/api/conversations",
|
|
7015
7041
|
"/api/conversations/*",
|
|
7016
7042
|
"/api/locations",
|
|
@@ -7103,14 +7129,6 @@ function validateDashboardRouteOwnership(args) {
|
|
|
7103
7129
|
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`);
|
|
7104
7130
|
}
|
|
7105
7131
|
// src/app.ts
|
|
7106
|
-
/** Resolve the public deployment URL used by ACP and MCP browser authorization. */
|
|
7107
|
-
function resolvePublicBaseURL(dashboard) {
|
|
7108
|
-
const configured = dashboard?.baseURL?.trim() || process.env["JUNIOR_BASE_URL"]?.trim();
|
|
7109
|
-
if (configured) return configured;
|
|
7110
|
-
const vercelURL = process.env["VERCEL_PROJECT_PRODUCTION_URL"]?.trim() || process.env["VERCEL_URL"]?.trim();
|
|
7111
|
-
if (!vercelURL) return void 0;
|
|
7112
|
-
return vercelURL.startsWith("https://") || vercelURL.startsWith("http://") ? vercelURL : `https://${vercelURL}`;
|
|
7113
|
-
}
|
|
7114
7132
|
/** Build a `WaitUntilFn`, preferring Vercel's lifetime extension when available. */
|
|
7115
7133
|
async function defaultWaitUntil() {
|
|
7116
7134
|
try {
|
|
@@ -7143,6 +7161,34 @@ async function resolveVirtualConfig() {
|
|
|
7143
7161
|
return;
|
|
7144
7162
|
}
|
|
7145
7163
|
}
|
|
7164
|
+
/** Config values that createApp options and the build set over env. */
|
|
7165
|
+
function appConfigInput(options, virtualConfig) {
|
|
7166
|
+
const dashboard = options?.dashboard ?? virtualConfig?.dashboard;
|
|
7167
|
+
return {
|
|
7168
|
+
bot: {
|
|
7169
|
+
modelId: options?.modelId,
|
|
7170
|
+
decisionModelId: options?.decisionModelId,
|
|
7171
|
+
embeddingModelId: options?.embeddingModelId,
|
|
7172
|
+
fastModelId: options?.fastModelId,
|
|
7173
|
+
rerankingModelId: options?.rerankingModelId,
|
|
7174
|
+
guardianModelId: options?.guardianModelId,
|
|
7175
|
+
imageGenerationModelId: options?.imageGenerationModelId,
|
|
7176
|
+
transcriptionModelId: options?.transcriptionModelId,
|
|
7177
|
+
visionModelId: options?.visionModelId,
|
|
7178
|
+
webSearchModelId: options?.webSearchModelId,
|
|
7179
|
+
refusalFallbackModelId: options?.refusalFallbackModelId,
|
|
7180
|
+
userName: virtualConfig?.botName
|
|
7181
|
+
},
|
|
7182
|
+
deployment: { configuredBaseUrl: dashboard?.baseURL?.trim() || void 0 },
|
|
7183
|
+
functionMaxDurationSeconds: virtualConfig?.functionMaxDurationSeconds,
|
|
7184
|
+
limits: options?.limits,
|
|
7185
|
+
sandbox: { vcpus: options?.sandbox?.vcpus },
|
|
7186
|
+
slack: {
|
|
7187
|
+
completedReactionEmoji: options?.slack?.completedReactionEmoji,
|
|
7188
|
+
processingReactionEmoji: options?.slack?.processingReactionEmoji
|
|
7189
|
+
}
|
|
7190
|
+
};
|
|
7191
|
+
}
|
|
7146
7192
|
function hasConfiguredPluginCatalog(config) {
|
|
7147
7193
|
if (!config) return false;
|
|
7148
7194
|
return Boolean(config.inlineManifests?.length || config.packages?.length || Object.keys(config.manifests ?? {}).length);
|
|
@@ -7191,23 +7237,21 @@ async function createApp(options) {
|
|
|
7191
7237
|
validatePlugins(plugins);
|
|
7192
7238
|
getDb();
|
|
7193
7239
|
const shouldValidatePluginCatalog = hasConfiguredPluginCatalog(pluginConfig) || Boolean(configuredPlugins?.registrations.length) || Boolean(Object.keys(options?.configDefaults ?? {}).length);
|
|
7194
|
-
const previousRuntimeConfig = snapshotRuntimeConfig();
|
|
7195
7240
|
const previousPluginCatalogConfig = pluginCatalogRuntime.setConfig(pluginConfig);
|
|
7196
7241
|
const previousPlugins = setPlugins(plugins);
|
|
7197
7242
|
const previousConfigDefaults = getConfigDefaults();
|
|
7198
|
-
const previousSandboxResources = getSandboxResourceConfig();
|
|
7199
7243
|
const previousExperimentalFeatures = getExperimentalFeatures();
|
|
7200
7244
|
const previousEventEmbeddingsConfig = setEventEmbeddingsConfig(options?.eventEmbeddings);
|
|
7201
7245
|
const previousMemoryConfig = setMemoryConfig(options?.memory);
|
|
7202
7246
|
const previousDashboardLinkOptions = setDashboardConversationLinkOptions(dashboard);
|
|
7203
7247
|
let previousTrustConfig;
|
|
7204
|
-
|
|
7248
|
+
let restoreChatConfig;
|
|
7249
|
+
const restoreRuntimeConfig = () => {
|
|
7205
7250
|
if (previousTrustConfig) setTrustConfig(previousTrustConfig);
|
|
7206
7251
|
pluginCatalogRuntime.setConfig(previousPluginCatalogConfig);
|
|
7207
7252
|
setPlugins(previousPlugins);
|
|
7208
7253
|
setConfigDefaults(previousConfigDefaults);
|
|
7209
|
-
|
|
7210
|
-
setSandboxResourceConfig(previousSandboxResources);
|
|
7254
|
+
restoreChatConfig?.();
|
|
7211
7255
|
setExperimentalFeatures(previousExperimentalFeatures);
|
|
7212
7256
|
setEventEmbeddingsConfig(previousEventEmbeddingsConfig);
|
|
7213
7257
|
setMemoryConfig(previousMemoryConfig);
|
|
@@ -7225,15 +7269,14 @@ async function createApp(options) {
|
|
|
7225
7269
|
let dispatchForIdentity;
|
|
7226
7270
|
try {
|
|
7227
7271
|
sandboxEgressTracePropagationDomains = normalizeSandboxEgressTracePropagationDomains(options?.sandbox?.egressTracePropagationDomains);
|
|
7228
|
-
setSandboxResourceConfig(options?.sandbox);
|
|
7229
7272
|
setExperimentalFeatures(options?.experimental);
|
|
7230
7273
|
setConfigDefaults(options?.configDefaults);
|
|
7231
7274
|
warnUnregisteredConfigDefaults(options?.configDefaults);
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7275
|
+
const previousChatConfig = installChatConfig(loadConfig({
|
|
7276
|
+
env: process.env,
|
|
7277
|
+
options: appConfigInput(options, virtualConfig)
|
|
7278
|
+
}));
|
|
7279
|
+
restoreChatConfig = () => installChatConfig(previousChatConfig);
|
|
7237
7280
|
assertNoLegacyAllowedDomains(Object.keys(dashboard ?? {}));
|
|
7238
7281
|
allowedDomains = resolveAllowedDomains(options?.allowedDomains);
|
|
7239
7282
|
previousTrustConfig = setTrustConfig({
|
|
@@ -7259,7 +7302,7 @@ async function createApp(options) {
|
|
|
7259
7302
|
readObjectLinkTypes(plugins);
|
|
7260
7303
|
}
|
|
7261
7304
|
} catch (error) {
|
|
7262
|
-
restoreRuntimeConfig
|
|
7305
|
+
restoreRuntimeConfig();
|
|
7263
7306
|
throw error;
|
|
7264
7307
|
}
|
|
7265
7308
|
const waitUntil = options?.waitUntil ?? await defaultWaitUntil();
|
|
@@ -7271,6 +7314,7 @@ async function createApp(options) {
|
|
|
7271
7314
|
const pluginTaskQueue = options?.pluginTaskQueue?.((message, delivery) => processPluginTask(message, {
|
|
7272
7315
|
deliveryCount: delivery?.deliveryCount,
|
|
7273
7316
|
events,
|
|
7317
|
+
sendPluginTask: (task, sendOptions) => sendPluginTask(task, sendOptions),
|
|
7274
7318
|
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7275
7319
|
}));
|
|
7276
7320
|
const sendPluginTask = pluginTaskQueue ? (message, sendOptions) => pluginTaskQueue.send(message, sendOptions) : sendVercelPluginTask;
|
|
@@ -7310,7 +7354,7 @@ async function createApp(options) {
|
|
|
7310
7354
|
handleRequest: createAcpHttpHandler({
|
|
7311
7355
|
...dashboard && !dashboard.disabled ? { browserAuth: {
|
|
7312
7356
|
agentName: botConfig.userName,
|
|
7313
|
-
baseURL:
|
|
7357
|
+
baseURL: getChatConfig().deployment.baseUrl
|
|
7314
7358
|
} } : void 0,
|
|
7315
7359
|
conversations: createAcpConversations({
|
|
7316
7360
|
conversationStore: work.conversationStore,
|
|
@@ -7334,7 +7378,7 @@ async function createApp(options) {
|
|
|
7334
7378
|
const mcpConsentRoute = {
|
|
7335
7379
|
handler: (request, user) => handleMcpConsentPage({
|
|
7336
7380
|
agentName: botConfig.userName,
|
|
7337
|
-
baseURL:
|
|
7381
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7338
7382
|
request,
|
|
7339
7383
|
state: getMcpState(),
|
|
7340
7384
|
user
|
|
@@ -7360,7 +7404,7 @@ async function createApp(options) {
|
|
|
7360
7404
|
routes: pluginRoutes
|
|
7361
7405
|
});
|
|
7362
7406
|
} catch (error) {
|
|
7363
|
-
restoreRuntimeConfig
|
|
7407
|
+
restoreRuntimeConfig();
|
|
7364
7408
|
throw error;
|
|
7365
7409
|
}
|
|
7366
7410
|
const signInAuth = signInConfig ? createSignInAuth(signInConfig) : void 0;
|
|
@@ -7393,7 +7437,7 @@ async function createApp(options) {
|
|
|
7393
7437
|
], MCP_ROUTE_PATHS, (c) => {
|
|
7394
7438
|
handleMcpRequest ??= createMcpHttpHandler({
|
|
7395
7439
|
allowedDomains,
|
|
7396
|
-
baseURL:
|
|
7440
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7397
7441
|
attachmentStorage,
|
|
7398
7442
|
queue: conversationWorkQueue,
|
|
7399
7443
|
state: getMcpState()
|
|
@@ -7447,6 +7491,7 @@ async function createApp(options) {
|
|
|
7447
7491
|
app.post(JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, (c) => {
|
|
7448
7492
|
pluginTaskPOST ??= createVercelPluginTaskCallback({
|
|
7449
7493
|
events,
|
|
7494
|
+
sendPluginTask,
|
|
7450
7495
|
showInboxItem: createInboxItemShow(getProductionSlackAdapter)
|
|
7451
7496
|
});
|
|
7452
7497
|
return pluginTaskPOST(c.req.raw);
|