@sentry/junior 0.276.0 → 0.277.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 (77) hide show
  1. package/dist/{adapter-DoPR2jS-.js → adapter-BtfBHVM5.js} +1 -1
  2. package/dist/{admin-BJTT-kXb.js → admin-DzAKbZsm.js} +1 -1
  3. package/dist/{agent-invocations-CUWrrzkc.js → agent-invocations-Crs3XHhg.js} +5 -1
  4. package/dist/{agent-runner-sMpA5qGM.js → agent-runner-BsYAbniN.js} +151 -65
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.d.ts +13 -2
  8. package/dist/api.js +137 -28
  9. package/dist/{app-DTj-yAQt.d.ts → app-BjEQwNVP.d.ts} +3 -3
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +65 -56
  12. package/dist/{assistant-reply-DbxKnBQF.js → assistant-reply-NebRGG4G.js} +1 -1
  13. package/dist/{automation-B8_mC68r.js → automation-Cql9h2vO.js} +1 -1
  14. package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-hh18yCeU.js} +2 -2
  15. package/dist/{briefs-IL7QnCCR.js → briefs-BBo0Eimi.js} +4 -4
  16. package/dist/{catalog-runtime--sC2CYLQ.js → catalog-runtime-DE-F4Awo.js} +1 -1
  17. package/dist/cli/chat.d.ts +1 -1
  18. package/dist/cli/chat.js +14 -14
  19. package/dist/cli/check.js +3 -3
  20. package/dist/cli/main.js +3 -3
  21. package/dist/cli/plugins.d.ts +1 -1
  22. package/dist/cli/plugins.js +4 -4
  23. package/dist/cli/snapshot-create.js +4 -4
  24. package/dist/cli/upgrade.d.ts +2 -2
  25. package/dist/cli/upgrade.js +3 -3
  26. package/dist/{client-7diKvInp.js → client-DZ8HTnYH.js} +2 -2
  27. package/dist/{config-Cb--cuv-.js → config-D5uUtrCP.js} +2 -2
  28. package/dist/{connections-C4-4fxaE.js → connections-Do24CGP5.js} +10 -10
  29. package/dist/{conversation-DppJ83Hw.js → conversation-SsASlWL7.js} +4 -6
  30. package/dist/{conversation-privacy-DTwdT3Pi.js → conversation-privacy-VuylvlKr.js} +1 -1
  31. package/dist/{credential-sync-Sl5RQCkS.js → credential-sync-BGQK3pOa.js} +13 -13
  32. package/dist/{db-Ck6TXQIx.d.ts → db-DEiwO5Sh.d.ts} +1 -1
  33. package/dist/{executor-BFKmqxYe.js → executor-hPfFTH0C.js} +13 -5
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{logging-B04X_eCB.js → logging-cI3T1dNc.js} +4 -2
  36. package/dist/{message-DQMFyyE-.js → message-DBwsAl7O.js} +9 -9
  37. package/dist/nitro.d.ts +2 -2
  38. package/dist/nitro.js +7 -3
  39. package/dist/{oauth-callback-server-BGq0_vQI.js → oauth-callback-server-DXrnbplb.js} +2 -2
  40. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
  41. package/dist/{projection-6dXaN0n-.js → projection-7EFIqzuj.js} +4476 -4348
  42. package/dist/{prompt-B4fQKGZR.js → prompt-oRfGsxd3.js} +1 -1
  43. package/dist/{registry-CEqKR_ld.js → registry-Bzefs7kT.js} +24 -8
  44. package/dist/{resolve-8I5DkrfI.js → resolve-CuiEY_2u.js} +3 -3
  45. package/dist/{result-BgAW90IM.js → result-DrcUtFaD.js} +9 -9
  46. package/dist/{runner-CSKDr_19.js → runner-CDE4CZ52.js} +11 -11
  47. package/dist/{sandbox-egress-signals-BxAT276e.js → sandbox-egress-signals-0tcmGd13.js} +1 -1
  48. package/dist/{schema-CaUWl2EV.d.ts → schema-B6N2nc6v.d.ts} +35 -10
  49. package/dist/{schema-Cal-EFdi.js → schema-Dzi3lkdP.js} +19 -4
  50. package/dist/{service-account-CtOab1Xz.js → service-account-BOz9pqOE.js} +3 -3
  51. package/dist/{service-account-CUuVJCKT.js → service-account-DIyz_9Uh.js} +3 -3
  52. package/dist/{session-stop-DK8LuPZW.js → session-stop-0juF_BP0.js} +17 -14
  53. package/dist/{skills-Bc0D7BGy.js → skills-CU5Is147.js} +2 -2
  54. package/dist/{spawn-DF_GUcd8.js → spawn-6C9jHH4b.js} +2 -2
  55. package/dist/{stop-DthSy-z8.js → stop-6FVG1c-r.js} +388 -153
  56. package/dist/{store-BgH2P3X9.js → store-DKs1WwdB.js} +3 -3
  57. package/dist/{store-C5uVTx2G.js → store-DtHZviJ1.js} +4 -4
  58. package/dist/{task-queue-C6ROM_XJ.js → task-queue-CcvFQE_p.js} +3 -3
  59. package/dist/{task-runner-BwAkjjVE.js → task-runner-DBkNejLl.js} +6 -6
  60. package/dist/{thread-state-BXjgk1pW.js → thread-state-4hjEIkIq.js} +4 -4
  61. package/dist/{turn-failure-response-CVI57qKL.js → turn-failure-response-BZNLydC3.js} +7 -7
  62. package/dist/{turn-lifecycle-CF6ibonp.js → turn-lifecycle-BhqYjaa4.js} +1 -1
  63. package/dist/{turn-session-routing-DddybdNu.js → turn-session-routing-jnLOfBHJ.js} +10 -10
  64. package/dist/{validation-BxF1nQbC.js → validation-BUFmsnKs.js} +1 -1
  65. package/dist/{version-CTzSbCmR.js → version-DJTk0ZCE.js} +1 -1
  66. package/dist/version.js +1 -1
  67. package/dist/{viewer-CQwBszc7.js → viewer-WY0RYE4E.js} +47 -12
  68. package/dist/{work-BHlShEQ6.js → work-C5AKvXJV.js} +10 -10
  69. package/dist/{worker-DhY9MnsH.js → worker-BcYVDVUy.js} +6 -6
  70. package/migrations/0074_conversation_participant_pins.sql +1 -0
  71. package/migrations/0075_conversation_detail_version.sql +1 -0
  72. package/migrations/0076_conversation_auto_archive.sql +5 -0
  73. package/migrations/meta/0074_snapshot.json +4076 -0
  74. package/migrations/meta/0075_snapshot.json +4299 -0
  75. package/migrations/meta/0076_snapshot.json +4363 -0
  76. package/migrations/meta/_journal.json +22 -1
  77. package/package.json +5 -5
