@sentry/junior 0.300.0 → 0.302.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 (81) hide show
  1. package/dist/adapter-context-Cx9fn9B3.js +43 -0
  2. package/dist/{admin-UrTniSPO.js → admin-_poE5NKL.js} +2 -2
  3. package/dist/{agent-runner-bY4_0UPm.js → agent-runner-CY9RvsTX.js} +1367 -10649
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +124 -67
  8. package/dist/{app-D-AcIcCV.d.ts → app-BpY3wtRP.d.ts} +3 -3
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +71 -299
  11. package/dist/{automation-Dw82oQ-h.js → automation-Cva5ZOwW.js} +1 -1
  12. package/dist/{background-compaction-queue-B6U3060-.js → background-compaction-queue-CXFq1_Cz.js} +94 -203
  13. package/dist/{briefs-DqiwWu-n.js → briefs-B3NG-pid.js} +3 -3
  14. package/dist/{catalog-runtime-D1oYNv04.js → catalog-runtime-Dss0lSV6.js} +1 -1
  15. package/dist/cli/chat.js +15 -15
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{config-9nHoFiJP.js → config-CzeZiMKs.js} +2 -2
  23. package/dist/{connections-DZjTN3JC.js → connections-CDYhMfrs.js} +6 -6
  24. package/dist/{continue-in-slack-Dtv7_U42.js → continue-in-slack-7Uf05ndC.js} +5 -6
  25. package/dist/{conversation-Dyjq2CZ8.js → conversation-BNXfq6Lb.js} +11 -1
  26. package/dist/{conversation-feed-CcDxlrlQ.js → conversation-feed-Clf_cv0n.js} +2 -1
  27. package/dist/{conversation-privacy-D-5HTXjS.js → conversation-privacy-D9xnM5mK.js} +1 -1
  28. package/dist/{conversation-turn-Cxl8WZD7.js → conversation-turn-D7SEZgTG.js} +16 -17
  29. package/dist/{credential-sync-C49ClwDX.js → credential-sync-DoD0gW-j.js} +13 -15
  30. package/dist/{db-BJNo6fK5.js → db-B-gtnNjr.js} +314 -5
  31. package/dist/{db-2resqBh1.d.ts → db-BdsCzytP.d.ts} +1 -1
  32. package/dist/{executor-DBIaOeJ_.js → executor-DZg20EqU.js} +39 -4
  33. package/dist/install-t1KQyTUs.js +228 -0
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{state-zSilNpbi.js → legacy-web-actor-id-C-cEeWqL.js} +33 -4
  36. package/dist/{lineage-0dereG7H.js → lineage-C79GjoQr.js} +2 -2
  37. package/dist/{logging-BIclibct.js → logging-C9oDAg4M.js} +7 -3
  38. package/dist/{message-dkOl-Iii.js → message-BLUCzJXN.js} +8 -8
  39. package/dist/{model-input-CLo9TaUd.js → model-input-5jwNC45G.js} +3 -3
  40. package/dist/nitro.d.ts +1 -1
  41. package/dist/nitro.js +4 -3
  42. package/dist/{oauth-callback-server-WmpjfJgQ.js → oauth-callback-server-BBl66vCb.js} +2 -2
  43. package/dist/{projection-w_X-zi7v.js → projection-CIBwgD3s.js} +437 -97
  44. package/dist/{prompt-B1Xw46-S.js → prompt-CRQbzp5e.js} +15 -5
  45. package/dist/queue-DtCDaIct.js +115 -0
  46. package/dist/{registry-BmP5vnlj.js → registry-DdFQHZ_d.js} +1 -1
  47. package/dist/{resolve-goo34bJK.js → resolve-CdW4BdrK.js} +4 -229
  48. package/dist/{result-PVBeU0Wf.js → result-oOMv1t4O.js} +9 -9
  49. package/dist/{runner-DKrfvNV6.js → runner-DqitLtm-.js} +9 -9
  50. package/dist/{sandbox-egress-signals-DsUcqrI0.js → sandbox-egress-signals-Bw9I0yfJ.js} +1 -1
  51. package/dist/{schema-Dns-sTas.d.ts → schema-BIFM-U1a.d.ts} +470 -30
  52. package/dist/{schema-C9iNFz5n.js → schema-DnVQepWP.js} +76 -31
  53. package/dist/{service-account-CMAAloAL.js → service-account-B6mKAPVo.js} +3 -3
  54. package/dist/{service-account-CmowamcB.js → service-account-CrZftRTb.js} +257 -6
  55. package/dist/{session-stop-BcAXze8a.js → session-stop-DW63Z3kj.js} +1103 -1007
  56. package/dist/{skills-DfsazET6.js → skills-C16fz60Z.js} +2 -2
  57. package/dist/{slack-conversation-unfurl-CzQonuWz.js → slack-conversation-unfurl-BHhefEb7.js} +8 -7
  58. package/dist/{spawn-C7o0FDDp.js → spawn-D_RnFYfy.js} +6 -6
  59. package/dist/{stop-CFOujp8C.js → stop-7p1i08CY.js} +941 -2311
  60. package/dist/{store-E3x2Fg_F.js → store-C28I0CVW.js} +5 -5
  61. package/dist/{task-queue-D-hCqdZW.js → task-queue-BVUJbQ28.js} +3 -3
  62. package/dist/{task-runner-vohUPLHe.js → task-runner-CWi8j7Z6.js} +6 -8
  63. package/dist/{thread-context-BzvdkgI9.js → thread-context-D3-yYUd0.js} +8 -8
  64. package/dist/{store-Dkeis_8o.js → turn-session-routing-BFMS9ATF.js} +382 -11
  65. package/dist/{turn-user-message-D5RnVmxQ.js → turn-user-message-C3-O8Omt.js} +3 -3
  66. package/dist/{validation-BbWikeSa.js → validation-BSFKUIb4.js} +1 -1
  67. package/dist/{version-GVBMW2jA.js → version-BHHXNi-0.js} +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/{viewer-BpxRliyO.js → viewer-B1SO21Qa.js} +3 -3
  70. package/dist/warmup-Bz9bzkzN.js +13927 -0
  71. package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
  72. package/dist/{worker-Cbd-iuwZ.js → worker-BspReIIK.js} +7 -7
  73. package/migrations/0108_conversation_embeddings.sql +13 -0
  74. package/migrations/meta/0108_snapshot.json +4688 -0
  75. package/migrations/meta/_journal.json +7 -0
  76. package/package.json +10 -8
  77. package/dist/adapter-S5UkjNK3.js +0 -303
  78. package/dist/reporting-window-DopzcOHh.js +0 -137
  79. package/dist/turn-session-routing-Bo_LxFum.js +0 -380
  80. package/dist/users-2bggndVg.js +0 -424
  81. package/dist/warmup-BW2qwnal.js +0 -3693
