@sentry/junior 0.302.0 → 0.304.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-context-Cx9fn9B3.js → adapter-context-B1IpoELr.js} +2 -2
- package/dist/{admin-_poE5NKL.js → admin-BnVFGo_z.js} +5 -5
- package/dist/{agent-runner-CY9RvsTX.js → agent-runner-CoEeZSRh.js} +1461 -1248
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +13 -12
- package/dist/api.js +230 -105
- package/dist/{app-BpY3wtRP.d.ts → app-Cs157Zc5.d.ts} +17 -15
- package/dist/app.d.ts +1 -1
- package/dist/app.js +108 -96
- package/dist/{automation-Cva5ZOwW.js → automation-CuA3yEcD.js} +3 -1
- package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-WLPNSF_b.js} +6 -6
- package/dist/{briefs-B3NG-pid.js → briefs-CagVVefw.js} +12 -9
- package/dist/{catalog-runtime-Dss0lSV6.js → catalog-runtime-B8ZXvXWm.js} +2 -2
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +21 -21
- package/dist/cli/check.js +10 -10
- package/dist/cli/env.d.ts +1 -0
- package/dist/cli/env.js +8 -7
- package/dist/cli/init.js +13 -4
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-create.js +7 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +6 -6
- package/dist/{config-CzeZiMKs.js → config-DdO1BNcw.js} +142 -67
- package/dist/{connections-CDYhMfrs.js → connections-D20kp0j5.js} +6 -6
- package/dist/{continue-in-slack-7Uf05ndC.js → continue-in-slack-BKEVMBj1.js} +8 -8
- package/dist/{conversation-BNXfq6Lb.js → conversation-BOqdRtUx.js} +4 -12
- package/dist/{conversation-feed-Clf_cv0n.js → conversation-feed-CgpgP7yi.js} +35 -2
- package/dist/{conversation-privacy-D9xnM5mK.js → conversation-privacy-L1SK_v0V.js} +16 -8
- package/dist/{conversation-turn-D7SEZgTG.js → conversation-turn-BptVJylj.js} +20 -23
- package/dist/{credential-sync-DoD0gW-j.js → credential-sync-D1J1CGzL.js} +19 -19
- package/dist/{db-B-gtnNjr.js → db-EKJnkrIb.js} +180 -17
- package/dist/{db-BdsCzytP.d.ts → db-zbN5ZV_o.d.ts} +26 -26
- package/dist/{executor-DZg20EqU.js → executor-CoIZmFK8.js} +55 -15
- package/dist/{history-IjdmO_r6.js → history-m2-ceTTX.js} +21 -12
- package/dist/{install-t1KQyTUs.js → install-BT2Pf6HP.js} +3 -3
- package/dist/instrumentation.d.ts +4 -4
- package/dist/instrumentation.js +15 -11
- package/dist/{lineage-C79GjoQr.js → lineage-C5DGQCS_.js} +2 -2
- package/dist/{logging-C9oDAg4M.js → logging-QSZuMcvo.js} +19 -19
- package/dist/{message-BLUCzJXN.js → message-TtxftRHj.js} +9 -9
- package/dist/{model-input-5jwNC45G.js → model-input-BHXfA29g.js} +4 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +8 -8
- package/dist/{oauth-callback-server-BBl66vCb.js → oauth-callback-server-B0enqHtZ.js} +5 -4
- package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
- package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
- package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
- package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
- package/dist/{projection-CIBwgD3s.js → projection-CNKK7doO.js} +755 -221
- package/dist/{prompt-CRQbzp5e.js → prompt-DSjhoKu5.js} +185 -12
- package/dist/{queue-DtCDaIct.js → queue-CDxkit82.js} +4 -4
- package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
- package/dist/{registry-DdFQHZ_d.js → registry-DBDNUUmz.js} +37 -37
- package/dist/{resolve-CdW4BdrK.js → resolve-CQLhMWSu.js} +3 -3
- package/dist/{result-oOMv1t4O.js → result-B-pauj42.js} +10 -15
- package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
- package/dist/{runner-DqitLtm-.js → runner-B3KxKks5.js} +10 -10
- package/dist/{sandbox-egress-signals-Bw9I0yfJ.js → sandbox-egress-signals-DJJX9ClG.js} +1 -1
- package/dist/{schema-DnVQepWP.js → schema-Bx0Mlo32.js} +77 -13
- package/dist/{schema-BIFM-U1a.d.ts → schema-CKcu-IK6.d.ts} +562 -23
- package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
- package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
- package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
- package/dist/{service-account-CrZftRTb.js → service-account-2HmlNPvy.js} +49 -48
- package/dist/{service-account-B6mKAPVo.js → service-account-DQLqkSVv.js} +5 -5
- package/dist/{session-stop-DW63Z3kj.js → session-stop-DEeZKqbX.js} +132 -74
- package/dist/{skills-C16fz60Z.js → skills-2UrD7JkN.js} +6 -9
- package/dist/{slack-conversation-unfurl-BHhefEb7.js → slack-conversation-unfurl-Dd129Uov.js} +14 -18
- package/dist/{spawn-D_RnFYfy.js → spawn-eMho9HDJ.js} +7 -7
- package/dist/{legacy-web-actor-id-C-cEeWqL.js → state-Bveuc4Zh.js} +32 -32
- package/dist/{stop-7p1i08CY.js → stop-D_ltJLDS.js} +359 -171
- package/dist/{store-C28I0CVW.js → store-COeYnPL_.js} +5 -5
- package/dist/{task-queue-BVUJbQ28.js → task-queue-CBIDXZpV.js} +3 -3
- package/dist/{task-runner-CWi8j7Z6.js → task-runner-CJF7zIJL.js} +15 -18
- package/dist/{thread-context-D3-yYUd0.js → thread-context-Cg0jt0aE.js} +12 -12
- package/dist/{turn-session-routing-BFMS9ATF.js → turn-session-routing-CaY3Tp8m.js} +32 -32
- package/dist/{turn-user-message-C3-O8Omt.js → turn-user-message-tcom1RYd.js} +3 -3
- package/dist/{validation-BSFKUIb4.js → validation-EU91JwIT.js} +2 -2
- package/dist/vercel.js +1 -1
- package/dist/{version-BHHXNi-0.js → version-BYRPhY5G.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-B1SO21Qa.js → viewer-Cf8ISkAc.js} +3 -3
- package/dist/{warmup-Bz9bzkzN.js → warmup-TgY4S1vx.js} +202 -577
- package/dist/{worker-BspReIIK.js → worker-C6Uq4OKD.js} +9 -12
- package/migrations/0109_user_preferences.sql +1 -0
- package/migrations/0110_code_change_repository_state_index.sql +1 -0
- package/migrations/0111_attachment_kinds.sql +14 -0
- package/migrations/0112_attachment_url_fill.sql +51 -0
- package/migrations/0113_attachment_url_index.sql +1 -0
- package/migrations/meta/0099_snapshot.json +102 -326
- package/migrations/meta/0109_snapshot.json +4925 -0
- package/migrations/meta/0110_snapshot.json +4952 -0
- package/migrations/meta/0111_snapshot.json +5011 -0
- package/migrations/meta/0112_snapshot.json +5011 -0
- package/migrations/meta/0113_snapshot.json +5033 -0
- package/migrations/meta/_journal.json +36 -1
- package/package.json +16 -19
package/dist/app.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, G as normalizeIdentityEmail, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, U as GOOGLE_IDENTITY_PROVIDER, b as setSpanAttributes, h as logWarn, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
1
|
+
import { Ar as dismissOpenReviewItems, Bi as createPluginState, C as settleConversationTitleWork, Ci as bindSlackDirectCredentialSubject, Ea as postSlackEphemeralMessage, Ei as verifySlackDirectCredentialSubject, Fi as getDashboardTaskLink, Fo as readConversationMessageEventSeq, Fs as getConfigDefaults, Ha as clearSandboxEgressSignals, Is as setConfigDefaults, Ka as parseSandboxEgressCredentialToken, Ko as collectAttachmentGarbage, Lr as searchReviewItems, Ma as slackEntitySchema, Mo as readConversationEventPageAfter, Mt as hasRunnableConversationWork, Na as slackExternalRefIdSchema, Ni as getDashboardReviewItemLink, Po as readConversationLastEventSeq, Pt as isInvalidConversationRecordError, Qr as reviewItemReaderForUserInConversation, Rt as pruneActiveConversation, Si as bindScheduledAutomationCredentialSubject, Ta as openSlackModal, Ti as verifyScheduledAutomationCredentialSubject, Tr as createPluginReviewItems, Ua as consumeSandboxEgressAuthRequiredSignal, Vr as canActOnReviewItem, Wa as consumeSandboxEgressPermissionDeniedSignal, Xa as normalizeSandboxEgressTracePropagationDomains, Xo as requestAttachmentDeletion, Yn as createUserTokenStore, Zr as reviewItemReaderForUser, _ as appendConversationMessages, _a as slackMention, _i as findMatchingWatches, _o as createPluginLogger, aa as isVercelSandboxEgressRequest, bi as takeDueTimerWatches, bs as createPluginAnnotations, cr as getPlugins, dr as validatePlugins, dt as CONVERSATION_WORK_STALE_ENQUEUE_MS, er as createPluginEventPublisher, gs as resolveRootVisibility, ii as createCodeChangePublisher, is as getSlackClient, jo as readConversationEventPage, ki as getDashboardConversationLink, ks as createPluginCache, mr as setBriefsConfig, ms as runWithWorkspaceTeamId, nr as getPluginApiRoutes, oa as proxyVercelSandboxEgressRequest, os as isDmChannel, pi as collectEventMatchKeys, ps as getWorkspaceTeamId, ro as createPluginEmbedder, rr as getPluginRoutes, ua as resolveBaseUrl, ur as setPlugins, wi as verifyEventAutomationCredentialSubject, wr as projectConversationMessages, xi as bindEventAutomationCredentialSubject, xo as readConversationAccessFromSql, xs as listConversationAnnotations, zi as setDashboardConversationLinkOptions } from "./projection-CNKK7doO.js";
|
|
2
|
+
import { d as restoreRuntimeConfig, et as getAttachmentStorage, f as setBotModelConfig, g as snapshotRuntimeConfig, h as setSlackReactionConfig, i as getChatConfig, m as setRuntimeLimits, n as botConfig, o as getSlackBotToken, p as setBotName, u as resetRuntimeConfig } from "./config-DdO1BNcw.js";
|
|
3
|
+
import { $ as MUTATION_LOCK_TTL_MS, C as withConversationMutationLock, H as recordGoogleSignIn, I as resolveActorIdentityId, J as disconnectStateAdapter, X as getStateAdapter, a as getConversationStore, gt as createSlackDestination, ht as touchConversationDetail, m as withConversationEventLock, nt as withLock, o as getDb, p as deleteMessageLinks, q as createCache, r as getConversationEventStore, s as getSqlExecutor, t as closeDb, tt as fenceLock } from "./db-EKJnkrIb.js";
|
|
4
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, G as normalizeIdentityEmail, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, U as GOOGLE_IDENTITY_PROVIDER, b as setSpanAttributes, h as logWarn, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-QSZuMcvo.js";
|
|
5
|
+
import { C as parseSlackReviewItemClick, E as parseSlackUserInputSubmission, S as buildSlackReviewItemModal, _ as createSlackReviewItemShow, b as findSlackThreadOwnerId, d as publicArtifactHeaders, f as readPublicArtifact, g as scheduledAutomationRunAttributes, h as logScheduledAutomationRunSkipped, n as executeAgentRun, p as unpublishedArtifactHeaders, r as processBackgroundCompaction, t as createAgentRunner, v as resolveSlackReviewItemCardConversationId, w as parseSlackReviewItemFormTarget, y as syncReviewItemSlackCards } from "./agent-runner-CoEeZSRh.js";
|
|
6
|
+
import { $ as slackChannelMessageEvent, F as renderTaskInput, J as isExperimentalFeatureEnabled, V as renderSlackObjectCard, X as getEventCatalog, Y as setExperimentalFeatures, Z as SLACK_EVENT_NAMESPACE, b as getAuthPausedConversationTurnId, et as slackChannelMessageReplyThreadTs, q as getExperimentalFeatures, tt as slackChannelMessageRunsAutomation } from "./session-stop-DEeZKqbX.js";
|
|
7
|
+
import { a as getSandboxResourceConfig, s as setSandboxResourceConfig } from "./install-BT2Pf6HP.js";
|
|
8
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-B8ZXvXWm.js";
|
|
9
|
+
import { $ as readObjectLinkTypes, A as isAllowedSignInEmail, B as runAutoArchiveSweep, C as encodeConversationCursor, Ct as getThreadStopDecision, F as actOnReviewItem, I as closeReviewItemsAnsweredByReply, J as backfillCacheWarmingGaps, K as runSavingsRefillSlice, L as readReviewItemForUser, M as resolveAllowedDomains, N as stopConversation, O as assertNoLegacyAllowedDomains, P as ReviewItemActionError, R as reviewItemChange, S as decodeConversationCursor, St as SubscribedReplyReason, T as readConversationPendingMessages, V as setConversationAutoArchive, Y as GET$4, _t as createSlackWebApiStatusSender, at as createProductionConversationWorkOptions, b as createConversationForViewer, bt as stripLeadingBotMention, ct as buildSlackInboundMessage, dt as normalizeIncomingSlackThreadId, ft as withNormalizedThreadId, gt as recordSkippedConversationMessage, ht as failStoppedDispatch, i as readConversationFeed, it as publicAddressLookup, j as readEnvList, k as isAllowedDomain, l as readConversationDetail, lt as clearSlackPendingReactions, mt as enqueueAgentDispatch, n as steerConversationPendingMessagesForViewer, ot as createProductionSlackWebhookServices, rt as isPublicAddress, s as pinConversation, st as getProductionSlackAdapter, t as stopConversationTurnForViewer, ut as slackInboundMessageId, v as readConversationRecordFromSql, vt as bindMessageAuthorIdentityId, w as cancelConversationPendingMessagesForViewer, xt as parseContent, y as appendConversationMessageForViewer, yt as startProcessingReaction, z as archiveViewerDoneConversations } from "./stop-D_ltJLDS.js";
|
|
10
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-EU91JwIT.js";
|
|
11
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-Bkk0XRo2.js";
|
|
12
|
+
import { At as collectAttachmentUploadGarbage, Ci as missingAutomationSkillReason, Ct as conversationTurnIdForMessage, Dt as webActorFromUser, E as processWorkspaceSnapshotJob, Et as recordWebConversationActivity, Gn as setConversationSubscription, Jt as listPendingAgentInvocationMailboxAppends, L as lookupSlackUserProfile, Si as findAutomationSkill, St as appendAndEnqueueWebMessage, Yt as listPendingAgentInvocationResults, bt as reviewItemChangeRecord, ci as ViewerTaskNotFoundError, dt as archiveConversation, fi as readViewerAutomationSummary, fn as enqueueAgentInvocation, k as ingestEvent, mi as readViewerAutomations, pt as markConversationRead, sr as parseSlackThreadId, ui as readViewerAutomationExecutions, vt as deliverReviewItemChange, wi as effectiveTaskOutcomes, yn as recordSubagentEnded, yr as joinPublicChannel, yt as renderReviewItemMessage } from "./warmup-TgY4S1vx.js";
|
|
13
|
+
import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-CuA3yEcD.js";
|
|
14
|
+
import { E as notifyAutomationBlocked, G as readScheduledAutomation, I as recordAutomationExecution, J as scheduledRunId, O as existingConversationId, U as listScheduledAutomationsForTeam, X as blockEventAutomation, Y as withScheduledAutomationLock, Z as collectEventAutomationMatchKeys, b as listPendingDispatchMailboxAppends, bt as eventGuidance, c as coerceThreadConversationState, d as confirmDispatchMailboxAppend, et as findMatchingEventAutomations, f as createOrGetDispatch, g as getDispatchRecord, l as buildDispatchId, lt as automationVersionOf, ot as admitEventAutomationRun, p as getDispatchConversationId, q as saveScheduledAutomationInLock, st as eventAutomationRunLimitReason, v as getPluginDispatchProjection, w as markDispatchFailed, y as isTerminalDispatchStatus } from "./turn-session-routing-CaY3Tp8m.js";
|
|
15
|
+
import { I as juniorDestinations, N as juniorConversations, T as juniorConversationEvents, f as juniorAutomations, g as juniorAgentInvocations, h as juniorAgentBindings, l as juniorReviewItems, u as juniorAutomationRuns, x as juniorConversationBriefs } from "./executor-CoIZmFK8.js";
|
|
16
|
+
import { i as getActiveSpan, n as captureMessage, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
17
|
+
import { a as queueCallback, c as verifyConversationQueueMessage, f as getQueueProvider, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyBackgroundCompactionMessage, o as getVercelConversationWorkQueue, r as vercelBackgroundCompactionQueue, s as resolveConversationWorkQueueTopic, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-WLPNSF_b.js";
|
|
18
|
+
import { _ as getConversationWorkState, g as getConversation, h as ensureConversationWake, l as clearExpiredConversationLease, r as appendAndEnqueueInboundMessage, y as listActiveConversationIds } from "./store-COeYnPL_.js";
|
|
11
19
|
import { a as getNextRunAtMs } from "./schedule-cP0AACm1.js";
|
|
12
|
-
import { i as
|
|
13
|
-
import {
|
|
20
|
+
import { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-B-pauj42.js";
|
|
21
|
+
import { n as readSchedulerSecret, r as readSignInSecret } from "./secrets-DHaJ5TTn.js";
|
|
22
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-D1J1CGzL.js";
|
|
23
|
+
import { t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
14
24
|
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
25
|
+
import { $ as conversationBriefSchema, N as conversationTitleSchema, R as annotationCard, b as conversationSurfaceSchema, v as conversationReportStatusSchema } from "./conversation-BOqdRtUx.js";
|
|
26
|
+
import { i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-Cf8ISkAc.js";
|
|
27
|
+
import { b as slackMessageTsSchema, g as slackTeamIdSchema, h as slackChannelIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId, v as parseSlackMessageTs, y as slackMessageTsFromMs } from "./actor-D2iXzvlN.js";
|
|
28
|
+
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-Dd129Uov.js";
|
|
29
|
+
import { o as unlinkProvider } from "./connections-D20kp0j5.js";
|
|
20
30
|
import { s as buttonUserInputField } from "./web-message-id-lNodcCOI.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { t as bindSpawnAgent } from "./spawn-D_RnFYfy.js";
|
|
32
|
-
import { a as pluginTaskQueueConsumer, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-BVUJbQ28.js";
|
|
33
|
-
import { t as processPluginTask } from "./task-runner-CWi8j7Z6.js";
|
|
34
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BSFKUIb4.js";
|
|
35
|
-
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-BBX07Jzt.js";
|
|
36
|
-
import { o as unlinkProvider } from "./connections-CDYhMfrs.js";
|
|
37
|
-
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-DoD0gW-j.js";
|
|
38
|
-
import { t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
|
|
39
|
-
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-BHhefEb7.js";
|
|
40
|
-
import { t as processConversationWork } from "./worker-BspReIIK.js";
|
|
31
|
+
import { n as verifySlackSignature, t as runWithSlackInstallation } from "./adapter-context-B1IpoELr.js";
|
|
32
|
+
import { a as resumeConversationDelivery } from "./conversation-turn-BptVJylj.js";
|
|
33
|
+
import { t as processConversationWork } from "./worker-C6Uq4OKD.js";
|
|
34
|
+
import { t as bindMessageAgent } from "./message-TtxftRHj.js";
|
|
35
|
+
import { t as bindSpawnAgent } from "./spawn-eMho9HDJ.js";
|
|
36
|
+
import { a as pluginTaskQueueConsumer, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-CBIDXZpV.js";
|
|
37
|
+
import { t as processPluginTask } from "./task-runner-CJF7zIJL.js";
|
|
38
|
+
import { i as registerVercelCacheWarmupDevConsumer, l as verifyWorkspaceSnapshotJobMessage, n as cacheWarmupQueueConsumer, o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, r as createVercelCacheWarmupCallback } from "./queue-CDxkit82.js";
|
|
39
|
+
import { t as JUNIOR_VERSION } from "./version-BYRPhY5G.js";
|
|
40
|
+
import { c as conversationPendingMessageDeliverySchema, n as conversationFeedQuerySchema } from "./conversation-feed-CgpgP7yi.js";
|
|
41
41
|
import { createRequire } from "node:module";
|
|
42
42
|
import { Hono } from "hono";
|
|
43
43
|
import * as z from "zod";
|
|
44
44
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
45
45
|
import { and, asc, eq, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
|
|
46
|
-
import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, dispatchOptionsSchema, eventSchema, eventTriggerFiltersText, isSlackDestination, userSchema } from "@sentry/junior-plugin-api";
|
|
46
|
+
import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, dispatchOptionsSchema, eventSchema as eventSchema$1, eventTriggerFiltersText, isSlackDestination, userSchema } from "@sentry/junior-plugin-api";
|
|
47
47
|
import { pathToFileURL } from "node:url";
|
|
48
48
|
import { Message, ThreadImpl } from "chat";
|
|
49
49
|
import pLimit from "p-limit";
|
|
@@ -365,7 +365,7 @@ function eventInput(task, event, outcomes, catalog) {
|
|
|
365
365
|
* limit both use the event key, so it runs and counts once.
|
|
366
366
|
*/
|
|
367
367
|
async function ingestEventAutomations(input, options) {
|
|
368
|
-
const event = eventSchema.parse(input);
|
|
368
|
+
const event = eventSchema$1.parse(input);
|
|
369
369
|
const db = getDb();
|
|
370
370
|
const nowMs = options.nowMs ?? Date.now();
|
|
371
371
|
const catalog = getEventCatalog();
|
|
@@ -717,7 +717,7 @@ function taskDedupeFingerprint(task) {
|
|
|
717
717
|
month: task.schedule.recurrence.month ?? null,
|
|
718
718
|
startDate: task.schedule.recurrence.startDate,
|
|
719
719
|
time: task.schedule.recurrence.time,
|
|
720
|
-
weekdays: [...task.schedule.recurrence.weekdays ?? []].sort()
|
|
720
|
+
weekdays: [...task.schedule.recurrence.weekdays ?? []].sort((left, right) => left - right)
|
|
721
721
|
} : null,
|
|
722
722
|
timezone: task.schedule.timezone
|
|
723
723
|
},
|
|
@@ -1414,7 +1414,7 @@ async function GET$3(request, waitUntil, options = {}) {
|
|
|
1414
1414
|
nowMs,
|
|
1415
1415
|
showReviewItem: options.showReviewItem
|
|
1416
1416
|
}).catch((error) => {
|
|
1417
|
-
logException(error, "heartbeat.failed", { "app.heartbeat.now_ms": nowMs });
|
|
1417
|
+
logException(error, "heartbeat.run.failed", { "app.heartbeat.now_ms": nowMs });
|
|
1418
1418
|
}));
|
|
1419
1419
|
return new Response("Accepted", { status: 202 });
|
|
1420
1420
|
}
|
|
@@ -1574,6 +1574,7 @@ async function purgeConversationTree(executor, args) {
|
|
|
1574
1574
|
};
|
|
1575
1575
|
}
|
|
1576
1576
|
await executor.db().delete(juniorConversationEvents).where(inArray(juniorConversationEvents.conversationId, ids));
|
|
1577
|
+
await deleteMessageLinks(executor, ids);
|
|
1577
1578
|
await executor.db().delete(juniorAgentInvocations).where(or(inArray(juniorAgentInvocations.parentConversationId, ids), inArray(juniorAgentInvocations.childConversationId, ids)));
|
|
1578
1579
|
await executor.db().delete(juniorAgentBindings).where(or(inArray(juniorAgentBindings.parentConversationId, ids), inArray(juniorAgentBindings.childConversationId, ids)));
|
|
1579
1580
|
await dismissOpenReviewItems(executor.db(), {
|
|
@@ -1748,7 +1749,7 @@ async function handleSandboxEgressRoute(request, tracePropagationDomains, next)
|
|
|
1748
1749
|
const SANDBOX_EGRESS_TOKEN_HEADER = "x-junior-sandbox-egress-token";
|
|
1749
1750
|
function isLoopbackDevelopmentRequest(request) {
|
|
1750
1751
|
const hostname = new URL(request.url).hostname;
|
|
1751
|
-
return process.env
|
|
1752
|
+
return process.env["NODE_ENV"] === "development" && (hostname === "127.0.0.1" || hostname === "localhost");
|
|
1752
1753
|
}
|
|
1753
1754
|
/** Clear command-scoped sandbox egress signals through the loopback dev server. */
|
|
1754
1755
|
async function DELETE(request) {
|
|
@@ -1770,7 +1771,7 @@ async function GET(request) {
|
|
|
1770
1771
|
});
|
|
1771
1772
|
}
|
|
1772
1773
|
// src/chat/slack/annotation-details.ts
|
|
1773
|
-
const eventSchema
|
|
1774
|
+
const eventSchema = z.object({
|
|
1774
1775
|
trigger_id: z.string().min(1),
|
|
1775
1776
|
user: z.string().min(1),
|
|
1776
1777
|
external_ref: z.object({
|
|
@@ -1785,14 +1786,14 @@ const refSchema = z.tuple([
|
|
|
1785
1786
|
]);
|
|
1786
1787
|
/** Show saved annotation facts only to a viewer who can read their Conversation. */
|
|
1787
1788
|
async function presentSlackAnnotationDetails(event, teamId) {
|
|
1788
|
-
const triggerId = event
|
|
1789
|
+
const triggerId = event["trigger_id"];
|
|
1789
1790
|
if (typeof triggerId !== "string" || !triggerId) return;
|
|
1790
1791
|
const client = getSlackClient();
|
|
1791
1792
|
const missing = () => client.entity.presentDetails({
|
|
1792
1793
|
trigger_id: triggerId,
|
|
1793
1794
|
error: { status: "not_found" }
|
|
1794
1795
|
});
|
|
1795
|
-
const parsed = eventSchema
|
|
1796
|
+
const parsed = eventSchema.safeParse(event);
|
|
1796
1797
|
if (!parsed.success || !teamId) {
|
|
1797
1798
|
await missing();
|
|
1798
1799
|
return;
|
|
@@ -2589,8 +2590,8 @@ function slackMessageAttributes(body) {
|
|
|
2589
2590
|
"app.slack.bot_id": field(event?.bot_id, /^B[A-Z0-9]+$/),
|
|
2590
2591
|
"app.slack.team_id": field(body.team_id, /^T[A-Z0-9]+$/),
|
|
2591
2592
|
"app.slack.enterprise_id": field(body.enterprise_id, /^E[A-Z0-9]+$/),
|
|
2592
|
-
"app.slack.user_team": field(event?.user_team, teamId),
|
|
2593
|
-
"app.slack.source_team": field(event?.source_team, teamId),
|
|
2593
|
+
"app.slack.user_team": field(event?.["user_team"], teamId),
|
|
2594
|
+
"app.slack.source_team": field(event?.["source_team"], teamId),
|
|
2594
2595
|
"app.slack.event_team": field(event?.team, teamId),
|
|
2595
2596
|
"app.slack.context_team_id": field(body.context_team_id, /^T[A-Z0-9]+$/),
|
|
2596
2597
|
"app.slack.context_enterprise_id": body.context_enterprise_id === null ? "none" : field(body.context_enterprise_id, /^E[A-Z0-9]+$/),
|
|
@@ -2691,7 +2692,7 @@ const detailsEventSchema = z.object({
|
|
|
2691
2692
|
async function presentSlackAutomationDetails(event, teamId) {
|
|
2692
2693
|
const parsed = detailsEventSchema.safeParse(event);
|
|
2693
2694
|
const client = getSlackClient();
|
|
2694
|
-
const triggerId = event
|
|
2695
|
+
const triggerId = event["trigger_id"];
|
|
2695
2696
|
if (typeof triggerId !== "string" || !triggerId) return;
|
|
2696
2697
|
if (!parsed.success || !teamId) {
|
|
2697
2698
|
await client.entity.presentDetails({
|
|
@@ -2777,7 +2778,7 @@ async function buildThread(args) {
|
|
|
2777
2778
|
});
|
|
2778
2779
|
}
|
|
2779
2780
|
function shouldIgnoreMessage(message) {
|
|
2780
|
-
return message.author.isMe
|
|
2781
|
+
return message.author.isMe || !parseActorUserId(message.author.userId);
|
|
2781
2782
|
}
|
|
2782
2783
|
/**
|
|
2783
2784
|
* Resolve the Slack author Identity at ingress and bind its id to the message.
|
|
@@ -3039,7 +3040,7 @@ async function handleSlackEvent(args) {
|
|
|
3039
3040
|
state,
|
|
3040
3041
|
task: async () => {
|
|
3041
3042
|
if (event.type === "assistant_thread_started" || event.type === "assistant_thread_context_changed") {
|
|
3042
|
-
const parsed = slackAssistantThreadSchema.safeParse(event
|
|
3043
|
+
const parsed = slackAssistantThreadSchema.safeParse(event["assistant_thread"]);
|
|
3043
3044
|
if (!parsed.success) return;
|
|
3044
3045
|
const thread = parsed.data;
|
|
3045
3046
|
const callback = {
|
|
@@ -3057,7 +3058,7 @@ async function handleSlackEvent(args) {
|
|
|
3057
3058
|
return;
|
|
3058
3059
|
}
|
|
3059
3060
|
if (event.type === "entity_details_requested") {
|
|
3060
|
-
const ref = event
|
|
3061
|
+
const ref = event["external_ref"];
|
|
3061
3062
|
if (ref && typeof ref === "object" && "type" in ref && ref.type === "annotation") await presentSlackAnnotationDetails(event, installation.teamId);
|
|
3062
3063
|
else await presentSlackAutomationDetails(event, installation.teamId);
|
|
3063
3064
|
return;
|
|
@@ -4182,7 +4183,7 @@ async function streamPrompt(args) {
|
|
|
4182
4183
|
})) return false;
|
|
4183
4184
|
}
|
|
4184
4185
|
if (page.terminal?.status === "completed") return await args.emit(resultMessage$2(args.output.requestId, { stopReason: page.terminal.outcome === "cancelled" ? "cancelled" : "end_turn" }));
|
|
4185
|
-
if (page.terminal?.status === "failed") return await args.emit(errorMessage$1(args.output.requestId, acp.RequestError.internalError({ failureCode: page.terminal.failureCode }, "
|
|
4186
|
+
if (page.terminal?.status === "failed") return await args.emit(errorMessage$1(args.output.requestId, acp.RequestError.internalError({ failureCode: page.terminal.failureCode }, "Turn failed")));
|
|
4186
4187
|
}
|
|
4187
4188
|
return false;
|
|
4188
4189
|
}
|
|
@@ -4383,11 +4384,15 @@ const acpAuthorizationPointerSchema = z.object({
|
|
|
4383
4384
|
expiresAtMs: z.number().int().positive(),
|
|
4384
4385
|
transactionId: z.string().uuid()
|
|
4385
4386
|
}).strict();
|
|
4386
|
-
const
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4387
|
+
const ACP_AUTH_METHOD_ID = "junior";
|
|
4388
|
+
/** Describe browser sign-in with the configured bot name. */
|
|
4389
|
+
function acpAuthMethod(agentName) {
|
|
4390
|
+
return {
|
|
4391
|
+
id: ACP_AUTH_METHOD_ID,
|
|
4392
|
+
name: `Sign in to ${agentName}`,
|
|
4393
|
+
description: "Sign in with the Google account that this app allows."
|
|
4394
|
+
};
|
|
4395
|
+
}
|
|
4391
4396
|
function authorizationKey$1(transactionId) {
|
|
4392
4397
|
return `junior:acp:v1:authorization:${transactionId}`;
|
|
4393
4398
|
}
|
|
@@ -4453,7 +4458,7 @@ function hasAcpConnectionCredential(request, expectedHash) {
|
|
|
4453
4458
|
/** Resolve a trusted browser origin, with request fallback only on loopback. */
|
|
4454
4459
|
function authorizationBaseURL(request, configured) {
|
|
4455
4460
|
const url = resolvePublicOrigin(request, configured);
|
|
4456
|
-
if (!url) throw acp.RequestError.internalError(void 0, "
|
|
4461
|
+
if (!url) throw acp.RequestError.internalError(void 0, "ACP sign-in requires a configured public base URL");
|
|
4457
4462
|
return url;
|
|
4458
4463
|
}
|
|
4459
4464
|
async function readAuthorization(state, transactionId) {
|
|
@@ -4503,7 +4508,7 @@ function resultMessage$1(requestId) {
|
|
|
4503
4508
|
result: {}
|
|
4504
4509
|
};
|
|
4505
4510
|
}
|
|
4506
|
-
function cancelledMessage(requestId, message = "
|
|
4511
|
+
function cancelledMessage(requestId, message = "Sign-in was cancelled") {
|
|
4507
4512
|
return {
|
|
4508
4513
|
jsonrpc: "2.0",
|
|
4509
4514
|
id: requestId,
|
|
@@ -4516,7 +4521,7 @@ async function beginAcpAuthorization(args) {
|
|
|
4516
4521
|
const result = await withLock(args.state, authorizationPointerLockKey(args.connectionId), async (lock) => {
|
|
4517
4522
|
const pointer = await readAuthorizationPointer(args.state, args.connectionId);
|
|
4518
4523
|
if (pointer) {
|
|
4519
|
-
if ((await readAuthorization(args.state, pointer.transactionId))?.connectionId === args.connectionId) throw acp.RequestError.invalidRequest(void 0, "
|
|
4524
|
+
if ((await readAuthorization(args.state, pointer.transactionId))?.connectionId === args.connectionId) throw acp.RequestError.invalidRequest(void 0, "Sign-in is already in progress");
|
|
4520
4525
|
await fenceLock(args.state, lock, MUTATION_LOCK_TTL_MS);
|
|
4521
4526
|
await args.state.delete(authorizationPointerKey(args.connectionId));
|
|
4522
4527
|
}
|
|
@@ -4552,7 +4557,7 @@ async function beginAcpAuthorization(args) {
|
|
|
4552
4557
|
url.pathname = `/_junior/acp/auth/${transactionId}`;
|
|
4553
4558
|
const params = {
|
|
4554
4559
|
mode: "url",
|
|
4555
|
-
message: `Sign in to
|
|
4560
|
+
message: `Sign in to ${args.agentName} in your browser. Enter verification code ${userCode}.`,
|
|
4556
4561
|
elicitationId: transactionId,
|
|
4557
4562
|
requestId: args.requestId,
|
|
4558
4563
|
url: url.toString()
|
|
@@ -4587,7 +4592,7 @@ async function completeAcpAuthorization(args) {
|
|
|
4587
4592
|
if (authorization.expiresAtMs <= Date.now()) {
|
|
4588
4593
|
const completion = await finishAuthorization({
|
|
4589
4594
|
authorization,
|
|
4590
|
-
response: cancelledMessage(authorization.requestId, "
|
|
4595
|
+
response: cancelledMessage(authorization.requestId, "Sign-in request expired"),
|
|
4591
4596
|
state: args.state
|
|
4592
4597
|
});
|
|
4593
4598
|
if (completion === "busy") return completion;
|
|
@@ -4605,7 +4610,7 @@ async function completeAcpAuthorization(args) {
|
|
|
4605
4610
|
if (binding !== "completed") {
|
|
4606
4611
|
const completion = await finishAuthorization({
|
|
4607
4612
|
authorization,
|
|
4608
|
-
response: cancelledMessage(authorization.requestId, "
|
|
4613
|
+
response: cancelledMessage(authorization.requestId, "Sign-in could not bind this connection"),
|
|
4609
4614
|
state: args.state
|
|
4610
4615
|
});
|
|
4611
4616
|
if (completion !== "completed") return completion;
|
|
@@ -4670,7 +4675,7 @@ async function expireAcpAuthorization(args) {
|
|
|
4670
4675
|
if (authorization.expiresAtMs > Date.now()) return false;
|
|
4671
4676
|
if (await finishAuthorization({
|
|
4672
4677
|
authorization,
|
|
4673
|
-
response: cancelledMessage(authorization.requestId, "
|
|
4678
|
+
response: cancelledMessage(authorization.requestId, "Sign-in request expired"),
|
|
4674
4679
|
state: args.state
|
|
4675
4680
|
}) === "busy") return false;
|
|
4676
4681
|
await fenceLock(args.state, lock, MUTATION_LOCK_TTL_MS);
|
|
@@ -4688,7 +4693,7 @@ async function expireAcpAuthorization(args) {
|
|
|
4688
4693
|
/**
|
|
4689
4694
|
* Own the remote ACP v1 Streamable HTTP edge.
|
|
4690
4695
|
*
|
|
4691
|
-
* Shared state records route short-lived JSON-RPC messages.
|
|
4696
|
+
* Shared state records route short-lived JSON-RPC messages. The
|
|
4692
4697
|
* Conversation log remains the source for session replay and Turn output. No
|
|
4693
4698
|
* request relies on another request reaching the same app process.
|
|
4694
4699
|
*/
|
|
@@ -4707,8 +4712,8 @@ function authenticatedAcpUser(connection) {
|
|
|
4707
4712
|
function supportsUrlElicitation(params) {
|
|
4708
4713
|
const parsed = initializeParamsSchema.safeParse(params);
|
|
4709
4714
|
if (!parsed.success) return false;
|
|
4710
|
-
const elicitation = parsed.data.clientCapabilities?.elicitation;
|
|
4711
|
-
return isRecord(elicitation) && isRecord(elicitation
|
|
4715
|
+
const elicitation = parsed.data.clientCapabilities?.["elicitation"];
|
|
4716
|
+
return isRecord(elicitation) && isRecord(elicitation["url"]);
|
|
4712
4717
|
}
|
|
4713
4718
|
function parseParams(schema, params) {
|
|
4714
4719
|
const parsed = schema.safeParse(params);
|
|
@@ -4716,9 +4721,9 @@ function parseParams(schema, params) {
|
|
|
4716
4721
|
const firstPath = parsed.error.issues[0]?.path[0];
|
|
4717
4722
|
throw acp.RequestError.invalidParams({ field: typeof firstPath === "string" || typeof firstPath === "number" ? String(firstPath) : "params" });
|
|
4718
4723
|
}
|
|
4719
|
-
/** Reject client MCP servers because
|
|
4724
|
+
/** Reject client MCP servers because the agent does not use the client workspace. */
|
|
4720
4725
|
function rejectUnsupportedMcpServers(mcpServers) {
|
|
4721
|
-
if (mcpServers.length > 0) throw acp.RequestError.invalidParams({ field: "mcpServers" }, "
|
|
4726
|
+
if (mcpServers.length > 0) throw acp.RequestError.invalidParams({ field: "mcpServers" }, "Client MCP servers are not supported");
|
|
4722
4727
|
}
|
|
4723
4728
|
function resourceLinkText(block) {
|
|
4724
4729
|
return [
|
|
@@ -4733,18 +4738,18 @@ function resourceLinkText(block) {
|
|
|
4733
4738
|
}
|
|
4734
4739
|
/** Convert supported ACP content blocks to one bounded Conversation Message. */
|
|
4735
4740
|
function promptText(prompt) {
|
|
4736
|
-
if (prompt.length === 0) throw acp.RequestError.invalidParams({ field: "prompt" }, "
|
|
4741
|
+
if (prompt.length === 0) throw acp.RequestError.invalidParams({ field: "prompt" }, "Prompt must have one or more text or resource link blocks");
|
|
4737
4742
|
const blocks = [];
|
|
4738
4743
|
for (const block of prompt) {
|
|
4739
4744
|
if (block.type === "resource_link") {
|
|
4740
4745
|
blocks.push(resourceLinkText(block));
|
|
4741
4746
|
continue;
|
|
4742
4747
|
}
|
|
4743
|
-
if (!block.text.trim()) throw acp.RequestError.invalidParams({ field: "prompt" }, "
|
|
4748
|
+
if (!block.text.trim()) throw acp.RequestError.invalidParams({ field: "prompt" }, "Text blocks must not be empty");
|
|
4744
4749
|
blocks.push(block.text);
|
|
4745
4750
|
}
|
|
4746
4751
|
const text = blocks.join("\n");
|
|
4747
|
-
if (text.length > MAX_PROMPT_TEXT_LENGTH) throw acp.RequestError.invalidParams({ field: "prompt" }, `
|
|
4752
|
+
if (text.length > MAX_PROMPT_TEXT_LENGTH) throw acp.RequestError.invalidParams({ field: "prompt" }, `Prompt must have at most ${MAX_PROMPT_TEXT_LENGTH} characters`);
|
|
4748
4753
|
return text;
|
|
4749
4754
|
}
|
|
4750
4755
|
function stableHex(value, length = 32) {
|
|
@@ -4800,12 +4805,11 @@ function textResponse(body, status) {
|
|
|
4800
4805
|
});
|
|
4801
4806
|
}
|
|
4802
4807
|
function jsonResponse(value, status, headers) {
|
|
4808
|
+
const responseHeaders = new Headers(headers);
|
|
4809
|
+
if (!responseHeaders.has("Content-Type")) responseHeaders.set("Content-Type", ACP_JSON_MIME_TYPE);
|
|
4803
4810
|
return new Response(JSON.stringify(value), {
|
|
4804
4811
|
status,
|
|
4805
|
-
headers:
|
|
4806
|
-
"Content-Type": ACP_JSON_MIME_TYPE,
|
|
4807
|
-
...headers
|
|
4808
|
-
}
|
|
4812
|
+
headers: responseHeaders
|
|
4809
4813
|
});
|
|
4810
4814
|
}
|
|
4811
4815
|
function emptyResponse(status) {
|
|
@@ -4901,7 +4905,7 @@ async function handleInitialize(args) {
|
|
|
4901
4905
|
if (requestId === void 0) return textResponse("Initialize request must include an ID", 400);
|
|
4902
4906
|
try {
|
|
4903
4907
|
parseParams(initializeParamsSchema, args.call.params);
|
|
4904
|
-
if (!supportsUrlElicitation(args.call.params)) throw acp.RequestError.invalidParams({ field: "clientCapabilities.elicitation.url" }, "Remote
|
|
4908
|
+
if (!supportsUrlElicitation(args.call.params)) throw acp.RequestError.invalidParams({ field: "clientCapabilities.elicitation.url" }, "Remote authentication requires URL elicitation support");
|
|
4905
4909
|
const credential = createAcpConnectionCredential(args.request);
|
|
4906
4910
|
const result = {
|
|
4907
4911
|
protocolVersion: acp.PROTOCOL_VERSION,
|
|
@@ -4913,7 +4917,7 @@ async function handleInitialize(args) {
|
|
|
4913
4917
|
embeddedContext: false
|
|
4914
4918
|
}
|
|
4915
4919
|
},
|
|
4916
|
-
authMethods: args.
|
|
4920
|
+
authMethods: args.browserAuthAgentName ? [acpAuthMethod(args.browserAuthAgentName)] : [],
|
|
4917
4921
|
agentInfo: {
|
|
4918
4922
|
name: "junior",
|
|
4919
4923
|
version: args.version
|
|
@@ -4955,13 +4959,14 @@ async function handleConnectedPost(args) {
|
|
|
4955
4959
|
createReceipt: async () => {
|
|
4956
4960
|
try {
|
|
4957
4961
|
if (identifiedCall.method === acp.methods.agent.authenticate) {
|
|
4958
|
-
if (parseParams(authenticateParamsSchema, identifiedCall.params).methodId !== "junior") throw acp.RequestError.invalidParams({ field: "methodId" }, "
|
|
4962
|
+
if (parseParams(authenticateParamsSchema, identifiedCall.params).methodId !== "junior") throw acp.RequestError.invalidParams({ field: "methodId" }, "This authentication method was not advertised");
|
|
4959
4963
|
if (args.authenticated) return { outputs: [{
|
|
4960
4964
|
kind: "message",
|
|
4961
4965
|
message: resultMessage(requestId, {})
|
|
4962
4966
|
}] };
|
|
4963
|
-
if (!args.options.browserAuth) throw acp.RequestError.internalError(void 0, "
|
|
4967
|
+
if (!args.options.browserAuth) throw acp.RequestError.internalError(void 0, "ACP authentication requires an enabled dashboard");
|
|
4964
4968
|
return await beginAcpAuthorization({
|
|
4969
|
+
agentName: args.options.browserAuth.agentName,
|
|
4965
4970
|
baseURL: args.options.browserAuth.baseURL,
|
|
4966
4971
|
connectionId: args.connectionId,
|
|
4967
4972
|
credentialHash: args.connection.credentialHash,
|
|
@@ -5043,7 +5048,7 @@ function createAcpHttpHandler(options) {
|
|
|
5043
5048
|
call = message;
|
|
5044
5049
|
if (connectionId) return textResponse("Initialize not allowed on existing connection", 400);
|
|
5045
5050
|
return await handleInitialize({
|
|
5046
|
-
|
|
5051
|
+
browserAuthAgentName: options.browserAuth?.agentName,
|
|
5047
5052
|
call,
|
|
5048
5053
|
request,
|
|
5049
5054
|
state,
|
|
@@ -5434,7 +5439,7 @@ const MCP_SCOPES = [
|
|
|
5434
5439
|
const MCP_SCOPE_DESCRIPTIONS = {
|
|
5435
5440
|
"conversations:read": "List and read the conversations that you started or take part in",
|
|
5436
5441
|
"conversations:manage": "Archive, pin, and mark your conversations read, stop a running Turn, and cancel queued messages",
|
|
5437
|
-
"conversations:write": "Start conversations and send messages as you.
|
|
5442
|
+
"conversations:write": "Start conversations and send messages as you. Each message starts agent work",
|
|
5438
5443
|
"review_items:read": "List and read your review items",
|
|
5439
5444
|
"automations:read": "List and read the automations that you can see"
|
|
5440
5445
|
};
|
|
@@ -5811,7 +5816,7 @@ const MCP_CONSENT_PATH = "/_junior/mcp/authorize/:authorizationId";
|
|
|
5811
5816
|
/** Resolve the MCP URLs for this request from the trusted public origin. */
|
|
5812
5817
|
function resolveMcpUrls(request, baseURL) {
|
|
5813
5818
|
const origin = resolvePublicOrigin(request, baseURL);
|
|
5814
|
-
if (!origin) throw new Error("
|
|
5819
|
+
if (!origin) throw new Error("MCP requires a configured public base URL");
|
|
5815
5820
|
const url = (path) => new URL(path, origin).toString();
|
|
5816
5821
|
return {
|
|
5817
5822
|
authorize: url(MCP_AUTHORIZE_PATH),
|
|
@@ -6933,14 +6938,18 @@ const TOOLS_BY_SCOPE = {
|
|
|
6933
6938
|
"review_items:read": [registerSearchReviewItemsTool, registerGetReviewItemTool],
|
|
6934
6939
|
"automations:read": [registerSearchAutomationsTool, registerGetAutomationTool]
|
|
6935
6940
|
};
|
|
6936
|
-
|
|
6937
|
-
|
|
6941
|
+
function readInstructions(agentName) {
|
|
6942
|
+
return `${agentName} is a Slack agent. These tools read and manage your ${agentName} conversations, and read your review items and automations. They cannot send a message or start agent work. To ask ${agentName} for work or to answer a review item, use the Slack or dashboard link in a result.`;
|
|
6943
|
+
}
|
|
6944
|
+
function writeInstructions(agentName) {
|
|
6945
|
+
return `${agentName} is a Slack agent. These tools read and manage your ${agentName} conversations, and read your review items and automations. createConversation and sendMessage send a message as you, and ${agentName} works on it in the background. They return a \`cursor\`. Call getConversation with \`after\` set to the newest \`cursor\` to read the new messages. Repeat until \`status\` is not \`active\` and \`hasMore\` is not set. \`authorization\` means a turn waits for you to connect an account. To answer a review item, use the dashboard link in a result.`;
|
|
6946
|
+
}
|
|
6938
6947
|
/** Build the MCP server for one authenticated user and granted scopes. */
|
|
6939
6948
|
function createMcpServer(context, scopes) {
|
|
6940
6949
|
const server = new McpServer({
|
|
6941
6950
|
name: "junior",
|
|
6942
6951
|
version: JUNIOR_VERSION
|
|
6943
|
-
}, { instructions: scopes.includes("conversations:write") ?
|
|
6952
|
+
}, { instructions: scopes.includes("conversations:write") ? writeInstructions(botConfig.userName) : readInstructions(botConfig.userName) });
|
|
6944
6953
|
for (const scope of scopes) for (const register of TOOLS_BY_SCOPE[scope]) register(server, context);
|
|
6945
6954
|
return server;
|
|
6946
6955
|
}
|
|
@@ -7233,7 +7242,7 @@ function resolveSignInAuthConfig(agentName, allowedDomains, options = {}) {
|
|
|
7233
7242
|
};
|
|
7234
7243
|
}
|
|
7235
7244
|
function required(value, name) {
|
|
7236
|
-
if (!value?.trim()) throw new Error(`${name} is required for
|
|
7245
|
+
if (!value?.trim()) throw new Error(`${name} is required for sign-in`);
|
|
7237
7246
|
return value.trim();
|
|
7238
7247
|
}
|
|
7239
7248
|
function createBetterAuth(config) {
|
|
@@ -7248,8 +7257,8 @@ function createBetterAuth(config) {
|
|
|
7248
7257
|
secret,
|
|
7249
7258
|
trustedOrigins: config.trustedOrigins,
|
|
7250
7259
|
socialProviders: { google: {
|
|
7251
|
-
clientId: required(config.googleClientId ?? process.env
|
|
7252
|
-
clientSecret: required(config.googleClientSecret ?? process.env
|
|
7260
|
+
clientId: required(config.googleClientId ?? process.env["GOOGLE_CLIENT_ID"], "GOOGLE_CLIENT_ID"),
|
|
7261
|
+
clientSecret: required(config.googleClientSecret ?? process.env["GOOGLE_CLIENT_SECRET"], "GOOGLE_CLIENT_SECRET"),
|
|
7253
7262
|
hd: hostedDomain,
|
|
7254
7263
|
prompt: "select_account",
|
|
7255
7264
|
disableIdTokenSignIn: true,
|
|
@@ -7262,7 +7271,7 @@ function createBetterAuth(config) {
|
|
|
7262
7271
|
return {
|
|
7263
7272
|
user: {
|
|
7264
7273
|
email: claims.email,
|
|
7265
|
-
emailVerified: claims.email_verified
|
|
7274
|
+
emailVerified: claims.email_verified,
|
|
7266
7275
|
image: claims.picture ?? null,
|
|
7267
7276
|
name: claims.name
|
|
7268
7277
|
},
|
|
@@ -7354,7 +7363,7 @@ const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
|
7354
7363
|
function dashboardRequiresSignIn(dashboard) {
|
|
7355
7364
|
if (!dashboard || dashboard.disabled) return false;
|
|
7356
7365
|
if (dashboard.authRequired !== void 0) return dashboard.authRequired;
|
|
7357
|
-
return process.env
|
|
7366
|
+
return process.env["JUNIOR_DASHBOARD_AUTH_REQUIRED"]?.trim() !== "false";
|
|
7358
7367
|
}
|
|
7359
7368
|
/** Mount the dashboard app on the dashboard-owned host paths. */
|
|
7360
7369
|
async function createDashboardRouteRegistrations(args) {
|
|
@@ -7552,9 +7561,9 @@ function validateDashboardRouteOwnership(args) {
|
|
|
7552
7561
|
// src/app.ts
|
|
7553
7562
|
/** Resolve the public deployment URL used by ACP and MCP browser authorization. */
|
|
7554
7563
|
function resolvePublicBaseURL(dashboard) {
|
|
7555
|
-
const configured = dashboard?.baseURL?.trim() || process.env
|
|
7564
|
+
const configured = dashboard?.baseURL?.trim() || process.env["JUNIOR_BASE_URL"]?.trim();
|
|
7556
7565
|
if (configured) return configured;
|
|
7557
|
-
const vercelURL = process.env
|
|
7566
|
+
const vercelURL = process.env["VERCEL_PROJECT_PRODUCTION_URL"]?.trim() || process.env["VERCEL_URL"]?.trim();
|
|
7558
7567
|
if (!vercelURL) return void 0;
|
|
7559
7568
|
return vercelURL.startsWith("https://") || vercelURL.startsWith("http://") ? vercelURL : `https://${vercelURL}`;
|
|
7560
7569
|
}
|
|
@@ -7698,7 +7707,7 @@ async function createApp(options) {
|
|
|
7698
7707
|
setSlackReactionConfig(options?.slack ?? {});
|
|
7699
7708
|
assertNoLegacyAllowedDomains(Object.keys(dashboard ?? {}));
|
|
7700
7709
|
allowedDomains = resolveAllowedDomains(options?.allowedDomains);
|
|
7701
|
-
if (allowedDomains.length === 0) logWarn("app.allowed_domains.unset", { "app.reason": "allowedDomains is empty, so any Slack workspace member can use
|
|
7710
|
+
if (allowedDomains.length === 0) logWarn("app.allowed_domains.unset", { "app.reason": "allowedDomains is empty, so any Slack workspace member can use the bot" });
|
|
7702
7711
|
if (dashboard && !dashboard.disabled) signInConfig = resolveSignInAuthConfig(botConfig.userName, allowedDomains, dashboard);
|
|
7703
7712
|
if (shouldValidatePluginCatalog) {
|
|
7704
7713
|
pluginCatalogRuntime.getSignature();
|
|
@@ -7763,7 +7772,10 @@ async function createApp(options) {
|
|
|
7763
7772
|
const state = work.state ?? getStateAdapter();
|
|
7764
7773
|
acpRuntime = {
|
|
7765
7774
|
handleRequest: createAcpHttpHandler({
|
|
7766
|
-
...dashboard && !dashboard.disabled ? { browserAuth: {
|
|
7775
|
+
...dashboard && !dashboard.disabled ? { browserAuth: {
|
|
7776
|
+
agentName: botConfig.userName,
|
|
7777
|
+
baseURL: resolvePublicBaseURL(dashboard)
|
|
7778
|
+
} } : void 0,
|
|
7767
7779
|
conversations: createAcpConversations({
|
|
7768
7780
|
conversationStore: work.conversationStore,
|
|
7769
7781
|
eventStore: getConversationEventStore(),
|
|
@@ -7891,7 +7903,7 @@ async function createApp(options) {
|
|
|
7891
7903
|
});
|
|
7892
7904
|
let agentContinuePOST;
|
|
7893
7905
|
let pluginTaskPOST;
|
|
7894
|
-
if (process.env
|
|
7906
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
7895
7907
|
registerVercelConversationWorkDevConsumer(getConversationWorkOptions());
|
|
7896
7908
|
registerVercelPluginTaskDevConsumer();
|
|
7897
7909
|
registerVercelWorkspaceSnapshotJobDevConsumer();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveLocalScheduleAtMs, i as getFirstRunAtMs, o as getZonedDateTimeParts, s as isValidTimeZone } from "./schedule-cP0AACm1.js";
|
|
2
|
-
import { i as actorIdentitySchema } from "./conversation-
|
|
2
|
+
import { i as actorIdentitySchema } from "./conversation-BOqdRtUx.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
5
5
|
// src/chat/automations/task.ts
|
|
@@ -568,6 +568,8 @@ const automationListQuerySchema = z.object({
|
|
|
568
568
|
"unavailable"
|
|
569
569
|
]).default("all"),
|
|
570
570
|
creator: z.string().max(300).optional(),
|
|
571
|
+
/** Only the viewer's own Automations, inside any scope. */
|
|
572
|
+
owner: z.literal("me").optional(),
|
|
571
573
|
destination: z.string().max(300).optional(),
|
|
572
574
|
/** Only Automations that run this skill. */
|
|
573
575
|
skill: automationSkillNameSchema.optional(),
|
package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-WLPNSF_b.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
-
import { E as withSpan, m as logInfo, p as logException } from "./logging-
|
|
3
|
-
import { t as readJuniorSecret } from "./secrets-
|
|
1
|
+
import { i as getChatConfig } from "./config-DdO1BNcw.js";
|
|
2
|
+
import { E as withSpan, m as logInfo, p as logException } from "./logging-QSZuMcvo.js";
|
|
3
|
+
import { t as readJuniorSecret } from "./secrets-DHaJ5TTn.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
@@ -172,7 +172,7 @@ const bullmqQueueProvider = {
|
|
|
172
172
|
};
|
|
173
173
|
// src/chat/queue/vercel.ts
|
|
174
174
|
function defaultQueueClientOptions() {
|
|
175
|
-
if (process.env
|
|
175
|
+
if (process.env["VERCEL_DEPLOYMENT_ID"]?.trim()) return {};
|
|
176
176
|
return { deploymentId: null };
|
|
177
177
|
}
|
|
178
178
|
let client;
|
|
@@ -312,7 +312,7 @@ const CONVERSATION_WORK_QUEUE_RETENTION_SECONDS = CONVERSATION_WORK_QUEUE_SIGNAT
|
|
|
312
312
|
let defaultQueue;
|
|
313
313
|
/** Resolve the Vercel Queue topic used for conversation wake-up nudges. */
|
|
314
314
|
function resolveConversationWorkQueueTopic(options = {}) {
|
|
315
|
-
return options.topic?.trim() || process.env
|
|
315
|
+
return options.topic?.trim() || process.env["JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC"]?.trim() || "junior_conversation_work";
|
|
316
316
|
}
|
|
317
317
|
function toDelaySeconds(options) {
|
|
318
318
|
if (!options?.delayMs || options.delayMs <= 0) return;
|
|
@@ -390,7 +390,7 @@ function queueCallback(options) {
|
|
|
390
390
|
consumer,
|
|
391
391
|
create: () => getQueueProvider().createCallback(consumer),
|
|
392
392
|
registerDev: () => {
|
|
393
|
-
if (process.env
|
|
393
|
+
if (process.env["NODE_ENV"] !== "development") return;
|
|
394
394
|
return getQueueProvider().registerDevConsumer?.(consumer);
|
|
395
395
|
}
|
|
396
396
|
};
|