@sentry/junior 0.316.0 → 0.317.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-QYiDMnsu.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
- package/dist/api/schema.d.ts +558 -102
- package/dist/api/schema.js +6 -6
- package/dist/api.js +230 -213
- package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +167 -122
- package/dist/catalog-runtime-DfSpJZdY.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-Bref7aPI.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +5 -2
- package/dist/cli/upgrade.js +5 -3
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
- package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
- package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
- package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
- package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
- package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
- package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-CuMWy37l.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-CCi7323k.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
- package/dist/{thread-context-fiMNylbg.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/package.json +5 -5
- package/dist/people-CUtFApfL.js +0 -81
- package/dist/start-conversation-B-LIqqNi.js +0 -162
- package/dist/turn-session-routing-D15orfwy.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
3
|
-
import { D as buildSentryConversationUrl, E as withSpan, N as normalizeIdentityEmail, P as toOptionalString, S as setTags, T as withLogContext, 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
|
|
1
|
+
import { $l as deliversFinalText, Ac as listReplyActionItems, Ai as wrapBareSlackUserIds, Al as isDashboardLink, Ao as bindScheduledAutomationCredentialSubject, Ar as viewerMarksFromParticipant, B as conversationIsActiveSql, Bo as credentialContextForActor, C as conversationSlackTenantId, Cd as topLevelConversation, Cl as getDashboardConversationLink, Cr as readConversationAccessRows, Cs as createSlackActor, Da as existingConversationId, Dc as getInboxItem, Di as normalizeSlackStatusText, Dr as conversationPinnedForUser, Ds as parseActorUserId, Ec as dismissOpenInboxItems, El as getDashboardPersonLink, Er as conversationIsNotUnsubscribedRoot, Es as isUserActor, F as parseSessionSource, Fc as inboxItemAnswer, Fd as juniorAutomationRuns, Fo as verifySlackDirectCredentialSubject, Fs as SlackActionError, G as executionIsActive, Gc as identityAvatarUrl, H as conversationStatusSql, Hs as isDmChannel, I as conversationCostOf, Ia as readAutomationTitlesByConversationId, Ic as inboxItemRequest, Ii as createPluginEmbedder, In as createInboxItemShow, Is as downloadPrivateSlackFile, J as hasUnexpiredAuthorizationRequest, Ji as createPluginCache, Jr as buildDispatchId, Ju as setStateValues, K as conversationKindFromRow, Ka as fallbackShortTitle, Ko as readSubjectLinks, Kr as resolveConversationRouting, Ks as streamPrivateSlackFile, Ku as getStateAdapter, La as recordAutomationExecution, Lo as updateTimerIndex, Md as juniorQuestions, Ml as parseDashboardPersonLink, Mu as completeDecision, Nc as takeInboxItem, No as verifyEventAutomationCredentialSubject, Oi as slackMention, On as canJoinTurn, Or as readMemberParticipants, Pi as createPluginState, Po as verifyScheduledAutomationCredentialSubject, Pu as completeText, Q as canAnswerInboxItem, Qd as juniorConversationEvents, Qn as createPluginEventPublisher, Qr as getDispatchConversationId, Qu as hasAgentTurnUsage, Rc as itemQuestion, Rd as juniorAutomations, Rn as pushInboxSnoozeWakes, Rs as getHeaderString, Rt as setTodoStatusByUser, S as setArchivedAt, Sc as closeHandledReplyNotices, So as findMatchingWatches, Sr as readConversationAccessFromSql, Ss as createActor, T as lastMessageAtSql, Tc as closeInboxItem, Tl as getDashboardLinkFilter, To as listConversationsWithWatches, Tr as conversationIsMemberRoot, Ts as isActorUserId, U as conversationTurnFailedSql, Ua as AUTOMATION_ALERT_STEPS, Uc as subjectTodo, Ud as juniorInboxItems, Us as isSlackRequestTimeout, Vi as basePluginContext, W as conversationWaitsOnUserSql, Wa as AUTOMATION_ALERT_STEP_FIELD_ID, Wc as hasUserPhoto, Wr as runWithSlackInstallation, Ws as normalizeSlackConversationId, Wt as cancelHumanFacingPendingMessages, X as canActOnInboxItem, Xc as userAvatarUrlsFromJoinedPhotos, Xn as sendSlackReply, Y as treeAwaitsAuthorization, Yc as userAvatarUrlsFromIdentities, Yi as truncateStatusText, Yn as resolveSlackReplyTarget, Yu as addAgentTurnUsage, Zc as SNOOZE_TIMER_EVENT_TYPE, Zo as canPauseConversationDelivery, Zr as createOrGetDispatch, Zs as createPluginUsers, Zu as agentTurnUsageSchema, _a as eventAutomationRunLimitReason, _c as readCachedUserByEmail, _r as canInviteToConversation, a as getDb, ad as createSlackDestination, ao as slackChannelMessageRunsAutomation, as as conversationSearchVector, at as inboxItemOwnedByConversation, bd as spaceLeadIds, br as createConversationAccessReader, bs as lookupSlackUser, cc as saveActorAvatar, cd as parseSlackChannelId, cf as juniorMessageAttachments, cl as CORE_EVENT_NAMESPACE, cr as getTurnRequestDeadline, cs as isPublicConversation, di as notifyAutomationBlocked, dl as eventGuidance, ds as conversationAncestorsOrSelf, dt as isInboxItemForEveryone, ed as resolveRootConversationId, ei as getDispatchInputMessageId, eo as getEventCatalog, et as canUserReadInboxItem, ff as juniorIdentities, fi as addReactionToMessage, fr as createPluginConversationChanges, fs as conversationSubtree, ft as isOnlyAssignee, ga as admitEventAutomationRun, gd as parseSlackMessageTs, gf as juniorDestinations, go as cancelSubscriptions, gr as canAddConversationMessages, hf as juniorUsers, hu as indexEndedTurnEvents, i as getConversationStore, if as juniorCodeChanges, ii as isTerminalDispatchStatus, il as settleInboxSnoozes, io as slackChannelMessageReplyThreadTs, is as listConversationAnnotationsById, it as inboxItemNeedsInput, iu as isTopLevel, jc as ownerConversationId, ji as applyPluginFormatMarkdown, jl as parseDashboardConversationLink, jo as bindSlackDirectCredentialSubject, jr as getVercelConversationWorkQueue, k as locationFromRow, kd as juniorTodos, ki as slackMentionedUserIds, kn as canShareTurn, ko as bindEventAutomationCredentialSubject, kr as rootVisibleToViewer, lf as juniorConversations, lr as createPluginCodeChanges, mr as createPluginInboxItems, n as getConversationEventStore, ni as getDispatchTurnId, nl as listFiringInboxSnoozeTriggers, nn as getConversation, ns as createPluginAnnotations, nt as inboxItemAddedByAutomation, o as getSqlExecutor, oa as blockEventAutomation, od as requireSlackDestination, or as sendVercelPluginTask, ot as inboxItemPlugin, ou as ownsLocation, p as copyMessageLinks, pr as PLUGIN_CHOICE_FIELD_ID, ps as conversationSubtreeColumns, pt as isPluginInboxItem, q as awaitsAuthorizationFrom, qd as juniorConversationParticipants, qn as safeLinkUrl, qr as resolveTurnResumeRouting, qs as withSlackRetries, qu as getStateValues, rd as nextDetailVersion, ri as getPluginDispatchProjection, rn as getConversationWorkState, rs as listConversationAnnotations, rt as inboxItemForUser, ru as isThread, sa as collectEventAutomationMatchKeys, sc as resolveActorIdentityId, sf as juniorAttachments, su as postsRunNotices, tf as juniorConversationAnnotations, ti as getDispatchRecord, tr as createPluginTaskStarter, u as isPostgresErrorCode, ua as findMatchingEventAutomations, ud as parseSlackTeamId, ut as isAutomationAlertItem, uu as turnBehavior, v as withConversationEventLock, vo as collectEventMatchKeys, w as loadConversationSlackTenantIds, wi as SLACK_USER_MENTION_RE, ws as createSlackResumeActor, wu as storedMessageJson, x as readConversationTrees, xc as waitingConversationIdsQuery, xd as listedConversation, xr as leaveEndsAccess, xs as lookupSlackUserNames, xt as getPlugins, y as conversationAncestors, ya as automationVersionOf, yd as rootSpaceIdSql, yi as removeReactionFromMessage, yr as conversationAccessFromRows, zc as INBOX_SUBJECT_KINDS, zo as actorLogContext, zs as getSlackClient, zu as JUNIOR_NATIVE_EVENT_NAMESPACE } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { $ as isProviderRetryError, B as textCharsForTokens, C as resolveGatewayModel, M as acquireActiveLock, a as getSlackClientId, d as normalizeSlackEmojiName, i as getSlackBotToken, k as createCache, n as getChatConfig, o as getSlackClientSecret, s as getSlackSigningSecret, t as botConfig, z as estimateTextTokens } from "./config-CHQ8X251.js";
|
|
3
|
+
import { D as buildSentryConversationUrl, E as withSpan, N as normalizeIdentityEmail, P as toOptionalString, S as setTags, T as withLogContext, 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--smS7XRK.js";
|
|
4
4
|
import { h as startSpan, n as captureMessage } from "./sentry-CPbZjomA.js";
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
6
|
-
import {
|
|
7
|
-
import { $ as
|
|
8
|
-
import {
|
|
9
|
-
import { $
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { n as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { a as
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-BeZhWWBE.js";
|
|
6
|
+
import { L as mapBounded, M as trimTrailingAssistantMessages, h as createPluginLogger } from "./prompt-Dv7gkpD6.js";
|
|
7
|
+
import { $ as activityPreviewText, Fn as automationTaskText, Kt as MAX_ATTACHMENT_BYTES, Lt as conversationTreeStateSchema, St as contextProvenance, Xt as readMessageAttachments, Y as conversationReportStatusSchema, Z as conversationSurfaceSchema, at as KNOWN_CONVERSATION_EVENT_TYPES, bn as normalizeUserInputAnswer, fn as inboxItemQuestion, gn as answeredChoices, t as OPEN_TODO_STATUSES, wt as instructionProvenanceFor, yn as isEmptyUserInputAnswer, yt as piMessageFromHistoryItem } from "./types-C4iC-IMC.js";
|
|
8
|
+
import { n as webMessageId } from "./agent-status-BA5x3Xtp.js";
|
|
9
|
+
import { $ as getTurnUserSlackMessageTs, An as recordSubscribedReplyRoute, B as resolveEventAuthor, Bn as getConversationMessageSlackTs, Br as requireTurnFailureEventId, Cr as listTurnSummaries, Ct as savedInputInstruction, D as notInheritedByForkChild, Dr as loadTurnStart, Dt as instructionActorFor, Er as getTurnLifecycle, Et as buildSteeringPiMessage, F as eventAuthorText, Fn as persistConversationMessages, G as resumeForPersonInput, Gn as recordDeliveredAssistantMessage, H as resolveBotSlackTeamId, Hn as latestConversationMessageSeq, In as resolveConversationTitle, Jn as upsertConversationMessage, Kn as trimConversationMessages, Lt as buildDeterministicAssistantMessageId, Nn as hydrateConversationMessages, Nt as renderTaskInput, Pn as persistConversationMessageWindow, Pr as buildTurnErrorResponse, Q as getTurnUserReplyAttachmentContext, Qn as isEventConversationMessage, Rn as buildConversationContext, Rr as finalizeFailedTurnReplyWithEvent, Rt as buildDeterministicTurnId, Sr as getTurnRecord, St as loadInboxItemInput, Tn as recordAuthorizationCompleted, Un as markConversationMessage, Vn as isHumanConversationMessage, Wn as normalizeConversationText, X as getTurnUserMessage, Xn as EVENT_SYSTEM_ACTOR, _n as commitMessages, _r as pauseLostWorkerTurn, _t as coerceThreadConversationState, at as isCooperativeTurnYieldError, br as completeTurnRecord, bt as getWebAuthorization, c as legacyWebMailboxMetadataSchema, cr as AuthorizationFlowDisabledError, ct as markTurnClosed, dt as startActiveTurn, et as ConversationTurnBoundaryError, fr as clearPendingAuth, ft as getLocationConfigurationService, gn as commitAcceptedReply, gr as lostWorkerBeforeFirstSave, gt as persistThreadStateById, hr as loadTurnCheckpoint, ht as persistThreadRuntimeState, ir as PluginCredentialFailureError, it as getConversationTurnBoundaryError, jt as withoutSavedSteeringMessages, li as configValueSchema, lt as markTurnCompleted, mt as getPersistedThreadState, nt as TurnInputCommitLostError, ot as isTurnInputCommitLostError, pt as getPersistedSandboxState, qn as turnHasReply, rr as createPluginEgress, rt as TurnInputDeferredError, st as isTurnInputDeferredError, ti as persistWithRetry, tn as isExperimentalFeatureEnabled, tt as CooperativeTurnYieldError, ut as markTurnFailed, vr as saveTurnCheckpoint, wr as recordTurnSummary, xn as loadTurnProjection, xr as failTurnRecord, yn as loadConversationProjection, yr as abandonTurnRecord, zn as estimateConversationMessagesTokens, zr as getAgentTurnDiagnosticsAttributes } from "./mailbox-turn-uSXhUFc9.js";
|
|
10
|
+
import { o as ingestEvent } from "./job-runner-A1lCkybD.js";
|
|
11
|
+
import { $ as requireSpaceForWork, $t as AutomationEditError, At as parseSlackThreadId, B as archiveConversation, C as CONVERSATION_STATE_TTL_MS, Ct as setConversationSubscription, D as isConversationWorkDone, Dt as renderAttachmentText, E as segmentGapsKey, Et as throwApiError, Ht as takeViewerAutomationAlertStep, It as createPluginConversationWatches, J as stopChildAgentsOf, K as stopConversation, Kt as readConversationSourceTask, Mt as resolveSlackChannelIdFromMessage, O as listConversationWork, Ot as renderBlockText, S as ANSWER_TOOL_ENDINGS, Sn as resolveConversationConfiguration, St as leaveConversation, T as GLOBAL_GAPS_TTL_MS, Tt as jsonResponse, U as conversationReadPositionQuery, W as markConversationRead, Wt as ViewerTaskNotFoundError, Y as deliverInboxItemChange, a as getMcpOAuthCallbackPath, an as addHistoryPeriod, bn as NO_REPLY_GAP_MS, bt as setConversationTitle, cn as historyPeriodSavings, ct as acceptsWebMessages, dt as createAndEnqueueConversation, en as findAutomationSkill, et as setConversationSpaceForViewer, ft as createConversationId, gn as providerCacheTtlMs, hn as connectedState, ht as AttachmentUploadError, jt as readSlackRawMessageContext, kt as parseSlackMessageReference, l as latestProgressStatus, ln as replaceHistorySavings, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, nn as effectiveTaskOutcomes, nt as getSpaceLead, o as createClientMetadata, on as addHistoryWarmupCost, pt as recordWebConversationActivity, r as buildAuthPauseResponse, s as readMcpClientInformation, sn as firstLiveSavingsDate, t as createAgentRunner, tn as missingAutomationSkillReason, tt as readSpaceRefs, u as resolveDestinationVisibility, vn as MINUTE_MS, vt as verifyAttachmentUploads, w as GLOBAL_GAPS_MAX, x as shouldEmitDevAgentTrace, xn as gapSegment, y as RetryableDeliveryError, z as readLastUserMessageAtByConversation } from "./agent-runner-AjrEV6Qe.js";
|
|
12
|
+
import { N as webActorUserIds, T as getMcpStoredOAuthCredentials, _ as McpAuthorizationRequiredError, v as PluginMcpClient } from "./registry-iXMT5Jmh.js";
|
|
13
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
|
|
14
|
+
import { A as createUserTokenStore } from "./profile-BQ-iBDsZ.js";
|
|
15
|
+
import { h as getAssistantReplyText } from "./system-prompt-table-CiXy0eNR.js";
|
|
16
|
+
import { o as detectImageMediaType, s as isVisionImageMediaType } from "./user-customization-CvfuY9Eo.js";
|
|
17
|
+
import { a as readAttachmentVisionSummary, c as slackAttachmentsVersionQuery, m as storeAttachment, n as savedTurnMessages, r as getSlackFileId, s as recordSlackAttachment, u as isFileAttachment } from "./turn-membership-CENFf3kI.js";
|
|
18
|
+
import { a as isConversationMember, i as getConversationInfo, l as listThreadReplies, o as isPublicSlackChannel, r as getChannelMessage } from "./channel-access-j-YAVYK4.js";
|
|
19
|
+
import { C as cancelConversationPendingMessagesBodySchema, D as conversationPendingMessageDeliverySchema, G as messageObjectCard, K as personObjectCard, N as healthReportSchema, S as conversationAutoArchiveSchema, W as conversationObjectCard, b as archiveConversationResponseSchema, c as conversationSubscriptionResponseSchema, g as pinConversationResponseSchema, h as pinConversationBodySchema, l as setConversationSpaceBodySchema, m as renameConversationResponseSchema, o as conversationLeaveResponseSchema, p as renameConversationBodySchema, q as webPageObjectCard, r as stopConversationTurnResponseSchema, s as conversationSubscriptionBodySchema, u as setConversationSpaceResponseSchema, w as cancelConversationPendingMessagesResponseSchema, x as archiveDoneConversationsResponseSchema, y as archiveConversationBodySchema } from "./conversation-feed--9S0_PXL.js";
|
|
20
|
+
import { a as recordFinishedTurnForAutomatedLimit, c as getTurnInputSpanAttributes, i as stopAtAutomatedTurnLimit, l as turnInputTelemetry, n as createConversationTurnWorker, o as AgentRunError, r as supersedeTurnForInput, s as executeTurn, u as withTurnSpan } from "./conversation-turn-BUE_7xaN.js";
|
|
21
|
+
import { n as attachmentFactLines, r as buildStoredAttachmentPromptText } from "./model-input-BReSnwHp.js";
|
|
22
|
+
import { a as getChildAgentLabel } from "./result-Bta_dlWa.js";
|
|
23
|
+
import { t as bindMessageAgent } from "./message-BNenhsmB.js";
|
|
24
|
+
import { t as readConversationLineage } from "./lineage-Bktb0UcV.js";
|
|
25
|
+
import { t as bindSpawnAgent } from "./spawn-frczVPIr.js";
|
|
26
|
+
import { a as buildDeliveredTurnStatePatch, i as persistAuthPauseTurnState, n as loadThreadContextTrimFloor, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CqZDKErp.js";
|
|
27
|
+
import { c as readConversationEventPageAround, n as scheduleSessionCompletedPluginTasks, o as readConversationEventPage, s as readConversationEventPageAfter } from "./task-runner-C9Yc2_ae.js";
|
|
28
|
+
import { a as createAgentDispatchConversationWorker, i as buildDispatchRoutingContext, o as enqueueAgentDispatch, s as failStoppedDispatch, t as runConversation } from "./run-conversation-DL6ru7iW.js";
|
|
29
|
+
import { n as getPausedTurnRequest, o as getTurnAuthorization, r as recordFailedDispatchTurn, t as createPausedTurns } from "./turn-wake-BhloiI2h.js";
|
|
30
|
+
import { r as canContinueInSlack } from "./continue-in-slack-D-FZ8Fin.js";
|
|
26
31
|
import * as z from "zod";
|
|
27
|
-
import pLimit from "p-limit";
|
|
28
32
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
29
33
|
import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, conversationSidebarAnnotationSchema, createSlackSource, dispatchOptionsSchema, encodeObjectImageRef, escapeTagText, escapeTagTextAndQuotes, eventMatches, eventSchema, isSlackDestination, objectAnnotationSchema, objectLinkFilterMatches, objectLinkFilterSpecificity, objectTypeSchema, ownedObjectAnnotationSchema, renderEmptyTag, renderTag } from "@sentry/junior-plugin-api";
|
|
30
|
-
import { and, asc, count, desc, eq,
|
|
34
|
+
import { and, asc, count, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, min, ne, not, or, sql } from "drizzle-orm";
|
|
31
35
|
import { alias } from "drizzle-orm/pg-core";
|
|
36
|
+
import pLimit from "p-limit";
|
|
37
|
+
import { performance } from "node:perf_hooks";
|
|
32
38
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
33
39
|
import net from "node:net";
|
|
34
|
-
import { performance } from "node:perf_hooks";
|
|
35
40
|
import https from "node:https";
|
|
36
41
|
import { SlackFormatConverter, createSlackAdapter } from "@chat-adapter/slack";
|
|
37
42
|
import dns from "node:dns";
|
|
@@ -60,7 +65,7 @@ const imageIdPayloadSchema = z.object({
|
|
|
60
65
|
source: z.string().min(1)
|
|
61
66
|
}).strict();
|
|
62
67
|
function signature$1(payload) {
|
|
63
|
-
const secret =
|
|
68
|
+
const secret = getChatConfig().secrets.juniorSecret;
|
|
64
69
|
if (!secret) throw new Error("Cannot sign image ids without JUNIOR_SECRET");
|
|
65
70
|
return createHmac("sha256", secret).update(`${IMAGE_ID_CONTEXT}:${payload}`).digest("base64url");
|
|
66
71
|
}
|
|
@@ -98,7 +103,7 @@ function imagePath(image, width, version) {
|
|
|
98
103
|
// src/chat/mcp/viewer.ts
|
|
99
104
|
function viewerAuthProvider(plugin, userId) {
|
|
100
105
|
const provider = plugin.manifest.name;
|
|
101
|
-
const baseUrl =
|
|
106
|
+
const baseUrl = getChatConfig().deployment.baseUrl;
|
|
102
107
|
if (!baseUrl) throw new Error("Cannot determine base URL (set JUNIOR_BASE_URL or deploy to Vercel)");
|
|
103
108
|
const callbackUrl = `${baseUrl}${getMcpOAuthCallbackPath(provider)}`;
|
|
104
109
|
return {
|
|
@@ -577,7 +582,8 @@ const conversationRecordColumns = () => ({
|
|
|
577
582
|
identityProvider: juniorIdentities.provider,
|
|
578
583
|
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
579
584
|
identityTenantId: juniorIdentities.providerTenantId,
|
|
580
|
-
userDisplayName: juniorUsers.displayName
|
|
585
|
+
userDisplayName: juniorUsers.displayName,
|
|
586
|
+
spaceId: rootSpaceIdSql(juniorConversations)
|
|
581
587
|
});
|
|
582
588
|
/** Left-join conditions from a Conversation to its record tables. */
|
|
583
589
|
const conversationRecordJoins = {
|
|
@@ -620,7 +626,7 @@ function conversationFromRecordRow(row) {
|
|
|
620
626
|
...value.executionUpdatedAt ? { updatedAtMs: value.executionUpdatedAt.getTime() } : void 0
|
|
621
627
|
},
|
|
622
628
|
...value.parentConversationId ? { parentConversationId: value.parentConversationId } : void 0,
|
|
623
|
-
...
|
|
629
|
+
...row.spaceId ? { spaceId: row.spaceId } : void 0,
|
|
624
630
|
...value.archivedAt ? { archivedAtMs: value.archivedAt.getTime() } : void 0,
|
|
625
631
|
...actor ? { actor } : void 0,
|
|
626
632
|
...location ? { location } : void 0,
|
|
@@ -4599,297 +4605,6 @@ function createPrepareTurnState(deps) {
|
|
|
4599
4605
|
};
|
|
4600
4606
|
};
|
|
4601
4607
|
}
|
|
4602
|
-
// src/chat/agent-dispatch/work.ts
|
|
4603
|
-
const agentDispatchMailboxMetadataSchema = z.object({
|
|
4604
|
-
dispatchId: z.string().min(1),
|
|
4605
|
-
kind: z.literal("agent_dispatch")
|
|
4606
|
-
}).strict();
|
|
4607
|
-
const AGENT_DISPATCH_MAX_AGE_MS = 864e5;
|
|
4608
|
-
/** Return whether a dispatch is a Scheduled or Event automation run. */
|
|
4609
|
-
function isAutomationRun(dispatch) {
|
|
4610
|
-
return dispatch.source.kind === "scheduled_automation" || dispatch.source.kind === "event_automation";
|
|
4611
|
-
}
|
|
4612
|
-
/** Restore the exact actor, credential, and dispatch routing for every slice. */
|
|
4613
|
-
function buildDispatchRoutingContext(dispatch) {
|
|
4614
|
-
return {
|
|
4615
|
-
actor: dispatch.actor,
|
|
4616
|
-
credentialContext: credentialContextForActor(dispatch.actor, dispatch.credentialSubject),
|
|
4617
|
-
dispatch: {
|
|
4618
|
-
actor: dispatch.actor,
|
|
4619
|
-
id: dispatch.id,
|
|
4620
|
-
metadata: dispatch.metadata,
|
|
4621
|
-
plugin: dispatch.plugin,
|
|
4622
|
-
replyAttribution: dispatch.replyAttribution,
|
|
4623
|
-
outcomes: dispatch.outcomes,
|
|
4624
|
-
...dispatch.skill ? { skill: dispatch.skill } : void 0,
|
|
4625
|
-
...isAutomationRun(dispatch) ? { declaresResult: true } : void 0
|
|
4626
|
-
},
|
|
4627
|
-
surface: "api"
|
|
4628
|
-
};
|
|
4629
|
-
}
|
|
4630
|
-
/** Build the stable mailbox work item for one agent dispatch. */
|
|
4631
|
-
function buildAgentDispatchInboundMessage(dispatch, nowMs = Date.now(), authorIdentityId) {
|
|
4632
|
-
return {
|
|
4633
|
-
conversationId: getDispatchConversationId(dispatch),
|
|
4634
|
-
createdAtMs: dispatch.createdAtMs,
|
|
4635
|
-
delivery: "defer",
|
|
4636
|
-
destination: dispatch.destination,
|
|
4637
|
-
inboundMessageId: getDispatchInputMessageId(dispatch.id),
|
|
4638
|
-
input: {
|
|
4639
|
-
text: "[plugin dispatch]",
|
|
4640
|
-
...authorIdentityId ? { authorIdentityId } : void 0,
|
|
4641
|
-
metadata: {
|
|
4642
|
-
dispatchId: dispatch.id,
|
|
4643
|
-
kind: "agent_dispatch"
|
|
4644
|
-
}
|
|
4645
|
-
},
|
|
4646
|
-
receivedAtMs: nowMs,
|
|
4647
|
-
source: "plugin"
|
|
4648
|
-
};
|
|
4649
|
-
}
|
|
4650
|
-
/** Persist dispatch mailbox work before sending its conversation wake-up. */
|
|
4651
|
-
async function enqueueAgentDispatch(dispatch, options) {
|
|
4652
|
-
const nowMs = options.nowMs ?? Date.now();
|
|
4653
|
-
const claimedDispatch = await claimDispatchMailboxAppend(dispatch.id);
|
|
4654
|
-
if (!claimedDispatch) return;
|
|
4655
|
-
const conversationStore = options.conversationStore ?? getConversationStore();
|
|
4656
|
-
const conversationId = getDispatchConversationId(claimedDispatch);
|
|
4657
|
-
const destination = claimedDispatch.destination;
|
|
4658
|
-
await conversationStore.recordActivity({
|
|
4659
|
-
activityAtMs: claimedDispatch.createdAtMs,
|
|
4660
|
-
conversationId,
|
|
4661
|
-
destination,
|
|
4662
|
-
kind: isAutomationRun(claimedDispatch) ? "automation" : "thread",
|
|
4663
|
-
nowMs,
|
|
4664
|
-
source: "plugin",
|
|
4665
|
-
sessionSource: claimedDispatch.source,
|
|
4666
|
-
...claimedDispatch.title ? { title: claimedDispatch.title } : void 0
|
|
4667
|
-
});
|
|
4668
|
-
if (destination.platform === "slack" && destination.threadTs) await conversationStore.claimProviderConversation({
|
|
4669
|
-
atMs: nowMs,
|
|
4670
|
-
conversationId,
|
|
4671
|
-
provider: "slack",
|
|
4672
|
-
providerDestinationId: destination.channelId,
|
|
4673
|
-
providerTenantId: destination.teamId,
|
|
4674
|
-
providerConversationId: destination.threadTs
|
|
4675
|
-
});
|
|
4676
|
-
await appendAndEnqueueInboundMessage({
|
|
4677
|
-
message: buildAgentDispatchInboundMessage(claimedDispatch, nowMs, await resolveActorIdentityId(getSqlExecutor(), claimedDispatch.actor)),
|
|
4678
|
-
conversationStore: options.conversationStore,
|
|
4679
|
-
nowMs,
|
|
4680
|
-
queue: options.queue,
|
|
4681
|
-
state: options.state
|
|
4682
|
-
});
|
|
4683
|
-
await confirmDispatchMailboxAppend(claimedDispatch.id);
|
|
4684
|
-
}
|
|
4685
|
-
/** Parse dispatch routing metadata from a durable mailbox message. */
|
|
4686
|
-
function dispatchIdFromMessages(messages) {
|
|
4687
|
-
if (messages.length === 0) return;
|
|
4688
|
-
const parsed = messages.map((message) => agentDispatchMailboxMetadataSchema.safeParse(message.input.metadata));
|
|
4689
|
-
if (parsed.every((result) => !result.success)) return;
|
|
4690
|
-
if (parsed.some((result) => !result.success)) throw new Error("Conversation mailbox mixes dispatch and provider input");
|
|
4691
|
-
const ids = new Set(parsed.map((result) => {
|
|
4692
|
-
if (!result.success) throw new Error("Dispatch mailbox metadata failed validation");
|
|
4693
|
-
return result.data.dispatchId;
|
|
4694
|
-
}));
|
|
4695
|
-
if (ids.size !== 1) throw new Error("Conversation mailbox contains multiple dispatches");
|
|
4696
|
-
return ids.values().next().value;
|
|
4697
|
-
}
|
|
4698
|
-
/**
|
|
4699
|
-
* Resolve a dispatch from concrete mailbox metadata or the active turn.
|
|
4700
|
-
*
|
|
4701
|
-
* Provider source and conversation-id conventions are deliberately not
|
|
4702
|
-
* execution routing authority.
|
|
4703
|
-
*/
|
|
4704
|
-
async function resolveAgentDispatchId(context) {
|
|
4705
|
-
const mailboxDispatchId = dispatchIdFromMessages(context.attempt.messages);
|
|
4706
|
-
if (mailboxDispatchId) return mailboxDispatchId;
|
|
4707
|
-
if (context.attempt.messages.length > 0) return;
|
|
4708
|
-
const summaries = await listTurnSummaries(context.conversationId);
|
|
4709
|
-
const activeDispatchIds = new Set(summaries.filter((summary) => (summary.state === "paused" || summary.state === "running") && Boolean(summary.dispatchId)).map((summary) => summary.dispatchId).filter((id) => Boolean(id)));
|
|
4710
|
-
if (activeDispatchIds.size > 1) throw new Error(`Conversation ${context.conversationId} has multiple active dispatches`);
|
|
4711
|
-
const activeDispatchId = activeDispatchIds.values().next().value;
|
|
4712
|
-
if (activeDispatchId) return activeDispatchId;
|
|
4713
|
-
const durableDispatchIds = new Set(summaries.map((summary) => summary.dispatchId).filter((id) => Boolean(id)));
|
|
4714
|
-
if (durableDispatchIds.size > 1) throw new Error(`Conversation ${context.conversationId} has multiple dispatch sessions`);
|
|
4715
|
-
const durableDispatchId = durableDispatchIds.values().next().value;
|
|
4716
|
-
if (!durableDispatchId) return;
|
|
4717
|
-
const dispatch = await getDispatchRecord(durableDispatchId);
|
|
4718
|
-
return dispatch && !isTerminalDispatchStatus(dispatch.status) ? durableDispatchId : void 0;
|
|
4719
|
-
}
|
|
4720
|
-
async function readDispatchTurnResult(dispatch) {
|
|
4721
|
-
const conversationId = getDispatchConversationId(dispatch);
|
|
4722
|
-
const turnId = getDispatchTurnId(dispatch.id);
|
|
4723
|
-
const storedSession = await getTurnRecord(conversationId, turnId);
|
|
4724
|
-
const summary = (await listTurnSummaries(conversationId)).find((candidate) => candidate.turnId === turnId);
|
|
4725
|
-
const session = storedSession ?? summary;
|
|
4726
|
-
const dispatchOutcome = summary?.dispatchOutcome ?? storedSession?.dispatchOutcome;
|
|
4727
|
-
const resultMessageTs = summary?.resultMessageId ?? storedSession?.resultMessageId;
|
|
4728
|
-
const errorMessage = storedSession?.errorMessage;
|
|
4729
|
-
if (dispatchOutcome) return {
|
|
4730
|
-
...errorMessage ? { errorMessage } : void 0,
|
|
4731
|
-
outcome: dispatchOutcome,
|
|
4732
|
-
...resultMessageTs ? { resultMessageTs } : void 0
|
|
4733
|
-
};
|
|
4734
|
-
if (resultMessageTs) return {
|
|
4735
|
-
outcome: "completed",
|
|
4736
|
-
resultMessageTs
|
|
4737
|
-
};
|
|
4738
|
-
if (!session) return { outcome: "not_started" };
|
|
4739
|
-
switch (session.state) {
|
|
4740
|
-
case "paused": return { outcome: "awaiting_resume" };
|
|
4741
|
-
case "running": return { outcome: "still_running" };
|
|
4742
|
-
case "completed": return { outcome: "completed" };
|
|
4743
|
-
case "abandoned":
|
|
4744
|
-
case "failed": return {
|
|
4745
|
-
...errorMessage ? { errorMessage } : void 0,
|
|
4746
|
-
outcome: "retryable"
|
|
4747
|
-
};
|
|
4748
|
-
}
|
|
4749
|
-
}
|
|
4750
|
-
async function projectDispatchTurnResult(dispatchId, result) {
|
|
4751
|
-
switch (result.outcome) {
|
|
4752
|
-
case "awaiting_resume":
|
|
4753
|
-
await markDispatchAwaitingResume(dispatchId);
|
|
4754
|
-
break;
|
|
4755
|
-
case "blocked":
|
|
4756
|
-
await markDispatchBlocked(dispatchId, result.errorMessage ?? "Dispatch requires authorization that is unavailable for background work", result.resultMessageTs);
|
|
4757
|
-
break;
|
|
4758
|
-
case "failed":
|
|
4759
|
-
await markDispatchFailed(dispatchId, result.errorMessage ?? "Agent turn failed", result.resultMessageTs);
|
|
4760
|
-
break;
|
|
4761
|
-
case "completed":
|
|
4762
|
-
await markDispatchCompleted(dispatchId, result.resultMessageTs);
|
|
4763
|
-
break;
|
|
4764
|
-
case "not_started": await markDispatchFailed(dispatchId, "Dispatch turn record is missing");
|
|
4765
|
-
}
|
|
4766
|
-
}
|
|
4767
|
-
function getDispatchBlockingError(error) {
|
|
4768
|
-
const cause = getConversationTurnBoundaryError(error)?.cause ?? error;
|
|
4769
|
-
return cause instanceof AuthorizationFlowDisabledError || cause instanceof PluginCredentialFailureError ? cause : void 0;
|
|
4770
|
-
}
|
|
4771
|
-
function missingAuthorizationReason(dispatch, provider) {
|
|
4772
|
-
return dispatch.credentialSubject ? `This run needs a connected ${provider} account.` : `This run uses system credentials, which have no ${provider} access. Switch it to creator credentials and connect a ${provider} account.`;
|
|
4773
|
-
}
|
|
4774
|
-
async function persistBlockedDispatchTurn(dispatch, error) {
|
|
4775
|
-
const conversationId = getDispatchConversationId(dispatch);
|
|
4776
|
-
const sessionId = getDispatchTurnId(dispatch.id);
|
|
4777
|
-
const session = await getTurnRecord(conversationId, sessionId);
|
|
4778
|
-
await recordTurnSummary({
|
|
4779
|
-
actor: dispatch.actor,
|
|
4780
|
-
conversationId,
|
|
4781
|
-
destination: dispatch.destination,
|
|
4782
|
-
dispatchId: dispatch.id,
|
|
4783
|
-
dispatchOutcome: "blocked",
|
|
4784
|
-
turnId: sessionId,
|
|
4785
|
-
sliceId: session?.sliceId ?? 1,
|
|
4786
|
-
source: dispatch.source,
|
|
4787
|
-
state: "failed",
|
|
4788
|
-
surface: "api"
|
|
4789
|
-
});
|
|
4790
|
-
await markDispatchBlocked(dispatch.id, error instanceof AuthorizationFlowDisabledError ? missingAuthorizationReason(dispatch, error.provider) : error.message);
|
|
4791
|
-
}
|
|
4792
|
-
/** Run one dispatch start or resume under the owning conversation lease. */
|
|
4793
|
-
function createAgentDispatchConversationWorker(options) {
|
|
4794
|
-
return async (context, dispatchId) => {
|
|
4795
|
-
const dispatch = await getDispatchRecord(dispatchId);
|
|
4796
|
-
if (!dispatch) throw new Error(`Dispatch record is missing for ${dispatchId}`);
|
|
4797
|
-
const expectedConversationId = getDispatchConversationId(dispatch);
|
|
4798
|
-
if (context.conversationId !== expectedConversationId) throw new Error(`Dispatch ${dispatch.id} belongs to ${expectedConversationId}, not ${context.conversationId}`);
|
|
4799
|
-
if (!context.destination || context.destination.platform !== dispatch.destination.platform || context.destination.teamId !== dispatch.destination.teamId || context.destination.channelId !== dispatch.destination.channelId) throw new Error(`Dispatch ${dispatch.id} destination does not match its conversation lease`);
|
|
4800
|
-
let acknowledged = context.attempt.messages.length === 0;
|
|
4801
|
-
const acknowledge = async () => {
|
|
4802
|
-
if (acknowledged) return;
|
|
4803
|
-
try {
|
|
4804
|
-
await context.attempt.ack();
|
|
4805
|
-
} catch {
|
|
4806
|
-
throw new TurnInputCommitLostError(`Conversation work lease lost before dispatch inbox ack for ${context.conversationId}`);
|
|
4807
|
-
}
|
|
4808
|
-
acknowledged = true;
|
|
4809
|
-
};
|
|
4810
|
-
if (isTerminalDispatchStatus(dispatch.status)) {
|
|
4811
|
-
await acknowledge();
|
|
4812
|
-
return { status: "completed" };
|
|
4813
|
-
}
|
|
4814
|
-
const durableResult = await readDispatchTurnResult(dispatch);
|
|
4815
|
-
if (durableResult.outcome === "blocked" || durableResult.outcome === "completed" || durableResult.outcome === "failed") {
|
|
4816
|
-
await projectDispatchTurnResult(dispatch.id, durableResult);
|
|
4817
|
-
await acknowledge();
|
|
4818
|
-
return { status: "completed" };
|
|
4819
|
-
}
|
|
4820
|
-
if (Date.now() - dispatch.createdAtMs > 864e5) {
|
|
4821
|
-
await markDispatchFailed(dispatch.id, "Dispatch exceeded its maximum processing age");
|
|
4822
|
-
await acknowledge();
|
|
4823
|
-
return { status: "completed" };
|
|
4824
|
-
}
|
|
4825
|
-
const runningDispatch = await markDispatchRunning(dispatch.id);
|
|
4826
|
-
if (!runningDispatch) throw new Error(`Dispatch record disappeared for ${dispatch.id}`);
|
|
4827
|
-
if (isTerminalDispatchStatus(runningDispatch.status)) {
|
|
4828
|
-
await acknowledge();
|
|
4829
|
-
return { status: "completed" };
|
|
4830
|
-
}
|
|
4831
|
-
try {
|
|
4832
|
-
const resumesDurableTurn = durableResult.outcome === "awaiting_resume" || durableResult.outcome === "still_running";
|
|
4833
|
-
if (resumesDurableTurn && context.attempt.messages.length > 0) await acknowledge();
|
|
4834
|
-
let result;
|
|
4835
|
-
if (resumesDurableTurn) {
|
|
4836
|
-
await options.resumeTurn(dispatch, {
|
|
4837
|
-
shouldYield: context.shouldYield,
|
|
4838
|
-
checkIn: context.checkIn
|
|
4839
|
-
});
|
|
4840
|
-
result = await readDispatchTurnResult(dispatch);
|
|
4841
|
-
} else result = await options.runTurn(dispatch, {
|
|
4842
|
-
ack: acknowledge,
|
|
4843
|
-
shouldYield: context.shouldYield,
|
|
4844
|
-
checkIn: context.checkIn
|
|
4845
|
-
}) ?? await readDispatchTurnResult(dispatch);
|
|
4846
|
-
if (result.outcome === "still_running") throw new Error(`Dispatch turn ${dispatch.id} is still running after its attempt`);
|
|
4847
|
-
if (result.outcome === "retryable") throw new Error(result.errorMessage ?? `Dispatch turn ${dispatch.id} failed`);
|
|
4848
|
-
await projectDispatchTurnResult(dispatch.id, result);
|
|
4849
|
-
if (!acknowledged) await acknowledge();
|
|
4850
|
-
return result.outcome === "awaiting_resume" && context.shouldYield() ? { status: "yielded" } : { status: "completed" };
|
|
4851
|
-
} catch (error) {
|
|
4852
|
-
if (isCooperativeTurnYieldError(error)) {
|
|
4853
|
-
await markDispatchAwaitingResume(dispatch.id);
|
|
4854
|
-
return { status: "yielded" };
|
|
4855
|
-
}
|
|
4856
|
-
if (isTurnInputCommitLostError(error)) {
|
|
4857
|
-
logWarn("agent.dispatch.lost_lease", {
|
|
4858
|
-
"app.dispatch.id": dispatch.id,
|
|
4859
|
-
"error.type": error.name,
|
|
4860
|
-
"exception.message": error.message
|
|
4861
|
-
});
|
|
4862
|
-
return { status: "lost_lease" };
|
|
4863
|
-
}
|
|
4864
|
-
const blockingError = getDispatchBlockingError(error);
|
|
4865
|
-
if (blockingError) {
|
|
4866
|
-
await persistBlockedDispatchTurn(dispatch, blockingError);
|
|
4867
|
-
await indexEndedTurnEvents({
|
|
4868
|
-
conversationId: context.conversationId,
|
|
4869
|
-
turnId: getDispatchTurnId(dispatch.id)
|
|
4870
|
-
});
|
|
4871
|
-
await acknowledge();
|
|
4872
|
-
return { status: "completed" };
|
|
4873
|
-
}
|
|
4874
|
-
if (!context.attempt.isFinalAttempt) throw error;
|
|
4875
|
-
await markDispatchFailed(dispatch.id, error instanceof Error ? error.message : "Dispatch turn failed");
|
|
4876
|
-
await indexEndedTurnEvents({
|
|
4877
|
-
conversationId: context.conversationId,
|
|
4878
|
-
turnId: getDispatchTurnId(dispatch.id)
|
|
4879
|
-
});
|
|
4880
|
-
await acknowledge();
|
|
4881
|
-
return { status: "completed" };
|
|
4882
|
-
}
|
|
4883
|
-
};
|
|
4884
|
-
}
|
|
4885
|
-
/**
|
|
4886
|
-
* Fail the dispatch of stopped Conversation work, so the Automation run that
|
|
4887
|
-
* waits on it settles instead of blocking later runs.
|
|
4888
|
-
*/
|
|
4889
|
-
async function failStoppedDispatch(conversationId) {
|
|
4890
|
-
const dispatchId = getDispatchIdForConversation(conversationId);
|
|
4891
|
-
if (dispatchId) await markDispatchFailed(dispatchId, "Dispatch work stopped after repeated failed attempts.");
|
|
4892
|
-
}
|
|
4893
4608
|
// src/chat/slack/dispatch-turn.ts
|
|
4894
4609
|
/** Build the Slack provider adapter for agent-dispatched conversation turns. */
|
|
4895
4610
|
function createSlackDispatchTurnRunner(options) {
|
|
@@ -6827,32 +6542,7 @@ function createConversationWork(options) {
|
|
|
6827
6542
|
queue: options.queue,
|
|
6828
6543
|
state: options.state
|
|
6829
6544
|
});
|
|
6830
|
-
const
|
|
6831
|
-
runTurn: conversationTurnWorker,
|
|
6832
|
-
state: options.state
|
|
6833
|
-
});
|
|
6834
|
-
const destinationWorker = async (context) => {
|
|
6835
|
-
const destination = context.destination;
|
|
6836
|
-
if (!destination) throw new Error(`Conversation ${context.conversationId} is missing a destination`);
|
|
6837
|
-
if (destination.platform === "slack") return await slackWorker(context);
|
|
6838
|
-
throw new Error(`Conversation ${context.conversationId} has a ${destination.platform} destination but no matching conversation worker`);
|
|
6839
|
-
};
|
|
6840
|
-
const runRoot = async (context) => {
|
|
6841
|
-
const mailboxTurn = await resolveMailboxTurnWork(context);
|
|
6842
|
-
if (mailboxTurn) {
|
|
6843
|
-
const work = await withAgentInvocationResultActors(mailboxTurn);
|
|
6844
|
-
if (!work) {
|
|
6845
|
-
await context.attempt.ack();
|
|
6846
|
-
return { status: "completed" };
|
|
6847
|
-
}
|
|
6848
|
-
return await conversationTurnWorker(context, work);
|
|
6849
|
-
}
|
|
6850
|
-
const dispatchId = await resolveAgentDispatchId(context);
|
|
6851
|
-
if (dispatchId) return await dispatchWorker(context, dispatchId);
|
|
6852
|
-
return await destinationWorker(context);
|
|
6853
|
-
};
|
|
6854
|
-
const runByKind = async (context, topLevel) => {
|
|
6855
|
-
const worker = topLevel ? runRoot : childWorker;
|
|
6545
|
+
const runWithStopCascade = async (context) => {
|
|
6856
6546
|
const readStopSignal = context.stopSignal;
|
|
6857
6547
|
let stopSignal;
|
|
6858
6548
|
const stopLateChildAgents = async () => {
|
|
@@ -6860,9 +6550,14 @@ function createConversationWork(options) {
|
|
|
6860
6550
|
};
|
|
6861
6551
|
let result;
|
|
6862
6552
|
try {
|
|
6863
|
-
result = await
|
|
6553
|
+
result = await runConversation({
|
|
6864
6554
|
...context,
|
|
6865
6555
|
stopSignal: readStopSignal ? () => stopSignal = readStopSignal() : void 0
|
|
6556
|
+
}, {
|
|
6557
|
+
destinations: { slack: slackWorker },
|
|
6558
|
+
runDispatch: dispatchWorker,
|
|
6559
|
+
runTurn: conversationTurnWorker,
|
|
6560
|
+
state: options.state
|
|
6866
6561
|
});
|
|
6867
6562
|
} catch (error) {
|
|
6868
6563
|
await stopLateChildAgents().catch((cascadeError) => {
|
|
@@ -6876,8 +6571,8 @@ function createConversationWork(options) {
|
|
|
6876
6571
|
const run = async (context) => {
|
|
6877
6572
|
await resumeForPersonInput(context.conversationId, context.attempt.messages);
|
|
6878
6573
|
const conversation = await options.conversationStore.get({ conversationId: context.conversationId });
|
|
6879
|
-
const topLevel = !conversation ||
|
|
6880
|
-
return await withLogContext({ rootConversationId: conversation?.rootConversationId ?? (topLevel ? context.conversationId : void 0) }, () =>
|
|
6574
|
+
const topLevel = !conversation || ownsLocation(conversation);
|
|
6575
|
+
return await withLogContext({ rootConversationId: conversation?.rootConversationId ?? (topLevel ? context.conversationId : void 0) }, () => runWithStopCascade(context));
|
|
6881
6576
|
};
|
|
6882
6577
|
return {
|
|
6883
6578
|
beforeWorkStops: failStoppedDispatch,
|
|
@@ -8505,10 +8200,14 @@ const INBOX_SNOOZE_TIMER_INDEX = {
|
|
|
8505
8200
|
async function resolvedTodos(db, resolved) {
|
|
8506
8201
|
if (resolved.length === 0) return [];
|
|
8507
8202
|
const items = await db.select({
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8203
|
+
id: juniorInboxItems.id,
|
|
8204
|
+
subjectId: juniorInboxItems.subjectId,
|
|
8205
|
+
subjectKind: juniorInboxItems.subjectKind
|
|
8206
|
+
}).from(juniorInboxItems).where(and(inArray(juniorInboxItems.id, resolved.map((row) => row.inboxItemId)), eq(juniorInboxItems.subjectKind, INBOX_SUBJECT_KINDS.todo)));
|
|
8207
|
+
const todoOf = new Map(items.map((item) => [item.id, subjectTodo({
|
|
8208
|
+
id: item.subjectId,
|
|
8209
|
+
kind: item.subjectKind
|
|
8210
|
+
})]));
|
|
8512
8211
|
return resolved.flatMap((row) => {
|
|
8513
8212
|
const todo = todoOf.get(row.inboxItemId);
|
|
8514
8213
|
return todo ? [{
|
|
@@ -8521,7 +8220,7 @@ async function resolvedTodos(db, resolved) {
|
|
|
8521
8220
|
* Fire the snooze triggers that one Event matches. A `resolve` trigger
|
|
8522
8221
|
* cancels the snooze and closes the item: it dismisses it, or marks the
|
|
8523
8222
|
* To-do of a To-do item done for the person who snoozed it, so the agent
|
|
8524
|
-
* sees the change in its next
|
|
8223
|
+
* sees the change in its next To-do delta. A `wake` trigger ends the
|
|
8525
8224
|
* snooze, which records `reason`. When one Event fires both on a snooze,
|
|
8526
8225
|
* `resolve` wins. A snooze that already ended ignores the Event. Each
|
|
8527
8226
|
* woken snooze pushes to its User. Returns the number of items woken.
|
|
@@ -8764,6 +8463,7 @@ function createHeartbeatContext(args) {
|
|
|
8764
8463
|
send: args.sendPluginTask,
|
|
8765
8464
|
tasks: typeof args.plugin === "string" ? void 0 : args.plugin.tasks
|
|
8766
8465
|
}),
|
|
8466
|
+
users: createPluginUsers(pluginName),
|
|
8767
8467
|
log: createPluginLogger(pluginName),
|
|
8768
8468
|
agent: {
|
|
8769
8469
|
async dispatch(options) {
|
|
@@ -8793,9 +8493,14 @@ function createHeartbeatContext(args) {
|
|
|
8793
8493
|
}
|
|
8794
8494
|
};
|
|
8795
8495
|
}
|
|
8496
|
+
const EVENT_AUTOMATION_PLUGIN = "junior";
|
|
8497
|
+
/** The dispatch id of an event automation run, which is also its run id. */
|
|
8498
|
+
function eventAutomationDispatchId(idempotencyKey) {
|
|
8499
|
+
return buildDispatchId(EVENT_AUTOMATION_PLUGIN, idempotencyKey);
|
|
8500
|
+
}
|
|
8796
8501
|
/** Create and enqueue one core-owned event automation dispatch. */
|
|
8797
8502
|
async function dispatchEventAutomation(args) {
|
|
8798
|
-
const plugin =
|
|
8503
|
+
const plugin = EVENT_AUTOMATION_PLUGIN;
|
|
8799
8504
|
const { credentialSubject, outcomes, skill, ...unboundOptions } = args.options;
|
|
8800
8505
|
validateDispatchOptions({ ...unboundOptions });
|
|
8801
8506
|
const boundSubject = credentialSubject ? bindEventAutomationCredentialSubject({
|
|
@@ -8811,7 +8516,7 @@ async function dispatchEventAutomation(args) {
|
|
|
8811
8516
|
source: {
|
|
8812
8517
|
kind: "event_automation",
|
|
8813
8518
|
automationId: args.automationId,
|
|
8814
|
-
automationRunId:
|
|
8519
|
+
automationRunId: eventAutomationDispatchId(unboundOptions.idempotencyKey)
|
|
8815
8520
|
}
|
|
8816
8521
|
};
|
|
8817
8522
|
return await dispatch({
|
|
@@ -8856,12 +8561,25 @@ async function getScheduledAutomationDispatch(id) {
|
|
|
8856
8561
|
id
|
|
8857
8562
|
});
|
|
8858
8563
|
}
|
|
8564
|
+
// src/chat/inbox-items/automation-questions.ts
|
|
8565
|
+
const OPEN_AUTOMATION_QUESTION_LIMIT = 20;
|
|
8566
|
+
/**
|
|
8567
|
+
* List the open questions that the runs of one Automation asked, oldest
|
|
8568
|
+
* first, by item id and title. A later run of the Automation gets them in
|
|
8569
|
+
* its task, so it changes one by its id instead of asking it again.
|
|
8570
|
+
*/
|
|
8571
|
+
async function listOpenAutomationQuestions(db, automationId) {
|
|
8572
|
+
return await db.select({
|
|
8573
|
+
id: juniorInboxItems.id,
|
|
8574
|
+
title: juniorQuestions.title
|
|
8575
|
+
}).from(juniorInboxItems).innerJoin(juniorQuestions, itemQuestion).where(and(eq(juniorInboxItems.status, "open"), inboxItemAddedByAutomation(automationId))).orderBy(asc(juniorInboxItems.createdAt), asc(juniorInboxItems.id)).limit(OPEN_AUTOMATION_QUESTION_LIMIT);
|
|
8576
|
+
}
|
|
8859
8577
|
// src/chat/event-automations/runs.ts
|
|
8860
8578
|
/**
|
|
8861
|
-
* Record
|
|
8862
|
-
*
|
|
8863
|
-
*
|
|
8864
|
-
*
|
|
8579
|
+
* Record an event automation run with the Automation version it runs, before
|
|
8580
|
+
* its dispatch, so the dispatch can link the run's Conversation as soon as it
|
|
8581
|
+
* exists. A retry of the same Event keeps the row it has. A run whose
|
|
8582
|
+
* dispatch is never stored fails when the heartbeat settles it.
|
|
8865
8583
|
*/
|
|
8866
8584
|
async function recordEventAutomationRunStarted(db, args) {
|
|
8867
8585
|
const conversationId = getDispatchConversationId({ id: args.dispatchId });
|
|
@@ -8875,18 +8593,21 @@ async function recordEventAutomationRunStarted(db, args) {
|
|
|
8875
8593
|
status: "running"
|
|
8876
8594
|
}).onConflictDoNothing({ target: juniorAutomationRuns.id });
|
|
8877
8595
|
}
|
|
8596
|
+
const MISSING_DISPATCH_GRACE_MS = 3e5;
|
|
8878
8597
|
/**
|
|
8879
8598
|
* Settle running event automation runs whose dispatch has ended. A run whose
|
|
8880
|
-
* dispatch record is
|
|
8599
|
+
* dispatch record is still missing after a short grace fails.
|
|
8881
8600
|
*/
|
|
8882
8601
|
async function settleEventAutomationRuns(db, nowMs) {
|
|
8883
8602
|
const runs = await db.select({
|
|
8884
8603
|
automationId: juniorAutomationRuns.automationId,
|
|
8885
|
-
id: juniorAutomationRuns.id
|
|
8604
|
+
id: juniorAutomationRuns.id,
|
|
8605
|
+
startedAtMs: juniorAutomationRuns.startedAtMs
|
|
8886
8606
|
}).from(juniorAutomationRuns).innerJoin(juniorAutomations, eq(juniorAutomations.id, juniorAutomationRuns.automationId)).where(and(eq(juniorAutomations.kind, "event"), eq(juniorAutomationRuns.status, "running")));
|
|
8887
8607
|
const dispatches = await mapBounded(runs, (run) => getDispatchRecord(run.id));
|
|
8888
8608
|
for (const [index, run] of runs.entries()) {
|
|
8889
8609
|
const dispatch = dispatches[index];
|
|
8610
|
+
if (!dispatch && (run.startedAtMs ?? 0) > nowMs - MISSING_DISPATCH_GRACE_MS) continue;
|
|
8890
8611
|
const status = dispatch?.status ?? "failed";
|
|
8891
8612
|
if (status !== "blocked" && status !== "completed" && status !== "failed") continue;
|
|
8892
8613
|
await recordAutomationExecution(run.automationId, {
|
|
@@ -9149,8 +8870,11 @@ async function answerAutomationAlert(args) {
|
|
|
9149
8870
|
function eventAutomationDispatchKey(taskId, namespace, eventKey) {
|
|
9150
8871
|
return `event-automation:${createHash("sha256").update(`${taskId}\0${namespace}\0${eventKey}`).digest("hex").slice(0, 32)}`;
|
|
9151
8872
|
}
|
|
9152
|
-
/**
|
|
9153
|
-
|
|
8873
|
+
/**
|
|
8874
|
+
* Render plain agent input for one matching event automation, with the open
|
|
8875
|
+
* questions of its earlier runs.
|
|
8876
|
+
*/
|
|
8877
|
+
function eventInput(task, event, outcomes, catalog, author, openQuestions) {
|
|
9154
8878
|
const guidance = eventGuidance(catalog, event.namespace, event.eventType);
|
|
9155
8879
|
return renderTaskInput({
|
|
9156
8880
|
about: task.trigger.label,
|
|
@@ -9159,6 +8883,7 @@ function eventInput(task, event, outcomes, catalog, author) {
|
|
|
9159
8883
|
creator: slackMention(task.createdBy.slackUserId),
|
|
9160
8884
|
instructions: automationTaskText(task.task),
|
|
9161
8885
|
...task.task.kind === "skill" ? { skill: task.task.skill } : void 0,
|
|
8886
|
+
openQuestions,
|
|
9162
8887
|
outcomes,
|
|
9163
8888
|
guidance,
|
|
9164
8889
|
trustedSummary: event.trustedSummary,
|
|
@@ -9246,7 +8971,12 @@ async function ingestEventAutomations(input, options) {
|
|
|
9246
8971
|
allowedWhen: "event-automation",
|
|
9247
8972
|
taskId: task.id
|
|
9248
8973
|
} : void 0;
|
|
9249
|
-
|
|
8974
|
+
await recordEventAutomationRunStarted(db, {
|
|
8975
|
+
automation: task,
|
|
8976
|
+
dispatchId: eventAutomationDispatchId(idempotencyKey),
|
|
8977
|
+
nowMs
|
|
8978
|
+
});
|
|
8979
|
+
if ((await dispatchEventAutomation({
|
|
9250
8980
|
automationId: task.id,
|
|
9251
8981
|
conversationWorkQueue: options.queue,
|
|
9252
8982
|
nowMs,
|
|
@@ -9255,19 +8985,13 @@ async function ingestEventAutomations(input, options) {
|
|
|
9255
8985
|
...credentialSubject ? { credentialSubject } : void 0,
|
|
9256
8986
|
destination,
|
|
9257
8987
|
destinationVisibility: task.destinationVisibility,
|
|
9258
|
-
input: eventInput(task, event, outcomes, catalog, author),
|
|
8988
|
+
input: eventInput(task, event, outcomes, catalog, author, await listOpenAutomationQuestions(db, task.id)),
|
|
9259
8989
|
...skill ? { skill } : void 0,
|
|
9260
8990
|
metadata: { eventAutomationId: task.id },
|
|
9261
8991
|
replyAttribution: automationReplyAttribution(task.title),
|
|
9262
8992
|
outcomes
|
|
9263
8993
|
}
|
|
9264
|
-
});
|
|
9265
|
-
await recordEventAutomationRunStarted(db, {
|
|
9266
|
-
automation: task,
|
|
9267
|
-
dispatchId: dispatch.id,
|
|
9268
|
-
nowMs
|
|
9269
|
-
});
|
|
9270
|
-
if (dispatch.status === "created") dispatched += 1;
|
|
8994
|
+
})).status === "created") dispatched += 1;
|
|
9271
8995
|
} catch (error) {
|
|
9272
8996
|
errors.push(error);
|
|
9273
8997
|
}
|
|
@@ -9352,7 +9076,7 @@ function createEventAppPublisher(args) {
|
|
|
9352
9076
|
*/
|
|
9353
9077
|
async function answerPluginInboxItem(args) {
|
|
9354
9078
|
const { item } = args;
|
|
9355
|
-
const pluginName = inboxItemPlugin(item
|
|
9079
|
+
const pluginName = inboxItemPlugin(item);
|
|
9356
9080
|
const choice = item.answer?.values[PLUGIN_CHOICE_FIELD_ID]?.[0];
|
|
9357
9081
|
const conversationId = ownerConversationId(item);
|
|
9358
9082
|
if (!pluginName || !choice || !conversationId) return;
|
|
@@ -9365,7 +9089,10 @@ async function answerPluginInboxItem(args) {
|
|
|
9365
9089
|
choice,
|
|
9366
9090
|
codeChanges: createPluginCodeChanges(pluginName),
|
|
9367
9091
|
conversationId,
|
|
9368
|
-
|
|
9092
|
+
subject: {
|
|
9093
|
+
id: item.subject.id,
|
|
9094
|
+
kind: item.subject.kind.slice(pluginName.length + 1)
|
|
9095
|
+
},
|
|
9369
9096
|
events: createPluginEventPublisher(plugin, events),
|
|
9370
9097
|
itemId: item.id,
|
|
9371
9098
|
nowMs: args.nowMs,
|
|
@@ -9383,11 +9110,12 @@ const MATCH_CONFIDENCE_THRESHOLD = .7;
|
|
|
9383
9110
|
/** A slow decision keeps the items open instead of delaying the close. */
|
|
9384
9111
|
const MATCH_TIMEOUT_MS = 1e4;
|
|
9385
9112
|
function describeItem(item) {
|
|
9386
|
-
const
|
|
9113
|
+
const request = inboxItemQuestion(item.request);
|
|
9114
|
+
const fields = (request?.fields ?? []).map((field) => "options" in field ? `- ${field.label}: ${field.options.map((option) => option.label).join(" / ")}` : `- ${field.label}: free text`);
|
|
9387
9115
|
return [
|
|
9388
9116
|
`Title: ${item.title}`,
|
|
9389
9117
|
`Details: ${item.body}`,
|
|
9390
|
-
...
|
|
9118
|
+
...request ? [`Question: ${request.question}`] : [],
|
|
9391
9119
|
...fields.length ? ["Fields:", ...fields] : []
|
|
9392
9120
|
].join("\n");
|
|
9393
9121
|
}
|
|
@@ -9483,8 +9211,9 @@ function isSameClose(item, action, user) {
|
|
|
9483
9211
|
return item.closeReason !== "Replied in thread" && item.closedBy?.userId === user.id && item.status === closedStatus(action) && action === "submit" === Boolean(item.answer);
|
|
9484
9212
|
}
|
|
9485
9213
|
function submittedAnswer(item, answer) {
|
|
9486
|
-
|
|
9487
|
-
|
|
9214
|
+
const question = inboxItemQuestion(item.request);
|
|
9215
|
+
if (item.kind !== "action" || !question) throw new InboxItemActionError("invalid", "Only an action item takes an answer.");
|
|
9216
|
+
const normalized = normalizeUserInputAnswer(question, {
|
|
9488
9217
|
other: answer?.other,
|
|
9489
9218
|
requestId: item.id,
|
|
9490
9219
|
values: answer?.values ?? {}
|
|
@@ -9503,16 +9232,24 @@ function submittedAnswer(item, answer) {
|
|
|
9503
9232
|
* `exceptConversationId` is the Conversation where the person acted. It gets
|
|
9504
9233
|
* the person's input from its own surface, so it gets no message here.
|
|
9505
9234
|
* `delivery` shows the change and sends the messages; see
|
|
9506
|
-
* `deliverInboxItemChange`.
|
|
9235
|
+
* `deliverInboxItemChange`. A submit, dismiss, or done also closes the
|
|
9236
|
+
* person's reply notices in the item's Conversations: the item had their
|
|
9237
|
+
* attention.
|
|
9507
9238
|
*/
|
|
9508
9239
|
async function actOnInboxItem(args) {
|
|
9509
9240
|
const { action, user } = args;
|
|
9510
9241
|
const nowMs = args.nowMs ?? Date.now();
|
|
9511
9242
|
const db = getDb();
|
|
9512
9243
|
const item = await readInboxItemForUser(user, args.id);
|
|
9513
|
-
if (
|
|
9244
|
+
if (subjectTodo(item.subject)) {
|
|
9514
9245
|
if (action !== "done" && action !== "dismiss") throw new InboxItemActionError("invalid", "A To-do item takes only Done or Dismiss.");
|
|
9515
|
-
|
|
9246
|
+
const closed = await closeTodoItem(item, user, nowMs, action);
|
|
9247
|
+
await closeHandledReplyNotices(db, {
|
|
9248
|
+
item: closed,
|
|
9249
|
+
nowMs,
|
|
9250
|
+
userId: user.id
|
|
9251
|
+
});
|
|
9252
|
+
return closed;
|
|
9516
9253
|
}
|
|
9517
9254
|
if (action === "done") throw new InboxItemActionError("invalid", "Only a To-do item can be marked done.");
|
|
9518
9255
|
if (action === "take") {
|
|
@@ -9548,6 +9285,11 @@ async function actOnInboxItem(args) {
|
|
|
9548
9285
|
closed = await readInboxItemForUser(user, item.id);
|
|
9549
9286
|
}
|
|
9550
9287
|
if (args.firstCloseOnly ? !closedNow : !isSameClose(closed, action, user)) throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
9288
|
+
await closeHandledReplyNotices(db, {
|
|
9289
|
+
item: closed,
|
|
9290
|
+
nowMs,
|
|
9291
|
+
userId: user.id
|
|
9292
|
+
});
|
|
9551
9293
|
if (action === "submit" && isPluginInboxItem(closed)) await answerPluginInboxItem({
|
|
9552
9294
|
delivery: args.delivery,
|
|
9553
9295
|
item: closed,
|
|
@@ -9576,11 +9318,11 @@ async function actOnInboxItem(args) {
|
|
|
9576
9318
|
* Close a To-do item for its assignee through its To-do: Done marks the
|
|
9577
9319
|
* To-do done, and Dismiss drops it. The To-do change closes the item as
|
|
9578
9320
|
* done or dismissed (`syncTodoInboxItems`), and the agent sees it in its
|
|
9579
|
-
* next
|
|
9321
|
+
* next To-do delta, so it sends no message and starts no Turn. A retry
|
|
9580
9322
|
* after the item closed the same way by the same person succeeds.
|
|
9581
9323
|
*/
|
|
9582
9324
|
async function closeTodoItem(item, user, nowMs, action) {
|
|
9583
|
-
const todo =
|
|
9325
|
+
const todo = subjectTodo(item.subject);
|
|
9584
9326
|
if (item.status === "open") {
|
|
9585
9327
|
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
9586
9328
|
await setTodoStatusByUser(getSqlExecutor(), {
|
|
@@ -9607,8 +9349,9 @@ function replyAnswers(item, user) {
|
|
|
9607
9349
|
}
|
|
9608
9350
|
/** Return the answer that the text of a person's message gives to an item. */
|
|
9609
9351
|
function messageAnswer(item, text) {
|
|
9610
|
-
|
|
9611
|
-
|
|
9352
|
+
const question = inboxItemQuestion(item.request);
|
|
9353
|
+
if (!question) return void 0;
|
|
9354
|
+
const answer = normalizeUserInputAnswer(question, {
|
|
9612
9355
|
other: text,
|
|
9613
9356
|
requestId: item.id,
|
|
9614
9357
|
values: {}
|
|
@@ -10253,24 +9996,6 @@ async function reorderPinnedConversations(viewer, body) {
|
|
|
10253
9996
|
const updatedIds = new Set(updated.map((row) => row.rootConversationId));
|
|
10254
9997
|
return { conversationIds: ids.filter((id) => updatedIds.has(id)) };
|
|
10255
9998
|
}
|
|
10256
|
-
// src/chat/conversations/sql/title.ts
|
|
10257
|
-
/**
|
|
10258
|
-
* Replace one Conversation's title. Returns the stored title, or undefined
|
|
10259
|
-
* when the Conversation does not exist.
|
|
10260
|
-
*
|
|
10261
|
-
* recordActivity reads the title and writes it back under the mutation lock,
|
|
10262
|
-
* so this write takes the same lock. A concurrent Turn cannot restore the old
|
|
10263
|
-
* title.
|
|
10264
|
-
*/
|
|
10265
|
-
async function setConversationTitle(executor, conversationId, title) {
|
|
10266
|
-
return await withConversationMutationLock(executor, conversationId, async () => {
|
|
10267
|
-
const [row] = await executor.db().update(juniorConversations).set({
|
|
10268
|
-
detailVersion: nextDetailVersion,
|
|
10269
|
-
title
|
|
10270
|
-
}).where(eq(juniorConversations.conversationId, conversationId)).returning({ title: juniorConversations.title });
|
|
10271
|
-
return row?.title ?? void 0;
|
|
10272
|
-
});
|
|
10273
|
-
}
|
|
10274
9999
|
// src/api/conversations/rename.ts
|
|
10275
10000
|
/**
|
|
10276
10001
|
* Rename one conversation. The title is shared, so only a participant can
|
|
@@ -10348,12 +10073,12 @@ const writeAnnotations = {
|
|
|
10348
10073
|
const archiveConversationOperation = defineApiOperation({
|
|
10349
10074
|
name: "archiveConversation",
|
|
10350
10075
|
title: "Archive conversation",
|
|
10351
|
-
description: "Archive one of your conversations, or restore it, for everyone in it. Archiving a conversation hides it and its child conversations. A restore fails while a conversation above it is archived. A new message from a person restores the conversation and the archived conversations above it.",
|
|
10076
|
+
description: "Archive one of your conversations, or restore it, for everyone in it. Archiving a conversation hides it and its child conversations and stops their running work. A restore fails while a conversation above it is archived. A new message from a person restores the conversation and the archived conversations above it.",
|
|
10352
10077
|
scope: "conversations:manage",
|
|
10353
10078
|
input: archiveConversationBodySchema.extend(conversationIdInput),
|
|
10354
10079
|
output: archiveConversationResponseSchema,
|
|
10355
10080
|
annotations: writeAnnotations,
|
|
10356
|
-
run: (viewer, { conversationId, ...body }) => archiveConversation(viewer, conversationId, body)
|
|
10081
|
+
run: (viewer, { conversationId, ...body }, services) => archiveConversation(viewer, conversationId, body, services)
|
|
10357
10082
|
});
|
|
10358
10083
|
/** Archive every done Conversation of the viewer once. */
|
|
10359
10084
|
const archiveDoneConversationsOperation = defineApiOperation({
|
|
@@ -10486,7 +10211,7 @@ const conversationCursorPayloadSchema = z.object({
|
|
|
10486
10211
|
version: z.literal(1)
|
|
10487
10212
|
}).strict();
|
|
10488
10213
|
function cursorSecret() {
|
|
10489
|
-
const secret =
|
|
10214
|
+
const secret = getChatConfig().secrets.juniorSecret;
|
|
10490
10215
|
if (!secret) throw new Error("Cannot sign conversation cursor without JUNIOR_SECRET");
|
|
10491
10216
|
return secret;
|
|
10492
10217
|
}
|
|
@@ -10551,7 +10276,6 @@ async function requireWebMessageConversation(viewer, conversationId, idempotency
|
|
|
10551
10276
|
if (!acceptsWebMessages(conversation)) throwApiError(409, "Conversation does not accept web messages.");
|
|
10552
10277
|
const access = await readConversationAccessFromSql(getDb(), [conversationId], viewer);
|
|
10553
10278
|
if (!canAddConversationMessages(access.get(conversationId))) throwApiError(403, "Only participants can add messages to a private conversation.");
|
|
10554
|
-
if (messagesNeedSpaceMembership(conversation.kind) && conversation.spaceId) await requireSpaceForWork(viewer, conversation.spaceId);
|
|
10555
10279
|
return conversationId;
|
|
10556
10280
|
}
|
|
10557
10281
|
function actorFromViewer(viewer) {
|
|
@@ -10563,6 +10287,7 @@ async function createConversationForViewer(viewer, body, services) {
|
|
|
10563
10287
|
const space = body.spaceId ? await requireSpaceForWork(viewer, body.spaceId) : void 0;
|
|
10564
10288
|
if (space && body.visibility && body.visibility !== space.visibility) throwApiError(400, `A conversation in this Space is ${space.visibility}.`);
|
|
10565
10289
|
const visibility = space?.visibility ?? body.visibility;
|
|
10290
|
+
const lead = space ? await getSpaceLead(space.id) : void 0;
|
|
10566
10291
|
const uploads = await verifyUploads({
|
|
10567
10292
|
conversationId: await requireWebMessageConversation(viewer, void 0, body.idempotencyKey),
|
|
10568
10293
|
idempotencyKey: body.idempotencyKey,
|
|
@@ -10577,7 +10302,7 @@ async function createConversationForViewer(viewer, body, services) {
|
|
|
10577
10302
|
uploads,
|
|
10578
10303
|
...body.title ? { title: body.title } : void 0,
|
|
10579
10304
|
...visibility ? { visibility } : void 0,
|
|
10580
|
-
...
|
|
10305
|
+
...lead ? { leadConversationId: lead.conversationId } : void 0
|
|
10581
10306
|
}, {
|
|
10582
10307
|
conversationStore: getConversationStore(),
|
|
10583
10308
|
attachmentStorage: services.attachmentStorage,
|
|
@@ -10586,7 +10311,6 @@ async function createConversationForViewer(viewer, body, services) {
|
|
|
10586
10311
|
} catch (error) {
|
|
10587
10312
|
throwApiError(500, "Unable to create conversation.", error);
|
|
10588
10313
|
}
|
|
10589
|
-
await inviteMentionedPeople(viewer, accepted.conversationId, body.message);
|
|
10590
10314
|
return accepted;
|
|
10591
10315
|
}
|
|
10592
10316
|
/** Append one viewer message to an existing conversation. */
|
|
@@ -10611,7 +10335,6 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
10611
10335
|
queue: services.queue
|
|
10612
10336
|
});
|
|
10613
10337
|
const applyAccepted = async () => {
|
|
10614
|
-
await inviteMentionedPeople(viewer, conversationId, body.message);
|
|
10615
10338
|
await closeInboxItemsAnsweredByReply({
|
|
10616
10339
|
conversationId,
|
|
10617
10340
|
delivery: {
|
|
@@ -11511,11 +11234,12 @@ function viewerStateVersion(db, conversationId, viewerId) {
|
|
|
11511
11234
|
const versionSpaceConversation = alias(juniorConversations, "version_space_conversation");
|
|
11512
11235
|
const versionSpaceRoot = alias(juniorConversations, "version_space_root");
|
|
11513
11236
|
/**
|
|
11514
|
-
* Hash the root's Space. A move
|
|
11515
|
-
*
|
|
11237
|
+
* Hash the root's Space. A move and a rename write only the root, the Lead
|
|
11238
|
+
* whose title is the Space's name, so a child's token reads both through
|
|
11239
|
+
* its root.
|
|
11516
11240
|
*/
|
|
11517
11241
|
function rootSpaceVersion(db, conversationId) {
|
|
11518
|
-
const space = db.select({ state: sql`md5(concat_ws(':', ${versionSpaceRoot.spaceId}, ${
|
|
11242
|
+
const space = db.select({ state: sql`md5(concat_ws(':', ${versionSpaceRoot.spaceId}, ${versionSpaceRoot.title}))` }).from(versionSpaceConversation).innerJoin(versionSpaceRoot, eq(versionSpaceRoot.conversationId, sql`coalesce(${versionSpaceConversation.rootConversationId}, ${versionSpaceConversation.conversationId})`)).where(eq(versionSpaceConversation.conversationId, conversationId));
|
|
11519
11243
|
return sql`coalesce((${space}), '')`;
|
|
11520
11244
|
}
|
|
11521
11245
|
/**
|
|
@@ -11568,11 +11292,11 @@ async function readDetailStateRow(conversationId, viewer) {
|
|
|
11568
11292
|
pinnedAt: juniorConversationParticipants.pinnedAt,
|
|
11569
11293
|
pinPosition: juniorConversationParticipants.pinPosition,
|
|
11570
11294
|
rootConversationId,
|
|
11571
|
-
spaceId:
|
|
11572
|
-
spaceName:
|
|
11295
|
+
spaceId: spaceRoot.spaceId,
|
|
11296
|
+
spaceName: spaceRoot.title,
|
|
11573
11297
|
unsubscribedAt: juniorConversationParticipants.unsubscribedAt,
|
|
11574
11298
|
version: sql`(${conversationVersionQuery(db, conversationId, viewer?.id)})`
|
|
11575
|
-
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).leftJoin(forkSource, eq(forkSource.conversationId, juniorConversations.forkedFromConversationId)).leftJoin(spaceRoot, eq(spaceRoot.conversationId, rootConversationId)).leftJoin(
|
|
11299
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).leftJoin(forkSource, eq(forkSource.conversationId, juniorConversations.forkedFromConversationId)).leftJoin(spaceRoot, eq(spaceRoot.conversationId, rootConversationId)).leftJoin(juniorConversationParticipants, viewerParticipant).leftJoin(detailViewer, viewer ? eq(detailViewer.id, viewer.id) : sql`false`).where(eq(juniorConversations.conversationId, conversationId));
|
|
11576
11300
|
return row;
|
|
11577
11301
|
}
|
|
11578
11302
|
async function readDetailState(conversationId, viewer, readAccess) {
|
|
@@ -11604,7 +11328,7 @@ async function readDetailState(conversationId, viewer, readAccess) {
|
|
|
11604
11328
|
...viewer ? { autoArchive: row?.autoArchive ?? row?.autoArchiveDefault ?? false } : void 0,
|
|
11605
11329
|
forks,
|
|
11606
11330
|
...row?.lastReadSeq != null ? { readPosition: { lastReadSeq: row.lastReadSeq } } : void 0,
|
|
11607
|
-
space: row?.spaceId && row.spaceName &&
|
|
11331
|
+
space: row?.spaceId && row.spaceName && access?.canViewPrivateContent ? {
|
|
11608
11332
|
id: row.spaceId,
|
|
11609
11333
|
name: row.spaceName
|
|
11610
11334
|
} : null,
|
|
@@ -11986,11 +11710,10 @@ function needsUserSql(userId) {
|
|
|
11986
11710
|
* Conversation and every child Conversation at any depth. When more than
|
|
11987
11711
|
* one applies:
|
|
11988
11712
|
*
|
|
11989
|
-
* - `needs_you`: the tree's `needs_input` includes the viewer.
|
|
11990
|
-
* item
|
|
11991
|
-
*
|
|
11992
|
-
*
|
|
11993
|
-
* shown.
|
|
11713
|
+
* - `needs_you`: the tree's `needs_input` includes the viewer. An Inbox
|
|
11714
|
+
* item, a sign-in wait, or a wait on the starter anywhere in the tree
|
|
11715
|
+
* counts when it waits on the viewer. Input that waits on another person
|
|
11716
|
+
* is not shown.
|
|
11994
11717
|
* - `working`: a Turn is queued or running anywhere in the tree.
|
|
11995
11718
|
* - `done`: anything else.
|
|
11996
11719
|
*
|
|
@@ -12010,7 +11733,7 @@ function needsUserSql(userId) {
|
|
|
12010
11733
|
async function readConversationTreeStates(db, conversationIds, viewerUserId) {
|
|
12011
11734
|
if (conversationIds.length === 0) return /* @__PURE__ */ new Map();
|
|
12012
11735
|
const scopeId = conversationSubtreeColumns.scopeConversationId;
|
|
12013
|
-
const needsViewer = viewerUserId ? sql`bool_or(${needsUserSql(viewerUserId)} or
|
|
11736
|
+
const needsViewer = viewerUserId ? sql`bool_or(${needsUserSql(viewerUserId)} or ${conversationWaitsOnUserSql(juniorConversations, viewerUserId)})` : sql`false`;
|
|
12014
11737
|
const rows = await db.select({
|
|
12015
11738
|
conversationId: scopeId,
|
|
12016
11739
|
needsViewer,
|
|
@@ -12201,16 +11924,17 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
12201
11924
|
name: "Project conversation detail",
|
|
12202
11925
|
op: "function"
|
|
12203
11926
|
}, () => projectConversationDetail(detail));
|
|
11927
|
+
const isRoot = access?.rootConversationId === conversationId;
|
|
12204
11928
|
return {
|
|
12205
11929
|
...report,
|
|
12206
11930
|
...state.forks,
|
|
12207
11931
|
...treeStateByConversation.get(conversationId),
|
|
12208
11932
|
...agentTree ? { agentTree } : void 0,
|
|
12209
11933
|
...report.isParticipant && state.autoArchive !== void 0 ? { autoArchive: state.autoArchive } : void 0,
|
|
12210
|
-
...report.isParticipant
|
|
11934
|
+
...isRoot && (report.isParticipant ? state.subscribed !== void 0 : access?.visibility === "public") ? { subscribed: report.isParticipant && state.subscribed === true } : void 0,
|
|
12211
11935
|
...canContinueInSlack(record.conversation, access) ? { canContinueInSlack: true } : void 0,
|
|
12212
11936
|
...canInviteToConversation(access) ? { canInvite: true } : void 0,
|
|
12213
|
-
...leaveEndsAccess(access) ? { leaveEndsAccess: true } : void 0,
|
|
11937
|
+
...isRoot && leaveEndsAccess(access) ? { leaveEndsAccess: true } : void 0,
|
|
12214
11938
|
...report.isParticipant && canPauseConversationDelivery(record.conversation) ? { deliveryPaused: record.conversation.deliveryPausedAtMs !== void 0 } : void 0
|
|
12215
11939
|
};
|
|
12216
11940
|
}
|
|
@@ -12229,54 +11953,65 @@ async function readConversationDetail(conversationId, options = {}) {
|
|
|
12229
11953
|
} : { limit: options.limit }
|
|
12230
11954
|
});
|
|
12231
11955
|
}
|
|
12232
|
-
// src/
|
|
12233
|
-
/**
|
|
12234
|
-
*
|
|
12235
|
-
*
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
11956
|
+
// src/api/inbox-items/resolve-subjects.ts
|
|
11957
|
+
/**
|
|
11958
|
+
* Read the link and card of each item subject that has a link, such as a
|
|
11959
|
+
* pull request, for one viewer and one page of items, by `subjectKey`. A
|
|
11960
|
+
* link type that can read many objects at once reads the page with one
|
|
11961
|
+
* call, such as one GitHub GraphQL query. A subject whose card cannot be
|
|
11962
|
+
* read, such as when its provider is down, has only its link: the Inbox
|
|
11963
|
+
* then shows the item's own title and the label of its kind.
|
|
11964
|
+
*/
|
|
11965
|
+
async function resolveInboxItemSubjects(viewer, items) {
|
|
11966
|
+
const links = await readSubjectLinks(getDb(), items);
|
|
11967
|
+
if (links.size === 0) return /* @__PURE__ */ new Map();
|
|
11968
|
+
const cards = new Map((await resolveObjectLinks(viewer, [...new Set(links.values())])).map(({ object, url }) => [url, object]));
|
|
11969
|
+
return new Map([...links].map(([key, url]) => {
|
|
11970
|
+
const object = cards.get(url);
|
|
11971
|
+
return [key, {
|
|
11972
|
+
url,
|
|
11973
|
+
...object ? { object } : void 0
|
|
11974
|
+
}];
|
|
11975
|
+
}));
|
|
12247
11976
|
}
|
|
12248
11977
|
// src/api/conversations/threads.ts
|
|
12249
11978
|
/**
|
|
12250
|
-
* Find where a Thread nests: its nearest ancestor that is a listed
|
|
12251
|
-
* Thread. A Thread under a Task moves up.
|
|
12252
|
-
* is archived, because an archive hides
|
|
11979
|
+
* Find where a Thread nests: its nearest ancestor that is a listed row or a
|
|
11980
|
+
* Thread, and the listed row above it. A Thread under a Task moves up.
|
|
11981
|
+
* Returns undefined when an ancestor is archived, because an archive hides
|
|
11982
|
+
* its whole subtree.
|
|
12253
11983
|
*/
|
|
12254
11984
|
function findThreadPlacement(threadId, tree, rootIds) {
|
|
12255
11985
|
let placement;
|
|
12256
11986
|
for (const ancestor of conversationAncestors(tree, threadId)) {
|
|
12257
|
-
if (rootIds.has(ancestor.conversationId)) return
|
|
11987
|
+
if (rootIds.has(ancestor.conversationId)) return {
|
|
11988
|
+
listedId: ancestor.conversationId,
|
|
11989
|
+
parentId: placement ?? ancestor.conversationId
|
|
11990
|
+
};
|
|
12258
11991
|
if (ancestor.archivedAt) return void 0;
|
|
12259
11992
|
if (isThread(ancestor)) placement ??= ancestor.conversationId;
|
|
12260
11993
|
}
|
|
12261
11994
|
}
|
|
12262
11995
|
/**
|
|
12263
|
-
* Read the stored Threads
|
|
12264
|
-
* read-time titles
|
|
12265
|
-
* feed reads. The caller passes only unarchived roots, so a root archive
|
|
11996
|
+
* Read the stored Threads under the listed rows for the feed, with their
|
|
11997
|
+
* read-time titles and each Thread's tree state for the viewer. It needs
|
|
11998
|
+
* no access, so it can start with the other feed reads. The caller passes only unarchived roots, so a root archive
|
|
12266
11999
|
* hides its tree with no writes to the children.
|
|
12267
12000
|
*/
|
|
12268
|
-
async function readFeedThreadRecords(db, rootIds) {
|
|
12001
|
+
async function readFeedThreadRecords(db, rootIds, viewerUserId) {
|
|
12269
12002
|
if (rootIds.length === 0) return void 0;
|
|
12270
|
-
const rows = await selectConversationRecords(db).
|
|
12003
|
+
const rows = await selectConversationRecords(db).innerJoin(conversationSubtree(rootIds), eq(conversationSubtreeColumns.conversationId, juniorConversations.conversationId)).where(and(eq(juniorConversations.kind, "thread"), isNotNull(juniorConversations.parentConversationId), not(topLevelConversation()), isNull(juniorConversations.archivedAt))).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId));
|
|
12271
12004
|
if (rows.length === 0) return void 0;
|
|
12272
12005
|
const threads = rows.map((row) => ({
|
|
12273
12006
|
conversation: conversationFromRecordRow(row),
|
|
12274
12007
|
row
|
|
12275
12008
|
}));
|
|
12009
|
+
const [firstHumanMessageTexts, treeStates] = await Promise.all([readFirstHumanMessageTexts(db, threads.map(({ conversation }) => conversation)), readConversationTreeStates(db, threads.map(({ conversation }) => conversation.conversationId), viewerUserId)]);
|
|
12276
12010
|
return {
|
|
12277
|
-
firstHumanMessageTexts
|
|
12011
|
+
firstHumanMessageTexts,
|
|
12278
12012
|
rootIds: new Set(rootIds),
|
|
12279
|
-
threads
|
|
12013
|
+
threads,
|
|
12014
|
+
treeStates
|
|
12280
12015
|
};
|
|
12281
12016
|
}
|
|
12282
12017
|
/**
|
|
@@ -12289,16 +12024,16 @@ async function readFeedThreadRecords(db, rootIds) {
|
|
|
12289
12024
|
*/
|
|
12290
12025
|
function nestFeedThreads(records, tree, accessByRoot) {
|
|
12291
12026
|
if (!records) return /* @__PURE__ */ new Map();
|
|
12292
|
-
const { firstHumanMessageTexts, rootIds, threads } = records;
|
|
12027
|
+
const { firstHumanMessageTexts, rootIds, threads, treeStates } = records;
|
|
12293
12028
|
const childrenByParent = /* @__PURE__ */ new Map();
|
|
12294
12029
|
const placedByRoot = /* @__PURE__ */ new Map();
|
|
12295
12030
|
for (const { conversation, row } of threads) {
|
|
12296
|
-
const
|
|
12297
|
-
if (!
|
|
12298
|
-
const
|
|
12299
|
-
|
|
12031
|
+
const placement = findThreadPlacement(conversation.conversationId, tree, rootIds);
|
|
12032
|
+
if (!placement) continue;
|
|
12033
|
+
const { listedId, parentId } = placement;
|
|
12034
|
+
placedByRoot.set(listedId, (placedByRoot.get(listedId) ?? 0) + 1);
|
|
12300
12035
|
const summary = conversationSummaryFromStoredConversation({
|
|
12301
|
-
access:
|
|
12036
|
+
access: accessByRoot.get(listedId),
|
|
12302
12037
|
conversation,
|
|
12303
12038
|
durationMs: row.conversation.durationMs,
|
|
12304
12039
|
firstHumanMessageText: firstHumanMessageTexts.get(conversation.conversationId),
|
|
@@ -12306,7 +12041,10 @@ function nestFeedThreads(records, tree, accessByRoot) {
|
|
|
12306
12041
|
...row.conversation.usage ? { usage: row.conversation.usage } : void 0
|
|
12307
12042
|
});
|
|
12308
12043
|
const siblings = childrenByParent.get(parentId) ?? [];
|
|
12309
|
-
siblings.push(
|
|
12044
|
+
siblings.push({
|
|
12045
|
+
...summary,
|
|
12046
|
+
...treeStates.get(conversation.conversationId)
|
|
12047
|
+
});
|
|
12310
12048
|
childrenByParent.set(parentId, siblings);
|
|
12311
12049
|
}
|
|
12312
12050
|
const nest = (items, budget) => items.flatMap((item) => {
|
|
@@ -12331,59 +12069,6 @@ function nestFeedThreads(records, tree, accessByRoot) {
|
|
|
12331
12069
|
}]];
|
|
12332
12070
|
}));
|
|
12333
12071
|
}
|
|
12334
|
-
// src/chat/inbox-items/waiting.ts
|
|
12335
|
-
const waitingRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItemConversations.conversationId})`.as("waiting_root_id");
|
|
12336
|
-
const waitingTodoRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItems.ownerId})`.as("waiting_root_id");
|
|
12337
|
-
/** Open items that need the User now, with the root where each one waits. */
|
|
12338
|
-
function waitingItemsQuery(db, userId) {
|
|
12339
|
-
const columns = {
|
|
12340
|
-
createdAt: juniorInboxItems.createdAt,
|
|
12341
|
-
dedupeKey: juniorInboxItems.dedupeKey,
|
|
12342
|
-
itemId: juniorInboxItems.id,
|
|
12343
|
-
title: juniorInboxItems.title
|
|
12344
|
-
};
|
|
12345
|
-
return db.select({
|
|
12346
|
-
conversationId: waitingRootId,
|
|
12347
|
-
...columns
|
|
12348
|
-
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorInboxItemConversations.conversationId)).where(inboxItemNeedsUserNow(userId)).union(db.select({
|
|
12349
|
-
conversationId: waitingTodoRootId,
|
|
12350
|
-
...columns
|
|
12351
|
-
}).from(juniorInboxItems).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorInboxItems.ownerId)).where(and(inboxItemNeedsUserNow(userId), eq(juniorInboxItems.ownerKind, "conversation"), like(juniorInboxItems.dedupeKey, `${TODO_INBOX_ITEM_KEY_PREFIX}%`))));
|
|
12352
|
-
}
|
|
12353
|
-
/**
|
|
12354
|
-
* Return a query for the ids of the root Conversations that wait on a User,
|
|
12355
|
-
* as `listWaitingConversations` lists them, to filter another query by.
|
|
12356
|
-
*/
|
|
12357
|
-
function waitingConversationIdsQuery(db, userId) {
|
|
12358
|
-
const items = waitingItemsQuery(db, userId).as("waiting_items");
|
|
12359
|
-
return db.select({ conversationId: items.conversationId }).from(items);
|
|
12360
|
-
}
|
|
12361
|
-
/**
|
|
12362
|
-
* List the root Conversations that wait on a User: each root or one of its
|
|
12363
|
-
* child conversations is linked to, or owns a To-do's, open item that needs
|
|
12364
|
-
* the User now (`inboxItemNeedsUserNow`), so a snoozed item leaves it out.
|
|
12365
|
-
*/
|
|
12366
|
-
async function listWaitingConversations(db, userId) {
|
|
12367
|
-
const rows = (await waitingItemsQuery(db, userId)).sort((left, right) => right.createdAt.getTime() - left.createdAt.getTime() || right.itemId.localeCompare(left.itemId));
|
|
12368
|
-
const waiting = /* @__PURE__ */ new Map();
|
|
12369
|
-
for (const row of rows) {
|
|
12370
|
-
const plugin = inboxItemPlugin(row.dedupeKey);
|
|
12371
|
-
const item = {
|
|
12372
|
-
title: row.title,
|
|
12373
|
-
...plugin ? { plugin } : void 0
|
|
12374
|
-
};
|
|
12375
|
-
const current = waiting.get(row.conversationId);
|
|
12376
|
-
if (current) {
|
|
12377
|
-
current.items.push(item);
|
|
12378
|
-
current.waitingSince = row.createdAt.toISOString();
|
|
12379
|
-
} else waiting.set(row.conversationId, {
|
|
12380
|
-
conversationId: row.conversationId,
|
|
12381
|
-
items: [item],
|
|
12382
|
-
waitingSince: row.createdAt.toISOString()
|
|
12383
|
-
});
|
|
12384
|
-
}
|
|
12385
|
-
return [...waiting.values()].sort((left, right) => left.conversationId.localeCompare(right.conversationId));
|
|
12386
|
-
}
|
|
12387
12072
|
// src/api/conversations/priority.ts
|
|
12388
12073
|
/** Conversations with no known work leave Priority after this idle window. */
|
|
12389
12074
|
const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
|
|
@@ -12533,7 +12218,7 @@ function feedMediaSql(db) {
|
|
|
12533
12218
|
* closed since.
|
|
12534
12219
|
*/
|
|
12535
12220
|
function feedViewerAnswerSql(db, userId) {
|
|
12536
|
-
const latest = db.select({ answer: sql`jsonb_build_object('answer', ${
|
|
12221
|
+
const latest = db.select({ answer: sql`jsonb_build_object('answer', ${inboxItemAnswer}, 'closedAt', ${juniorInboxItems.closedAt}, 'request', ${inboxItemRequest})` }).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(inboxItemOwnedByConversation(juniorConversations.conversationId), eq(juniorInboxItems.closedByUserId, userId), isNotNull(inboxItemAnswer), isNotNull(inboxItemRequest))).orderBy(desc(juniorInboxItems.closedAt), desc(juniorInboxItems.id)).limit(1);
|
|
12537
12222
|
return sql`(${latest})`;
|
|
12538
12223
|
}
|
|
12539
12224
|
/**
|
|
@@ -12590,30 +12275,25 @@ function feedMember(filter) {
|
|
|
12590
12275
|
function conversationFeedMembershipFilter(status, filter) {
|
|
12591
12276
|
if (!filter) return status === "archived" ? sql`false` : void 0;
|
|
12592
12277
|
const member = feedMember(filter);
|
|
12593
|
-
return and(conversationIsMemberRoot(member),
|
|
12278
|
+
return and(conversationIsMemberRoot(member), status === "archived" ? isNotNull(juniorConversations.archivedAt) : status === "all" ? void 0 : and(isNull(juniorConversations.archivedAt), conversationIsNotUnsubscribedRoot(member)));
|
|
12594
12279
|
}
|
|
12595
12280
|
/**
|
|
12596
|
-
* Keep
|
|
12597
|
-
* link a child conversation, so linked ids resolve to their
|
|
12598
|
-
* roots stay visible only to
|
|
12281
|
+
* Keep top-level conversations linked to one code repository. A code change
|
|
12282
|
+
* can link a child conversation, so linked ids resolve to their ancestors,
|
|
12283
|
+
* and the list keeps the top-level one. Private roots stay visible only to
|
|
12284
|
+
* their members.
|
|
12599
12285
|
*/
|
|
12600
12286
|
function conversationCodeRepositoryFilter(repositoryId, viewerUserId) {
|
|
12601
|
-
return and(sql`${juniorConversations.conversationId} IN (
|
|
12602
|
-
SELECT coalesce(linked.root_conversation_id, linked.conversation_id)
|
|
12603
|
-
FROM ${juniorConversations} AS linked
|
|
12604
|
-
WHERE linked.conversation_id IN (
|
|
12605
|
-
SELECT unnest(${juniorCodeChanges.conversationIds})
|
|
12287
|
+
return and(sql`${juniorConversations.conversationId} IN ${conversationAncestorsOrSelf(sql`SELECT unnest(${juniorCodeChanges.conversationIds})
|
|
12606
12288
|
FROM ${juniorCodeChanges}
|
|
12607
|
-
WHERE ${juniorCodeChanges.repositoryId} = ${repositoryId}
|
|
12608
|
-
)
|
|
12609
|
-
)`, rootVisibleToViewer(viewerUserId));
|
|
12289
|
+
WHERE ${juniorCodeChanges.repositoryId} = ${repositoryId}`)}`, rootVisibleToViewer(viewerUserId));
|
|
12610
12290
|
}
|
|
12611
12291
|
/**
|
|
12612
|
-
* Keep the
|
|
12613
|
-
* private Space shows its
|
|
12292
|
+
* Keep the Lead's children in one Space with the status that the viewer may
|
|
12293
|
+
* find. A private Space shows its work only to its members.
|
|
12614
12294
|
*/
|
|
12615
12295
|
function conversationSpaceFilter(spaceId, status, viewerUserId) {
|
|
12616
|
-
return and(
|
|
12296
|
+
return and(inArray(juniorConversations.parentConversationId, spaceLeadIds(spaceId)), status === "archived" ? isNotNull(juniorConversations.archivedAt) : status === "active" ? isNull(juniorConversations.archivedAt) : void 0, rootVisibleToViewer(viewerUserId));
|
|
12617
12297
|
}
|
|
12618
12298
|
async function conversationRows(db, { codeRepository, conversationIds, cursor, filter, include = [], includePrivateMatches = false, limit, pinnedForUserId, query, space, status, waitingForUserId }) {
|
|
12619
12299
|
const rows = db.select({
|
|
@@ -12628,16 +12308,15 @@ async function conversationRows(db, { codeRepository, conversationIds, cursor, f
|
|
|
12628
12308
|
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(listedConversation(), space ? conversationSpaceFilter(space.id, status, space.viewerUserId) : conversationFeedMembershipFilter(status, filter), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, waitingForUserId ? inArray(juniorConversations.conversationId, waitingConversationIdsQuery(db, waitingForUserId)) : void 0, pinnedForUserId ? pinnedForUserId.pinned ? conversationPinnedForUser(pinnedForUserId.userId) : not(conversationPinnedForUser(pinnedForUserId.userId)) : void 0, cursor ? sql`(${juniorConversations.lastActivityAt} < ${cursor.at}::timestamptz or (${juniorConversations.lastActivityAt} = ${cursor.at}::timestamptz and ${juniorConversations.conversationId} > ${cursor.conversationId}))` : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, and(includePrivateMatches ? void 0 : isPublicConversation(juniorConversations), sql`${conversationSearchVector} @@ websearch_to_tsquery('english', ${query})`), annotationMatch(db, query, includePrivateMatches)) : void 0)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).$dynamic();
|
|
12629
12309
|
return limit === void 0 ? rows : rows.limit(limit);
|
|
12630
12310
|
}
|
|
12631
|
-
const searchAnnotated = alias(juniorConversations, "search_annotated");
|
|
12632
12311
|
/**
|
|
12633
|
-
* Match a
|
|
12634
|
-
* title, such as `getsentry/roach#12`. The feed shows the
|
|
12635
|
-
* the whole tree, so search reads the same rows. Private
|
|
12636
|
-
* only where the feed shows them.
|
|
12312
|
+
* Match a top-level Conversation whose tree has an Annotation with the text
|
|
12313
|
+
* in its label or title, such as `getsentry/roach#12`. The feed shows the
|
|
12314
|
+
* annotations of the whole tree, so search reads the same rows. Private
|
|
12315
|
+
* annotations match only where the feed shows them.
|
|
12637
12316
|
*/
|
|
12638
12317
|
function annotationMatch(db, query, includePrivate) {
|
|
12639
12318
|
const annotation = juniorConversationAnnotations.annotation;
|
|
12640
|
-
return
|
|
12319
|
+
return and(includePrivate ? void 0 : isPublicConversation(juniorConversations), sql`${juniorConversations.conversationId} IN ${conversationAncestorsOrSelf(sql`${db.select({ conversationId: juniorConversationAnnotations.conversationId }).from(juniorConversationAnnotations).where(sql`strpos(lower(concat_ws(' ', ${annotation}->>'label', ${annotation}->>'title')), ${query}) > 0`)}`)}`);
|
|
12641
12320
|
}
|
|
12642
12321
|
/**
|
|
12643
12322
|
* Feed rows show last activity only as an age in whole minutes. A running
|
|
@@ -12687,6 +12366,7 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
12687
12366
|
then concat('active:', ${ownedItemsVersion(row.conversationId)})
|
|
12688
12367
|
else ${row.detailVersion}::text
|
|
12689
12368
|
end`;
|
|
12369
|
+
const feedRowTreeRoot = sql`coalesce(${juniorConversations.rootConversationId}, ${conversationId})`;
|
|
12690
12370
|
const child = sql`${feedTree.conversationId} <> ${conversationId}`;
|
|
12691
12371
|
const active = conversationIsActiveSql(feedTree);
|
|
12692
12372
|
const tree = db.select({ version: sql`concat_ws(':',
|
|
@@ -12701,8 +12381,8 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
12701
12381
|
where ${child} and ${active} and ${feedTree.kind} = 'thread'
|
|
12702
12382
|
)),
|
|
12703
12383
|
count(*) filter (where ${hasUnexpiredAuthorizationRequest(feedTree.conversationId)})
|
|
12704
|
-
)` }).from(feedTree).where(or(eq(feedTree.conversationId, conversationId), eq(feedTree.rootConversationId,
|
|
12705
|
-
const annotations = db.select({ version: sql`concat_ws(':', count(*), max(${juniorConversationAnnotations.updatedAt}))` }).from(juniorConversationAnnotations).innerJoin(feedAnnotated, eq(feedAnnotated.conversationId, juniorConversationAnnotations.conversationId)).where(eq(feedAnnotated.rootConversationId,
|
|
12384
|
+
)` }).from(feedTree).where(or(eq(feedTree.conversationId, conversationId), eq(feedTree.rootConversationId, feedRowTreeRoot)));
|
|
12385
|
+
const annotations = db.select({ version: sql`concat_ws(':', count(*), max(${juniorConversationAnnotations.updatedAt}))` }).from(juniorConversationAnnotations).innerJoin(feedAnnotated, eq(feedAnnotated.conversationId, juniorConversationAnnotations.conversationId)).where(eq(feedAnnotated.rootConversationId, feedRowTreeRoot));
|
|
12706
12386
|
const page = db.select({
|
|
12707
12387
|
conversationId,
|
|
12708
12388
|
channelName: juniorConversations.channelName,
|
|
@@ -12827,11 +12507,12 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12827
12507
|
}
|
|
12828
12508
|
const conversations = rows.map((row) => conversationFromRecordRow(row));
|
|
12829
12509
|
const conversationIds = conversations.map((conversation) => conversation.conversationId);
|
|
12510
|
+
const rootConversationIds = [...new Set(conversations.map((conversation) => conversation.rootConversationId ?? conversation.conversationId))];
|
|
12830
12511
|
const conversationTrees = readConversationTrees(db, conversationIds);
|
|
12831
12512
|
const [accessRows, tree, participantsByRoot, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation, treeStateByConversation, threadRecords, spaceRefs] = await Promise.all([
|
|
12832
12513
|
readConversationAccessRows(db, conversationIds),
|
|
12833
12514
|
conversationTrees,
|
|
12834
|
-
readMemberParticipants(db,
|
|
12515
|
+
readMemberParticipants(db, rootConversationIds, options.viewer ? { userId: options.viewer.id } : filter ? feedMember(filter) : void 0),
|
|
12835
12516
|
listConversationAnnotationsById(db, conversationIds),
|
|
12836
12517
|
readConversationAuxiliaryCostsFromSql(db, conversationIds),
|
|
12837
12518
|
readConversationTreeMetricsFromSql(db, conversationIds),
|
|
@@ -12845,11 +12526,10 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12845
12526
|
readAutomationTitlesByConversationId(conversations),
|
|
12846
12527
|
readFirstHumanMessageTexts(db, conversations),
|
|
12847
12528
|
readConversationTreeStates(db, conversationIds, options.viewer?.id),
|
|
12848
|
-
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0).map(({ conversationId }) => conversationId)),
|
|
12529
|
+
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0).map(({ conversationId }) => conversationId), options.viewer?.id),
|
|
12849
12530
|
readSpaceRefs(db, conversations.flatMap(({ spaceId }) => spaceId ? [spaceId] : []))
|
|
12850
12531
|
]);
|
|
12851
|
-
const
|
|
12852
|
-
const accessByConversation = conversationAccessFromRows(accessRows, options.viewer ? new Set(participantsByRoot.keys()) : /* @__PURE__ */ new Set(), memberSpaceIds);
|
|
12532
|
+
const accessByConversation = conversationAccessFromRows(accessRows, options.viewer ? new Set(participantsByRoot.keys()) : /* @__PURE__ */ new Set());
|
|
12853
12533
|
const tenantByConversation = new Map(rows.flatMap((row) => {
|
|
12854
12534
|
const tenantId = conversationSlackTenantId({
|
|
12855
12535
|
provider: row.location?.provider,
|
|
@@ -12876,7 +12556,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12876
12556
|
automationTitle: automationTitleByConversation.get(conversation.conversationId),
|
|
12877
12557
|
conversation,
|
|
12878
12558
|
access,
|
|
12879
|
-
space: conversation.spaceId &&
|
|
12559
|
+
space: conversation.spaceId && access?.canViewPrivateContent ? spaceRefs.get(conversation.spaceId) ?? null : null,
|
|
12880
12560
|
auxiliaryCosts: auxiliaryCosts?.total,
|
|
12881
12561
|
...childAgentTotals ? { childAgentTotals } : void 0,
|
|
12882
12562
|
durationMs: metrics?.durationMs ?? row.conversation.durationMs,
|
|
@@ -12940,4 +12620,4 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12940
12620
|
async function readConversationFeed(options = {}) {
|
|
12941
12621
|
return readConversationFeedFromSql(options);
|
|
12942
12622
|
}
|
|
12943
|
-
export {
|
|
12623
|
+
export { reviewItemChange as $, setConversationSubscriptionOperation as A, createProductionSlackWebhookServices as At, mcpIdempotencyKeySchema as B, startProcessingReaction as Bt, cancelQueuedMessagesOperation as C, resolveObjectLinkNow as Ct, renameConversationOperation as D, isPublicAddress as Dt, pinConversationOperation as E, guardedFetch as Et, mcpAuthorizationSchema as F, normalizeIncomingSlackThreadId as Ft, readMcpPendingWork as G, resolvePersonLink as Gt, mcpMessageTextSchema as H, parseContent as Ht, mcpConversation as I, withNormalizedThreadId as It, resolveMentions as J, readFirstHumanMessageTexts as Jt, readMcpPendingWorkAfterSend as K, readConversationRecordFromSql as Kt, mcpConversationIdSchema as L, recordSkippedConversationMessage as Lt, reorderPinnedConversations as M, buildSlackInboundMessage as Mt, apiOperationHandler as N, clearSlackPendingReactions as Nt, setConversationAutoArchiveOperation as O, publicAddressLookup as Ot, mcpAcceptedMessageSchema as P, slackInboundMessageId as Pt, readInboxItemForUser as Q, mcpConversationSchema as R, createSlackWebApiStatusSender as Rt, archiveDoneConversationsOperation as S, readObjectLinkTypes as St, leaveConversationOperation as T, viewerCanViewPluginLink as Tt, mcpMessages as U, SubscribedReplyReason as Ut, mcpMessageSchema as V, stripLeadingBotMention as Vt, mcpPendingMessagesSchema as W, getThreadStopDecision as Wt, actOnInboxItem as X, IMAGE_WIDTHS as Xt, InboxItemActionError as Y, createViewerMcp as Yt, closeInboxItemsAnsweredByReply as Z, decodeImageId as Zt, createConversationForViewer as _, backfillCacheWarmingGaps as _t, resolveInboxItemSubjects as a, updateUserSettings as at, encodeConversationCursor as b, OBJECT_LINK_TTL_MS as bt, readConversationAuxiliaryCostsFromSql as c, listOpenAutomationQuestions as ct, conversationVersionsQuery as d, getScheduledAutomationDispatch as dt, createEventAppPublisher as et, readConversationDetailEtag as f, runInboxSnoozeTimers as ft, appendConversationMessageForViewer as g, startSavingsRefill as gt, readConversationEvents as h, runSavingsRefillSlice as ht, encodePageCursor as i, readUserSettings as it, stopConversationOperation as j, getProductionSlackAdapter as jt, setConversationSpaceOperation as k, createProductionConversationWorkOptions as kt, childAgentTotalsReport as l, createHeartbeatContext as lt, keepQuickQuestionForViewer as m, readSavingsRefill as mt, readConversationFeed as n, runAutoArchiveSweep as nt, readConversationDetail as o, automationReplyAttribution as ot, forkConversationForViewer as p, scheduleInboxSnoozeTimer as pt, requireConversationPendingMessages as q, conversationSummaryFromStoredConversation as qt, decodePageCursor as r, DEFAULT_USER_SETTINGS as rt, readConversationTreeStates as s, settleEventAutomationRuns as st, conversationFeedVersionQuery as t, ingestEventAutomations as tt, readConversationTreeMetricsFromSql as u, dispatchScheduledAutomation as ut, requireWebMessageConversation as v, GET as vt, conversationOperations as w, resolveObjectLinks as wt, archiveConversationOperation as x, readLinkObjectType as xt, decodeConversationCursor as y, readHealthReport as yt, mcpCursorSchema as z, bindMessageAuthorIdentityId as zt };
|