@@ -1,46 +1,46 @@
1
- import { $ as loadTurnCheckpoint, $a as listConversationAnnotations, $n as listReplyActionItems, A as buildConversationContext, Aa as createPluginLogger, Bn as getPlugins, D as fallbackShortTitle, Dn as createUserTokenStore, F as markConversationMessage, Fa as conversationHasParticipantUser, G as AuthorizationFlowDisabledError, Ga as notInheritedByForkChild, Ha as readConversationEventPage, Ht as buildTurnErrorResponse, I as normalizeConversationText, Ia as conversationIsMemberRoot, Ja as readAttachmentVisionSummary, Ji as SlackActionError, Ka as getSlackFileId, Kr as truncateStatusText, Kt as persistWithRetry, L as recordDeliveredAssistantMessage, La as conversationNotArchivedForEmail, M as estimateConversationContextTokens, Ma as conversationArchiveTimes, N as getConversationMessageSlackTs, Na as conversationArchivedForEmail, P as isHumanConversationMessage, Pa as conversationArchivedForUser, Qi as getSlackClient, R as turnHasReply, Ra as conversationNotArchivedForUser, S as persistConversationMessages, T as resolveConversationTitle, Tn as isExperimentalFeatureEnabled, Ua as buildSentryConversationUrl, V as PluginCredentialFailureError, Va as readLatestConversationBrief, Wr as normalizeSlackStatusText, Y as clearPendingAuth, Ya as recordSlackAttachment, Yi as downloadPrivateSlackFile, Z as wasPendingAuthStopped, Zi as getHeaderString, Zn as getReviewItem, _ as recordSubscribedReplyRoute, _n as getThreadStopDecision, ar as canActOnReviewItem, at as listTurnSummaries, cn as trimTrailingAssistantMessages, co as piMessageFromHistoryItem, cr as isOnlyAssignee, ea as isDmChannel, ei as removeReactionFromMessage, eo as listConversationAnnotationsById, et as saveTurnCheckpoint, fn as buildDeterministicAssistantMessageId, fr as reviewItemReaderForUser, gn as getSubscribedReplyPreflightDecision, hn as decideSubscribedThreadReply, i as loadConversationProjection, io as createPluginCache, it as getTurnRecord, j as createConversationMemoryService, ja as readConversationAccessFromSql, ji as cancelSubscriptions, k as appendThreadContextMessages, kn as webActorUserIds, n as commitMessages, nr as takeReviewItem, nt as completeTurnRecord, o as loadProjection, oo as configValueSchema, ot as recordTurnSummary, p as recordAuthorizationCompleted, pn as buildDeterministicTurnId, qi as verifyTimerWatchCredentialSubject, qn as closeReviewItem, qr as addReactionToMessage, ra as withSlackRetries, ro as lookupSlackUser, rt as failTurnRecord, s as loadTurnProjection, sa as JUNIOR_THREAD_STATE_TTL_MS, sr as canReadReviewItem, t as commitAcceptedReply, ta as normalizeSlackConversationId, tt as abandonTurnRecord, w as persistConversationMessageSummaries, x as hydrateConversationMessages, z as upsertConversationMessage, za as viewerConversationMembership } from "./projection-6dXaN0n-.js";
2
- import { a as completeText, b as isProviderRetryError, c as resolveGatewayModel, m as escapeXml, r as completeDecision } from "./client-7diKvInp.js";
3
- import { _ as normalizeSlackEmojiName, c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as createS3AttachmentStorage } from "./config-Cb--cuv-.js";
4
- import { E as withSpan, H as isRecord, S as setTags, T as withLogContext, U as toOptionalNumber, W as toOptionalString, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-B04X_eCB.js";
1
+ import { $ as loadTurnCheckpoint, $a as recordSlackAttachment, $n as listReplyActionItems, A as buildConversationContext, Ba as conversationPinnedForUser, Bn as getPlugins, Br as verifyTimerWatchCredentialSubject, Ci as normalizeSlackStatusText, D as fallbackShortTitle, Dn as createUserTokenStore, Ei as addReactionToMessage, F as markConversationMessage, Fa as conversationArchivedForUser, G as AuthorizationFlowDisabledError, Ga as readLatestConversationBrief, Gi as normalizeSlackConversationId, Ha as readConversationViewerMarks, Hi as getSlackClient, Ht as buildTurnErrorResponse, I as normalizeConversationText, Ia as conversationHasParticipantUser, Ka as readConversationEventPage, Kt as persistWithRetry, L as recordDeliveredAssistantMessage, La as conversationIsMemberRoot, M as estimateConversationContextTokens, Ma as createPluginLogger, N as getConversationMessageSlackTs, Na as readConversationAccessFromSql, Ni as removeReactionFromMessage, P as isHumanConversationMessage, Pa as conversationArchivedForEmail, Qa as readAttachmentVisionSummary, R as turnHasReply, Ra as conversationNotArchivedForEmail, Ri as SlackActionError, S as persistConversationMessages, T as resolveConversationTitle, Ti as truncateStatusText, Tn as isExperimentalFeatureEnabled, Ua as viewerConversationMembership, V as PluginCredentialFailureError, Va as conversationViewerMarks, Vi as getHeaderString, Vr as JUNIOR_THREAD_STATE_TTL_MS, Wi as isDmChannel, Xa as getSlackFileId, Y as clearPendingAuth, Ya as notInheritedByForkChild, Z as wasPendingAuthStopped, Zn as getReviewItem, _ as recordSubscribedReplyRoute, _n as getThreadStopDecision, ar as canActOnReviewItem, at as listTurnSummaries, cn as trimTrailingAssistantMessages, co as createPluginCache, cr as isOnlyAssignee, er as listWaitingConversations, et as saveTurnCheckpoint, fn as buildDeterministicAssistantMessageId, fo as piMessageFromHistoryItem, fr as reviewItemNeedsUser, gn as getSubscribedReplyPreflightDecision, hn as decideSubscribedThreadReply, i as loadConversationProjection, io as listConversationAnnotationsById, it as getTurnRecord, j as createConversationMemoryService, k as appendThreadContextMessages, kn as webActorUserIds, n as commitMessages, nr as takeReviewItem, nt as completeTurnRecord, o as loadProjection, ot as recordTurnSummary, p as recordAuthorizationCompleted, pn as buildDeterministicTurnId, pr as reviewItemReaderForUser, qa as buildSentryConversationUrl, qi as withSlackRetries, qn as closeReviewItem, ro as listConversationAnnotations, rt as failTurnRecord, s as loadTurnProjection, so as lookupSlackUser, sr as canReadReviewItem, t as commitAcceptedReply, tt as abandonTurnRecord, uo as configValueSchema, w as persistConversationMessageSummaries, wr as cancelSubscriptions, x as hydrateConversationMessages, z as upsertConversationMessage, za as conversationNotArchivedForUser, zi as downloadPrivateSlackFile } from "./projection-7EFIqzuj.js";
2
+ import { a as completeText, b as isProviderRetryError, c as resolveGatewayModel, m as escapeXml, r as completeDecision } from "./client-DZ8HTnYH.js";
3
+ import { _ as normalizeSlackEmojiName, c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as createS3AttachmentStorage } from "./config-D5uUtrCP.js";
4
+ import { E as withSpan, G as toOptionalNumber, K as toOptionalString, S as setTags, T as withLogContext, W as isRecord, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-cI3T1dNc.js";
5
5
  import { i as getActiveSpan, r as continueTrace } from "./sentry-MDkYAVPV.js";
6
6
  import { i as defaultModelId } from "./model-profile-B998sjVd.js";
7
7
  import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-B4DYygOB.js";
8
- import { A as locationFromRow, C as getSqlExecutor, D as loadConversationSlackTenantIds, E as withConversationEventLock, J as hasAgentTurnUsage, N as resolveActorIdentityId, P as saveActorAvatar, Q as requireSlackDestination, S as getDb, U as parseSessionSource, W as addAgentTurnUsage, X as createSlackDestination, Y as resolveRootConversationId, f as identityAvatarUrl, h as readUserAvatarUrls, q as agentTurnUsageSchema, x as getConversationStore, y as getConversationEventStore } from "./viewer-CQwBszc7.js";
9
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-CUWrrzkc.js";
10
- import { C as juniorCodeChanges, _ as juniorConversationBriefs, b as juniorConversationEvents, h as juniorConversationParticipants, m as juniorConversationReadPositions } from "./executor-BFKmqxYe.js";
8
+ import { $ as createSlackDestination, A as locationFromRow, C as getSqlExecutor, D as loadConversationSlackTenantIds, E as withConversationEventLock, G as nextDetailVersion, N as resolveActorIdentityId, P as saveActorAvatar, Q as resolveRootConversationId, S as getDb, U as parseSessionSource, W as conversationDetailTouch, X as agentTurnUsageSchema, Z as hasAgentTurnUsage, f as identityAvatarUrl, h as readUserAvatarUrls, q as addAgentTurnUsage, tt as requireSlackDestination, x as getConversationStore, y as getConversationEventStore } from "./viewer-WY0RYE4E.js";
9
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
10
+ import { C as juniorCodeChanges, _ as juniorConversationBriefs, b as juniorConversationEvents, c as juniorReviewItems, h as juniorConversationParticipants, m as juniorConversationReadPositions, o as juniorReviewItemConversations } from "./executor-hPfFTH0C.js";
11
11
  import { g as instructionProvenanceFor, m as contextProvenance, n as detectImageMediaType, r as isVisionImageMediaType } from "./media-DstkkoNP.js";
12
- import { d as actorLogContext, f as credentialContextForActor } from "./registry-CEqKR_ld.js";
13
- import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, m as latestProgressStatus, n as executeAgentRun, pt as resolveConversationDestination, rt as deliverReviewItemChange, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-sMpA5qGM.js";
12
+ import { d as actorLogContext, f as credentialContextForActor } from "./registry-Bzefs7kT.js";
13
+ import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, m as latestProgressStatus, n as executeAgentRun, pt as resolveConversationDestination, rt as deliverReviewItemChange, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-BsYAbniN.js";
14
14
  import { a as withLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
15
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
16
- import { K as readMessageAttachments, d as conversationDetailReportSchema, g as conversationFeedSchema } from "./conversation-DppJ83Hw.js";
17
- import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-B4fQKGZR.js";
18
- import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-C5uVTx2G.js";
19
- import { n as getAssistantReplyText } from "./assistant-reply-DbxKnBQF.js";
20
- import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-DK8LuPZW.js";
15
+ import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
16
+ import { W as readMessageAttachments, l as conversationDetailReportSchema, m as conversationFeedSchema } from "./conversation-SsASlWL7.js";
17
+ import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-oRfGsxd3.js";
18
+ import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-DtHZviJ1.js";
19
+ import { n as getAssistantReplyText } from "./assistant-reply-NebRGG4G.js";
20
+ import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-0juF_BP0.js";
21
21
  import { _ as isEmptyUserInputAnswer, v as normalizeUserInputAnswer } from "./reporting-window-DgHgwQB3.js";
22
- import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-Bywqo1WJ.js";
23
- import { D as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-BgH2P3X9.js";
24
- import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-DddybdNu.js";
22
+ import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-hh18yCeU.js";
23
+ import { D as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-DKs1WwdB.js";
24
+ import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-jnLOfBHJ.js";
25
25
  import { n as healthReportSchema, t as apiErrorSchema } from "./common-Eu6sx09c.js";
26
- import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-BgAW90IM.js";
27
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-CF6ibonp.js";
28
- import { o as AgentRunError, s as executeTurn } from "./work-BHlShEQ6.js";
29
- import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-BXjgk1pW.js";
30
- import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-C4-4fxaE.js";
31
- import { t as bindMessageAgent } from "./message-DQMFyyE-.js";
32
- import { t as bindSpawnAgent } from "./spawn-DF_GUcd8.js";
33
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BwAkjjVE.js";
34
- import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-CVI57qKL.js";
26
+ import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-DrcUtFaD.js";
27
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BhqYjaa4.js";
28
+ import { o as AgentRunError, s as executeTurn } from "./work-C5AKvXJV.js";
29
+ import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-4hjEIkIq.js";
30
+ import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-Do24CGP5.js";
31
+ import { t as bindMessageAgent } from "./message-DBwsAl7O.js";
32
+ import { t as bindSpawnAgent } from "./spawn-6C9jHH4b.js";
33
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DBkNejLl.js";
34
+ import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-BZNLydC3.js";
35
35
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
36
36
  import { z } from "zod";
37
- import { and, asc, desc, eq, inArray, isNotNull, isNull, max, or, sql } from "drizzle-orm";
37
+ import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
38
38
  import { conversationSidebarAnnotationSchema, createSlackSource, objectTypeSchema } from "@sentry/junior-plugin-api";
39
39
  import { alias } from "drizzle-orm/pg-core";
40
40
  import { del, get, put } from "@vercel/blob";
41
+ import { HTTPException } from "hono/http-exception";
41
42
  import { Message, ThreadImpl, stringifyMarkdown } from "chat";
42
43
  import { SlackFormatConverter, createSlackAdapter } from "@chat-adapter/slack";
43
- import { HTTPException } from "hono/http-exception";
44
44
  // src/handlers/health.ts
45
45
  /** Build Junior's process health value for HTTP and reporting consumers. */
46
46
  function readHealthReport() {
@@ -381,6 +381,306 @@ function createAttachmentStorage(config) {
381
381
  default: throw new Error(`Unsupported attachment storage provider: ${String(config.provider)}`);
382
382
  }
383
383
  }
384
+ // src/chat/plugins/unfinished-work.ts
385
+ /**
386
+ * Return assigned and unfinished plugin work for the candidate conversations.
387
+ * Feed Priority combines these signals with conversation activity on the host.
388
+ */
389
+ async function listConversationWork(conversationIds) {
390
+ if (conversationIds.length === 0) return {
391
+ assignedIds: [],
392
+ finishedAtById: {},
393
+ unfinishedIds: []
394
+ };
395
+ const candidates = new Set(conversationIds);
396
+ const assigned = /* @__PURE__ */ new Set();
397
+ const finishedAtById = /* @__PURE__ */ new Map();
398
+ const unfinished = /* @__PURE__ */ new Set();
399
+ for (const plugin of getPlugins()) {
400
+ const hook = plugin.hooks?.unfinishedWork;
401
+ if (!hook) continue;
402
+ try {
403
+ const result = await hook({
404
+ conversationIds,
405
+ db: getDb(),
406
+ log: createPluginLogger(plugin.manifest.name),
407
+ plugin: { name: plugin.manifest.name },
408
+ cache: createPluginCache(plugin.manifest.name)
409
+ });
410
+ for (const conversationId of result.conversationIds) {
411
+ if (!candidates.has(conversationId)) continue;
412
+ unfinished.add(conversationId);
413
+ assigned.add(conversationId);
414
+ }
415
+ for (const conversationId of result.assignedConversationIds ?? []) if (candidates.has(conversationId)) assigned.add(conversationId);
416
+ for (const [conversationId, finishedAt] of Object.entries(result.finishedWorkAtByConversationId ?? {})) {
417
+ if (!candidates.has(conversationId)) continue;
418
+ const time = Date.parse(finishedAt);
419
+ if (!Number.isFinite(time)) continue;
420
+ const current = finishedAtById.get(conversationId);
421
+ if (!current || time > Date.parse(current)) finishedAtById.set(conversationId, finishedAt);
422
+ }
423
+ } catch (error) {
424
+ logWarn("plugin.unfinished_work.hook.failed", {
425
+ "app.plugin.name": plugin.manifest.name,
426
+ "exception.message": error instanceof Error ? error.message : String(error)
427
+ });
428
+ }
429
+ }
430
+ return {
431
+ assignedIds: conversationIds.filter((conversationId) => assigned.has(conversationId)),
432
+ finishedAtById: Object.fromEntries(conversationIds.flatMap((conversationId) => {
433
+ const finishedAt = finishedAtById.get(conversationId);
434
+ return finishedAt ? [[conversationId, finishedAt]] : [];
435
+ })),
436
+ unfinishedIds: conversationIds.filter((conversationId) => unfinished.has(conversationId))
437
+ };
438
+ }
439
+ // src/api/http.ts
440
+ const NO_STORE_HEADERS = { "cache-control": "no-store" };
441
+ /** Build response init that keeps personalized API payloads out of shared caches. */
442
+ function noStoreInit(init) {
443
+ if (!init) return { headers: NO_STORE_HEADERS };
444
+ const headers = new Headers(init.headers);
445
+ if (!headers.has("cache-control")) headers.set("cache-control", "no-store");
446
+ return {
447
+ ...init,
448
+ headers
449
+ };
450
+ }
451
+ /** Serialize a REST response only after it satisfies its declared schema. */
452
+ function jsonResponse(schema, value, init) {
453
+ return Response.json(schema.parse(value), noStoreInit(init));
454
+ }
455
+ /** Return an empty personalized API response with no-store caching. */
456
+ function emptyResponse(status = 204) {
457
+ return new Response(null, noStoreInit({ status }));
458
+ }
459
+ /** Stop a request with Junior's stable JSON error contract. */
460
+ function throwApiError(status, message, cause) {
461
+ throw new HTTPException(status, {
462
+ ...cause === void 0 ? void 0 : { cause },
463
+ message,
464
+ res: jsonResponse(apiErrorSchema, { error: message }, { status })
465
+ });
466
+ }
467
+ // src/api/conversations/user-message-activity.ts
468
+ /** Read the latest true user message time for each selected conversation. */
469
+ async function readLastUserMessageAtByConversation(db, conversationIds) {
470
+ if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
471
+ const authority = sql`${juniorConversationEvents.payload}->'provenance'->>'authority'`;
472
+ const actorPlatform = sql`${juniorConversationEvents.payload}->'provenance'->'actor'->>'platform'`;
473
+ const role = sql`${juniorConversationEvents.payload}->>'role'`;
474
+ const rows = await db.select({
475
+ conversationId: juniorConversationEvents.conversationId,
476
+ lastUserMessageAt: sql`max(${juniorConversationEvents.createdAt})`
477
+ }).from(juniorConversationEvents).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationEvents.actorIdentityId)).where(and(inArray(juniorConversationEvents.conversationId, conversationIds), or(and(eq(juniorConversationEvents.type, "user_message"), eq(authority, "instruction"), sql`${actorPlatform} in ('slack', 'local', 'web')`), and(eq(juniorConversationEvents.type, "message"), eq(role, "user"), eq(juniorIdentities.kind, "user"))))).groupBy(juniorConversationEvents.conversationId);
478
+ return new Map(rows.map((row) => [row.conversationId, new Date(row.lastUserMessageAt).toISOString()]));
479
+ }
480
+ // src/api/conversations/auto-archive.ts
481
+ const HOUR_MS = 36e5;
482
+ /** Participant rows checked per page. A run reads pages until none remain. */
483
+ const AUTO_ARCHIVE_PAGE_SIZE = 500;
484
+ /** Settings of a user who has not changed auto-archive. */
485
+ const DEFAULT_AUTO_ARCHIVE_SETTINGS = {
486
+ autoArchiveDefault: false,
487
+ autoArchiveGraceHours: 24
488
+ };
489
+ /**
490
+ * Decide whether a conversation's work is done long enough to auto-archive.
491
+ * Conversations without plugin-reported work are never done.
492
+ */
493
+ function isConversationWorkDone(conversation, cutoffMs) {
494
+ if (!conversation.assignedWork || conversation.unfinishedWork) return false;
495
+ const finishedAt = Date.parse(conversation.finishedWorkAt ?? "");
496
+ if (!Number.isFinite(finishedAt) || finishedAt > cutoffMs) return false;
497
+ const lastUserMessageAt = Date.parse(conversation.lastUserMessageAt ?? "");
498
+ return !(Number.isFinite(lastUserMessageAt) && lastUserMessageAt > finishedAt);
499
+ }
500
+ function runOptsIn(run) {
501
+ return run.kind === "scheduled" ? sql`coalesce(${juniorConversationParticipants.autoArchive}, ${juniorUsers.autoArchiveDefault}) = true` : sql`${juniorConversationParticipants.autoArchive} is distinct from false`;
502
+ }
503
+ function runCutoff(run) {
504
+ return /* @__PURE__ */ new Date(run.now.getTime() - run.graceHours * HOUR_MS);
505
+ }
506
+ /**
507
+ * True when the participant row's root and every child conversation are idle
508
+ * and had no activity after the cutoff. Child activity does not move the
509
+ * root's `lastActivityAt`, so the whole tree is checked.
510
+ */
511
+ function treeIsQuiet(cutoff) {
512
+ const active = getDb().select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).where(and(or(eq(juniorConversations.conversationId, juniorConversationParticipants.rootConversationId), eq(juniorConversations.rootConversationId, juniorConversationParticipants.rootConversationId)), or(ne(juniorConversations.executionStatus, "idle"), gt(juniorConversations.lastActivityAt, cutoff))));
513
+ return sql`not exists (${active})`;
514
+ }
515
+ /**
516
+ * True when no open Review item on the participant row's root or a child
517
+ * conversation needs the user. Such a conversation waits on them, so it must
518
+ * stay in their feed.
519
+ */
520
+ function notWaitingOnUser(userId) {
521
+ const linked = alias(juniorConversations, "linked_conversation");
522
+ const waiting = getDb().select({ itemId: juniorReviewItemConversations.itemId }).from(juniorReviewItemConversations).innerJoin(juniorReviewItems, eq(juniorReviewItems.id, juniorReviewItemConversations.itemId)).innerJoin(linked, eq(linked.conversationId, juniorReviewItemConversations.conversationId)).where(and(reviewItemNeedsUser(userId), or(eq(linked.conversationId, juniorConversationParticipants.rootConversationId), eq(linked.rootConversationId, juniorConversationParticipants.rootConversationId))));
523
+ return sql`not exists (${waiting})`;
524
+ }
525
+ /**
526
+ * Conditions that a participant row must meet when it is selected and again
527
+ * when it is archived, so new activity, a new run, a new Review item, or a
528
+ * changed setting wins over a stale read.
529
+ */
530
+ function archivableRow(run) {
531
+ return and(eq(juniorConversationParticipants.userId, run.userId), isNull(juniorConversationParticipants.archivedAt), isNull(juniorConversationParticipants.pinnedAt), lte(juniorConversationParticipants.lastMessageAt, runCutoff(run)), runOptsIn(run), run.kind === "scheduled" ? sql`${juniorUsers.autoArchiveGraceHours} <= ${run.graceHours}` : void 0, treeIsQuiet(runCutoff(run)), notWaitingOnUser(run.userId));
532
+ }
533
+ /**
534
+ * One page of the user's unarchived participant rows that may be done. Pages
535
+ * follow `junior_conversation_participants_unarchived_activity_idx`, so a run
536
+ * reads only rows older than the cutoff. Archive writes during the run do not
537
+ * move `lastMessageAt`, so they do not skip rows.
538
+ */
539
+ async function selectCandidateRoots(run, after) {
540
+ return await getDb().select({
541
+ lastMessageAt: sql`${juniorConversationParticipants.lastMessageAt}::text`,
542
+ rootConversationId: juniorConversationParticipants.rootConversationId
543
+ }).from(juniorConversationParticipants).innerJoin(juniorUsers, eq(juniorUsers.id, juniorConversationParticipants.userId)).where(and(archivableRow(run), after ? sql`(${juniorConversationParticipants.lastMessageAt}, ${juniorConversationParticipants.rootConversationId}) > (${after.lastMessageAt}::timestamptz, ${after.rootConversationId})` : void 0)).orderBy(asc(juniorConversationParticipants.lastMessageAt), asc(juniorConversationParticipants.rootConversationId)).limit(AUTO_ARCHIVE_PAGE_SIZE);
544
+ }
545
+ /**
546
+ * Keep the roots whose work is done. Work comes first because most roots
547
+ * have none, so the message history read covers only finished work.
548
+ */
549
+ async function selectDoneRoots(rootIds, cutoffMs) {
550
+ const work = await listConversationWork(rootIds);
551
+ const unfinished = new Set(work.unfinishedIds);
552
+ const finished = work.assignedIds.filter((id) => !unfinished.has(id) && isConversationWorkDone({
553
+ assignedWork: true,
554
+ finishedWorkAt: work.finishedAtById[id]
555
+ }, cutoffMs));
556
+ if (finished.length === 0) return [];
557
+ const lastUserMessageAtById = await readLastUserMessageAtByConversation(getDb(), finished);
558
+ return finished.filter((id) => isConversationWorkDone({
559
+ assignedWork: true,
560
+ finishedWorkAt: work.finishedAtById[id],
561
+ lastUserMessageAt: lastUserMessageAtById.get(id)
562
+ }, cutoffMs));
563
+ }
564
+ /** Archive one root for the run's user when it is still archivable. */
565
+ async function archiveRoot(run, rootConversationId) {
566
+ return (await getDb().update(juniorConversationParticipants).set({ archivedAt: run.now }).from(juniorUsers).where(and(eq(juniorUsers.id, juniorConversationParticipants.userId), eq(juniorConversationParticipants.rootConversationId, rootConversationId), archivableRow(run))).returning({ userId: juniorConversationParticipants.userId })).length > 0;
567
+ }
568
+ /** Archive every done conversation of one user and count the rows. */
569
+ async function archiveUserDoneConversations(run) {
570
+ const cutoffMs = runCutoff(run).getTime();
571
+ let after;
572
+ let archived = 0;
573
+ let scanned = 0;
574
+ for (;;) {
575
+ const rows = await selectCandidateRoots(run, after);
576
+ if (rows.length === 0) break;
577
+ scanned += rows.length;
578
+ const rootIds = rows.map((row) => row.rootConversationId);
579
+ for (const rootId of await selectDoneRoots(rootIds, cutoffMs)) if (await archiveRoot(run, rootId)) archived += 1;
580
+ if (rows.length < AUTO_ARCHIVE_PAGE_SIZE) break;
581
+ after = rows.at(-1);
582
+ }
583
+ return {
584
+ archived,
585
+ scanned
586
+ };
587
+ }
588
+ /**
589
+ * Users with auto-archive on by default or for at least one unarchived
590
+ * conversation. Most users never turn it on, so the sweep reads only these.
591
+ */
592
+ async function selectAutoArchiveUsers() {
593
+ const optedInConversation = getDb().select({ userId: juniorConversationParticipants.userId }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.userId, juniorUsers.id), eq(juniorConversationParticipants.autoArchive, true), isNull(juniorConversationParticipants.archivedAt)));
594
+ return await getDb().select({
595
+ graceHours: juniorUsers.autoArchiveGraceHours,
596
+ id: juniorUsers.id
597
+ }).from(juniorUsers).where(or(eq(juniorUsers.autoArchiveDefault, true), sql`exists (${optedInConversation})`)).orderBy(asc(juniorUsers.id));
598
+ }
599
+ /**
600
+ * Run one auto-archive sweep over every user who wants it and return how
601
+ * many participant rows it checked and archived.
602
+ */
603
+ async function runAutoArchiveSweep(args) {
604
+ const now = new Date(args.nowMs);
605
+ let archived = 0;
606
+ let scanned = 0;
607
+ for (const user of await selectAutoArchiveUsers()) {
608
+ const result = await archiveUserDoneConversations({
609
+ graceHours: user.graceHours,
610
+ kind: "scheduled",
611
+ now,
612
+ userId: user.id
613
+ });
614
+ archived += result.archived;
615
+ scanned += result.scanned;
616
+ }
617
+ logInfo("auto_archive.sweep.completed", {
618
+ "app.auto_archive.archived": archived,
619
+ "app.auto_archive.scanned": scanned
620
+ });
621
+ return {
622
+ archived,
623
+ scanned
624
+ };
625
+ }
626
+ /**
627
+ * Archive all of the viewer's done conversations now, with no grace period.
628
+ * It skips conversations where the viewer turned auto-archive off.
629
+ */
630
+ async function archiveViewerDoneConversations(viewer) {
631
+ const { archived } = await archiveUserDoneConversations({
632
+ graceHours: 0,
633
+ kind: "manual",
634
+ now: /* @__PURE__ */ new Date(),
635
+ userId: viewer.id
636
+ });
637
+ return { archived };
638
+ }
639
+ /** Read the viewer's effective auto-archive choice for a conversation. */
640
+ async function readConversationAutoArchive(viewer, conversationId) {
641
+ const rootConversationId = await resolveRootConversationId(getSqlExecutor(), conversationId);
642
+ const [user] = await getDb().select({
643
+ autoArchive: juniorConversationParticipants.autoArchive,
644
+ autoArchiveDefault: juniorUsers.autoArchiveDefault
645
+ }).from(juniorUsers).leftJoin(juniorConversationParticipants, and(eq(juniorConversationParticipants.userId, juniorUsers.id), eq(juniorConversationParticipants.rootConversationId, rootConversationId))).where(eq(juniorUsers.id, viewer.id)).limit(1);
646
+ return user?.autoArchive ?? user?.autoArchiveDefault ?? false;
647
+ }
648
+ /** Turn auto-archive on or off for one conversation and the signed-in viewer. */
649
+ async function setConversationAutoArchive(viewer, conversationId, autoArchive) {
650
+ if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
651
+ const rootConversationId = await resolveRootConversationId(getSqlExecutor(), conversationId);
652
+ const [root] = await getDb().select({ lastActivityAt: juniorConversations.lastActivityAt }).from(juniorConversations).where(eq(juniorConversations.conversationId, rootConversationId)).limit(1);
653
+ if (!root) throwApiError(404, "Conversation not found.");
654
+ await getDb().insert(juniorConversationParticipants).values({
655
+ autoArchive,
656
+ lastMessageAt: root.lastActivityAt,
657
+ rootConversationId,
658
+ userId: viewer.id
659
+ }).onConflictDoUpdate({
660
+ target: [juniorConversationParticipants.userId, juniorConversationParticipants.rootConversationId],
661
+ set: { autoArchive }
662
+ });
663
+ return { autoArchive };
664
+ }
665
+ /** Read the user's auto-archive settings. */
666
+ async function readUserAutoArchiveSettings(userId) {
667
+ const [user] = await getDb().select({
668
+ autoArchiveDefault: juniorUsers.autoArchiveDefault,
669
+ autoArchiveGraceHours: juniorUsers.autoArchiveGraceHours
670
+ }).from(juniorUsers).where(eq(juniorUsers.id, userId)).limit(1);
671
+ return user;
672
+ }
673
+ /** Save changed auto-archive settings and return the saved settings. */
674
+ async function updateUserAutoArchiveSettings(userId, settings) {
675
+ const [user] = await getDb().update(juniorUsers).set({
676
+ ...settings,
677
+ updatedAt: /* @__PURE__ */ new Date()
678
+ }).where(eq(juniorUsers.id, userId)).returning({
679
+ autoArchiveDefault: juniorUsers.autoArchiveDefault,
680
+ autoArchiveGraceHours: juniorUsers.autoArchiveGraceHours
681
+ });
682
+ return user;
683
+ }
384
684
  // src/chat/review-items/reply-match.ts
