@sentry/junior 0.297.0 → 0.299.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.
Files changed (94) hide show
  1. package/dist/{actor-6jsm_v96.js → actor-D2iXzvlN.js} +2 -1
  2. package/dist/{state-DFnmLmfn.js → adapter-AgCNqqsG.js} +49 -133
  3. package/dist/{admin-tmGIw4KS.js → admin-1VwEXztm.js} +2 -2
  4. package/dist/{agent-runner-CneTquAE.js → agent-runner-Ciet8_nn.js} +1067 -1353
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +8 -7
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +125 -43
  9. package/dist/{app-BJojZ7HL.d.ts → app--ky-Eu33.d.ts} +6 -4
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +126 -299
  12. package/dist/{automation-BrP6ImrC.js → automation-M3RFJUBf.js} +1 -1
  13. package/dist/{background-compaction-queue-CwfJy3Cd.js → background-compaction-queue-CnimvRdk.js} +4 -4
  14. package/dist/{briefs-uFTuhMqA.js → briefs-CwzvgdCa.js} +4 -4
  15. package/dist/{catalog-runtime-0kuQqYL4.js → catalog-runtime-DaBaHY7u.js} +1 -1
  16. package/dist/cli/chat.js +17 -17
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +5 -5
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +4 -4
  23. package/dist/{config-Dj9M_nqB.js → config-CAXIpWQb.js} +80 -6
  24. package/dist/{connections-B96JUM5o.js → connections-Dy0hPdUq.js} +6 -6
  25. package/dist/continue-in-slack-DIOjFj76.js +176 -0
  26. package/dist/{conversation-CvcBU1z2.js → conversation-fCWD9Az3.js} +73 -13
  27. package/dist/{conversation-feed-BSMlGZnS.js → conversation-feed-BPK8vkkZ.js} +88 -3
  28. package/dist/{conversation-privacy-DI29jbZV.js → conversation-privacy-DUgtRkf8.js} +1 -1
  29. package/dist/{conversation-turn-CZWBr091.js → conversation-turn-DkJB6yMF.js} +85 -68
  30. package/dist/{credential-sync-Blhx4_xf.js → credential-sync-RX24Y8aY.js} +18 -18
  31. package/dist/{db-CrtyFRz7.d.ts → db-B07FtU9g.d.ts} +1 -1
  32. package/dist/{db-Br0tfAo7.js → db-COYOGzYS.js} +171 -12
  33. package/dist/{executor-BMPipFVA.js → executor-BWmAgSyi.js} +40 -11
  34. package/dist/{media-BepyEUNm.js → history-IjdmO_r6.js} +1 -85
  35. package/dist/instrumentation.js +2 -2
  36. package/dist/lineage-D-5jm_oj.js +37 -0
  37. package/dist/{logging-CQjlDQYX.js → logging-DPLEa8Bn.js} +1 -1
  38. package/dist/media-BAHvgkok.js +85 -0
  39. package/dist/{message-BOZEIuxy.js → message-BIHR1yRk.js} +9 -10
  40. package/dist/model-input-BPZYH8Nd.js +82 -0
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +17 -9
  43. package/dist/{oauth-callback-server-V_DuMuNX.js → oauth-callback-server-R7qvSzFG.js} +2 -2
  44. package/dist/{plugins-HYh_JOdw.js → plugins-CBW2Prb_.js} +1 -1
  45. package/dist/{projection-B08mfi0u.js → projection-DEdP1q6f.js} +261 -36
  46. package/dist/{prompt-BlutWLNt.js → prompt-4M98h_tC.js} +4 -4
  47. package/dist/{registry-BDWgCJDf.js → registry-BTKmKM-r.js} +3 -3
  48. package/dist/{resolve-2Z_o_SsI.js → resolve-B8hXNVZ3.js} +3 -3
  49. package/dist/{result-CAujiaci.js → result-g-XAaOj6.js} +158 -69
  50. package/dist/{runner-D2Chc02N.js → runner-BlPSA5A8.js} +9 -9
  51. package/dist/{sandbox-egress-signals-CFoJduFj.js → sandbox-egress-signals-Pai-MzEY.js} +1 -1
  52. package/dist/{schema-Bqa5NbcP.js → schema-BNnY_trV.js} +47 -7
  53. package/dist/{schema-Ce2XCS7O.d.ts → schema-DbuWR-DN.d.ts} +663 -346
  54. package/dist/{service-account-C9kRQEb_.js → service-account-9OLNQMyz.js} +4 -4
  55. package/dist/{service-account-CERfXEVU.js → service-account-BYGZ08DQ.js} +3 -3
  56. package/dist/session-stop-2XJrcNCy.js +3356 -0
  57. package/dist/{skills-B0m1nZ_j.js → skills-DpBQoeHV.js} +3 -3
  58. package/dist/slack-conversation-unfurl-BcDIWo67.js +370 -0
  59. package/dist/spawn-09GssFod.js +73 -0
  60. package/dist/state-Cufq0_rH.js +132 -0
  61. package/dist/{user-input-request-CXNIov9n.js → statuses-B8mUfghF.js} +30 -25
  62. package/dist/{stop-BCH9VNGf.js → stop-U7iUrR1g.js} +6011 -5773
  63. package/dist/{store-B59rOYbS.js → store-BHiaHCQu.js} +24 -4
  64. package/dist/{store-m5bmdmsP.js → store-CSgUTMdv.js} +10 -10
  65. package/dist/{task-queue-N0kuCknH.js → task-queue-bMNq0clp.js} +4 -4
  66. package/dist/{task-runner-COOwR8qm.js → task-runner-B__rxwxU.js} +10 -10
  67. package/dist/{thread-context-Cd44z_W5.js → thread-context-d0ceWbVT.js} +18 -18
  68. package/dist/{turn-session-routing-BlCtVFRN.js → turn-session-routing-BVZHBFCF.js} +5 -5
  69. package/dist/turn-user-message-BEw7acTP.js +355 -0
  70. package/dist/users-BK3dbxZL.js +424 -0
  71. package/dist/{validation-Ba2OcUse.js → validation-BDVJjO2E.js} +1 -1
  72. package/dist/{version-KNDzIAh6.js → version-DQgZoQ3D.js} +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/{viewer-BPpuN2f9.js → viewer-CAWfFo29.js} +25 -54
  75. package/dist/{warmup-Bskrwmk1.js → warmup-9ySPacF9.js} +1137 -143
  76. package/dist/{worker-B1skZlit.js → worker-D8jJO-WO.js} +8 -7
  77. package/migrations/0104_code_change_draft.sql +1 -0
  78. package/migrations/0105_attachment_uploads.sql +14 -0
  79. package/migrations/0106_conversation_agent_config.sql +1 -0
  80. package/migrations/meta/0104_snapshot.json +4516 -0
  81. package/migrations/meta/0105_snapshot.json +4611 -0
  82. package/migrations/meta/0106_snapshot.json +4617 -0
  83. package/migrations/meta/_journal.json +21 -0
  84. package/package.json +4 -4
  85. package/dist/attempt-selection-ClP3MMPr.js +0 -61
  86. package/dist/locks-D-0h111u.js +0 -48
  87. package/dist/notification-gusCgdQ6.js +0 -1284
  88. package/dist/prompt-input-Dxn8cDC0.js +0 -1424
  89. package/dist/session-stop-B-I1rAS1.js +0 -181
  90. package/dist/spawn-CwMjRRtn.js +0 -80
  91. package/dist/turn-cancel-DDu8TOwt.js +0 -201
  92. package/dist/turn-user-message-ygLG3ylQ.js +0 -641
  93. package/dist/turn-wake-DmQec4AG.js +0 -161
  94. package/dist/{oauth-relay-CsfIazeF.js → oauth-relay-DRzq73b6.js} +1 -1