package/dist/app.js CHANGED
@@ -1,58 +1,56 @@
1
1
  import { i as getActiveSpan, n as captureMessage, u as sentry_exports } from "./sentry-BRTJqumy.js";
2
- import { Aa as slackEntitySchema, Ao as readConversationEventPageAfter, Ar as dismissOpenReviewItems, Ba as clearSandboxEgressSignals, C as settleConversationTitleWork, Ca as openSlackModal, Ci as verifyEventAutomationCredentialSubject, Cs as getConfigDefaults, Er as projectConversationMessages, Ha as consumeSandboxEgressPermissionDeniedSignal, Ja as normalizeSandboxEgressTracePropagationDomains, Jo as getSlackClient, Lr as searchReviewItems, Mi as getDashboardReviewItemLink, Mo as readConversationLastEventSeq, Mt as hasRunnableConversationWork, No as readConversationMessageEventSeq, Oi as getDashboardConversationLink, Pi as getDashboardTaskLink, Pt as isInvalidConversationRecordError, Ri as setDashboardConversationLinkOptions, Rt as pruneActiveConversation, Si as bindSlackDirectCredentialSubject, Ti as verifySlackDirectCredentialSubject, Va as consumeSandboxEgressAuthRequiredSignal, Vr as canActOnReviewItem, Wa as parseSandboxEgressCredentialToken, Xo as isDmChannel, Xr as reviewItemReaderForUser, Zn as createUserTokenStore, Zr as reviewItemReaderForUserInConversation, _ as appendConversationMessages, _s as createPluginCache, aa as proxyVercelSandboxEgressRequest, ar as getPluginApiRoutes, bi as bindEventAutomationCredentialSubject, cs as createPluginAnnotations, dr as getPlugins, dt as CONVERSATION_WORK_STALE_ENQUEUE_MS, fi as collectEventMatchKeys, fr as setPlugins, ga as slackMention, gi as findMatchingWatches, gr as setBriefsConfig, ho as createPluginLogger, ia as isVercelSandboxEgressRequest, is as runWithWorkspaceTeamId, ja as slackExternalRefIdSchema, ko as readConversationEventPage, la as resolveBaseUrl, ls as listConversationAnnotations, or as getPluginRoutes, os as resolveRootVisibility, pr as validatePlugins, ri as createCodeChangePublisher, rr as createPluginEventPublisher, rs as getWorkspaceTeamId, to as createPluginEmbedder, wa as postSlackEphemeralMessage, wi as verifyScheduledAutomationCredentialSubject, ws as setConfigDefaults, xi as bindScheduledAutomationCredentialSubject, yi as takeDueTimerWatches, yo as readConversationAccessFromSql, zi as createPluginState } from "./projection-w_X-zi7v.js";
3
- import { Z as getAttachmentStorage, d as restoreRuntimeConfig, 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-9nHoFiJP.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-BIclibct.js";
5
- import { t as JUNIOR_VERSION } from "./version-GVBMW2jA.js";
2
+ import { Bi as createPluginState, C as settleConversationTitleWork, Ci as bindSlackDirectCredentialSubject, Dr as createPluginReviewItems, Ds as getConfigDefaults, Ea as postSlackEphemeralMessage, Ei as verifySlackDirectCredentialSubject, Er as projectConversationMessages, Fi as getDashboardTaskLink, Fo as readConversationMessageEventSeq, Ha as clearSandboxEgressSignals, Hr as canActOnReviewItem, Ka as parseSandboxEgressCredentialToken, Ma as slackEntitySchema, Mo as readConversationEventPageAfter, Mt as hasRunnableConversationWork, Na as slackExternalRefIdSchema, Ni as getDashboardReviewItemLink, Os as setConfigDefaults, Po as readConversationLastEventSeq, Pt as isInvalidConversationRecordError, Qo as isDmChannel, Qr as reviewItemReaderForUserInConversation, Rr as searchReviewItems, Rt as pruneActiveConversation, Si as bindScheduledAutomationCredentialSubject, Ta as openSlackModal, Ti as verifyScheduledAutomationCredentialSubject, Ua as consumeSandboxEgressAuthRequiredSignal, Wa as consumeSandboxEgressPermissionDeniedSignal, Xa as normalizeSandboxEgressTracePropagationDomains, Xo as getSlackClient, Zn as createUserTokenStore, Zr as reviewItemReaderForUser, _ as appendConversationMessages, _a as slackMention, _i as findMatchingWatches, _o as createPluginLogger, aa as isVercelSandboxEgressRequest, ar as getPluginRoutes, as as getWorkspaceTeamId, bi as takeDueTimerWatches, cs as resolveRootVisibility, dt as CONVERSATION_WORK_STALE_ENQUEUE_MS, fr as setPlugins, fs as createPluginAnnotations, gr as setBriefsConfig, ii as createCodeChangePublisher, ir as getPluginApiRoutes, jo as readConversationEventPage, jr as dismissOpenReviewItems, ki as getDashboardConversationLink, nr as createPluginEventPublisher, oa as proxyVercelSandboxEgressRequest, os as runWithWorkspaceTeamId, pi as collectEventMatchKeys, pr as validatePlugins, ps as listConversationAnnotations, ro as createPluginEmbedder, ua as resolveBaseUrl, ur as getPlugins, wi as verifyEventAutomationCredentialSubject, xi as bindEventAutomationCredentialSubject, xo as readConversationAccessFromSql, xs as createPluginCache, zi as setDashboardConversationLinkOptions } from "./projection-CIBwgD3s.js";
3
+ import { Z as getAttachmentStorage, d as restoreRuntimeConfig, 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-CzeZiMKs.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-C9oDAg4M.js";
5
+ import { t as JUNIOR_VERSION } from "./version-BHHXNi-0.js";
6
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-BJNo6fK5.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-DBIaOeJ_.js";
9
- import { c as fenceLock, l as withLock, o as MUTATION_LOCK_TTL_MS, r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-S5UkjNK3.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-D1oYNv04.js";
11
- import { $ as effectiveTaskOutcomes, A as parseSlackReviewItemClick, At as ingestEvent, Ct as markConversationRead, D as syncReviewItemSlackCards, E as readSlackReviewItemCardConversationId, G as ViewerTaskNotFoundError, M as parseSlackUserInputSubmission, Mt as missingAutomationSkillReason, N as parseSlackThreadId, R as logScheduledAutomationRunSkipped, T as createSlackReviewItemShow, Y as readViewerAutomationSummary, Z as readViewerAutomations, _t as collectAttachmentGarbage, at as appendAndEnqueueWebMessage, b as unpublishedArtifactHeaders, j as parseSlackReviewItemFormTarget, jt as findAutomationSkill, k as buildSlackReviewItemModal, kt as processWorkspaceSnapshotJob, lt as recordWebConversationActivity, n as executeAgentRun, nt as renderReviewItemMessage, ot as conversationTurnIdForMessage, pt as collectAttachmentUploadGarbage, q as readViewerAutomationExecutions, r as processBackgroundCompaction, rt as reviewItemChangeRecord, t as createAgentRunner, tt as deliverReviewItemChange, ut as webActorFromUser, v as publicArtifactHeaders, x as setConversationSubscription, xt as archiveConversation, y as readPublicArtifact, yt as requestAttachmentDeletion, z as scheduledAutomationRunAttributes } from "./agent-runner-bY4_0UPm.js";
7
+ import { $ as fenceLock, B as recordGoogleSignIn, G as createCache, J as getStateAdapter, K as disconnectStateAdapter, P as resolveActorIdentityId, Z as MUTATION_LOCK_TTL_MS, a as getConversationStore, et as withLock, f as withConversationEventLock, mt as createSlackDestination, o as getDb, pt as touchConversationDetail, r as getConversationEventStore, s as getSqlExecutor, t as closeDb, x as withConversationMutationLock } from "./db-B-gtnNjr.js";
8
+ import { F as juniorDestinations, M 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-DZg20EqU.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Dss0lSV6.js";
10
+ import { D as parseSlackUserInputSubmission, E as parseSlackReviewItemFormTarget, S as findSlackThreadOwnerId, T as parseSlackReviewItemClick, _ as logScheduledAutomationRunSkipped, b as resolveSlackReviewItemCardConversationId, h as unpublishedArtifactHeaders, m as readPublicArtifact, n as executeAgentRun, p as publicArtifactHeaders, r as processBackgroundCompaction, t as createAgentRunner, v as scheduledAutomationRunAttributes, w as buildSlackReviewItemModal, x as syncReviewItemSlackCards, y as createSlackReviewItemShow } from "./agent-runner-CY9RvsTX.js";
12
11
  import { a as getNextRunAtMs } from "./schedule-cP0AACm1.js";
13
- import { i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-BpxRliyO.js";
14
- import { P as conversationTitleSchema, et as conversationBriefSchema, m as conversationFeedQuerySchema, x as conversationSurfaceSchema, y as conversationReportStatusSchema, z as annotationCard } from "./conversation-Dyjq2CZ8.js";
12
+ import { i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-B1SO21Qa.js";
13
+ import { P as conversationTitleSchema, et as conversationBriefSchema, m as conversationFeedQuerySchema, x as conversationSurfaceSchema, y as conversationReportStatusSchema, z as annotationCard } from "./conversation-BNXfq6Lb.js";
15
14
  import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
16
15
  import { n as readSchedulerSecret, r as readSignInSecret } from "./secrets-DebYU866.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-BcAXze8a.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-BW2qwnal.js";
19
- import { E as getQueueProvider, _ as cacheWarmupQueueConsumer, a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, 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 createVercelCacheWarmupCallback, w as queueCallback, y as registerVercelCacheWarmupDevConsumer } from "./background-compaction-queue-B6U3060-.js";
20
- import { _ as getConversationWorkState, g as getConversation, h as ensureConversationWake, l as clearExpiredConversationLease, r as appendAndEnqueueInboundMessage, y as listActiveConversationIds } from "./store-E3x2Fg_F.js";
21
- import { c as coerceThreadConversationState, p as eventGuidance } from "./turn-session-routing-Bo_LxFum.js";
22
- import { o as buttonUserInputField } from "./statuses-Hn-HsOph.js";
23
- import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-goo34bJK.js";
24
- import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-Dw82oQ-h.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-Dkeis_8o.js";
26
- import { a as runWithSlackInstallation, o as verifySlackSignature, p as joinPublicChannel, r as lookupSlackUserProfile } from "./users-2bggndVg.js";
27
- import { A as resolveAllowedDomains, B as runAutoArchiveSweep, C as readConversationPendingMessages, D as isAllowedDomain, E as assertNoLegacyAllowedDomains, F as readReviewItemForUser, I as reviewItemChange, K as readObjectLinkTypes, M as ReviewItemActionError, N as actOnReviewItem, O as isAllowedSignInEmail, P as closeReviewItemsAnsweredByReply, R as archiveViewerDoneConversations, S as cancelConversationPendingMessagesForViewer, U as GET$4, V as setConversationAutoArchive, X as isPublicAddress, Z as publicAddressLookup, _ as appendConversationMessageForViewer, _t as SubscribedReplyReason, a as pinConversation, at as slackInboundMessageId, b as decodeConversationCursor, dt as recordSkippedConversationMessage, et as createProductionConversationWorkOptions, ft as createSlackWebApiStatusSender, g as readConversationRecordFromSql, gt as parseContent, ht as stripLeadingBotMention, i as readConversationFeed, it as clearSlackPendingReactions, j as stopConversation, k as readEnvList, lt as enqueueAgentDispatch, mt as startProcessingReaction, n as steerConversationPendingMessagesForViewer, nt as getProductionSlackAdapter, ot as normalizeIncomingSlackThreadId, pt as bindMessageAuthorIdentityId, rt as buildSlackInboundMessage, s as readConversationDetail, st as withNormalizedThreadId, t as stopConversationTurnForViewer, tt as createProductionSlackWebhookServices, ut as failStoppedDispatch, v as createConversationForViewer, vt as getThreadStopDecision, x as encodeConversationCursor } from "./stop-CFOujp8C.js";
28
- import { s as conversationPendingMessageDeliverySchema } from "./conversation-feed-CcDxlrlQ.js";
29
- import { a as resumeConversationDelivery } from "./conversation-turn-Cxl8WZD7.js";
30
- import { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-PVBeU0Wf.js";
31
- import { t as bindMessageAgent } from "./message-dkOl-Iii.js";
32
- import { t as bindSpawnAgent } from "./spawn-C7o0FDDp.js";
33
- import { a as pluginTaskQueueConsumer, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-D-hCqdZW.js";
34
- import { t as processPluginTask } from "./task-runner-vohUPLHe.js";
35
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BbWikeSa.js";
16
+ 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-DW63Z3kj.js";
17
+ import { Ct as recordWebConversationActivity, Di as effectiveTaskOutcomes, Dt as collectAttachmentUploadGarbage, Ei as missingAutomationSkillReason, I as lookupSlackUserProfile, Nt as requestAttachmentDeletion, O as ingestEvent, Sr as joinPublicChannel, T as processWorkspaceSnapshotJob, Ti as findAutomationSkill, Xt as listPendingAgentInvocationMailboxAppends, Zt as listPendingAgentInvocationResults, _i as readViewerAutomations, _t as reviewItemChangeRecord, bt as conversationTurnIdForMessage, ct as archiveConversation, di as ViewerTaskNotFoundError, gt as renderReviewItemMessage, hi as readViewerAutomationSummary, ht as deliverReviewItemChange, jt as collectAttachmentGarbage, lr as parseSlackThreadId, mn as enqueueAgentInvocation, pi as readViewerAutomationExecutions, qn as setConversationSubscription, ut as markConversationRead, wt as webActorFromUser, xn as recordSubagentEnded, yt as appendAndEnqueueWebMessage } from "./warmup-Bz9bzkzN.js";
18
+ import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-Cva5ZOwW.js";
19
+ 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-BFMS9ATF.js";
20
+ import { s as buttonUserInputField } from "./web-message-id-lNodcCOI.js";
21
+ 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-CXFq1_Cz.js";
22
+ import { _ as getConversationWorkState, g as getConversation, h as ensureConversationWake, l as clearExpiredConversationLease, r as appendAndEnqueueInboundMessage, y as listActiveConversationIds } from "./store-C28I0CVW.js";
23
+ import { a as getSandboxResourceConfig, s as setSandboxResourceConfig } from "./install-t1KQyTUs.js";
24
+ import { i as registerVercelCacheWarmupDevConsumer, l as verifyWorkspaceSnapshotJobMessage, n as cacheWarmupQueueConsumer, o as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, r as createVercelCacheWarmupCallback } from "./queue-DtCDaIct.js";
25
+ import { n as verifySlackSignature, t as runWithSlackInstallation } from "./adapter-context-Cx9fn9B3.js";
26
+ import { A as resolveAllowedDomains, B as runAutoArchiveSweep, C as readConversationPendingMessages, D as isAllowedDomain, E as assertNoLegacyAllowedDomains, F as readReviewItemForUser, I as reviewItemChange, K as backfillCacheWarmingGaps, M as ReviewItemActionError, N as actOnReviewItem, O as isAllowedSignInEmail, P as closeReviewItemsAnsweredByReply, R as archiveViewerDoneConversations, S as cancelConversationPendingMessagesForViewer, V as setConversationAutoArchive, W as runSavingsRefillSlice, X as readObjectLinkTypes, _ as appendConversationMessageForViewer, _t as stripLeadingBotMention, a as pinConversation, at as buildSlackInboundMessage, b as decodeConversationCursor, bt as getThreadStopDecision, ct as normalizeIncomingSlackThreadId, dt as enqueueAgentDispatch, et as isPublicAddress, ft as failStoppedDispatch, g as readConversationRecordFromSql, gt as startProcessingReaction, ht as bindMessageAuthorIdentityId, i as readConversationFeed, it as getProductionSlackAdapter, j as stopConversation, k as readEnvList, lt as withNormalizedThreadId, mt as createSlackWebApiStatusSender, n as steerConversationPendingMessagesForViewer, nt as createProductionConversationWorkOptions, ot as clearSlackPendingReactions, pt as recordSkippedConversationMessage, q as GET$4, rt as createProductionSlackWebhookServices, s as readConversationDetail, st as slackInboundMessageId, t as stopConversationTurnForViewer, tt as publicAddressLookup, v as createConversationForViewer, vt as parseContent, x as encodeConversationCursor, yt as SubscribedReplyReason } from "./stop-7p1i08CY.js";
27
+ import { s as conversationPendingMessageDeliverySchema } from "./conversation-feed-Clf_cv0n.js";
28
+ import { a as resumeConversationDelivery } from "./conversation-turn-D7SEZgTG.js";
29
+ import { i as enqueueAgentInvocationResult, r as createEndStoppedChildWork } from "./result-oOMv1t4O.js";
30
+ import { t as bindMessageAgent } from "./message-BLUCzJXN.js";
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";
36
35
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-BBX07Jzt.js";
37
- import { o as unlinkProvider } from "./connections-DZjTN3JC.js";
38
- import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-C49ClwDX.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";
39
38
  import { t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.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-CzQonuWz.js";
41
- import { t as processConversationWork } from "./worker-Cbd-iuwZ.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";
42
41
  import { createRequire } from "node:module";
43
42
  import { Hono } from "hono";
44
43
  import * as z from "zod";
45
44
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
46
- import { and, asc, desc, eq, gte, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
45
+ import { and, asc, eq, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
47
46
  import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, dispatchOptionsSchema, eventSchema, eventTriggerFiltersText, isSlackDestination, userSchema } from "@sentry/junior-plugin-api";
48
47
  import { pathToFileURL } from "node:url";
48
+ import { Message, ThreadImpl } from "chat";
49
49
  import pLimit from "p-limit";
50
50
  import net from "node:net";
51
51
  import { decodeJwt } from "jose";
52
- import { performance } from "node:perf_hooks";
53
52
  import { HTTPException } from "hono/http-exception";
54
53
  import https from "node:https";
55
- import { Message, ThreadImpl } from "chat";
56
54
  import * as acp from "@agentclientprotocol/sdk";
57
55
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
58
56
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
@@ -60,250 +58,6 @@ import { bodyLimit } from "hono/body-limit";
60
58
  import { createAuthMiddleware } from "better-auth/api";
61
59
  import { getSessionCookie } from "better-auth/cookies";
62
60
  import { betterAuth } from "better-auth/minimal";
63
- // src/chat/cache-warming/backfill.ts
64
- /**
65
- * Fill of the empty cache warming gap lists from stored Conversation
66
- * history, about once a month.
67
- *
68
- * `warmup.ts` learns reply gaps only from idle periods after it is deployed.
69
- * Until a `gapSegment` has gaps, Junior sends no warmups for it. This replays
70
- * the stored model calls of the last `GLOBAL_GAPS_TTL_MS` with the same rules
71
- * as live recording, so warming can start soon after the first deploy.
72
- *
73
- * The heartbeat runs it. Only one run claims it, and a completed run marks
74
- * the install as done, also when it stopped on its time budget or skipped a
75
- * batch that the statement timeout canceled. It fills only segment lists
76
- * that are empty when it starts, so it does not add history to gaps that
77
- * live recording already has.
78
- *
79
- * History does not tell the plugin work state or the archive state that a
80
- * Conversation had when an idle period started. So it fills only the
81
- * segments of Conversations that are not archived and have work state
82
- * `none`, which most Conversations have. The `open` and `done` segments and
83
- * the `archived:*` segments stay empty until live gaps arrive. Until then,
84
- * `decideWarmup` leans on their `parentGapSegment`, a `none` segment that
85
- * this fills. Each idle period still records its gap, so the segment fills
86
- * from live idle periods.
87
- */
88
- const BACKFILL_KEY = "junior:cache_warming:backfill:work_state:v2";
89
- const BACKFILL_CLAIM_TTL_MS = 60 * MINUTE_MS;
90
- const BACKFILL_DONE_TTL_MS = GLOBAL_GAPS_TTL_MS;
91
- const CONVERSATION_BATCH_SIZE = 10;
92
- const QUERY_CANCELED = "57014";
93
- const BACKFILL_BUDGET_MS = 6e4;
94
- const BACKFILL_GAPS_MAX = GLOBAL_GAPS_MAX / 2;
95
- const BACKFILL_SEGMENTS = new Set([true, false].flatMap((userActor) => [
96
- 0,
97
- 1,
98
- 2,
99
- 3
100
- ].map((endedTurns) => historySegment(userActor, endedTurns))));
101
- function historySegment(userActor, endedTurns) {
102
- return gapSegment({
103
- userActor,
104
- endedTurns,
105
- workState: "none",
106
- archived: false
107
- });
108
- }
109
- async function loadConversations(windowStartMs) {
110
- return await getDb().select({
111
- conversationId: juniorConversations.conversationId,
112
- kind: juniorConversations.kind,
113
- parentConversationId: juniorConversations.parentConversationId
114
- }).from(juniorConversations).where(and(gte(juniorConversations.lastActivityAt, new Date(windowStartMs)), isNull(juniorConversations.transcriptPurgedAt))).orderBy(desc(juniorConversations.lastActivityAt), juniorConversations.conversationId);
115
- }
116
- async function loadEvents(conversationIds) {
117
- const events = juniorConversationEvents;
118
- const isUserMessage = sql`${events.type} = 'user_message'`;
119
- const message = sql`CASE
120
- WHEN ${events.type} <> 'assistant_message' THEN NULL
121
- WHEN ${events.schemaVersion} >= 2 THEN (${events.payload}->>'message')::jsonb
122
- ELSE ${events.payload}
123
- END`;
124
- return await getDb().select({
125
- conversationId: events.conversationId,
126
- type: sql`${events.type}`,
127
- personInstruction: sql`CASE WHEN ${isUserMessage} THEN (${events.payload}->'provenance'->'actor'->>'userId') IS NOT NULL END`,
128
- stopReason: sql`(${message})->>'stopReason'`,
129
- startedAtMs: sql`(${message})->>'timestamp'`,
130
- cacheRead: sql`${events.payload}->'usage'->>'cacheRead'`,
131
- cacheWrite: sql`${events.payload}->'usage'->>'cacheWrite'`
132
- }).from(events).innerJoin(juniorConversations, eq(juniorConversations.conversationId, events.conversationId)).where(and(inArray(events.conversationId, conversationIds), or(eq(events.type, "assistant_message"), and(isUserMessage, sql`(${events.payload}->'provenance'->>'authority') = 'instruction'`)), gte(events.createdAt, juniorConversations.createdAt))).orderBy(events.conversationId, events.seq);
133
- }
134
- /**
135
- * Replay the model calls of one Conversation the way the recorder in
136
- * `warmup.ts` sees them, and return the gap of each idle period.
137
- *
138
- * Live recording measures from the start of the request that ended a Turn to
139
- * the start of the next recorded request. Here both times are the
140
- * `timestamp` of the stored assistant message, which Pi sets when it starts
141
- * the request. That is the closest stored time to the recorder's clock.
142
- *
143
- * Live recording records gaps only for idle periods that it could warm. The
144
- * stored usage gives the prefix size, so periods with a prefix below
145
- * `MIN_WARMUP_PREFIX_TOKENS` are skipped. The model, cache retention, and
146
- * snapshot size of the request are not checked: this assumes that reply
147
- * timing does not depend on them.
148
- */
149
- function replayConversation(kind, events, nowMs) {
150
- const gaps = [];
151
- const close = (idle, untilMs) => {
152
- const gapMs = untilMs - idle.sinceMs;
153
- if (!idle.eligible || gapMs <= 0) return;
154
- gaps.push({
155
- segment: idle.segment,
156
- sinceMs: idle.sinceMs,
157
- gapMs: gapMs >= 33e5 ? NO_REPLY_GAP_MS : gapMs
158
- });
159
- };
160
- let userActor = false;
161
- let inTurn = false;
162
- let endedTurns = 0;
163
- let lastCallMs;
164
- let idle;
165
- for (const event of events) {
166
- if (event.type === "user_message") {
167
- if (!inTurn) {
168
- userActor = event.personInstruction === true && kind !== "task";
169
- inTurn = true;
170
- }
171
- continue;
172
- }
173
- if (event.stopReason !== "toolUse") inTurn = false;
174
- const startedAtMs = event.startedAtMs === null ? NaN : Number(event.startedAtMs);
175
- if (!Number.isFinite(startedAtMs) || event.stopReason === "error" || event.stopReason === "aborted") continue;
176
- if (idle) close(idle, startedAtMs);
177
- idle = void 0;
178
- if (lastCallMs !== void 0 && startedAtMs - lastCallMs > CONVERSATION_STATE_TTL_MS) endedTurns = 0;
179
- lastCallMs = startedAtMs;
180
- if (event.stopReason === "stop") {
181
- const prefixTokens = Number(event.cacheRead ?? 0) + Number(event.cacheWrite ?? 0);
182
- idle = {
183
- sinceMs: startedAtMs,
184
- segment: historySegment(userActor, endedTurns),
185
- eligible: prefixTokens >= MIN_WARMUP_PREFIX_TOKENS
186
- };
187
- endedTurns += 1;
188
- }
189
- }
190
- if (idle && nowMs - idle.sinceMs >= 33e5) close(idle, nowMs);
191
- return gaps;
192
- }
193
- function isQueryCanceled(error) {
194
- let current = error;
195
- for (let depth = 0; current && depth < 6; depth += 1) {
196
- if (typeof current !== "object") return false;
197
- if (current.code === QUERY_CANCELED) return true;
198
- current = current.cause;
199
- }
200
- return false;
201
- }
202
- async function collectGaps(nowMs, budgetMs) {
203
- const startedAt = performance.now();
204
- const windowStartMs = nowMs - GLOBAL_GAPS_TTL_MS;
205
- const conversations = await loadConversations(windowStartMs);
206
- const recorded = [];
207
- let scanned = 0;
208
- let canceledBatches = 0;
209
- let budgetExceeded = false;
210
- for (let i = 0; i < conversations.length; i += CONVERSATION_BATCH_SIZE) {
211
- if (i > 0 && performance.now() - startedAt >= budgetMs) {
212
- budgetExceeded = true;
213
- break;
214
- }
215
- const batch = conversations.slice(i, i + CONVERSATION_BATCH_SIZE);
216
- let rows;
217
- try {
218
- rows = await loadEvents(batch.map((row) => row.conversationId));
219
- } catch (error) {
220
- if (!isQueryCanceled(error)) throw error;
221
- canceledBatches += 1;
222
- continue;
223
- }
224
- const events = /* @__PURE__ */ new Map();
225
- for (const event of rows) {
226
- const list = events.get(event.conversationId) ?? [];
227
- list.push(event);
228
- events.set(event.conversationId, list);
229
- }
230
- for (const conversation of batch) {
231
- const gaps = replayConversation(conversationKindFromRow(conversation), events.get(conversation.conversationId) ?? [], nowMs);
232
- recorded.push(...gaps.filter((gap) => gap.sinceMs >= windowStartMs));
233
- }
234
- scanned += batch.length;
235
- }
236
- recorded.sort((a, b) => a.sinceMs - b.sinceMs);
237
- const bySegment = /* @__PURE__ */ new Map();
238
- for (const gap of recorded) {
239
- const list = bySegment.get(gap.segment) ?? [];
240
- list.push(gap.gapMs);
241
- bySegment.set(gap.segment, list);
242
- }
243
- return {
244
- bySegment,
245
- scanned,
246
- canceledBatches,
247
- budgetExceeded
248
- };
249
- }
250
- /**
251
- * Fill each empty cache warming gap list from the stored Conversation
252
- * history. The heartbeat calls it each minute. After a run completes, a call
253
- * makes one state request and returns, until the completed run expires.
254
- *
255
- * A run that uses its scan budget writes the gaps that it has and also
256
- * completes. Some gaps are better than none, and a run that cannot finish
257
- * would otherwise try again each hour.
258
- */
259
- async function backfillCacheWarmingGaps(args) {
260
- if (!getChatConfig().cacheWarmingEnabled) return;
261
- const state = getStateAdapter();
262
- await state.connect();
263
- if (!await state.setIfNotExists(BACKFILL_KEY, "running", BACKFILL_CLAIM_TTL_MS)) return;
264
- await withSpan("cache_warming.backfill", "cache_warming.backfill", {}, async (setSpanAttributes) => {
265
- const emptySegments = /* @__PURE__ */ new Set();
266
- for (const segment of BACKFILL_SEGMENTS) if ((await state.getList(segmentGapsKey(segment))).length === 0) emptySegments.add(segment);
267
- const { bySegment, scanned, canceledBatches, budgetExceeded } = await collectGaps(args.nowMs, args.budgetMs ?? BACKFILL_BUDGET_MS);
268
- const logAttributes = {
269
- "app.cache_warming.backfill.conversation_count": scanned,
270
- "app.cache_warming.backfill.canceled_batch_count": canceledBatches,
271
- "app.cache_warming.backfill.budget_exceeded": budgetExceeded
272
- };
273
- if (scanned === 0 && canceledBatches > 0) {
274
- logInfo("cache_warming.backfill.not_completed", logAttributes);
275
- setSpanAttributes({
276
- ...logAttributes,
277
- "app.cache_warming.backfill.outcome": "not_completed"
278
- });
279
- return;
280
- }
281
- let gapCount = 0;
282
- let segmentCount = 0;
283
- for (const [segment, gaps] of bySegment) {
284
- if (!emptySegments.has(segment)) continue;
285
- const key = segmentGapsKey(segment);
286
- const newest = gaps.slice(-BACKFILL_GAPS_MAX);
287
- for (const gapMs of newest) await state.appendToList(key, gapMs, {
288
- maxLength: GLOBAL_GAPS_MAX,
289
- ttlMs: GLOBAL_GAPS_TTL_MS
290
- });
291
- gapCount += newest.length;
292
- segmentCount += 1;
293
- }
294
- await state.set(BACKFILL_KEY, "done", BACKFILL_DONE_TTL_MS);
295
- const completed = {
296
- ...logAttributes,
297
- "app.cache_warming.backfill.gap_count": gapCount,
298
- "app.cache_warming.backfill.segment_count": segmentCount
299
- };
300
- logInfo("cache_warming.backfill.completed", completed);
301
- setSpanAttributes({
302
- ...completed,
303
- "app.cache_warming.backfill.outcome": "completed"
304
- });
305
- });
306
- }
307
61
  // src/chat/events/timers.ts
308
62
  /** Publish a bounded batch of due timers; the mailbox owns agent execution. */
309
63
  async function runTimerWatchHeartbeat(args) {
@@ -431,6 +185,11 @@ function createHeartbeatContext(args) {
431
185
  db: getDb(),
432
186
  embedder: createPluginEmbedder(pluginName),
433
187
  events: args.events,
188
+ reviewItems: { forConversation: (conversationId) => createPluginReviewItems({
189
+ conversationId,
190
+ plugin: pluginName,
191
+ show: args.showReviewItem ?? (async () => {})
192
+ }) },
434
193
  state: createPluginState(pluginName),
435
194
  log: createPluginLogger(pluginName),
436
195
  agent: {
@@ -1510,7 +1269,8 @@ async function runPluginHeartbeats(args) {
1510
1269
  conversationWorkQueue: args.conversationWorkQueue,
1511
1270
  events: createPluginEventPublisher(plugin, args.events),
1512
1271
  plugin,
1513
- nowMs: args.nowMs
1272
+ nowMs: args.nowMs,
1273
+ showReviewItem: args.showReviewItem
1514
1274
  }))), PLUGIN_HEARTBEAT_TIMEOUT_MS);
1515
1275
  if (typeof result?.dispatchCount === "number" && result.dispatchCount > 0) logInfo("plugin.heartbeat.dispatched", {
1516
1276
  "app.dispatch.count": result.dispatchCount,
@@ -1618,13 +1378,19 @@ async function runHeartbeat(args) {
1618
1378
  await runPluginHeartbeats({
1619
1379
  conversationWorkQueue: queue,
1620
1380
  events,
1621
- nowMs: args.nowMs
1381
+ nowMs: args.nowMs,
1382
+ showReviewItem: args.showReviewItem
1622
1383
  });
1623
1384
  try {
1624
1385
  await backfillCacheWarmingGaps({ nowMs: args.nowMs });
1625
1386
  } catch (error) {
1626
1387
  logException(error, "cache_warming.backfill.failed");
1627
1388
  }
1389
+ try {
1390
+ await runSavingsRefillSlice({ nowMs: args.nowMs });
1391
+ } catch (error) {
1392
+ logException(error, "cache_warming.savings_refill.failed");
1393
+ }
1628
1394
  }
1629
1395
  // src/handlers/scheduler-auth.ts
1630
1396
  /** Check the bearer secret that internal cron requests must send. */
@@ -1645,7 +1411,8 @@ async function GET$3(request, waitUntil, options = {}) {
1645
1411
  waitUntil(() => runHeartbeat({
1646
1412
  conversationWorkQueue: options.conversationWorkQueue,
1647
1413
  events: options.events,
1648
- nowMs
1414
+ nowMs,
1415
+ showReviewItem: options.showReviewItem
1649
1416
  }).catch((error) => {
1650
1417
  logException(error, "heartbeat.failed", { "app.heartbeat.now_ms": nowMs });
1651
1418
  }));
@@ -2280,10 +2047,11 @@ async function act(args) {
2280
2047
  const { services, target } = args;
2281
2048
  const actor = await resolveActingUser(services, args.payload, target);
2282
2049
  if (!actor) return;
2283
- const conversationId = await readSlackReviewItemCardConversationId({
2284
- ...target,
2285
- itemId: args.itemId
2286
- }) ?? `slack:${target.channelId}:${target.threadTs}`;
2050
+ const conversationId = await resolveSlackReviewItemCardConversationId({
2051
+ channelId: target.channelId,
2052
+ teamId: actor.teamId,
2053
+ threadTs: target.threadTs
2054
+ });
2287
2055
  const delivery = {
2288
2056
  queue: services.queue,
2289
2057
  show: createSlackReviewItemShow(() => services.adapter)
@@ -3029,19 +2797,21 @@ async function resolveSlackConversationId(args) {
3029
2797
  const providerThread = parseSlackThreadId(args.canonicalThreadId);
3030
2798
  const conversationStore = args.conversationStore ?? getConversationStore();
3031
2799
  if (!providerThread) return args.canonicalThreadId;
3032
- const thread = {
3033
- provider: "slack",
3034
- providerDestinationId: providerThread.channelId,
3035
- providerTenantId: args.installation.teamId ?? "",
3036
- providerConversationId: providerThread.threadTs
3037
- };
3038
- const ownerId = await conversationStore.getConversationIdByProviderConversation(thread);
2800
+ const ownerId = await findSlackThreadOwnerId({
2801
+ channelId: providerThread.channelId,
2802
+ conversationStore,
2803
+ teamId: args.installation.teamId ?? "",
2804
+ threadTs: providerThread.threadTs
2805
+ });
3039
2806
  if (ownerId) return ownerId;
3040
2807
  if (args.claimAtMs === void 0 || !args.installation.teamId) return args.canonicalThreadId;
3041
2808
  return await conversationStore.claimProviderConversation({
3042
- ...thread,
3043
2809
  atMs: args.claimAtMs,
3044
- conversationId: args.canonicalThreadId
2810
+ conversationId: args.canonicalThreadId,
2811
+ provider: "slack",
2812
+ providerConversationId: providerThread.threadTs,
2813
+ providerDestinationId: providerThread.channelId,
2814
+ providerTenantId: args.installation.teamId
3045
2815
  });
3046
2816
  }
3047
2817
  /**
@@ -7692,7 +7462,6 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
7692
7462
  "/api/images/*",
7693
7463
  "/api/objects",
7694
7464
  "/api/stats",
7695
- "/api/reply-times",
7696
7465
  "/api/versions",
7697
7466
  "/api/conversations",
7698
7467
  "/api/conversations/*",
@@ -7706,6 +7475,8 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
7706
7475
  "/api/personal-tokens/*",
7707
7476
  "/api/service-accounts",
7708
7477
  "/api/service-accounts/*",
7478
+ "/api/cache-warming",
7479
+ "/api/cache-warming/*",
7709
7480
  "/api/workspaces",
7710
7481
  "/api/workspaces/*",
7711
7482
  "/api/config",
@@ -8153,7 +7924,8 @@ async function createApp(options) {
8153
7924
  app.get("/api/internal/heartbeat", (c) => {
8154
7925
  return GET$3(c.req.raw, waitUntil, {
8155
7926
  conversationWorkQueue,
8156
- events
7927
+ events,
7928
+ showReviewItem: createSlackReviewItemShow(getProductionSlackAdapter)
8157
7929
  });
8158
7930
  });
8159
7931
  app.get("/api/internal/retention", (c) => {
@@ -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-Dyjq2CZ8.js";
2
+ import { i as actorIdentitySchema } from "./conversation-BNXfq6Lb.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