385
685
  const MATCH_CONFIDENCE_THRESHOLD = .7;
386
686
  /** A slow decision keeps the items open instead of delaying the close. */
@@ -6765,34 +7065,6 @@ function createProductionConversationWorkOptions(options) {
6765
7065
  waitUntil: options.waitUntil
6766
7066
  });
6767
7067
  }
6768
- // src/api/http.ts
6769
- const NO_STORE_HEADERS = { "cache-control": "no-store" };
6770
- /** Build response init that keeps personalized API payloads out of shared caches. */
6771
- function noStoreInit(init) {
6772
- if (!init) return { headers: NO_STORE_HEADERS };
6773
- const headers = new Headers(init.headers);
6774
- if (!headers.has("cache-control")) headers.set("cache-control", "no-store");
6775
- return {
6776
- ...init,
6777
- headers
6778
- };
6779
- }
6780
- /** Serialize a REST response only after it satisfies its declared schema. */
6781
- function jsonResponse(schema, value, init) {
6782
- return Response.json(schema.parse(value), noStoreInit(init));
6783
- }
6784
- /** Return an empty personalized API response with no-store caching. */
6785
- function emptyResponse(status = 204) {
6786
- return new Response(null, noStoreInit({ status }));
6787
- }
6788
- /** Stop a request with Junior's stable JSON error contract. */
6789
- function throwApiError(status, message, cause) {
6790
- throw new HTTPException(status, {
6791
- ...cause === void 0 ? void 0 : { cause },
6792
- message,
6793
- res: jsonResponse(apiErrorSchema, { error: message }, { status })
6794
- });
6795
- }
6796
7068
  // src/api/conversations/archive.ts