package/dist/app.js CHANGED
@@ -1,49 +1,48 @@
1
1
  import { i as getActiveSpan, n as captureMessage, u as sentry_exports } from "./sentry-BRTJqumy.js";
2
- import { $i as escapeSlackMrkdwnText, Ao as readConversationMessageEventSeq, Ba as consumeSandboxEgressPermissionDeniedSignal, Bo as resolveRootVisibility, C as settleConversationTitleWork, Ci as getDashboardTaskLink, Di as createPluginState, Do as readConversationEventPageAfter, Eo as readConversationEventPage, Ft as pruneActiveConversation, Ha as parseSandboxEgressCredentialToken, Hn as createUserTokenStore, Ho as createPluginAnnotations, Hr as reviewItemReaderForUserInConversation, Jn as createPluginEventPublisher, Jr as createCodeChangePublisher, Ka as normalizeSandboxEgressTracePropagationDomains, Ki as isVercelSandboxEgressRequest, Mr as canActOnReviewItem, Oa as getWorkspaceTeamId, Or as searchReviewItems, Qa as createPluginEmbedder, Ra as clearSandboxEgressSignals, Sa as getSlackClient, Ti as setDashboardConversationLinkOptions, To as readLatestConversationBrief, Uo as listConversationAnnotations, Vr as reviewItemReaderForUser, Xn as getPluginApiRoutes, Zi as resolveBaseUrl, Zn as getPluginRoutes, Zo as createPluginCache, _ as appendConversationMessages, _a as slackExternalRefIdSchema, _r as projectConversationMessages, di as bindEventAutomationCredentialSubject, ea as formatSlackLink, fi as bindScheduledAutomationCredentialSubject, fo as createPluginLogger, ga as slackEntitySchema, gi as verifySlackDirectCredentialSubject, go as readConversationAccessFromSql, hi as verifyScheduledAutomationCredentialSubject, ir as validatePlugins, is as setConfigDefaults, jt as isInvalidConversationRecordError, ka as runWithWorkspaceTeamId, ko as readConversationLastEventSeq, kt as hasRunnableConversationWork, la as openSlackModal, mi as verifyEventAutomationCredentialSubject, nr as getPlugins, pa as unfurlSlackLinks, pi as bindSlackDirectCredentialSubject, qi as proxyVercelSandboxEgressRequest, ra as slackMention, ri as collectEventMatchKeys, rr as setPlugins, rs as getConfigDefaults, si as findMatchingWatches, sr as setBriefsConfig, ua as postSlackEphemeralMessage, ui as takeDueTimerWatches, ut as CONVERSATION_WORK_STALE_ENQUEUE_MS, wa as isDmChannel, wi as parseDashboardConversationLink, xi as getDashboardReviewItemLink, xr as dismissOpenReviewItems, yi as getDashboardConversationLink, za as consumeSandboxEgressAuthRequiredSignal } from "./projection-B08mfi0u.js";
3
- import { Y as getAttachmentStorage, d as restoreRuntimeConfig, f as setBotModelConfig, h as snapshotRuntimeConfig, i as getChatConfig, m as setSlackReactionConfig, n as botConfig, o as getSlackBotToken, p as setRuntimeLimits, u as resetRuntimeConfig } from "./config-Dj9M_nqB.js";
4
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, H as GOOGLE_IDENTITY_PROVIDER, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, W as normalizeIdentityEmail, 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-CQjlDQYX.js";
5
- import { t as JUNIOR_VERSION } from "./version-KNDzIAh6.js";
6
- import { _ as slackMessageTsSchema, f as parseSlackTeamId, g as slackMessageTsFromMs, h as parseSlackMessageTs, m as slackChannelIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
7
- import { B as recordGoogleSignIn, O as conversationKindFromRow, P as resolveActorIdentityId, S as withConversationMutationLock, W as getConversationIdByProviderConversation, a as getConversationStore, nt as createSlackDestination, o as getDb, p as withConversationEventLock, r as getConversationEventStore, s as getSqlExecutor, t as closeDb, tt as touchConversationDetail } from "./db-Br0tfAo7.js";
8
- import { A as juniorConversations, N as juniorDestinations, b as juniorConversationBriefs, f as juniorAutomations, g as juniorAgentInvocations, h as juniorAgentBindings, l as juniorReviewItems, u as juniorAutomationRuns, w as juniorConversationEvents } from "./executor-BMPipFVA.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-0kuQqYL4.js";
10
- import { A as parseSlackUserInputSubmission, At as processWorkspaceSnapshotJob, B as joinPublicChannel, C as createSlackReviewItemShow, D as buildSlackReviewItemModal, L as checkSlackChannelReadAccess, M as verifySlackSignature, Mt as findAutomationSkill, N as parseSlackThreadId, Nt as missingAutomationSkillReason, O as parseSlackReviewItemClick, Q as readViewerAutomationExecutions, St as archiveConversation, T as syncReviewItemSlackCards, U as logScheduledAutomationRunSkipped, W as scheduledAutomationRunAttributes, X as ViewerTaskNotFoundError, _ as readPublicArtifact, b as lookupSlackUserProfile, bt as requestAttachmentDeletion, ct as reviewItemChangeRecord, dt as conversationTurnIdForMessage, et as readViewerAutomationSummary, g as publicArtifactHeaders, ht as webActorFromUser, it as effectiveTaskOutcomes, j as runWithSlackInstallation, jt as ingestEvent, k as parseSlackReviewItemFormTarget, mt as recordWebConversationActivity, n as executeAgentRun, nt as readViewerAutomations, ot as deliverReviewItemChange, r as processBackgroundCompaction, st as renderReviewItemMessage, t as createAgentRunner, ut as appendAndEnqueueWebMessage, v as unpublishedArtifactHeaders, vt as collectAttachmentGarbage, w as readSlackReviewItemCardConversationId, wt as markConversationRead, y as setConversationSubscription } from "./agent-runner-CneTquAE.js";
11
- import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
12
- import { g as createCache, i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-BPpuN2f9.js";
13
- import { a as getStateAdapter, r as disconnectStateAdapter } from "./state-DFnmLmfn.js";
2
+ import { $a as consumeSandboxEgressAuthRequiredSignal, Aa as slackExternalRefIdSchema, Ar as dismissOpenReviewItems, C as settleConversationTitleWork, Ca as postSlackEphemeralMessage, Ci as verifyEventAutomationCredentialSubject, Er as projectConversationMessages, Fa as getSlackClient, Go as readConversationLastEventSeq, Ha as getWorkspaceTeamId, Ho as readConversationEventPage, Ko as readConversationMessageEventSeq, La as isDmChannel, Li as setDashboardConversationLinkOptions, Lr as searchReviewItems, Mi as getDashboardReviewItemLink, Mo as readConversationAccessFromSql, Mt as hasRunnableConversationWork, Oi as getDashboardConversationLink, Oo as createPluginLogger, Pi as getDashboardTaskLink, Pt as isInvalidConversationRecordError, Qa as clearSandboxEgressSignals, Ri as createPluginState, Rt as pruneActiveConversation, Sa as openSlackModal, Si as bindSlackDirectCredentialSubject, Ti as verifySlackDirectCredentialSubject, Ua as runWithWorkspaceTeamId, Uo as readConversationEventPageAfter, Vr as canActOnReviewItem, Xr as reviewItemReaderForUser, Zn as createUserTokenStore, Zr as reviewItemReaderForUserInConversation, _ as appendConversationMessages, ar as getPluginApiRoutes, as as listConversationAnnotations, bi as bindEventAutomationCredentialSubject, bs as setConfigDefaults, ca as resolveBaseUrl, dr as getPlugins, dt as CONVERSATION_WORK_STALE_ENQUEUE_MS, eo as consumeSandboxEgressPermissionDeniedSignal, fi as collectEventMatchKeys, fr as setPlugins, gi as findMatchingWatches, gr as setBriefsConfig, ha as slackMention, ia as proxyVercelSandboxEgressRequest, is as createPluginAnnotations, ka as slackEntitySchema, mo as createPluginEmbedder, no as parseSandboxEgressCredentialToken, ns as resolveRootVisibility, oo as normalizeSandboxEgressTracePropagationDomains, or as getPluginRoutes, pr as validatePlugins, ps as createPluginCache, ra as isVercelSandboxEgressRequest, ri as createCodeChangePublisher, rr as createPluginEventPublisher, wi as verifyScheduledAutomationCredentialSubject, xi as bindScheduledAutomationCredentialSubject, yi as takeDueTimerWatches, ys as getConfigDefaults } from "./projection-DEdP1q6f.js";
3
+ import { Y as getAttachmentStorage, d as restoreRuntimeConfig, f as setBotModelConfig, h as snapshotRuntimeConfig, i as getChatConfig, m as setSlackReactionConfig, n as botConfig, o as getSlackBotToken, p as setRuntimeLimits, u as resetRuntimeConfig } from "./config-CAXIpWQb.js";
4
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, H as GOOGLE_IDENTITY_PROVIDER, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, W as normalizeIdentityEmail, 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-DPLEa8Bn.js";
5
+ import { t as JUNIOR_VERSION } from "./version-DQgZoQ3D.js";
6
+ 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";
7
+ import { D as conversationKindFromRow, N as resolveActorIdentityId, W as createCache, a as getConversationStore, f as withConversationEventLock, it as createSlackDestination, o as getDb, r as getConversationEventStore, rt as touchConversationDetail, s as getSqlExecutor, t as closeDb, x as withConversationMutationLock, z as recordGoogleSignIn } from "./db-COYOGzYS.js";
8
+ import { P as juniorDestinations, b as juniorConversationBriefs, f as juniorAutomations, g as juniorAgentInvocations, h as juniorAgentBindings, j as juniorConversations, l as juniorReviewItems, u as juniorAutomationRuns, w as juniorConversationEvents } from "./executor-BWmAgSyi.js";
9
+ import { c as fenceLock, l as withLock, o as MUTATION_LOCK_TTL_MS, r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-AgCNqqsG.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
11
+ import { $ as deliverReviewItemChange, A as parseSlackUserInputSubmission, At as missingAutomationSkillReason, C as createSlackReviewItemShow, D as buildSlackReviewItemModal, Dt as processWorkspaceSnapshotJob, G as readViewerAutomationExecutions, I as logScheduledAutomationRunSkipped, L as scheduledAutomationRunAttributes, O as parseSlackReviewItemClick, Ot as ingestEvent, T as syncReviewItemSlackCards, U as ViewerTaskNotFoundError, Y as readViewerAutomations, Z as effectiveTaskOutcomes, _ as readPublicArtifact, _t as requestAttachmentDeletion, ct as webActorFromUser, dt as collectAttachmentUploadGarbage, et as renderReviewItemMessage, g as publicArtifactHeaders, ht as collectAttachmentGarbage, it as conversationTurnIdForMessage, j as parseSlackThreadId, k as parseSlackReviewItemFormTarget, kt as findAutomationSkill, n as executeAgentRun, q as readViewerAutomationSummary, r as processBackgroundCompaction, rt as appendAndEnqueueWebMessage, st as recordWebConversationActivity, t as createAgentRunner, tt as reviewItemChangeRecord, v as unpublishedArtifactHeaders, w as readSlackReviewItemCardConversationId, xt as markConversationRead, y as setConversationSubscription, yt as archiveConversation } from "./agent-runner-Ciet8_nn.js";
14
12
  import { a as getNextRunAtMs } from "./schedule-cP0AACm1.js";
15
- import { N as annotationCard, O as conversationTitleSchema, b as conversationSurfaceSchema, p as conversationFeedQuerySchema, q as conversationBriefSchema, v as conversationReportStatusSchema } from "./conversation-CvcBU1z2.js";
13
+ import { i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-CAWfFo29.js";
14
+ import { $ as conversationBriefSchema, N as conversationTitleSchema, R as annotationCard, b as conversationSurfaceSchema, p as conversationFeedQuerySchema, v as conversationReportStatusSchema } from "./conversation-fCWD9Az3.js";
16
15
  import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
17
16
  import { n as readSchedulerSecret, r as readSignInSecret } from "./secrets-DebYU866.js";
18
- import { f as getExperimentalFeatures, g as getAuthPausedConversationTurnId, m as setExperimentalFeatures, p as isExperimentalFeatureEnabled } from "./prompt-input-Dxn8cDC0.js";
19
- import { B as MIN_WARMUP_PREFIX_TOKENS, D as recordSubagentEnded, U as gapSegment, V as NO_REPLY_GAP_MS, a as segmentGapsKey, n as GLOBAL_GAPS_MAX, r as GLOBAL_GAPS_TTL_MS, t as CONVERSATION_STATE_TTL_MS, x as enqueueAgentInvocation, z as MINUTE_MS } from "./warmup-Bskrwmk1.js";
20
- import { C as queueCallback, T as getQueueProvider, _ as createVercelCacheWarmupCallback, a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, g as cacheWarmupQueueConsumer, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, m as isConversationQueueMessageRejectedError, p as conversationQueueMessageSchema, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, v as registerVercelCacheWarmupDevConsumer } from "./background-compaction-queue-CwfJy3Cd.js";
21
- import { M as listPendingAgentInvocationMailboxAppends, N as listPendingAgentInvocationResults } from "./turn-user-message-ygLG3ylQ.js";
22
- import { C as renderSlackObjectCard, c as SLACK_EVENT_NAMESPACE, d as slackChannelMessageReplyThreadTs, f as slackChannelMessageRunsAutomation, s as getEventCatalog, u as slackChannelMessageEvent, v as renderTaskInput } from "./notification-gusCgdQ6.js";
23
- import { _ as getConversationWorkState, g as getConversation, h as ensureConversationWake, l as clearExpiredConversationLease, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-B59rOYbS.js";
24
- import { c as coerceThreadConversationState, p as eventGuidance } from "./turn-session-routing-BlCtVFRN.js";
25
- import { r as buttonUserInputField } from "./user-input-request-CXNIov9n.js";
26
- import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-2Z_o_SsI.js";
27
- import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-BrP6ImrC.js";
28
- import { $ as eventAutomationRunLimitReason, B as scheduledRunId, F as listScheduledAutomationsForTeam, H as blockEventAutomation, K as findMatchingEventAutomations, L as readScheduledAutomation, O as recordAutomationExecution, Q as admitEventAutomationRun, U as collectEventAutomationMatchKeys, V as withScheduledAutomationLock, a as getDispatchConversationId, b as existingConversationId, c as getDispatchRecord, d as isTerminalDispatchStatus, f as listPendingDispatchMailboxAppends, g as markDispatchFailed, i as createOrGetDispatch, r as confirmDispatchMailboxAppend, t as buildDispatchId, tt as automationVersionOf, u as getPluginDispatchProjection, v as notifyAutomationBlocked, z as saveScheduledAutomationInLock } from "./store-m5bmdmsP.js";
29
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Ba2OcUse.js";
30
- import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-HYh_JOdw.js";
31
- import { s as conversationPendingMessageDeliverySchema } from "./conversation-feed-BSMlGZnS.js";
32
- import { $ as reviewItemChange, A as assertNoLegacyAllowedDomains, B as normalizeIncomingSlackThreadId, C as cancelConversationPendingMessagesForViewer, D as createProductionConversationWorkOptions, F as startProcessingReaction, G as stopConversation, H as createSlackWebApiStatusSender, I as buildSlackInboundMessage, J as bindMessageAuthorIdentityId, K as parseContent, L as clearSlackPendingReactions, M as isAllowedSignInEmail, N as readEnvList, O as createProductionSlackWebhookServices, P as resolveAllowedDomains, Q as readReviewItemForUser, R as slackInboundMessageId, S as encodeConversationCursor, U as SubscribedReplyReason, V as withNormalizedThreadId, W as getThreadStopDecision, X as actOnReviewItem, Y as ReviewItemActionError, Z as closeReviewItemsAnsweredByReply, a as pinConversation, at as archiveViewerDoneConversations, b as createConversationForViewer, ct as setConversationAutoArchive, dt as enqueueAgentDispatch, et as alreadyContinuesInSlackMessage, ft as GET$4, g as readConversationRecordFromSql, i as readConversationFeed, j as isAllowedDomain, k as getProductionSlackAdapter, n as steerConversationPendingMessagesForViewer, nt as continueConversationInSlack, q as recordSkippedConversationMessage, rt as isMovableToSlack, s as readConversationDetail, st as runAutoArchiveSweep, t as stopConversationTurnForViewer, tt as canContinueInSlack, w as readConversationPendingMessages, x as decodeConversationCursor, y as appendConversationMessageForViewer, z as stripLeadingBotMention } from "./stop-BCH9VNGf.js";
33
- import { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-CAujiaci.js";
34
- import { o as unlinkProvider } from "./connections-B96JUM5o.js";
35
- import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-Blhx4_xf.js";
17
+ import { C as getAuthPausedConversationTurnId, H as slackChannelMessageReplyThreadTs, R as getEventCatalog, U as slackChannelMessageRunsAutomation, V as slackChannelMessageEvent, Y as renderTaskInput, b as isExperimentalFeatureEnabled, et as renderSlackObjectCard, x as setExperimentalFeatures, y as getExperimentalFeatures, z as SLACK_EVENT_NAMESPACE } from "./session-stop-2XJrcNCy.js";
18
+ import { At as MIN_WARMUP_PREFIX_TOKENS, C as listPendingAgentInvocationMailboxAppends, H as enqueueAgentInvocation, Nt as gapSegment, X as recordSubagentEnded, a as segmentGapsKey, jt as NO_REPLY_GAP_MS, kt as MINUTE_MS, n as GLOBAL_GAPS_MAX, r as GLOBAL_GAPS_TTL_MS, t as CONVERSATION_STATE_TTL_MS, w as listPendingAgentInvocationResults } from "./warmup-9ySPacF9.js";
19
+ import { C as queueCallback, T as getQueueProvider, _ as createVercelCacheWarmupCallback, a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, g as cacheWarmupQueueConsumer, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, m as isConversationQueueMessageRejectedError, p as conversationQueueMessageSchema, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, v as registerVercelCacheWarmupDevConsumer } from "./background-compaction-queue-CnimvRdk.js";
20
+ import { _ as getConversationWorkState, g as getConversation, h as ensureConversationWake, l as clearExpiredConversationLease, r as appendAndEnqueueInboundMessage, y as listActiveConversationIds } from "./store-BHiaHCQu.js";
21
+ import { c as coerceThreadConversationState, p as eventGuidance } from "./turn-session-routing-BVZHBFCF.js";
22
+ import { o as buttonUserInputField } from "./statuses-B8mUfghF.js";
23
+ import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-B8hXNVZ3.js";
24
+ import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-M3RFJUBf.js";
25
+ import { $ as eventAutomationRunLimitReason, B as scheduledRunId, F as listScheduledAutomationsForTeam, H as blockEventAutomation, K as findMatchingEventAutomations, L as readScheduledAutomation, O as recordAutomationExecution, Q as admitEventAutomationRun, U as collectEventAutomationMatchKeys, V as withScheduledAutomationLock, a as getDispatchConversationId, b as existingConversationId, c as getDispatchRecord, d as isTerminalDispatchStatus, f as listPendingDispatchMailboxAppends, g as markDispatchFailed, i as createOrGetDispatch, r as confirmDispatchMailboxAppend, t as buildDispatchId, tt as automationVersionOf, u as getPluginDispatchProjection, v as notifyAutomationBlocked, z as saveScheduledAutomationInLock } from "./store-CSgUTMdv.js";
26
+ import { a as runWithSlackInstallation, o as verifySlackSignature, p as joinPublicChannel, r as lookupSlackUserProfile } from "./users-BK3dbxZL.js";
27
+ import { $ as slackInboundMessageId, A as resolveAllowedDomains, B as runAutoArchiveSweep, C as readConversationPendingMessages, D as isAllowedDomain, E as assertNoLegacyAllowedDomains, F as readReviewItemForUser, I as reviewItemChange, J as createProductionConversationWorkOptions, K as readObjectLinkTypes, M as ReviewItemActionError, N as actOnReviewItem, O as isAllowedSignInEmail, P as closeReviewItemsAnsweredByReply, Q as clearSlackPendingReactions, R as archiveViewerDoneConversations, S as cancelConversationPendingMessagesForViewer, U as GET$4, V as setConversationAutoArchive, X as getProductionSlackAdapter, Y as createProductionSlackWebhookServices, Z as buildSlackInboundMessage, _ as appendConversationMessageForViewer, a as pinConversation, at as createSlackWebApiStatusSender, b as decodeConversationCursor, ct as stripLeadingBotMention, dt as getThreadStopDecision, et as normalizeIncomingSlackThreadId, g as readConversationRecordFromSql, i as readConversationFeed, it as recordSkippedConversationMessage, j as stopConversation, k as readEnvList, lt as parseContent, n as steerConversationPendingMessagesForViewer, ot as bindMessageAuthorIdentityId, rt as enqueueAgentDispatch, s as readConversationDetail, st as startProcessingReaction, t as stopConversationTurnForViewer, tt as withNormalizedThreadId, ut as SubscribedReplyReason, v as createConversationForViewer, x as encodeConversationCursor } from "./stop-U7iUrR1g.js";
28
+ import { s as conversationPendingMessageDeliverySchema } from "./conversation-feed-BPK8vkkZ.js";
29
+ import { a as resumeConversationDelivery } from "./conversation-turn-DkJB6yMF.js";
30
+ import { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-g-XAaOj6.js";
31
+ import { t as bindMessageAgent } from "./message-BIHR1yRk.js";
32
+ import { t as bindSpawnAgent } from "./spawn-09GssFod.js";
33
+ import { a as pluginTaskQueueConsumer, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-bMNq0clp.js";
34
+ import { t as processPluginTask } from "./task-runner-B__rxwxU.js";
35
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BDVJjO2E.js";
36
+ import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-CBW2Prb_.js";
37
+ import { o as unlinkProvider } from "./connections-Dy0hPdUq.js";
38
+ import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-RX24Y8aY.js";
36
39
  import { t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
37
- import { c as resumeConversationDelivery } from "./conversation-turn-CZWBr091.js";
38
- import { t as processConversationWork } from "./worker-B1skZlit.js";
39
- import { t as bindMessageAgent } from "./message-BOZEIuxy.js";
40
- import { t as bindSpawnAgent } from "./spawn-CwMjRRtn.js";
41
- import { a as pluginTaskQueueConsumer, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-N0kuCknH.js";
42
- import { t as processPluginTask } from "./task-runner-COOwR8qm.js";
40
+ 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-BcDIWo67.js";
41
+ import { t as processConversationWork } from "./worker-D8jJO-WO.js";
43
42
  import { createRequire } from "node:module";
44
43
  import { Hono } from "hono";
45
- import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
46
44
  import * as z from "zod";
45
+ import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
47
46
  import { and, asc, desc, eq, gte, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
48
47
  import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, dispatchOptionsSchema, eventSchema, eventTriggerFiltersText, isSlackDestination, userSchema } from "@sentry/junior-plugin-api";
49
48
  import { pathToFileURL } from "node:url";
@@ -1884,8 +1883,14 @@ async function runRetentionPurge(executor, args) {
1884
1883
  nowMs: args.nowMs,
1885
1884
  storage: args.attachmentStorage
1886
1885
  }) : { deleted: 0 };
1886
+ const uploadResult = args.attachmentStorage ? await collectAttachmentUploadGarbage({
1887
+ db: executor,
1888
+ nowMs: args.nowMs,
1889
+ storage: args.attachmentStorage
1890
+ }) : { deleted: 0 };
1887
1891
  logInfo("retention.purge.completed", {
1888
1892
  "app.retention.attachments": attachmentResult.deleted,
1893
+ "app.retention.attachment_uploads": uploadResult.deleted,
1889
1894
  "app.retention.scanned": roots.length,
1890
1895
  "app.retention.purged": purged,
1891
1896
  "app.retention.failed": failed,
@@ -2131,6 +2136,8 @@ const slackEventSchema = z.looseObject({
2131
2136
  const slackEventEnvelopeSchema = z.object({
2132
2137
  event_id: z.unknown().optional(),
2133
2138
  is_ext_shared_channel: z.unknown().optional(),
2139
+ context_enterprise_id: z.unknown().optional(),
2140
+ context_team_id: z.unknown().optional(),
2134
2141
  enterprise_id: z.string().optional(),
2135
2142
  event: slackEventSchema.optional(),
2136
2143
  is_enterprise_install: z.boolean().optional(),
@@ -2138,6 +2145,22 @@ const slackEventEnvelopeSchema = z.object({
2138
2145
  type: z.string(),
2139
2146
  challenge: z.string().optional()
2140
2147
  });
2148
+ const workspaceChannelSchema = z.object({
2149
+ context_enterprise_id: z.string().nullish(),
2150
+ context_team_id: slackTeamIdSchema,
2151
+ enterprise_id: z.string().optional(),
2152
+ is_ext_shared_channel: z.literal(false),
2153
+ team_id: slackTeamIdSchema
2154
+ });
2155
+ /** Read the channel scope of an event from its envelope. */
2156
+ function slackChannelScope(body) {
2157
+ if (body.is_ext_shared_channel === true) return "external";
2158
+ const parsed = workspaceChannelSchema.safeParse(body);
2159
+ if (!parsed.success || parsed.data.context_team_id !== parsed.data.team_id) return "unknown";
2160
+ const enterpriseId = parsed.data.context_enterprise_id;
2161
+ if (enterpriseId == null) return "workspace";
2162
+ return enterpriseId === parsed.data.enterprise_id ? "enterprise" : "unknown";
2163
+ }
2141
2164
  const slackViewStateValueSchema = z.object({
2142
2165
  selected_option: z.object({ value: z.string().optional() }).nullish(),
2143
2166
  selected_options: z.array(z.object({ value: z.string().optional() })).nullish(),
@@ -2169,248 +2192,6 @@ const slackInteractivePayloadSchema = z.object({
2169
2192
  state: z.object({ values: z.record(z.string(), z.record(z.string(), slackViewStateValueSchema)) }).optional()
2170
2193
  }).nullish()
2171
2194
  });
2172
- // src/chat/ingress/workspace-membership.ts
2173
- const MEMBER_TTL_MS = 3e5;
2174
- const NON_MEMBER_TTL_MS = 3e4;
2175
- const authorTeamSchema = z.object({
2176
- user_team: z.string().optional(),
2177
- source_team: z.string().optional(),
2178
- user: z.unknown().optional()
2179
- });
2180
- /** Accept only verified workspace authors, reusing recent membership lookups. */
2181
- async function isSlackWorkspaceMember(raw, state) {
2182
- const workspaceTeamId = getWorkspaceTeamId();
2183
- if (!workspaceTeamId) return false;
2184
- const parsed = authorTeamSchema.safeParse(raw);
2185
- if (!parsed.success) return false;
2186
- const event = parsed.data;
2187
- const userId = parseSlackUserId(event.user);
2188
- if (!userId) return false;
2189
- const cache = createCache(state, "core");
2190
- const key = `slack:membership:${workspaceTeamId}:${userId}`;
2191
- const authorTeam = parseSlackTeamId(event.user_team);
2192
- if (authorTeam === workspaceTeamId) return true;
2193
- if (event.user_team !== void 0 && !authorTeam && !/^E[A-Z0-9]+$/.test(event.user_team)) return false;
2194
- if (authorTeam !== void 0) return await cache.getOrLoad(key, async () => ({
2195
- value: false,
2196
- ttlMs: NON_MEMBER_TTL_MS
2197
- }), { refresh: true });
2198
- return await cache.getOrLoad(key, async () => {
2199
- const user = await lookupSlackUserProfile(userId);
2200
- const authorTeam = parseSlackTeamId(user.team_id);
2201
- if (user.id !== userId || !authorTeam) return { value: false };
2202
- const member = authorTeam === workspaceTeamId && !user.is_deleted;
2203
- return {
2204
- value: member,
2205
- ttlMs: member ? MEMBER_TTL_MS : NON_MEMBER_TTL_MS
2206
- };
2207
- });
2208
- }
2209
- // src/chat/ingress/slack-acting-user.ts
2210
- /**
2211
- * Resolve the Junior User of the person who clicked a Slack control. The
2212
- * click acts as that person, so it needs the same workspace and allowed
2213
- * domain checks as a Slack mention. A person Junior does not know yet gets
2214
- * a note to sign in.
2215
- */
2216
- async function resolveSlackActingUser(args) {
2217
- const { payload } = args;
2218
- const slackUserId = parseActorUserId(payload.user?.id);
2219
- const teamId = parseSlackTeamId(payload.team?.id ?? payload.user?.team_id);
2220
- if (!slackUserId || !teamId) throw new Error("Slack interaction payload is missing a user or team");
2221
- if (!await isSlackWorkspaceMember({
2222
- user: slackUserId,
2223
- user_team: payload.user?.team_id
2224
- }, args.state) || !await args.isAuthorAllowed(slackUserId)) return;
2225
- const user = (await readActorIdentity(createSlackActor(teamId, slackUserId, void 0)))?.user;
2226
- if (!user) {
2227
- await args.tell(slackUserId, "Junior does not know your account yet. Sign in to the Junior dashboard, then try again.");
2228
- return;
2229
- }
2230
- return {
2231
- slackUserId,
2232
- teamId,
2233
- user
2234
- };
2235
- }
2236
- // src/chat/ingress/slack-conversation-unfurl.ts
2237
- /** Action id of the "Continue here" button on a dashboard link preview. */
2238
- const SLACK_CONTINUE_HERE_ACTION_ID = "junior_continue_here";
2239
- const MAX_LINKS = 5;
2240
- const MAX_SUMMARY_CHARS = 300;
2241
- const linkSharedEventSchema = z.object({
2242
- channel: z.string(),
2243
- links: z.array(z.object({ url: z.string() })),
2244
- message_ts: z.string(),
2245
- source: z.string().optional(),
2246
- thread_ts: slackMessageTsSchema.optional(),
2247
- unfurl_id: z.string().min(1).optional()
2248
- });
2249
- const continueHereValueSchema = z.object({
2250
- conversationId: z.string().min(1),
2251
- messageTs: slackMessageTsSchema,
2252
- threadTs: slackMessageTsSchema,
2253
- url: z.string().min(1)
2254
- });
2255
- function parseContinueHereValue(raw) {
2256
- try {
2257
- return continueHereValueSchema.parse(JSON.parse(raw ?? ""));
2258
- } catch {
2259
- return;
2260
- }
2261
- }
2262
- async function previewBlocks(args) {
2263
- const title = args.conversation.title ?? "Junior conversation";
2264
- const summary = (await readLatestConversationBrief(getDb(), args.conversation.conversationId))?.content.summary.trim();
2265
- const shortSummary = summary && summary.length > MAX_SUMMARY_CHARS ? `${summary.slice(0, 299)}…` : summary;
2266
- return [{
2267
- type: "section",
2268
- text: {
2269
- type: "mrkdwn",
2270
- text: [`*${formatSlackLink(args.url, title)}*`, ...shortSummary ? [escapeSlackMrkdwnText(shortSummary)] : []].join("\n")
2271
- }
2272
- }, ...args.footer ? [args.footer] : []];
2273
- }
2274
- function continueHereButton(value) {
2275
- return {
2276
- type: "actions",
2277
- elements: [{
2278
- type: "button",
2279
- action_id: SLACK_CONTINUE_HERE_ACTION_ID,
2280
- text: {
2281
- type: "plain_text",
2282
- text: "Continue here"
2283
- },
2284
- value: JSON.stringify(value)
2285
- }]
2286
- };
2287
- }
2288
- async function readPublicConversation(conversationId) {
2289
- const conversation = await getConversationStore().get({ conversationId });
2290
- if (!conversation || conversation.parentConversationId) return void 0;
2291
- return (await readConversationAccessFromSql(getDb(), [conversationId])).get(conversationId)?.visibility === "public" ? conversation : void 0;
2292
- }
2293
- /** Whether a thread in this channel can take a moved Conversation. */
2294
- async function canReceiveConversation(teamId, channelId, threadTs) {
2295
- return !await getConversationIdByProviderConversation(getSqlExecutor(), {
2296
- provider: "slack",
2297
- providerDestinationId: channelId,
2298
- providerTenantId: teamId,
2299
- providerConversationId: threadTs
2300
- }) && await isPublicChannel(teamId, channelId);
2301
- }
2302
- async function isPublicChannel(teamId, channelId) {
2303
- const access = await checkSlackChannelReadAccess({
2304
- currentChannelIds: [],
2305
- targetChannelId: channelId,
2306
- teamId
2307
- });
2308
- return access.allowed && access.isPublic === true;
2309
- }
2310
- /**
2311
- * Preview dashboard conversation links that a workspace member posted.
2312
- *
2313
- * Only public root Conversations get a preview, and only in channels that are
2314
- * not shared with other organizations. A public dashboard Conversation that
2315
- * can still move gets a "Continue here" button when the channel is public.
2316
- */
2317
- async function unfurlDashboardConversationLinks(args) {
2318
- const parsed = linkSharedEventSchema.safeParse(args.event);
2319
- const teamId = parseSlackTeamId(args.teamId);
2320
- if (!parsed.success || !teamId || parsed.data.source === "composer" || args.isExtSharedChannel || !await isSlackWorkspaceMember(args.event, args.state)) return;
2321
- const event = parsed.data;
2322
- const channelId = parseSlackChannelId(event.channel);
2323
- const messageTs = slackMessageTsSchema.safeParse(event.message_ts);
2324
- if (!channelId || !messageTs.success) return;
2325
- const threadTs = event.thread_ts ?? messageTs.data;
2326
- const unfurls = {};
2327
- let canReceive;
2328
- const urls = [...new Set(event.links.map((link) => link.url))];
2329
- for (const url of urls.slice(0, MAX_LINKS)) {
2330
- const conversationId = parseDashboardConversationLink(url);
2331
- const conversation = conversationId ? await readPublicConversation(conversationId) : void 0;
2332
- if (!conversation) continue;
2333
- unfurls[url] = { blocks: await previewBlocks({
2334
- conversation,
2335
- url,
2336
- ...isMovableToSlack(conversation) && await (canReceive ??= canReceiveConversation(teamId, channelId, threadTs)) ? { footer: continueHereButton({
2337
- conversationId: conversation.conversationId,
2338
- messageTs: messageTs.data,
2339
- threadTs,
2340
- url
2341
- }) } : void 0
2342
- }) };
2343
- }
2344
- if (Object.keys(unfurls).length === 0) return;
2345
- await unfurlSlackLinks({
2346
- channelId,
2347
- messageTs: messageTs.data,
2348
- ...event.unfurl_id ? { unfurlId: event.unfurl_id } : void 0,
2349
- unfurls
2350
- });
2351
- }
2352
- /**
2353
- * Move a dashboard Conversation into the thread of the message that shared
2354
- * its link, as the participant who clicked "Continue here".
2355
- */
2356
- async function handleSlackContinueHereClick(args) {
2357
- const target = parseContinueHereValue(args.value);
2358
- const channelId = parseSlackChannelId(args.payload.channel?.id);
2359
- if (!target || !channelId) throw new Error("Slack Continue here payload is incomplete");
2360
- const tellPerson = (userId, text) => postSlackEphemeralMessage({
2361
- channelId,
2362
- text,
2363
- ...target.threadTs !== target.messageTs ? { threadTs: target.threadTs } : void 0,
2364
- userId
2365
- });
2366
- const actor = await resolveSlackActingUser({
2367
- isAuthorAllowed: args.isAuthorAllowed,
2368
- payload: args.payload,
2369
- state: args.state,
2370
- tell: tellPerson
2371
- });
2372
- if (!actor) return;
2373
- const { teamId, user } = actor;
2374
- const tell = (text) => tellPerson(actor.slackUserId, text);
2375
- const conversation = await getConversationStore().get({ conversationId: target.conversationId });
2376
- const access = conversation ? (await readConversationAccessFromSql(getDb(), [target.conversationId], user)).get(target.conversationId) : void 0;
2377
- if (!conversation || !access?.isParticipant) {
2378
- await tell("Only people in this conversation can move it here.");
2379
- return;
2380
- }
2381
- if (!canContinueInSlack(conversation, access)) {
2382
- await tell(conversation.location ? await alreadyContinuesInSlackMessage(conversation) : "This conversation can no longer move to Slack.");
2383
- return;
2384
- }
2385
- const result = await continueConversationInSlack({
2386
- actorName: user.displayName ?? user.email,
2387
- channel: {
2388
- channelId,
2389
- teamId
2390
- },
2391
- conversation,
2392
- threadTs: target.threadTs
2393
- });
2394
- if (result.status === "refused") {
2395
- await tell(result.message);
2396
- return;
2397
- }
2398
- await unfurlSlackLinks({
2399
- channelId,
2400
- messageTs: target.messageTs,
2401
- unfurls: { [target.url]: { blocks: await previewBlocks({
2402
- conversation,
2403
- footer: {
2404
- type: "context",
2405
- elements: [{
2406
- type: "mrkdwn",
2407
- text: result.locationUrl ? `Continues in ${formatSlackLink(result.locationUrl, "this thread")}.` : "Continues in this thread."
2408
- }]
2409
- },
2410
- url: target.url
2411
- }) } }
2412
- });
2413
- }
2414
2195
  // src/chat/ingress/slack-interaction-input.ts
2415
2196
  /**
2416
2197
  * Build the Slack input that a click or form makes in a thread, as a
@@ -2975,6 +2756,13 @@ function textMentionsBot(text, botUserId) {
2975
2756
  const id = escapeRegExp(botUserId);
2976
2757
  return new RegExp(`<@${id}(?:\\|[^>]+)?>`).test(outside);
2977
2758
  }
2759
+ /**
2760
+ * Return true when a Slack message mentions the bot in its text or in a
2761
+ * section block, outside code.
2762
+ */
2763
+ function eventMentionsBot(event, botUserId) {
2764
+ return Boolean(botUserId && (textMentionsBot(event.text ?? "", botUserId) || event.blocks?.some((block) => block.type === "section" && typeof block.text === "object" && block.text.type === "mrkdwn" && textMentionsBot(block.text.text, botUserId))));
2765
+ }
2978
2766
  // src/chat/ingress/slack-allowed-domain.ts
2979
2767
  const ALLOWED_TTL_MS = 3e5;
2980
2768
  const NOT_ALLOWED_TTL_MS = 3e4;
@@ -3023,6 +2811,8 @@ function slackMessageAttributes(body) {
3023
2811
  "app.slack.user_team": field(event?.user_team, teamId),
3024
2812
  "app.slack.source_team": field(event?.source_team, teamId),
3025
2813
  "app.slack.event_team": field(event?.team, teamId),
2814
+ "app.slack.context_team_id": field(body.context_team_id, /^T[A-Z0-9]+$/),
2815
+ "app.slack.context_enterprise_id": body.context_enterprise_id === null ? "none" : field(body.context_enterprise_id, /^E[A-Z0-9]+$/),
3026
2816
  "app.slack.is_ext_shared_channel": typeof body.is_ext_shared_channel === "boolean" ? body.is_ext_shared_channel : body.is_ext_shared_channel === void 0 ? "missing" : "invalid"
3027
2817
  };
3028
2818
  }
@@ -3301,29 +3091,20 @@ async function routeParsedMessage(args) {
3301
3091
  const normalized = normalizeMessageThreadId(args.message);
3302
3092
  const message = normalized.message;
3303
3093
  const canonicalThreadId = normalized.threadId;
3304
- const botUserId = args.adapter.botUserId;
3305
- const isMention = Boolean(botUserId && (textMentionsBot(args.event.text ?? "", botUserId) || args.event.blocks?.some((block) => block.type === "section" && typeof block.text === "object" && block.text.type === "mrkdwn" && textMentionsBot(block.text.text, botUserId))));
3094
+ const isMention = eventMentionsBot(args.event, args.adapter.botUserId);
3306
3095
  if (isMention) message.isMention = true;
3307
3096
  const isDirectMessage = isDmEvent(args.event);
3308
3097
  const isSubscribed = !isDirectMessage && !isMention && await args.state.isSubscribed(canonicalThreadId);
3309
3098
  const route = isDirectMessage || isMention ? "mention" : isSubscribed ? "subscribed" : void 0;
3310
3099
  if (!route) {
3311
- const channelMessage = args.event.type === "message" && args.event.channel && args.event.ts ? slackChannelMessageEvent({
3312
- botId: args.event.bot_id,
3313
- channelId: args.event.channel,
3314
- subtype: args.event.subtype,
3315
- text: args.event.text,
3316
- threadTs: args.event.thread_ts,
3317
- ts: args.event.ts,
3318
- userId: message.author.userId
3319
- }) : void 0;
3320
- const teamId = args.installation.teamId;
3321
- if (channelMessage && teamId) await ingestEventAutomations({
3322
- ...channelMessage,
3323
- namespace: SLACK_EVENT_NAMESPACE
3324
- }, {
3100
+ await ingestChannelMessage({
3101
+ author: {
3102
+ kind: "user",
3103
+ userId: message.author.userId
3104
+ },
3105
+ event: args.event,
3325
3106
  queue: args.queue,
3326
- teamId
3107
+ teamId: args.installation.teamId
3327
3108
  });
3328
3109
  return;
3329
3110
  }
@@ -3423,6 +3204,31 @@ async function routeParsedMessage(args) {
3423
3204
  }
3424
3205
  args.runAfterUnlock(closeAnswered);
3425
3206
  }
3207
+ /**
3208
+ * Run the channel-message automations of the channel for a new message or
3209
+ * thread reply.
3210
+ */
3211
+ async function ingestChannelMessage(args) {
3212
+ const { event } = args;
3213
+ if (event.type !== "message" || !event.channel || !event.ts || !args.teamId) return;
3214
+ const channelMessage = slackChannelMessageEvent({
3215
+ author: args.author,
3216
+ botId: event.bot_id,
3217
+ channelId: event.channel,
3218
+ subtype: event.subtype,
3219
+ text: event.text,
3220
+ threadTs: event.thread_ts,
3221
+ ts: event.ts
3222
+ });
3223
+ if (!channelMessage) return;
3224
+ await ingestEventAutomations({
3225
+ ...channelMessage,
3226
+ namespace: SLACK_EVENT_NAMESPACE
3227
+ }, {
3228
+ queue: args.queue,
3229
+ teamId: args.teamId
3230
+ });
3231
+ }
3426
3232
  async function handleSlackEvent(args) {
3427
3233
  const event = args.body.event;
3428
3234
  if (!event) return;
@@ -3430,6 +3236,7 @@ async function handleSlackEvent(args) {
3430
3236
  const state = args.services.state ?? getStateAdapter();
3431
3237
  await state.connect();
3432
3238
  const installation = installationFromEnvelope(args.body);
3239
+ const channelScope = slackChannelScope(args.body);
3433
3240
  const receivedAtMs = Date.now();
3434
3241
  async function publishAppHomeViewBestEffort(userId) {
3435
3242
  await withLogContext({
@@ -3475,7 +3282,7 @@ async function handleSlackEvent(args) {
3475
3282
  if (event.type === "link_shared") {
3476
3283
  await unfurlDashboardConversationLinks({
3477
3284
  event,
3478
- isExtSharedChannel: args.body.is_ext_shared_channel === true,
3285
+ channelScope,
3479
3286
  state,
3480
3287
  teamId: installation.teamId
3481
3288
  });
@@ -3521,6 +3328,21 @@ async function handleSlackEvent(args) {
3521
3328
  return;
3522
3329
  }
3523
3330
  if ((event.type === "message" || event.type === "app_mention") && !shouldIgnoreMessageSubtype(event) && event.channel && event.ts) {
3331
+ if (event.user === void 0 && event.bot_id !== void 0) {
3332
+ const botId = await slackWorkspaceBotId(event, channelScope, state);
3333
+ setSpanAttributes({ "app.slack.membership": botId ? "verified" : "unverified" });
3334
+ if (!botId || eventMentionsBot(event, adapter.botUserId)) return;
3335
+ await ingestChannelMessage({
3336
+ author: {
3337
+ kind: "bot",
3338
+ botId
3339
+ },
3340
+ event,
3341
+ queue: args.services.queue,
3342
+ teamId: installation.teamId
3343
+ });
3344
+ return;
3345
+ }
3524
3346
  const member = await isSlackWorkspaceMember(event, state);
3525
3347
  setSpanAttributes({ "app.slack.membership": member ? "verified" : "unverified" });
3526
3348
  if (!member) return;
@@ -3739,6 +3561,7 @@ async function processConversationQueueMessage(message, options, metadata) {
3739
3561
  const result = await processConversationWork(parsed, {
3740
3562
  checkInIntervalMs: options.checkInIntervalMs,
3741
3563
  conversationStore: options.conversationStore,
3564
+ getSlackAdapter: options.getSlackAdapter,
3742
3565
  nowMs: options.nowMs,
3743
3566
  queue: options.queue ?? getVercelConversationWorkQueue(),
3744
3567
  run: options.run,
@@ -8030,6 +7853,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
8030
7853
  "/api/connections/*",
8031
7854
  "/api/notifications",
8032
7855
  "/api/notifications/*",
7856
+ "/api/objects",
8033
7857
  "/api/stats",
8034
7858
  "/api/reply-times",
8035
7859
  "/api/versions",
@@ -8276,7 +8100,10 @@ async function createApp(options) {
8276
8100
  events,
8277
8101
  showReviewItem: createSlackReviewItemShow(getProductionSlackAdapter)
8278
8102
  });
8279
- if (dashboard && !dashboard.disabled) pluginApiRoutes = getPluginApiRoutes();
8103
+ if (dashboard && !dashboard.disabled) {
8104
+ pluginApiRoutes = getPluginApiRoutes();
8105
+ readObjectLinkTypes(plugins);
8106
+ }
8280
8107
  } catch (error) {
8281
8108
  restoreRuntimeConfig$1();
8282
8109
  throw error;
@@ -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-CvcBU1z2.js";
2
+ import { i as actorIdentitySchema } from "./conversation-fCWD9Az3.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
@@ -1,9 +1,9 @@
1
- import { i as getChatConfig } from "./config-Dj9M_nqB.js";
2
- import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-CQjlDQYX.js";
1
+ import { i as getChatConfig } from "./config-CAXIpWQb.js";
2
+ import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-DPLEa8Bn.js";
3
3
  import { t as readJuniorSecret } from "./secrets-DebYU866.js";
4
+ import * as z from "zod";
4
5
  import { AsyncLocalStorage } from "node:async_hooks";
5
6
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
6
- import * as z from "zod";
7
7
  import { QueueClient, handleCallback, registerDevConsumer } from "@vercel/queue";
8
8
  // src/chat/queue/bullmq.ts
9
9
  const MAX_ATTEMPTS = 50;
@@ -369,7 +369,7 @@ function cacheWarmupCallback() {
369
369
  maxDeliveries: 1,
370
370
  onRejected: logCacheWarmupRejected,
371
371
  run: async (message) => {
372
- const { runCacheWarmup } = await import("./warmup-Bskrwmk1.js").then((n) => n.o);
372
+ const { runCacheWarmup } = await import("./warmup-9ySPacF9.js").then((n) => n.o);
373
373
  await runCacheWarmup(message);
374
374
  },
375
375
  skip: () => !getChatConfig().cacheWarmingEnabled,
@@ -1,8 +1,8 @@
1
- import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BlutWLNt.js";
2
- import { J as parseBriefInput, K as briefResourceLabel, U as briefCodeChangeSchema, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CvcBU1z2.js";
1
+ import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-4M98h_tC.js";
2
+ import { Q as briefResourceLabel, Y as briefCodeChangeSchema, d as conversationEventPageSchema, et as parseBriefInput, l as conversationDetailReportSchema } from "./conversation-fCWD9Az3.js";
3
3
  import { CLI_USAGE } from "./cli/run.js";
4
- import path from "node:path";
5
4
  import * as z from "zod";
5
+ import path from "node:path";
6
6
  import { mkdir, readFile, writeFile } from "node:fs/promises";
7
7
  // src/chat/briefs/render.ts
8
8
  function list(items, empty) {
@@ -262,7 +262,7 @@ async function parseRunOptions(argv) {
262
262
  * token.
263
263
  */
264
264
  async function configuredBriefModelId() {
265
- const { botConfig } = await import("./config-Dj9M_nqB.js").then((n) => n.r);
265
+ const { botConfig } = await import("./config-CAXIpWQb.js").then((n) => n.r);
266
266
  return botConfig.fastModelId;
267
267
  }
268
268
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-BDWgCJDf.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-BTKmKM-r.js";
3
3
  // src/chat/plugins/catalog-runtime.ts
4
4
  var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
5
5
  const pluginCatalogRuntime = createPluginCatalogRuntime();