@sentry/junior 0.316.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-QYiDMnsu.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
- package/dist/api/schema.d.ts +558 -102
- package/dist/api/schema.js +6 -6
- package/dist/api.js +230 -213
- package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +167 -122
- 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-Bref7aPI.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.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 +5 -3
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
- package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
- package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
- package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
- package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
- package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
- package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-CuMWy37l.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-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-CCi7323k.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-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
- package/dist/{thread-context-fiMNylbg.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-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.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/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,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 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 processConversationWork } from "./worker-
|
|
23
|
-
import { t as bindMessageAgent } from "./message-
|
|
24
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
25
|
-
import {
|
|
26
|
-
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-
|
|
27
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
28
|
-
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed
|
|
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";
|
|
29
33
|
import { t as isMissingVirtualModule } from "./virtual-module-BeKA_EII.js";
|
|
30
34
|
import { createRequire } from "node:module";
|
|
31
35
|
import { Hono } from "hono";
|
|
32
36
|
import * as z from "zod";
|
|
33
37
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
34
38
|
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";
|
|
39
|
+
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, notExists, or, sql } from "drizzle-orm";
|
|
36
40
|
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
41
|
+
import { pathToFileURL } from "node:url";
|
|
37
42
|
import { Message, ThreadImpl } from "chat";
|
|
38
43
|
import net from "node:net";
|
|
39
|
-
import { pathToFileURL } from "node:url";
|
|
40
44
|
import { decodeJwt } from "jose";
|
|
41
45
|
import { HTTPException } from "hono/http-exception";
|
|
42
46
|
import https from "node:https";
|
|
@@ -403,7 +407,7 @@ async function writeRun(db, run, automationVersion) {
|
|
|
403
407
|
automationId: stored.taskId,
|
|
404
408
|
claimedAtMs: stored.claimedAtMs,
|
|
405
409
|
completedAtMs: stored.completedAtMs ?? null,
|
|
406
|
-
|
|
410
|
+
...dispatchConversationId ? { conversationId: existingConversationId(dispatchConversationId) } : void 0,
|
|
407
411
|
costMicroUsd: dispatchConversationId ? conversationCostOf(dispatchConversationId) : null,
|
|
408
412
|
dispatchId: stored.dispatchId ?? null,
|
|
409
413
|
errorMessage: stored.errorMessage ?? null,
|
|
@@ -696,12 +700,16 @@ const SCHEDULED_AUTOMATION_HEARTBEAT_LIMIT = 10;
|
|
|
696
700
|
function singleLineMetadataValue(value) {
|
|
697
701
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
698
702
|
}
|
|
699
|
-
/**
|
|
700
|
-
|
|
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) {
|
|
701
708
|
return renderTaskInput({
|
|
702
709
|
creator: slackMention(task.createdBy.slackUserId),
|
|
703
710
|
instructions: automationTaskText(task.task),
|
|
704
711
|
...task.task.kind === "skill" ? { skill: task.task.skill } : void 0,
|
|
712
|
+
openQuestions: await listOpenAutomationQuestions(db, task.id),
|
|
705
713
|
outcomes: effectiveTaskOutcomes(task.outcomes, task.destination)
|
|
706
714
|
});
|
|
707
715
|
}
|
|
@@ -939,7 +947,7 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
939
947
|
} } : void 0,
|
|
940
948
|
destination: task.destination,
|
|
941
949
|
destinationVisibility: task.conversationAccess.visibility,
|
|
942
|
-
input: buildDispatchInput(task),
|
|
950
|
+
input: await buildDispatchInput(db, task),
|
|
943
951
|
...skill ? { skill } : void 0,
|
|
944
952
|
metadata: buildDispatchMetadata({
|
|
945
953
|
nowMs: args.nowMs,
|
|
@@ -1136,7 +1144,7 @@ async function runHeartbeat(args) {
|
|
|
1136
1144
|
// src/handlers/scheduler-auth.ts
|
|
1137
1145
|
/** Check the bearer secret that internal cron requests must send. */
|
|
1138
1146
|
function verifySchedulerRequest(request) {
|
|
1139
|
-
const secret =
|
|
1147
|
+
const secret = getChatConfig().secrets.schedulerSecret;
|
|
1140
1148
|
if (!secret) return false;
|
|
1141
1149
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1142
1150
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -1165,11 +1173,26 @@ async function GET$3(request, waitUntil, options) {
|
|
|
1165
1173
|
}));
|
|
1166
1174
|
return new Response("Accepted", { status: 202 });
|
|
1167
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
|
+
}
|
|
1168
1195
|
// 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
1196
|
const juniorConversationBriefs = pgTable("junior_conversation_briefs", { conversationId: text("conversation_id").notNull() });
|
|
1174
1197
|
/** Discover a root and its current descendants via `parent_conversation_id`. */
|
|
1175
1198
|
async function discoverConversationTree(executor, root) {
|
|
@@ -1224,26 +1247,16 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1224
1247
|
select 1 from junior_conversation_events events
|
|
1225
1248
|
where events.conversation_id = tree.conversation_id
|
|
1226
1249
|
)
|
|
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
1250
|
or exists (
|
|
1233
1251
|
select 1 from junior_agent_bindings bindings
|
|
1234
1252
|
where bindings.parent_conversation_id = tree.conversation_id
|
|
1235
1253
|
or bindings.child_conversation_id = tree.conversation_id
|
|
1236
1254
|
)
|
|
1237
1255
|
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
|
|
1256
|
+
select 1 from ${juniorInboxItems}
|
|
1257
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1258
|
+
and ${juniorInboxItems.status} = 'open'
|
|
1259
|
+
and not ${inboxItemAddedByAnyAutomation()}
|
|
1247
1260
|
)
|
|
1248
1261
|
or exists (
|
|
1249
1262
|
select 1 from junior_turns turns
|
|
@@ -1270,13 +1283,12 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1270
1283
|
where embeddings.conversation_id = tree.conversation_id
|
|
1271
1284
|
)
|
|
1272
1285
|
or exists (
|
|
1273
|
-
select 1 from
|
|
1274
|
-
where
|
|
1275
|
-
and
|
|
1276
|
-
and inbox_items.visibility = 'private'
|
|
1286
|
+
select 1 from ${juniorInboxItems}
|
|
1287
|
+
where ${inboxItemOwnerConversationId()} = tree.conversation_id
|
|
1288
|
+
and ${inboxItemVisibility()} = 'private'
|
|
1277
1289
|
and (
|
|
1278
|
-
|
|
1279
|
-
or
|
|
1290
|
+
${juniorInboxItems.status} <> 'open'
|
|
1291
|
+
or not ${inboxItemAddedByAnyAutomation()}
|
|
1280
1292
|
)
|
|
1281
1293
|
)
|
|
1282
1294
|
or exists (
|
|
@@ -1304,8 +1316,9 @@ async function selectExpiredRoots(executor, args) {
|
|
|
1304
1316
|
* event rows for the given conversation and every descendant, stamp
|
|
1305
1317
|
* `transcript_purged_at`, and — for non-public content — null the raw-payload
|
|
1306
1318
|
* metadata (`title`, `channel_name`, legacy actor JSON) so purged private
|
|
1307
|
-
* conversations keep only safe metadata.
|
|
1308
|
-
* 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.
|
|
1309
1322
|
* Non-public content also loses its summary, Conversation embedding, legacy
|
|
1310
1323
|
* Briefs, and the Inbox items that it added. The metadata rows themselves
|
|
1311
1324
|
* survive.
|
|
@@ -1354,14 +1367,13 @@ async function purgeConversationTree(executor, args) {
|
|
|
1354
1367
|
await deleteMessageLinks(executor, ids);
|
|
1355
1368
|
await executor.db().delete(juniorTurnInbox).where(inArray(juniorTurnInbox.conversationId, ids));
|
|
1356
1369
|
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
1370
|
await executor.db().delete(juniorAgentBindings).where(or(inArray(juniorAgentBindings.parentConversationId, ids), inArray(juniorAgentBindings.childConversationId, ids)));
|
|
1359
1371
|
await dismissOpenInboxItems(executor.db(), {
|
|
1360
1372
|
ownerConversationIds: ids,
|
|
1361
1373
|
nowMs: args.nowMs,
|
|
1362
1374
|
reason: "Conversation purged"
|
|
1363
1375
|
});
|
|
1364
|
-
await
|
|
1376
|
+
await purgePluginConversationContent(executor.db(), ids);
|
|
1365
1377
|
await requestAttachmentDeletion(executor, ids, args.nowMs);
|
|
1366
1378
|
const scrubMetadata = args.retention ? !isPublic : resolvedScrubMetadata;
|
|
1367
1379
|
await executor.db().update(juniorConversations).set({
|
|
@@ -1377,7 +1389,8 @@ async function purgeConversationTree(executor, args) {
|
|
|
1377
1389
|
if (scrubMetadata) {
|
|
1378
1390
|
await executor.db().delete(juniorConversationBriefs).where(inArray(juniorConversationBriefs.conversationId, ids));
|
|
1379
1391
|
await executor.db().delete(juniorConversationEmbeddings).where(inArray(juniorConversationEmbeddings.conversationId, ids));
|
|
1380
|
-
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))));
|
|
1381
1394
|
}
|
|
1382
1395
|
await touchConversationDetail(executor.db(), ids);
|
|
1383
1396
|
return {
|
|
@@ -1984,7 +1997,8 @@ async function handleSlackInboxItemClick(args) {
|
|
|
1984
1997
|
...common,
|
|
1985
1998
|
action: "submit",
|
|
1986
1999
|
answer: (item) => {
|
|
1987
|
-
const
|
|
2000
|
+
const request = inboxItemQuestion(item.request);
|
|
2001
|
+
const field = request && buttonUserInputField(request);
|
|
1988
2002
|
if (!field?.options.some((option) => option.label === click.label)) throw new InboxItemActionError("conflict", "This card changed. Use the updated card.");
|
|
1989
2003
|
return {
|
|
1990
2004
|
requestId: item.id,
|
|
@@ -2003,13 +2017,16 @@ async function handleSlackInboxItemSubmission(args) {
|
|
|
2003
2017
|
if (!view?.id || !formTarget || !channelId || !messageTs || !threadTs) throw new Error("Slack inbox item form submission is incomplete");
|
|
2004
2018
|
await act({
|
|
2005
2019
|
action: "submit",
|
|
2006
|
-
answer: (item) =>
|
|
2007
|
-
request
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
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
|
+
};
|
|
2013
2030
|
},
|
|
2014
2031
|
inputTs: slackMessageTsFromMs(Date.now()),
|
|
2015
2032
|
itemId: formTarget.itemId,
|
|
@@ -3476,9 +3493,11 @@ function createIdentityDispatcher(args) {
|
|
|
3476
3493
|
}
|
|
3477
3494
|
// src/api/acp/conversations.ts
|
|
3478
3495
|
const EVENT_PAGE_SIZE = 50;
|
|
3496
|
+
async function readAccess(conversationId, user) {
|
|
3497
|
+
return (await readConversationAccessFromSql(getDb(), [conversationId], user)).get(conversationId);
|
|
3498
|
+
}
|
|
3479
3499
|
async function hasConversationAccess(conversationId, user) {
|
|
3480
|
-
|
|
3481
|
-
return Boolean(access?.isParticipant);
|
|
3500
|
+
return Boolean((await readAccess(conversationId, user))?.isParticipant);
|
|
3482
3501
|
}
|
|
3483
3502
|
/** Return whether one Turn can return its terminal result without racing cleanup. */
|
|
3484
3503
|
async function turnTerminalIsReady(args) {
|
|
@@ -3528,9 +3547,8 @@ function createAcpConversations(options) {
|
|
|
3528
3547
|
return await hasConversationAccess(conversationId, user);
|
|
3529
3548
|
},
|
|
3530
3549
|
async prompt({ conversationId, idempotencyKey, text, user }) {
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
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" };
|
|
3534
3552
|
const currentCursor = await latestEventCursor(options.eventStore, conversationId);
|
|
3535
3553
|
if (await getAuthPausedConversationTurnId(conversationId)) return { status: "active" };
|
|
3536
3554
|
const result = await appendAndEnqueueWebMessage({
|
|
@@ -4795,7 +4813,6 @@ async function acceptPrompt(args) {
|
|
|
4795
4813
|
});
|
|
4796
4814
|
if (result.status === "not_found") throw acp.RequestError.resourceNotFound(params.sessionId);
|
|
4797
4815
|
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
4816
|
return {
|
|
4800
4817
|
output: {
|
|
4801
4818
|
afterSeq: result.afterCursor,
|
|
@@ -6127,23 +6144,31 @@ const mcpInboxItemSchema = z.object({
|
|
|
6127
6144
|
updatedAt: z.string(),
|
|
6128
6145
|
url: z.string().optional().describe("Dashboard link to answer it.")
|
|
6129
6146
|
}).strict();
|
|
6130
|
-
/**
|
|
6131
|
-
|
|
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) {
|
|
6132
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;
|
|
6133
6158
|
return {
|
|
6134
6159
|
id: item.id,
|
|
6135
6160
|
kind: item.kind,
|
|
6136
6161
|
status: item.status,
|
|
6137
6162
|
title: item.title,
|
|
6138
6163
|
body: item.body,
|
|
6139
|
-
...
|
|
6164
|
+
...question ? { question: question.question } : void 0,
|
|
6140
6165
|
assignees: item.assignedToEveryone ? [] : item.assignees.map((person) => person.displayName ?? person.email),
|
|
6141
6166
|
canAct: canActOnInboxItem(item, userId),
|
|
6142
6167
|
conversationIds: item.conversationIds,
|
|
6143
|
-
...
|
|
6168
|
+
...subjectUrl ? { subject: {
|
|
6144
6169
|
id: item.subject.id,
|
|
6145
|
-
...
|
|
6146
|
-
|
|
6170
|
+
...subjectTitle ? { title: subjectTitle } : void 0,
|
|
6171
|
+
url: subjectUrl
|
|
6147
6172
|
} } : void 0,
|
|
6148
6173
|
createdAt: item.createdAt.toISOString(),
|
|
6149
6174
|
updatedAt: item.updatedAt.toISOString(),
|
|
@@ -6166,7 +6191,9 @@ function registerGetInboxItemTool(server, { user }) {
|
|
|
6166
6191
|
}
|
|
6167
6192
|
}, async ({ id }) => {
|
|
6168
6193
|
try {
|
|
6169
|
-
|
|
6194
|
+
const item = await readInboxItemForUser(user, id);
|
|
6195
|
+
const cards = await resolveInboxItemSubjects(user, [item]);
|
|
6196
|
+
return mcpToolResult({ item: mcpInboxItem(item, user.id, cards) });
|
|
6170
6197
|
} catch (error) {
|
|
6171
6198
|
if (error instanceof InboxItemActionError) return mcpToolError(error.message);
|
|
6172
6199
|
throw error;
|
|
@@ -6344,8 +6371,10 @@ function registerSearchInboxItemsTool(server, { user }) {
|
|
|
6344
6371
|
...q ? { query: q } : void 0,
|
|
6345
6372
|
statuses: ["open"]
|
|
6346
6373
|
});
|
|
6374
|
+
const page = items.slice(0, limit);
|
|
6375
|
+
const cards = await resolveInboxItemSubjects(user, page);
|
|
6347
6376
|
return mcpToolResult({
|
|
6348
|
-
items:
|
|
6377
|
+
items: page.map((item) => mcpInboxItem(item, user.id, cards)),
|
|
6349
6378
|
truncated: items.length > limit
|
|
6350
6379
|
});
|
|
6351
6380
|
});
|
|
@@ -6683,9 +6712,9 @@ async function handleAcpAuthorizationPage(args) {
|
|
|
6683
6712
|
* a Google Workspace account whose `hd` claim is one of them. Slack and the
|
|
6684
6713
|
* dashboard share one list. `chat/identities/trust` decides who matches.
|
|
6685
6714
|
*/
|
|
6686
|
-
/**
|
|
6687
|
-
function
|
|
6688
|
-
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();
|
|
6689
6718
|
if (!value) return void 0;
|
|
6690
6719
|
if (!value.startsWith("[")) return value.split(",");
|
|
6691
6720
|
let parsed;
|
|
@@ -6703,15 +6732,15 @@ function readEnvList(name) {
|
|
|
6703
6732
|
* `JUNIOR_ALLOWED_DOMAINS`. An empty list allows every domain.
|
|
6704
6733
|
*/
|
|
6705
6734
|
function resolveAllowedDomains(allowedDomains) {
|
|
6706
|
-
return [...new Set((allowedDomains ??
|
|
6735
|
+
return [...new Set((allowedDomains ?? parseEnvList("JUNIOR_ALLOWED_DOMAINS", getChatConfig().signIn.allowedDomains) ?? []).map((value) => value.trim().toLowerCase()).filter(Boolean))];
|
|
6707
6736
|
}
|
|
6708
6737
|
/**
|
|
6709
|
-
* Fail startup on the removed Google-specific
|
|
6738
|
+
* Fail startup on the removed Google-specific option. Ignoring it would
|
|
6710
6739
|
* leave the list empty, which lets every Slack workspace member in.
|
|
6740
|
+
* `loadConfig` rejects the removed env var the same way.
|
|
6711
6741
|
*/
|
|
6712
6742
|
function assertNoLegacyAllowedDomains(dashboardOptionKeys) {
|
|
6713
6743
|
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
6744
|
}
|
|
6716
6745
|
// src/chat/sign-in/auth.ts
|
|
6717
6746
|
/**
|
|
@@ -6760,15 +6789,15 @@ function trimSlashes(value, leading) {
|
|
|
6760
6789
|
function withHttps(host) {
|
|
6761
6790
|
return host.startsWith("https://") || host.startsWith("http://") ? host : `https://${host}`;
|
|
6762
6791
|
}
|
|
6763
|
-
/** Resolve sign-in settings from dashboard options and
|
|
6792
|
+
/** Resolve sign-in settings from dashboard options and config. */
|
|
6764
6793
|
function resolveSignInAuthConfig(agentName, allowedDomains, options = {}) {
|
|
6765
6794
|
return {
|
|
6766
6795
|
agentName,
|
|
6767
6796
|
allowedDomains,
|
|
6768
6797
|
authPath: `/${trimSlashes(options.authPath?.trim() || DEFAULT_AUTH_PATH, true)}`,
|
|
6769
|
-
baseURL: trimSlashes(withHttps(options.baseURL?.trim() ||
|
|
6798
|
+
baseURL: trimSlashes(withHttps(options.baseURL?.trim() || getChatConfig().deployment.baseUrl || "http://localhost:3000"), false),
|
|
6770
6799
|
sessionMaxAgeSeconds: options.sessionMaxAgeSeconds,
|
|
6771
|
-
trustedOrigins: options.trustedOrigins ??
|
|
6800
|
+
trustedOrigins: options.trustedOrigins ?? parseEnvList("JUNIOR_DASHBOARD_TRUSTED_ORIGINS", getChatConfig().signIn.trustedOrigins) ?? []
|
|
6772
6801
|
};
|
|
6773
6802
|
}
|
|
6774
6803
|
function required(value, name) {
|
|
@@ -6776,7 +6805,7 @@ function required(value, name) {
|
|
|
6776
6805
|
return value.trim();
|
|
6777
6806
|
}
|
|
6778
6807
|
function createBetterAuth(config) {
|
|
6779
|
-
const secret = required(config.secret ??
|
|
6808
|
+
const secret = required(config.secret ?? getChatConfig().signIn.secret, "JUNIOR_SECRET or BETTER_AUTH_SECRET");
|
|
6780
6809
|
const sessionMaxAgeSeconds = config.sessionMaxAgeSeconds ?? DEFAULT_SESSION_MAX_AGE_SECONDS;
|
|
6781
6810
|
const { allowedDomains } = config;
|
|
6782
6811
|
const hostedDomain = allowedDomains.length === 0 ? void 0 : allowedDomains.length === 1 ? allowedDomains[0] : "*";
|
|
@@ -6787,8 +6816,8 @@ function createBetterAuth(config) {
|
|
|
6787
6816
|
secret,
|
|
6788
6817
|
trustedOrigins: config.trustedOrigins,
|
|
6789
6818
|
socialProviders: { google: {
|
|
6790
|
-
clientId: required(config.googleClientId ??
|
|
6791
|
-
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"),
|
|
6792
6821
|
hd: hostedDomain,
|
|
6793
6822
|
prompt: "select_account",
|
|
6794
6823
|
disableIdTokenSignIn: true,
|
|
@@ -6895,8 +6924,7 @@ const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
|
6895
6924
|
*/
|
|
6896
6925
|
function dashboardRequiresSignIn(dashboard) {
|
|
6897
6926
|
if (!dashboard || dashboard.disabled) return false;
|
|
6898
|
-
|
|
6899
|
-
return process.env["JUNIOR_DASHBOARD_AUTH_REQUIRED"]?.trim() !== "false";
|
|
6927
|
+
return dashboard.authRequired ?? getChatConfig().signIn.dashboardAuthRequired;
|
|
6900
6928
|
}
|
|
6901
6929
|
/** Mount the dashboard app on the dashboard-owned host paths. */
|
|
6902
6930
|
async function createDashboardRouteRegistrations(args) {
|
|
@@ -7101,14 +7129,6 @@ function validateDashboardRouteOwnership(args) {
|
|
|
7101
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`);
|
|
7102
7130
|
}
|
|
7103
7131
|
// 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
7132
|
/** Build a `WaitUntilFn`, preferring Vercel's lifetime extension when available. */
|
|
7113
7133
|
async function defaultWaitUntil() {
|
|
7114
7134
|
try {
|
|
@@ -7141,6 +7161,34 @@ async function resolveVirtualConfig() {
|
|
|
7141
7161
|
return;
|
|
7142
7162
|
}
|
|
7143
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
|
+
}
|
|
7144
7192
|
function hasConfiguredPluginCatalog(config) {
|
|
7145
7193
|
if (!config) return false;
|
|
7146
7194
|
return Boolean(config.inlineManifests?.length || config.packages?.length || Object.keys(config.manifests ?? {}).length);
|
|
@@ -7189,23 +7237,21 @@ async function createApp(options) {
|
|
|
7189
7237
|
validatePlugins(plugins);
|
|
7190
7238
|
getDb();
|
|
7191
7239
|
const shouldValidatePluginCatalog = hasConfiguredPluginCatalog(pluginConfig) || Boolean(configuredPlugins?.registrations.length) || Boolean(Object.keys(options?.configDefaults ?? {}).length);
|
|
7192
|
-
const previousRuntimeConfig = snapshotRuntimeConfig();
|
|
7193
7240
|
const previousPluginCatalogConfig = pluginCatalogRuntime.setConfig(pluginConfig);
|
|
7194
7241
|
const previousPlugins = setPlugins(plugins);
|
|
7195
7242
|
const previousConfigDefaults = getConfigDefaults();
|
|
7196
|
-
const previousSandboxResources = getSandboxResourceConfig();
|
|
7197
7243
|
const previousExperimentalFeatures = getExperimentalFeatures();
|
|
7198
7244
|
const previousEventEmbeddingsConfig = setEventEmbeddingsConfig(options?.eventEmbeddings);
|
|
7199
7245
|
const previousMemoryConfig = setMemoryConfig(options?.memory);
|
|
7200
7246
|
const previousDashboardLinkOptions = setDashboardConversationLinkOptions(dashboard);
|
|
7201
7247
|
let previousTrustConfig;
|
|
7202
|
-
|
|
7248
|
+
let restoreChatConfig;
|
|
7249
|
+
const restoreRuntimeConfig = () => {
|
|
7203
7250
|
if (previousTrustConfig) setTrustConfig(previousTrustConfig);
|
|
7204
7251
|
pluginCatalogRuntime.setConfig(previousPluginCatalogConfig);
|
|
7205
7252
|
setPlugins(previousPlugins);
|
|
7206
7253
|
setConfigDefaults(previousConfigDefaults);
|
|
7207
|
-
|
|
7208
|
-
setSandboxResourceConfig(previousSandboxResources);
|
|
7254
|
+
restoreChatConfig?.();
|
|
7209
7255
|
setExperimentalFeatures(previousExperimentalFeatures);
|
|
7210
7256
|
setEventEmbeddingsConfig(previousEventEmbeddingsConfig);
|
|
7211
7257
|
setMemoryConfig(previousMemoryConfig);
|
|
@@ -7223,15 +7269,14 @@ async function createApp(options) {
|
|
|
7223
7269
|
let dispatchForIdentity;
|
|
7224
7270
|
try {
|
|
7225
7271
|
sandboxEgressTracePropagationDomains = normalizeSandboxEgressTracePropagationDomains(options?.sandbox?.egressTracePropagationDomains);
|
|
7226
|
-
setSandboxResourceConfig(options?.sandbox);
|
|
7227
7272
|
setExperimentalFeatures(options?.experimental);
|
|
7228
7273
|
setConfigDefaults(options?.configDefaults);
|
|
7229
7274
|
warnUnregisteredConfigDefaults(options?.configDefaults);
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7275
|
+
const previousChatConfig = installChatConfig(loadConfig({
|
|
7276
|
+
env: process.env,
|
|
7277
|
+
options: appConfigInput(options, virtualConfig)
|
|
7278
|
+
}));
|
|
7279
|
+
restoreChatConfig = () => installChatConfig(previousChatConfig);
|
|
7235
7280
|
assertNoLegacyAllowedDomains(Object.keys(dashboard ?? {}));
|
|
7236
7281
|
allowedDomains = resolveAllowedDomains(options?.allowedDomains);
|
|
7237
7282
|
previousTrustConfig = setTrustConfig({
|
|
@@ -7257,7 +7302,7 @@ async function createApp(options) {
|
|
|
7257
7302
|
readObjectLinkTypes(plugins);
|
|
7258
7303
|
}
|
|
7259
7304
|
} catch (error) {
|
|
7260
|
-
restoreRuntimeConfig
|
|
7305
|
+
restoreRuntimeConfig();
|
|
7261
7306
|
throw error;
|
|
7262
7307
|
}
|
|
7263
7308
|
const waitUntil = options?.waitUntil ?? await defaultWaitUntil();
|
|
@@ -7309,7 +7354,7 @@ async function createApp(options) {
|
|
|
7309
7354
|
handleRequest: createAcpHttpHandler({
|
|
7310
7355
|
...dashboard && !dashboard.disabled ? { browserAuth: {
|
|
7311
7356
|
agentName: botConfig.userName,
|
|
7312
|
-
baseURL:
|
|
7357
|
+
baseURL: getChatConfig().deployment.baseUrl
|
|
7313
7358
|
} } : void 0,
|
|
7314
7359
|
conversations: createAcpConversations({
|
|
7315
7360
|
conversationStore: work.conversationStore,
|
|
@@ -7333,7 +7378,7 @@ async function createApp(options) {
|
|
|
7333
7378
|
const mcpConsentRoute = {
|
|
7334
7379
|
handler: (request, user) => handleMcpConsentPage({
|
|
7335
7380
|
agentName: botConfig.userName,
|
|
7336
|
-
baseURL:
|
|
7381
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7337
7382
|
request,
|
|
7338
7383
|
state: getMcpState(),
|
|
7339
7384
|
user
|
|
@@ -7359,7 +7404,7 @@ async function createApp(options) {
|
|
|
7359
7404
|
routes: pluginRoutes
|
|
7360
7405
|
});
|
|
7361
7406
|
} catch (error) {
|
|
7362
|
-
restoreRuntimeConfig
|
|
7407
|
+
restoreRuntimeConfig();
|
|
7363
7408
|
throw error;
|
|
7364
7409
|
}
|
|
7365
7410
|
const signInAuth = signInConfig ? createSignInAuth(signInConfig) : void 0;
|
|
@@ -7392,7 +7437,7 @@ async function createApp(options) {
|
|
|
7392
7437
|
], MCP_ROUTE_PATHS, (c) => {
|
|
7393
7438
|
handleMcpRequest ??= createMcpHttpHandler({
|
|
7394
7439
|
allowedDomains,
|
|
7395
|
-
baseURL:
|
|
7440
|
+
baseURL: getChatConfig().deployment.baseUrl,
|
|
7396
7441
|
attachmentStorage,
|
|
7397
7442
|
queue: conversationWorkQueue,
|
|
7398
7443
|
state: getMcpState()
|