6797
7069
  async function setViewerArchive(args) {
6798
7070
  const executor = getSqlExecutor();
@@ -6804,7 +7076,7 @@ async function setViewerArchive(args) {
6804
7076
  if (root.lastActivityAt.getTime() !== Date.parse(args.lastSeenAt)) return { status: "conflict" };
6805
7077
  const archivedAt = /* @__PURE__ */ new Date();
6806
7078
  const lastMessageAt = new Date(args.lastSeenAt);
6807
- await db.insert(juniorConversationParticipants).values({
7079
+ await db.with(conversationDetailTouch(db, [args.rootConversationId])).insert(juniorConversationParticipants).values({
6808
7080
  archivedAt,
6809
7081
  lastMessageAt,
6810
7082
  rootConversationId: args.rootConversationId,
@@ -6813,6 +7085,7 @@ async function setViewerArchive(args) {
6813
7085
  target: [juniorConversationParticipants.userId, juniorConversationParticipants.rootConversationId],
6814
7086
  set: {
6815
7087
  archivedAt,
7088
+ pinnedAt: null,
6816
7089
  lastMessageAt: sql`greatest(${juniorConversationParticipants.lastMessageAt}, excluded.last_message_at)`
6817
7090
  }
6818
7091
  });
@@ -6821,19 +7094,16 @@ async function setViewerArchive(args) {
6821
7094
  status: "updated"
6822
7095
  };
6823
7096
  }
6824
- await db.update(juniorConversationParticipants).set({ archivedAt: null }).where(and(eq(juniorConversationParticipants.userId, args.userId), eq(juniorConversationParticipants.rootConversationId, args.rootConversationId), isNotNull(juniorConversationParticipants.archivedAt)));
7097
+ await db.with(conversationDetailTouch(db, [args.rootConversationId])).update(juniorConversationParticipants).set({
7098
+ archivedAt: null,
7099
+ autoArchive: false
7100
+ }).where(and(eq(juniorConversationParticipants.userId, args.userId), eq(juniorConversationParticipants.rootConversationId, args.rootConversationId), isNotNull(juniorConversationParticipants.archivedAt)));
6825
7101
  return {
6826
7102
  archivedAt: null,
6827
7103
  status: "updated"
6828
7104
  };
6829
7105
  });
6830
7106
  }
6831
- /** Read one viewer's archive timestamp for a conversation root. */
6832
- async function readConversationArchivedAt(viewer, conversationId) {
6833
- const rootConversationId = await resolveRootConversationId(getSqlExecutor(), conversationId);
6834
- const [row] = await getDb().select({ archivedAt: juniorConversationParticipants.archivedAt }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.userId, viewer.id), eq(juniorConversationParticipants.rootConversationId, rootConversationId))).limit(1);
6835
- return row?.archivedAt?.getTime();
6836
- }
6837
7107
  /** Archive or restore one conversation for the signed-in viewer. */
6838
7108
  async function archiveConversation(viewer, conversationId, body) {
6839
7109
  if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
@@ -7085,7 +7355,8 @@ async function forkConversation(input) {
7085
7355
  await executor.db().update(juniorConversations).set({
7086
7356
  forkedFromConversationId: source.conversationId,
7087
7357
  title: source.title ? `Fork: ${source.title}` : "Forked conversation",
7088
- ...input.quickQuestion ? { quickQuestionAt: new Date(nowMs) } : void 0
7358
+ ...input.quickQuestion ? { quickQuestionAt: new Date(nowMs) } : void 0,
7359
+ detailVersion: nextDetailVersion
7089
7360
  }).where(eq(juniorConversations.conversationId, conversationId));
7090
7361
  await copyForkEvents({
7091
7362
  sourceConversationId: source.conversationId,
@@ -7117,7 +7388,10 @@ async function forkConversation(input) {
7117
7388
  async function keepQuickQuestion(conversationId) {
7118
7389
  const executor = getSqlExecutor();
7119
7390
  return withConversationEventLock(executor, conversationId, async () => {
7120
- if (!(await executor.db().update(juniorConversations).set({ quickQuestionAt: null }).where(and(eq(juniorConversations.conversationId, conversationId), isNotNull(juniorConversations.quickQuestionAt))).returning({ conversationId: juniorConversations.conversationId })).length) return;
7391
+ if (!(await executor.db().update(juniorConversations).set({
7392
+ quickQuestionAt: null,
7393
+ detailVersion: nextDetailVersion
7394
+ }).where(and(eq(juniorConversations.conversationId, conversationId), isNotNull(juniorConversations.quickQuestionAt))).returning({ conversationId: juniorConversations.conversationId })).length) return;
7121
7395
  const nowMs = Date.now();
7122
7396
  await getConversationEventStore().append(conversationId, [{
7123
7397
  idempotencyKey: QUICK_QUESTION_KEPT_NOTE_KEY,
@@ -7630,6 +7904,7 @@ function conversationSummaryFromStoredConversation(args) {
7630
7904
  ...actorIdentity ? { actorIdentity } : void 0,
7631
7905
  ...locationUrl ? { locationUrl } : void 0,
7632
7906
  archivedAt: args.archivedAtMs === void 0 ? null : new Date(args.archivedAtMs).toISOString(),
7907
+ pinnedAt: args.pinnedAtMs === void 0 ? null : new Date(args.pinnedAtMs).toISOString(),
7633
7908
  ...slackThread ? { channel: slackThread.channelId } : void 0,
7634
7909
  ...channelName ? { channelName } : void 0,
7635
7910
  ...channelNameRedacted ? { channelNameRedacted: true } : void 0,
@@ -7806,61 +8081,6 @@ async function readConversationAuxiliaryCostsFromSql(db, conversationIds) {
7806
8081
  }
7807
8082
  return result;
7808
8083
  }
7809
- // src/chat/plugins/unfinished-work.ts
7810
- /**
7811
- * Return assigned and unfinished plugin work for the candidate conversations.
7812
- * Feed Priority combines these signals with conversation activity on the host.
7813
- */
7814
- async function listConversationWork(conversationIds) {
7815
- if (conversationIds.length === 0) return {
7816
- assignedIds: [],
7817
- finishedAtById: {},
7818
- unfinishedIds: []
7819
- };
7820
- const candidates = new Set(conversationIds);
7821
- const assigned = /* @__PURE__ */ new Set();
7822
- const finishedAtById = /* @__PURE__ */ new Map();
7823
- const unfinished = /* @__PURE__ */ new Set();
7824
- for (const plugin of getPlugins()) {
7825
- const hook = plugin.hooks?.unfinishedWork;
7826
- if (!hook) continue;
7827
- try {
7828
- const result = await hook({
7829
- conversationIds,
7830
- db: getDb(),
7831
- log: createPluginLogger(plugin.manifest.name),
7832
- plugin: { name: plugin.manifest.name },
7833
- cache: createPluginCache(plugin.manifest.name)
7834
- });
7835
- for (const conversationId of result.conversationIds) {
7836
- if (!candidates.has(conversationId)) continue;
7837
- unfinished.add(conversationId);
7838
- assigned.add(conversationId);
7839
- }
7840
- for (const conversationId of result.assignedConversationIds ?? []) if (candidates.has(conversationId)) assigned.add(conversationId);
7841
- for (const [conversationId, finishedAt] of Object.entries(result.finishedWorkAtByConversationId ?? {})) {
7842
- if (!candidates.has(conversationId)) continue;
7843
- const time = Date.parse(finishedAt);
7844
- if (!Number.isFinite(time)) continue;
7845
- const current = finishedAtById.get(conversationId);
7846
- if (!current || time > Date.parse(current)) finishedAtById.set(conversationId, finishedAt);
7847
- }
7848
- } catch (error) {
7849
- logWarn("plugin.unfinished_work.hook.failed", {
7850
- "app.plugin.name": plugin.manifest.name,
7851
- "exception.message": error instanceof Error ? error.message : String(error)
7852
- });
7853
- }
7854
- }
7855
- return {
7856
- assignedIds: conversationIds.filter((conversationId) => assigned.has(conversationId)),
7857
- finishedAtById: Object.fromEntries(conversationIds.flatMap((conversationId) => {
7858
- const finishedAt = finishedAtById.get(conversationId);
7859
- return finishedAt ? [[conversationId, finishedAt]] : [];
7860
- })),
7861
- unfinishedIds: conversationIds.filter((conversationId) => unfinished.has(conversationId))
7862
- };
7863
- }
7864
8084
  // src/api/conversations/priority.ts
7865
8085
  /** Conversations with no known work leave Priority after this idle window. */
7866
8086
  const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
@@ -7887,19 +8107,6 @@ function isConversationPriority(conversation, nowMs) {
7887
8107
  }
7888
8108
  return nowMs - lastSeenAt <= UNASSIGNED_PRIORITY_WINDOW_MS;
7889
8109
  }
7890
- // src/api/conversations/user-message-activity.ts
7891
- /** Read the latest true user message time for each selected conversation. */
7892
- async function readLastUserMessageAtByConversation(db, conversationIds) {
7893
- if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
7894
- const authority = sql`${juniorConversationEvents.payload}->'provenance'->>'authority'`;
7895
- const actorPlatform = sql`${juniorConversationEvents.payload}->'provenance'->'actor'->>'platform'`;
7896
- const role = sql`${juniorConversationEvents.payload}->>'role'`;
7897
- const rows = await db.select({
7898
- conversationId: juniorConversationEvents.conversationId,
7899
- lastUserMessageAt: sql`max(${juniorConversationEvents.createdAt})`
7900
- }).from(juniorConversationEvents).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationEvents.actorIdentityId)).where(and(inArray(juniorConversationEvents.conversationId, conversationIds), or(and(eq(juniorConversationEvents.type, "user_message"), eq(authority, "instruction"), sql`${actorPlatform} in ('slack', 'local', 'web')`), and(eq(juniorConversationEvents.type, "message"), eq(role, "user"), eq(juniorIdentities.kind, "user"))))).groupBy(juniorConversationEvents.conversationId);
7901
- return new Map(rows.map((row) => [row.conversationId, new Date(row.lastUserMessageAt).toISOString()]));
7902
- }
7903
8110
  // src/api/conversations/activity-preview.ts
7904
8111
  /** Read one recent assistant message, or the latest user message, for each conversation. */
7905
8112
  async function readConversationActivityPreviews(db, conversationIds) {
@@ -8028,7 +8235,7 @@ function conversationCodeRepositoryFilter(repositoryId, viewerUserId) {
8028
8235
  participantMatch: conversationHasParticipantUser(viewerUserId)
8029
8236
  }) : void 0));
8030
8237
  }
8031
- async function conversationRows(db, limit, status, filter, query, includePrivateBriefs = false, codeRepository) {
8238
+ async function conversationRows(db, { codeRepository, conversationIds, filter, includePrivateBriefs = false, limit, query, status }) {
8032
8239
  return db.select({
8033
8240
  conversation: conversationReadColumns(),
8034
8241
  location: juniorDestinations,
@@ -8039,7 +8246,7 @@ async function conversationRows(db, limit, status, filter, query, includePrivate
8039
8246
  identitySubjectId: juniorIdentities.providerSubjectId,
8040
8247
  identityTenantId: juniorIdentities.providerTenantId,
8041
8248
  userDisplayName: juniorUsers.displayName
8042
- }).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), isNull(juniorConversations.quickQuestionAt), conversationFeedMembershipFilter(status, filter), codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
8249
+ }).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), isNull(juniorConversations.quickQuestionAt), conversationFeedMembershipFilter(status, filter), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
8043
8250
  select 1
8044
8251
  from ${juniorConversationBriefs}
8045
8252
  where ${juniorConversationBriefs.conversationId} = ${juniorConversations.conversationId}
@@ -8051,7 +8258,24 @@ async function conversationRows(db, limit, status, filter, query, includePrivate
8051
8258
  )
8052
8259
  and to_tsvector('english', ${juniorConversationBriefs.searchText})
8053
8260
  @@ websearch_to_tsquery('english', ${query})
8054
- )`) : void 0)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(limit);
8261
+ )`) : void 0)).orderBy(...filter?.kind === "viewer" && status === "active" ? [desc(conversationPinnedForUser(filter.userId))] : [], desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(limit);
8262
+ }
8263
+ /**
8264
+ * Read the viewer's active conversations that wait on them but fall outside
8265
+ * the newest page. Needs attention shows every conversation that waits on the
8266
+ * viewer, so an old one must come back to the feed.
8267
+ */
8268
+ async function waitingRowsOutsidePage(db, filter, page) {
8269
+ const loaded = new Set(page.map((row) => row.conversation.conversationId));
8270
+ const missing = (await listWaitingConversations(db, filter.userId)).map((waiting) => waiting.conversationId).filter((conversationId) => !loaded.has(conversationId));
8271
+ if (missing.length === 0) return [];
8272
+ return await conversationRows(db, {
8273
+ conversationIds: missing,
8274
+ filter,
8275
+ includePrivateBriefs: true,
8276
+ limit: missing.length,
8277
+ status: "active"
8278
+ });
8055
8279
  }
8056
8280
  /** Decode a conversation row with the linked user name and identity-scoped provider fields. */
8057
8281
  function conversationFromRow(row) {
@@ -8133,15 +8357,24 @@ async function readConversationFeedFromSql(options = {}) {
8133
8357
  const db = getDb();
8134
8358
  const filter = options.codeRepositoryId ? void 0 : conversationFeedFilter(options);
8135
8359
  const query = options.q?.trim().toLowerCase() || void 0;
8136
- const rows = await conversationRows(db, options.limit ?? CONVERSATION_FEED_LIMIT, query || options.codeRepositoryId ? "all" : options.status ?? "active", filter, query, filter?.kind === "viewer", options.codeRepositoryId ? {
8137
- id: options.codeRepositoryId,
8138
- ...options.viewer ? { viewerUserId: options.viewer.id } : void 0
8139
- } : void 0);
8360
+ const status = query || options.codeRepositoryId ? "all" : options.status ?? "active";
8361
+ const rows = await conversationRows(db, {
8362
+ ...options.codeRepositoryId ? { codeRepository: {
8363
+ id: options.codeRepositoryId,
8364
+ ...options.viewer ? { viewerUserId: options.viewer.id } : void 0
8365
+ } } : void 0,
8366
+ filter,
8367
+ includePrivateBriefs: filter?.kind === "viewer",
8368
+ limit: options.limit ?? CONVERSATION_FEED_LIMIT,
8369
+ query,
8370
+ status
8371
+ });
8372
+ if (filter?.kind === "viewer" && status === "active") rows.push(...await waitingRowsOutsidePage(db, filter, rows));
8140
8373
  const conversations = rows.map((row) => conversationFromRow(row));
8141
8374
  const conversationIds = conversations.map((conversation) => conversation.conversationId);
8142
- const [accessByConversation, archiveTimesByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, conversationWork, lastUserMessageAtByConversation, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
8375
+ const [accessByConversation, viewerMarksByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, conversationWork, lastUserMessageAtByConversation, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
8143
8376
  readConversationAccessFromSql(db, conversationIds, options.viewer),
8144
- conversationArchiveTimes(db, conversationIds, filter?.kind === "viewer" ? { userId: filter.userId } : filter?.kind === "actorEmail" ? { email: filter.email } : void 0),
8377
+ conversationViewerMarks(db, conversationIds, filter?.kind === "viewer" ? { userId: filter.userId } : filter?.kind === "actorEmail" ? { email: filter.email } : void 0),
8145
8378
  listConversationAnnotationsById(db, conversationIds),
8146
8379
  readConversationAuxiliaryCostsFromSql(db, conversationIds),
8147
8380
  readConversationTreeMetricsFromSql(db, conversationIds),
@@ -8164,9 +8397,8 @@ async function readConversationFeedFromSql(options = {}) {
8164
8397
  const metrics = metricsByRoot.get(conversation.conversationId);
8165
8398
  const auxiliaryCosts = auxiliaryCostsByRoot.get(conversation.conversationId);
8166
8399
  const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
8167
- const archivedAtMs = archiveTimesByConversation.get(conversation.conversationId);
8168
8400
  const summary = conversationSummaryFromStoredConversation({
8169
- ...archivedAtMs === void 0 ? void 0 : { archivedAtMs },
8401
+ ...viewerMarksByConversation.get(conversation.conversationId),
8170
8402
  automationTitle: automationTitleByConversation.get(conversation.conversationId),
8171
8403
  conversation,
8172
8404
  access,
@@ -8366,7 +8598,8 @@ function projectConversationDetail(args) {
8366
8598
  return {
8367
8599
  ...conversationSummaryFromStoredConversation({
8368
8600
  access: args.access,
8369
- ...args.archivedAtMs === void 0 ? void 0 : { archivedAtMs: args.archivedAtMs },
8601
+ archivedAtMs: args.archivedAtMs,
8602
+ pinnedAtMs: args.pinnedAtMs,
8370
8603
  automationTitle: args.automationTitle,
8371
8604
  auxiliaryCosts: args.auxiliaryCosts,
8372
8605
  ...args.childAgentTotals ? { childAgentTotals: args.childAgentTotals } : void 0,
@@ -8402,7 +8635,7 @@ function projectConversationDetail(args) {
8402
8635
  async function readConversationDetailFromSql(conversationId, options) {
8403
8636
  const record = await readConversationRecordFromSql(conversationId);
8404
8637
  if (!record) return void 0;
8405
- const archivedAtMs = options.viewer ? await readConversationArchivedAt(options.viewer, conversationId) : void 0;
8638
+ const viewerMarks = options.viewer ? await readConversationViewerMarks(options.viewer, conversationId) : void 0;
8406
8639
  const executor = getSqlExecutor();
8407
8640
  const [accessByConversation, annotations, automationTitleByConversation, auxiliaryCostsByConversation, briefVersion, firstHumanMessageTextByConversation, modelUsage, metricsByConversation, people, sourceTask, teamDomainByTeamId] = await Promise.all([
8408
8641
  readConversationAccessFromSql(getDb(), [conversationId], options.viewer),
@@ -8438,7 +8671,7 @@ async function readConversationDetailFromSql(conversationId, options) {
8438
8671
  return projectConversationDetail({
8439
8672
  ...record,
8440
8673
  access,
8441
- ...archivedAtMs === void 0 ? void 0 : { archivedAtMs },
8674
+ ...viewerMarks,
8442
8675
  automationTitle: automationTitleByConversation.get(conversationId),
8443
8676
  annotations,
8444
8677
  sidebarAnnotations,
@@ -8469,16 +8702,18 @@ async function readConversationDetail(conversationId, options = {}) {
8469
8702
  limit: options.limit ?? 500
8470
8703
  });
8471
8704
  if (!report) return void 0;
8472
- const [forks, agentTree, readPosition] = await Promise.all([
8705
+ const [forks, agentTree, readPosition, autoArchive] = await Promise.all([
8473
8706
  readConversationForks(conversationId, options.viewer),
8474
8707
  readConversationAgentTree(conversationId, options.viewer),
8475
- options.viewer ? readConversationReadPosition(options.viewer, conversationId) : void 0
8708
+ options.viewer ? readConversationReadPosition(options.viewer, conversationId) : void 0,
8709
+ options.viewer && report.isParticipant ? readConversationAutoArchive(options.viewer, conversationId) : void 0
8476
8710
  ]);
8477
8711
  return conversationDetailReportSchema.parse({
8478
8712
  ...report,
8479
8713
  ...forks,
8480
8714
  ...agentTree ? { agentTree } : void 0,
8481
- ...readPosition ? { readPosition } : void 0
8715
+ ...readPosition ? { readPosition } : void 0,
8716
+ ...autoArchive === void 0 ? void 0 : { autoArchive }
8482
8717
  });
8483
8718
  }
8484
8719
  // src/api/conversations/stop.ts
@@ -8533,4 +8768,4 @@ function viewerWebMessages(messages, viewer) {
8533
8768
  }] : [];
8534
8769
  });
8535
8770
  }
8536
- export { readHealthReport as $, resolveAllowedDomains as A, bindMessageAuthorIdentityId as B, createProductionSlackWebhookServices as C, isAllowedDomain as D, assertNoLegacyAllowedDomains as E, stopSlackThread as F, actOnReviewItem as G, stripLeadingBotMention as H, normalizeIncomingSlackThreadId as I, reviewItemChange as J, closeReviewItemsAnsweredByReply as K, withNormalizedThreadId as L, buildSlackInboundMessage as M, clearSlackPendingReactions as N, isAllowedSignInEmail as O, isSlackMessageStopped as P, GET as Q, stopConversationTurn as R, createProductionConversationWorkOptions as S, createSlackWebApiStatusSender as T, parseContent as U, startProcessingReaction as V, ReviewItemActionError as W, AGENT_DISPATCH_MAX_AGE_MS as X, getAttachmentStorage as Y, enqueueAgentDispatch as Z, encodeConversationCursor as _, keepQuickQuestionForViewer as a, jsonResponse as b, readConversationAuxiliaryCostsFromSql as c, conversationEventHistory as d, conversationSummaryFromStoredConversation as f, decodeConversationCursor as g, readFirstHumanMessageTexts as h, forkConversationForViewer as i, recordSkippedConversationMessage as j, readEnvList as k, childAgentTotalsReport as l, resolveMentions as m, readConversationDetail as n, readConversationFeed as o, attachConversationMentions as p, readReviewItemForUser as q, markConversationRead as r, readConversationRecordFromSql as s, stopConversationTurnForViewer as t, readConversationTreeMetricsFromSql as u, archiveConversation as v, getProductionSlackAdapter as w, throwApiError as x, emptyResponse as y, THREAD_OPTOUT_ACK as z };
8771
+ export { runAutoArchiveSweep as $, resolveAllowedDomains as A, bindMessageAuthorIdentityId as B, createProductionSlackWebhookServices as C, isAllowedDomain as D, assertNoLegacyAllowedDomains as E, stopSlackThread as F, actOnReviewItem as G, stripLeadingBotMention as H, normalizeIncomingSlackThreadId as I, reviewItemChange as J, closeReviewItemsAnsweredByReply as K, withNormalizedThreadId as L, buildSlackInboundMessage as M, clearSlackPendingReactions as N, isAllowedSignInEmail as O, isSlackMessageStopped as P, readUserAutoArchiveSettings as Q, stopConversationTurn as R, createProductionConversationWorkOptions as S, createSlackWebApiStatusSender as T, parseContent as U, startProcessingReaction as V, ReviewItemActionError as W, archiveViewerDoneConversations as X, DEFAULT_AUTO_ARCHIVE_SETTINGS as Y, readConversationAutoArchive as Z, resolveMentions as _, readConversationAgentTree as a, getAttachmentStorage as at, encodeConversationCursor as b, readConversationForks as c, GET as ct, readConversationAuxiliaryCostsFromSql as d, setConversationAutoArchive as et, childAgentTotalsReport as f, attachConversationMentions as g, conversationSummaryFromStoredConversation as h, readConversationReadPosition as i, throwApiError as it, recordSkippedConversationMessage as j, readEnvList as k, readConversationFeed as l, readHealthReport as lt, conversationEventHistory as m, readConversationDetail as n, emptyResponse as nt, forkConversationForViewer as o, AGENT_DISPATCH_MAX_AGE_MS as ot, readConversationTreeMetricsFromSql as p, readReviewItemForUser as q, markConversationRead as r, jsonResponse as rt, keepQuickQuestionForViewer as s, enqueueAgentDispatch as st, stopConversationTurnForViewer as t, updateUserAutoArchiveSettings as tt, readConversationRecordFromSql as u, readFirstHumanMessageTexts as v, getProductionSlackAdapter as w, archiveConversation as x, decodeConversationCursor as y, THREAD_OPTOUT_ACK as z };