@sentry/junior 0.313.0 → 0.314.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
- package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
- package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
- package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
- package/dist/agent-update-cS7Z9mnG.js +26 -0
- package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +334 -100
- package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
- package/dist/app.d.ts +2 -2
- package/dist/app.js +80 -169
- package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
- package/dist/callback-C8SdXCwr.js +68 -0
- package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
- package/dist/{channel-access-mt7K6dPh.js → channel-access-BOL29BG3.js} +6 -6
- package/dist/child-message--2G3Ft26.js +19 -0
- package/dist/cli/chat.js +18 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +23 -4
- package/dist/{config-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
- package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
- package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
- package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
- package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
- package/dist/create-CrNt4Ewu.js +212 -0
- package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
- package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
- package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
- package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
- package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
- package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
- package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
- package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
- package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
- package/dist/markers-DUP8aBOp.js +323 -0
- package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
- package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
- package/dist/{model-input-BhPJYdSV.js → model-input-0osF3pBS.js} +3 -3
- package/dist/nitro.d.ts +2 -4
- package/dist/nitro.js +340 -13
- package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
- package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
- package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
- package/dist/result-D090hxr5.js +402 -0
- package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
- package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
- package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
- package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
- package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
- package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
- package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
- package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
- package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
- package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
- package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
- package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
- package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
- package/dist/turn-session-routing-CZTRU8IY.js +116 -0
- package/dist/turn-wake-Bzq1Efrm.js +154 -0
- package/dist/user-customization-B27StpVQ.js +9 -0
- package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
- package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
- package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
- package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
- package/migrations/0160_money_micro_usd_repair.sql +99 -0
- package/migrations/0161_agent_config_backfill.sql +34 -0
- package/migrations/0162_inbox_item_deliveries.sql +15 -0
- package/migrations/0163_pg_trgm.sql +2 -0
- package/migrations/0164_search_indexes.sql +4 -0
- package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
- package/migrations/0166_memory_prefix_index.sql +1 -0
- package/migrations/0167_todo_search_indexes.sql +2 -0
- package/migrations/0168_todo_inbox_items.sql +4 -0
- package/migrations/0169_drop_code_urls.sql +2 -0
- package/migrations/meta/0160_snapshot.json +6515 -0
- package/migrations/meta/0161_snapshot.json +6278 -0
- package/migrations/meta/0162_snapshot.json +6404 -0
- package/migrations/meta/0163_snapshot.json +6404 -0
- package/migrations/meta/0164_snapshot.json +6466 -0
- package/migrations/meta/0165_snapshot.json +6466 -0
- package/migrations/meta/0166_snapshot.json +6494 -0
- package/migrations/meta/0167_snapshot.json +6525 -0
- package/migrations/meta/0168_snapshot.json +6525 -0
- package/migrations/meta/0169_snapshot.json +6513 -0
- package/migrations/meta/_journal.json +70 -0
- package/package.json +9 -18
- package/skills/design-automation-skill/SKILL.md +2 -3
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/conversation-privacy-BrMiDN61.js +0 -189
- package/dist/executor-CgWyWfYz.js +0 -1858
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/ingest-B0AggUEC.js +0 -7931
- package/dist/request-deadline-BUiRYQYj.js +0 -24
- package/dist/service-account-o15pZWcJ.js +0 -931
- package/dist/state-BTawTCme.js +0 -161
- package/dist/statuses-BKwqCPhj.js +0 -69
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { L as acquireActiveLock, O as resolveGatewayModel, P as createCache, U as estimateTextTokens, W as textCharsForTokens, a as getSlackBotToken, c as getSlackSigningSecret, ft as isProviderRetryError, n as botConfig, o as getSlackClientId, r as getChatConfig, s as getSlackClientSecret, v as normalizeSlackEmojiName } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { E as withSpan, H as buildSentryConversationUrl, J as normalizeIdentityEmail, S as setTags, T as withLogContext, Y as toOptionalString, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-DNt-qOIO.js";
|
|
1
|
+
import { $o as normalizeSlackConversationId, $r as markDispatchBlocked, Ba as inboxItemNeedsUserNow, Bo as bindSlackDirectCredentialSubject, Br as buildDispatchId, Bt as createPluginConversationWatches, Ci as normalizeSlackStatusText, Cr as basePluginContext, Di as truncateStatusText, Do as collectEventMatchKeys, Ds as completeText, Ea as recordAutomationExecution, Ei as wrapBareSlackUserIds, Fa as closeInboxItem, Ga as ownerConversationId, Go as SlackActionError, Gr as getDispatchIdForConversation, Gt as createPluginState, Ho as verifyScheduledAutomationCredentialSubject, Hr as confirmDispatchMailboxAppend, Ji as parseDashboardPersonLink, Jo as getHeaderString, Jr as getDispatchTurnId, Ki as isDashboardLink, Ko as downloadPrivateSlackFile, Kr as getDispatchInputMessageId, La as dismissOpenInboxItems, Lt as createCodeChangePublisher, Ms as JUNIOR_NATIVE_EVENT_NAMESPACE, Mt as trimTrailingAssistantMessages, Oa as AUTOMATION_ALERT_STEPS, Po as listConversationsWithWatches, Qo as isSlackRequestTimeout, Qr as markDispatchAwaitingResume, Ra as getInboxItem, Ri as getDashboardConversationLink, Ro as bindEventAutomationCredentialSubject, Rr as createPluginLogger, Ta as readAutomationTitlesByConversationId, Ti as slackMentionedUserIds, To as cancelSubscriptions, Ts as completeDecision, Ui as getDashboardPersonLink, Un as createPluginEmbedder, Uo as verifySlackDirectCredentialSubject, Ur as createOrGetDispatch, Vi as getDashboardLinkFilter, Vo as verifyEventAutomationCredentialSubject, Vr as claimDispatchMailboxAppend, Wa as listReplyActionItems, Wr as getDispatchConversationId, Xi as blockEventAutomation, Xn as conversationSearchVector, Xr as isTerminalDispatchStatus, Yo as getSlackClient, Yr as getPluginDispatchProjection, Zi as collectEventAutomationMatchKeys, Zo as isDmChannel, _a as existingConversationId, ao as listFiringInboxSnoozeTriggers, ar as createPluginConversationChanges, cr as createPluginAnnotations, cs as CORE_EVENT_NAMESPACE, di as removeReactionFromMessage, do as getEventCatalog, ds as eventGuidance, ea as findMatchingEventAutomations, ei as markDispatchCompleted, eo as SNOOZE_TIMER_EVENT_TYPE, gn as resolveBaseUrl, go as slackChannelMessageRunsAutomation, gt as storedMessageJson, h as getPlugins, ho as slackChannelMessageReplyThreadTs, hr as lookupSlackUserNames, ii as addReactionToMessage, ja as fallbackShortTitle, jo as findMatchingWatches, ka as AUTOMATION_ALERT_STEP_FIELD_ID, la as automationVersionOf, lr as listConversationAnnotations, mr as lookupSlackUser, ni as markDispatchRunning, ns as streamPrivateSlackFile, o as applyPluginFormatMarkdown, oa as admitEventAutomationRun, or as PLUGIN_CHOICE_FIELD_ID, qa as takeInboxItem, qi as parseDashboardConversationLink, qr as getDispatchRecord, r as createUserTokenStore, ri as notifyAutomationBlocked, rs as withSlackRetries, s as createPluginEventPublisher, sa as eventAutomationRunLimitReason, so as settleInboxSnoozes, sr as createPluginInboxItems, ss as updateTimerIndex, ti as markDispatchFailed, ur as listConversationAnnotationsById, vi as SLACK_USER_MENTION_RE, wi as slackMention, ws as createPluginCache, zo as bindScheduledAutomationCredentialSubject } from "./credentialed-dWRA3-oJ.js";
|
|
2
|
+
import { L as acquireActiveLock, O as resolveGatewayModel, P as createCache, U as estimateTextTokens, W as textCharsForTokens, a as getSlackBotToken, c as getSlackSigningSecret, ft as isProviderRetryError, gt as mapBounded, n as botConfig, o as getSlackClientId, r as getChatConfig, s as getSlackClientSecret, v as normalizeSlackEmojiName } from "./config-BIfHKNXN.js";
|
|
3
|
+
import { C as logInfo, F as withSpan, O as setSentryUser, P as withLogContext, S as logException, Z as buildSentryConversationUrl, d as createChatSdkLogger, g as getActiveTraceId, h as getActiveTraceContext, it as toOptionalString, j as setTags, k as setSpanAttributes, rt as normalizeIdentityEmail, u as buildTurnFailureResponse, w as logWarn, x as logError } from "./conversation-privacy-DtZhI91r.js";
|
|
5
4
|
import { h as startSpan, n as captureMessage } from "./sentry-CPbZjomA.js";
|
|
6
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { f as
|
|
13
|
-
import { n as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { i as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { $t as markTurnCompleted, Bt as getTurnUserMessage, D as resolveSlackReplyTarget, E as stopAtAutomatedTurnLimit, Et as eventAuthorText, F as createChildConversationWorker, Fn as conversationSubtree, Gt as CooperativeTurnYieldError, Ht as getTurnUserReplyAttachmentContext, I as createDeliverToParent, In as conversationSubtreeColumns, It as resumeForPersonInput, Jt as getConversationTurnBoundaryError, Kt as TurnInputCommitLostError, M as stopConversation, Nt as resolveBotSlackTeamId, O as sendSlackReply, P as stopChildAgentsOf, Qt as markTurnClosed, R as enqueueAgentInvocationResult, Rn as isExperimentalFeatureEnabled, S as recordFailedDispatchTurn, T as getTurnAuthorization, Ut as getTurnUserSlackMessageTs, V as withAgentInvocationResultActors, Wt as ConversationTurnBoundaryError, Xt as isTurnInputCommitLostError, Yt as isCooperativeTurnYieldError, Zt as isTurnInputDeferredError, _n as renderTaskInput, b as createPausedTurns, c as resolveMailboxTurnWork, d as legacyWebMailboxMetadataSchema, dn as instructionActorFor, en as markTurnFailed, gt as recordFinishedTurnForAutomatedLimit, hn as withoutSavedSteeringMessages, in as getWebAuthorization, it as getChildAgentLabel, jt as resolveEventAuthor, on as loadInboxItemInput, qt as TurnInputDeferredError, sn as savedInputInstruction, t as ingestEvent, tn as startActiveTurn, un as buildSteeringPiMessage, vt as AgentRunError, x as getPausedTurnRequest, y as supersedeTurnForInput, yt as executeTurn } from "./ingest-B0AggUEC.js";
|
|
21
|
-
import { Ar as gapSegment, At as parseSlackMessageReference, Bt as readSlackRawMessageContext, Ct as setConversationSubscription, Er as MINUTE_MS, Et as throwApiError, Fn as readConversationSourceTask, Jn as findAutomationSkill, Kn as AutomationEditError, Mn as takeViewerAutomationAlertStep, Or as NO_REPLY_GAP_MS, Ot as renderAttachmentText, Pn as ViewerTaskNotFoundError, Tt as jsonResponse, Vt as resolveSlackChannelIdFromMessage, Xn as effectiveTaskOutcomes, Yn as missingAutomationSkillReason, br as connectedState, ct as archiveConversation, i as GLOBAL_GAPS_TTL_MS, ir as historyPeriodSavings, kt as renderBlockText, l as isConversationWorkDone, lr as replaceHistorySavings, lt as conversationReadPositionQuery, mt as deliverInboxItemChange, n as CONVERSATION_STATE_TTL_MS, nr as addHistoryWarmupCost, o as segmentGapsKey, r as GLOBAL_GAPS_MAX, rr as firstLiveSavingsDate, st as readLastUserMessageAtByConversation, t as ANSWER_TOOL_ENDINGS, tr as addHistoryPeriod, u as listConversationWork, xr as providerCacheTtlMs, zt as parseSlackThreadId } from "./warmup-D5hzqTcp.js";
|
|
22
|
-
import { C as recordSlackAttachment, _ as verifyAttachmentUploads, d as recordWebConversationActivity, f as webActorFromUser, l as createAndEnqueueConversation, m as AttachmentUploadError, o as acceptsWebMessages, s as appendAndEnqueueWebMessage, u as createConversationId, w as slackAttachmentsVersionQuery, x as readAttachmentVisionSummary, y as getSlackFileId } from "./start-conversation-DbVujrwO.js";
|
|
23
|
-
import { a as isConversationMember, i as getConversationInfo, l as listThreadReplies, o as isPublicSlackChannel, r as getChannelMessage } from "./channel-access-mt7K6dPh.js";
|
|
24
|
-
import { r as isFileAttachment, s as storeAttachment } from "./store-CjXrp-Up.js";
|
|
25
|
-
import { f as OPEN_TODO_STATUSES } from "./statuses-BKwqCPhj.js";
|
|
26
|
-
import { t as getTurnRequestDeadline } from "./request-deadline-BUiRYQYj.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-DGUa1dZK.js";
|
|
6
|
+
import { A as lastMessageAtSql, An as conversationAccessFromRows, Ar as juniorConversationEvents, At as inboxItemPlugin, Bn as rootVisibleToViewer, Br as juniorConversations, C as createSlackActor, Ct as canUserReadInboxItem, D as parseActorUserId, Dt as inboxItemNeedsInput, E as isUserActor, Fr as juniorCodeChanges, Ft as isAutomationAlertItem, Gn as agentTurnUsageSchema, Gr as juniorDestinations, Hn as addAgentTurnUsage, In as conversationIsMemberRoot, It as isOnlyAssignee, K as locationFromRow, Kn as hasAgentTurnUsage, Ln as conversationIsNotUnsubscribedRoot, Lt as isPluginInboxItem, Mn as readConversationAccessFromSql, Mr as juniorConversationAnnotations, N as withConversationMutationLock, Nn as readConversationAccessRows, Nt as inboxItemTodo, On as canAddConversationMessages, P as deliversFinalText, Q as conversationCostOf, Rn as conversationPinnedForUser, Rr as juniorAttachments, S as createActor, T as isActorUserId, Tt as inboxItemForUser, V as postsRunNotices, Vn as viewerMarksFromParticipant, Vr as juniorIdentities, W as turnBehavior, Wr as juniorUsers, Xn as nextDetailVersion, Z as parseSessionSource, a as getDb, an as identityAvatarUrl, b as conversationSlackTenantId, bi as parseSlackMessageTs, bt as canActOnInboxItem, c as isPostgresErrorCode, ci as createSlackDestination, ct as conversationTurnFailedSql, dt as conversationKindFromRow, fi as parseSlackChannelId, fn as resolveActorIdentityId, fr as juniorInboxItemConversations, g as conversationAncestors, gt as PLUGIN_INBOX_ITEM_KEY_PREFIX, h as withConversationEventLock, hr as juniorInboxItems, i as getConversationStore, in as hasUserPhoto, jn as createConversationAccessReader, kt as inboxItemOwnedByConversation, ln as userAvatarUrlsFromIdentities, lt as conversationWaitsOnUserSql, mi as parseSlackTeamId, mt as treeAwaitsAuthorization, n as getConversationEventStore, o as getSqlExecutor, ot as conversationIsActiveSql, p as copyMessageLinks, pn as saveActorAvatar, pt as awaitsAuthorizationFrom, qn as resolveRootConversationId, rr as juniorTodos, st as conversationStatusSql, ui as requireSlackDestination, un as userAvatarUrlsFromJoinedPhotos, ut as executionIsActive, v as readConversationTrees, vr as juniorAutomations, w as createSlackResumeActor, wn as readCachedUserByEmail, wr as juniorConversationParticipants, x as loadConversationSlackTenantIds, y as setArchivedAt, yr as juniorAutomationRuns, yt as TODO_INBOX_ITEM_KEY_PREFIX, z as isTopLevelKind, zn as readMemberParticipants, zr as juniorMessageAttachments } from "./db-BTmLKZrp.js";
|
|
7
|
+
import { d as contextProvenance, h as OPEN_TODO_STATUSES, p as instructionProvenanceFor, t as KNOWN_CONVERSATION_EVENT_TYPES } from "./history-CneKY7_V.js";
|
|
8
|
+
import { a as getStateValues, i as getStateAdapter, o as setStateValues } from "./adapter-JARQvoLw.js";
|
|
9
|
+
import { G as actorLogContext, K as credentialContextForActor, M as webActorUserIds, _ as PluginMcpClient, g as McpAuthorizationRequiredError, w as getMcpStoredOAuthCredentials } from "./registry-D6kS6xYH.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BLKtnUL3.js";
|
|
11
|
+
import { A as canPauseConversationDelivery, C as safeLinkUrl, E as sendSlackReply, L as RetryableDeliveryError, T as resolveSlackReplyTarget, a as getMcpOAuthCallbackPath, c as latestProgressStatus, f as createInboxItemShow, l as resolveDestinationVisibility, m as pushInboxSnoozeWakes, n as executeAgentRun, o as createClientMetadata, r as buildAuthPauseResponse, s as readMcpClientInformation, t as createAgentRunner, z as shouldEmitDevAgentTrace } from "./agent-runner-qZU5TR8i.js";
|
|
12
|
+
import { $n as loadTurnProjection, $r as failTurnRecord, An as conversationSubtreeColumns, Ar as isEventConversationMessage, Br as AuthorizationFlowDisabledError, Bt as getConversationWorkState, Cr as recordDeliveredAssistantMessage, Dn as buildDeterministicAssistantMessageId, Dt as cancelHumanFacingPendingMessages, Er as upsertConversationMessage, Fr as createPluginEgress, H as resolveEventAuthor, Ir as PluginCredentialFailureError, Jn as commitAcceptedReply, Jr as lostWorkerBeforeFirstSave, L as eventAuthorText, Mi as finalizeFailedTurnReplyWithEvent, Mn as isExperimentalFeatureEnabled, Ni as getAgentTurnDiagnosticsAttributes, O as notInheritedByForkChild, Oi as buildTurnErrorResponse, On as buildDeterministicTurnId, Or as EVENT_SYSTEM_ACTOR, Pi as requireTurnFailureEventId, Q as getTurnUserMessage, Qr as completeTurnRecord, Qt as savedInputInstruction, Si as loadTurnStart, Sr as normalizeConversationText, St as getWebAuthorization, Tr as turnHasReply, Tt as appendAndEnqueueInboundMessage, W as resolveBotSlackTeamId, Wr as clearPendingAuth, Xr as saveTurnCheckpoint, Yn as commitMessages, Yr as pauseLostWorkerTurn, Zi as getAssistantReplyText, Zn as loadConversationProjection, Zr as abandonTurnRecord, Zt as loadInboxItemInput, _i as canShareTurn, _n as setTodoStatusByUser, _r as estimateConversationMessagesTokens, _t as persistThreadRuntimeState, a as resolveMailboxTurnWork, at as TurnInputDeferredError, br as latestConversationMessageSeq, c as legacyWebMailboxMetadataSchema, ca as configValueSchema, cn as renderTaskInput, cr as recordSubscribedReplyRoute, ct as isTurnInputCommitLostError, dr as hydrateConversationMessages, dt as markTurnCompleted, ei as getTurnRecord, et as getTurnUserReplyAttachmentContext, fr as persistConversationMessageWindow, ft as markTurnFailed, gi as canJoinTurn, gr as buildConversationContext, gt as getPersistedThreadState, ht as getPersistedSandboxState, it as TurnInputCommitLostError, kn as conversationSubtree, lt as isTurnInputDeferredError, mr as resolveConversationTitle, mt as getLocationConfigurationService, ni as recordTurnSummary, nn as instructionActorFor, nt as ConversationTurnBoundaryError, on as withoutSavedSteeringMessages, ot as getConversationTurnBoundaryError, pr as persistConversationMessages, pt as startActiveTurn, q as resumeForPersonInput, qr as loadTurnCheckpoint, rr as recordAuthorizationCompleted, rt as CooperativeTurnYieldError, sa as persistWithRetry, st as isCooperativeTurnYieldError, ti as listTurnSummaries, tn as buildSteeringPiMessage, tt as getTurnUserSlackMessageTs, ua as piMessageFromHistoryItem, ut as markTurnClosed, vr as getConversationMessageSlackTs, vt as persistThreadStateById, wr as trimConversationMessages, xi as getTurnLifecycle, xr as markConversationMessage, yr as isHumanConversationMessage, yt as coerceThreadConversationState, zt as getConversation } from "./mailbox-turn-DL3Lvsm0.js";
|
|
13
|
+
import { $ as conversationReportStatusSchema, Tt as MAX_ATTACHMENT_BYTES, Zt as answeredChoices, en as isEmptyUserInputAnswer, fn as automationTaskText, ft as conversationTreeStateSchema, gt as renameConversationResponseSchema, ht as renameConversationBodySchema, i as isVisionImageMediaType, kt as readMessageAttachments, ot as activityPreviewText, r as detectImageMediaType, tn as normalizeUserInputAnswer, tt as conversationSurfaceSchema } from "./media-FYM-Bl3H.js";
|
|
14
|
+
import { f as readJuniorSecret, t as getVercelConversationWorkQueue } from "./vercel-queue-nL0Hq3hr.js";
|
|
15
|
+
import { $n as readConversationSourceTask, Br as connectedState, Bt as setConversationSubscription, Cr as historyPeriodSavings, Ct as conversationReadPositionQuery, Gt as renderAttachmentText, Ht as jsonResponse, Jr as NO_REPLY_GAP_MS, Kr as MINUTE_MS, Kt as renderBlockText, O as ingestEvent, Or as replaceHistorySavings, Ot as deliverInboxItemChange, Sr as firstLiveSavingsDate, St as archiveConversation, Ut as throwApiError, Vr as providerCacheTtlMs, Xr as gapSegment, Yn as takeViewerAutomationAlertStep, Zn as ViewerTaskNotFoundError, br as addHistoryPeriod, fr as findAutomationSkill, i as GLOBAL_GAPS_TTL_MS, in as resolveSlackChannelIdFromMessage, l as isConversationWorkDone, mr as effectiveTaskOutcomes, n as CONVERSATION_STATE_TTL_MS, nn as parseSlackThreadId, o as segmentGapsKey, pr as missingAutomationSkillReason, qt as parseSlackMessageReference, r as GLOBAL_GAPS_MAX, rn as readSlackRawMessageContext, st as stopChildAgentsOf, t as ANSWER_TOOL_ENDINGS, u as listConversationWork, ur as AutomationEditError, wt as markConversationRead, xr as addHistoryWarmupCost, xt as readLastUserMessageAtByConversation } from "./warmup-CCOuIwAS.js";
|
|
16
|
+
import { C as recordSlackAttachment, _ as verifyAttachmentUploads, d as recordWebConversationActivity, f as webActorFromUser, l as createAndEnqueueConversation, m as AttachmentUploadError, o as acceptsWebMessages, s as appendAndEnqueueWebMessage, u as createConversationId, w as slackAttachmentsVersionQuery, x as readAttachmentVisionSummary, y as getSlackFileId } from "./start-conversation-a4NXH4X9.js";
|
|
17
|
+
import { a as isConversationMember, i as getConversationInfo, l as listThreadReplies, o as isPublicSlackChannel, r as getChannelMessage } from "./channel-access-BOL29BG3.js";
|
|
18
|
+
import { r as isFileAttachment, s as storeAttachment } from "./store-BuhF1QDm.js";
|
|
27
19
|
import { t as webMessageId } from "./web-message-id-C6P83ans.js";
|
|
28
|
-
import { t as
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { r as
|
|
20
|
+
import { l as getChildAgentLabel, n as createDeliverToParent, o as withAgentInvocationResultActors, t as createChildConversationWorker } from "./result-D090hxr5.js";
|
|
21
|
+
import { n as getTurnRequestDeadline } from "./callback-C8SdXCwr.js";
|
|
22
|
+
import { i as savedTurnMessages, n as resolveTurnResumeRouting, t as resolveConversationRouting } from "./turn-session-routing-CZTRU8IY.js";
|
|
23
|
+
import { t as runWithSlackInstallation } from "./adapter-context-B4BrJZuS.js";
|
|
24
|
+
import { B as webPageObjectCard, E as healthReportSchema, L as conversationObjectCard, R as messageObjectCard, _ as cancelConversationPendingMessagesResponseSchema, b as conversationPendingMessageDeliverySchema, c as pinConversationBodySchema, f as archiveConversationBodySchema, g as cancelConversationPendingMessagesBodySchema, h as conversationAutoArchiveSchema, l as pinConversationResponseSchema, m as archiveDoneConversationsResponseSchema, o as conversationSubscriptionBodySchema, p as archiveConversationResponseSchema, r as stopConversationTurnResponseSchema, s as conversationSubscriptionResponseSchema, z as personObjectCard } from "./conversation-feed-DdFQuQDR.js";
|
|
25
|
+
import { a as stopConversation, c as executeTurn, d as withTurnSpan, i as stopAtAutomatedTurnLimit, l as getTurnInputSpanAttributes, n as createConversationTurnWorker, o as recordFinishedTurnForAutomatedLimit, r as supersedeTurnForInput, s as AgentRunError, u as turnInputTelemetry } from "./conversation-turn-DScuDYmN.js";
|
|
26
|
+
import { n as attachmentFactLines, r as buildStoredAttachmentPromptText } from "./model-input-0osF3pBS.js";
|
|
27
|
+
import { t as bindMessageAgent } from "./message-DuDelZFr.js";
|
|
28
|
+
import { t as readConversationLineage } from "./lineage-EULJkGO1.js";
|
|
29
|
+
import { t as bindSpawnAgent } from "./spawn-DRjdzh3R.js";
|
|
30
|
+
import { a as buildDeliveredTurnStatePatch, i as persistAuthPauseTurnState, n as loadThreadContextTrimFloor, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CDX4dSZd.js";
|
|
31
|
+
import { c as readConversationEventPage, l as readConversationEventPageAfter, n as scheduleSessionCompletedPluginTasks, u as readConversationEventPageAround } from "./task-runner-C-pXsgHM.js";
|
|
32
|
+
import { a as sendVercelPluginTask } from "./task-queue-CrRjFzOh.js";
|
|
33
|
+
import { n as getPausedTurnRequest, o as getTurnAuthorization, r as recordFailedDispatchTurn, t as createPausedTurns } from "./turn-wake-Bzq1Efrm.js";
|
|
34
|
+
import { r as canContinueInSlack } from "./continue-in-slack-fnmD2Ifb.js";
|
|
39
35
|
import * as z from "zod";
|
|
40
36
|
import pLimit from "p-limit";
|
|
41
37
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
42
38
|
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";
|
|
43
|
-
import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, min, ne, not, or, sql } from "drizzle-orm";
|
|
39
|
+
import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, like, lt, lte, min, ne, not, or, sql } from "drizzle-orm";
|
|
44
40
|
import { alias } from "drizzle-orm/pg-core";
|
|
45
41
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
46
42
|
import net from "node:net";
|
|
@@ -6766,10 +6762,6 @@ function createConversationWork(options) {
|
|
|
6766
6762
|
},
|
|
6767
6763
|
runTurn: runtime.runDispatchTurn
|
|
6768
6764
|
});
|
|
6769
|
-
const enqueueResult = async (invocation) => await enqueueAgentInvocationResult(invocation, {
|
|
6770
|
-
queue: options.queue,
|
|
6771
|
-
state: options.state
|
|
6772
|
-
});
|
|
6773
6765
|
const conversationTurnWorker = createConversationTurnWorker(options.agentRunner, createSlackSystemTurnDelivery({
|
|
6774
6766
|
getSlackAdapter: options.getSlackAdapter,
|
|
6775
6767
|
state: options.state
|
|
@@ -6777,9 +6769,7 @@ function createConversationWork(options) {
|
|
|
6777
6769
|
queue: options.queue,
|
|
6778
6770
|
state: options.state
|
|
6779
6771
|
}));
|
|
6780
|
-
const childWorker = createChildConversationWorker(
|
|
6781
|
-
enqueueResult,
|
|
6782
|
-
queue: options.queue,
|
|
6772
|
+
const childWorker = createChildConversationWorker({
|
|
6783
6773
|
runTurn: conversationTurnWorker,
|
|
6784
6774
|
state: options.state
|
|
6785
6775
|
});
|
|
@@ -6804,7 +6794,7 @@ function createConversationWork(options) {
|
|
|
6804
6794
|
return await destinationWorker(context);
|
|
6805
6795
|
};
|
|
6806
6796
|
const runByKind = async (context, topLevel) => {
|
|
6807
|
-
|
|
6797
|
+
const worker = topLevel ? runRoot : childWorker;
|
|
6808
6798
|
const readStopSignal = context.stopSignal;
|
|
6809
6799
|
let stopSignal;
|
|
6810
6800
|
const stopLateChildAgents = async () => {
|
|
@@ -6812,7 +6802,7 @@ function createConversationWork(options) {
|
|
|
6812
6802
|
};
|
|
6813
6803
|
let result;
|
|
6814
6804
|
try {
|
|
6815
|
-
result = await
|
|
6805
|
+
result = await worker({
|
|
6816
6806
|
...context,
|
|
6817
6807
|
stopSignal: readStopSignal ? () => stopSignal = readStopSignal() : void 0
|
|
6818
6808
|
});
|
|
@@ -7929,11 +7919,19 @@ async function loadEvents(conversationIds) {
|
|
|
7929
7919
|
}).from(events).innerJoin(juniorConversations, eq(juniorConversations.conversationId, events.conversationId)).where(and(inArray(events.conversationId, conversationIds), or(eq(events.type, "assistant_message"), and(isToolResult, inArray(sql`(${message})->>'toolName'`, Object.keys(ANSWER_TOOL_ENDINGS)), sql`(${message})->>'isError' IS DISTINCT FROM 'true'`), and(isUserMessage, sql`(${events.payload}->'provenance'->>'authority') = 'instruction'`), isWarmupEvent), gte(events.createdAt, juniorConversations.createdAt))).orderBy(events.conversationId, events.seq);
|
|
7930
7920
|
}
|
|
7931
7921
|
async function loadChildAgents(conversationIds) {
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7922
|
+
const events = juniorConversationEvents;
|
|
7923
|
+
const rows = await getDb().select({
|
|
7924
|
+
conversationId: events.conversationId,
|
|
7925
|
+
createdAt: events.createdAt,
|
|
7926
|
+
markerId: sql`${events.payload}->>'subagentInvocationId'`,
|
|
7927
|
+
type: events.type
|
|
7928
|
+
}).from(events).where(and(inArray(events.conversationId, conversationIds), inArray(events.type, ["subagent_started", "subagent_ended"])));
|
|
7929
|
+
const endedAt = new Map(rows.flatMap((row) => row.type === "subagent_ended" && row.markerId ? [[`${row.conversationId}\0${row.markerId}`, row.createdAt]] : []));
|
|
7930
|
+
return rows.flatMap((row) => row.type === "subagent_started" ? [{
|
|
7931
|
+
conversationId: row.conversationId,
|
|
7932
|
+
createdAt: row.createdAt,
|
|
7933
|
+
terminalAt: endedAt.get(`${row.conversationId}\0${row.markerId}`) ?? null
|
|
7934
|
+
}] : []);
|
|
7937
7935
|
}
|
|
7938
7936
|
/**
|
|
7939
7937
|
* Replay the model calls of one Conversation the way the recorders in
|
|
@@ -8418,12 +8416,30 @@ const INBOX_SNOOZE_TIMER_INDEX = {
|
|
|
8418
8416
|
batchSize: 500,
|
|
8419
8417
|
key: "junior:inbox-snoozes:due"
|
|
8420
8418
|
};
|
|
8419
|
+
/** The To-do of each resolved item that shows one, for its snoozer. */
|
|
8420
|
+
async function resolvedTodos(db, resolved) {
|
|
8421
|
+
if (resolved.length === 0) return [];
|
|
8422
|
+
const items = await db.select({
|
|
8423
|
+
dedupeKey: juniorInboxItems.dedupeKey,
|
|
8424
|
+
id: juniorInboxItems.id
|
|
8425
|
+
}).from(juniorInboxItems).where(and(inArray(juniorInboxItems.id, resolved.map((row) => row.inboxItemId)), like(juniorInboxItems.dedupeKey, `${TODO_INBOX_ITEM_KEY_PREFIX}%`)));
|
|
8426
|
+
const todoOf = new Map(items.map((item) => [item.id, inboxItemTodo(item)]));
|
|
8427
|
+
return resolved.flatMap((row) => {
|
|
8428
|
+
const todo = todoOf.get(row.inboxItemId);
|
|
8429
|
+
return todo ? [{
|
|
8430
|
+
...todo,
|
|
8431
|
+
...row
|
|
8432
|
+
}] : [];
|
|
8433
|
+
});
|
|
8434
|
+
}
|
|
8421
8435
|
/**
|
|
8422
8436
|
* Fire the snooze triggers that one Event matches. A `resolve` trigger
|
|
8423
|
-
*
|
|
8437
|
+
* cancels the snooze and closes the item: it dismisses it, or marks the
|
|
8438
|
+
* To-do of a To-do item done for the person who snoozed it, so the agent
|
|
8439
|
+
* sees the change in its next `<todo-delta>`. A `wake` trigger ends the
|
|
8424
8440
|
* snooze, which records `reason`. When one Event fires both on a snooze,
|
|
8425
|
-
* `resolve` wins. A snooze that already ended ignores the Event.
|
|
8426
|
-
* the number of items woken.
|
|
8441
|
+
* `resolve` wins. A snooze that already ended ignores the Event. Each
|
|
8442
|
+
* woken snooze pushes to its User. Returns the number of items woken.
|
|
8427
8443
|
*/
|
|
8428
8444
|
async function fireTriggers(db, event, reason, nowMs) {
|
|
8429
8445
|
const triggers = (await listFiringInboxSnoozeTriggers(db, {
|
|
@@ -8431,25 +8447,37 @@ async function fireTriggers(db, event, reason, nowMs) {
|
|
|
8431
8447
|
identifiers: event.identifiers,
|
|
8432
8448
|
namespace: event.namespace
|
|
8433
8449
|
})).filter((trigger) => eventMatches(trigger.match ?? void 0, event.data));
|
|
8434
|
-
const resolving = new
|
|
8450
|
+
const resolving = new Map(triggers.filter((trigger) => trigger.outcome === "resolve").map((trigger) => [trigger.snoozeId, trigger]));
|
|
8435
8451
|
const waking = new Set(triggers.filter((trigger) => !resolving.has(trigger.snoozeId)).map((trigger) => trigger.snoozeId));
|
|
8436
8452
|
if (resolving.size === 0 && waking.size === 0) return 0;
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8453
|
+
const todos = await resolvedTodos(db, [...resolving.values()]);
|
|
8454
|
+
await mapBounded(todos, (todo) => setTodoStatusByUser(getSqlExecutor(), {
|
|
8455
|
+
assignedOnly: true,
|
|
8456
|
+
conversationId: todo.conversationId,
|
|
8457
|
+
id: todo.id,
|
|
8458
|
+
nowMs,
|
|
8459
|
+
status: "done",
|
|
8460
|
+
userId: todo.userId
|
|
8461
|
+
}));
|
|
8462
|
+
const todoItemIds = new Set(todos.map((todo) => todo.inboxItemId));
|
|
8463
|
+
const woken = await db.transaction(async (tx) => {
|
|
8464
|
+
const resolved = await settleInboxSnoozes(tx, {
|
|
8465
|
+
snoozeIds: [...resolving.keys()],
|
|
8440
8466
|
state: "cancelled"
|
|
8441
8467
|
});
|
|
8442
8468
|
await dismissOpenInboxItems(tx, {
|
|
8443
|
-
ids:
|
|
8469
|
+
ids: resolved.map((row) => row.inboxItemId).filter((id) => !todoItemIds.has(id)),
|
|
8444
8470
|
nowMs,
|
|
8445
8471
|
reason: "A snooze trigger resolved it."
|
|
8446
8472
|
});
|
|
8447
|
-
return
|
|
8473
|
+
return await settleInboxSnoozes(tx, {
|
|
8448
8474
|
reason,
|
|
8449
8475
|
snoozeIds: [...waking],
|
|
8450
8476
|
state: "woken"
|
|
8451
|
-
})
|
|
8477
|
+
});
|
|
8452
8478
|
});
|
|
8479
|
+
await pushInboxSnoozeWakes(woken);
|
|
8480
|
+
return woken.length;
|
|
8453
8481
|
}
|
|
8454
8482
|
/** Fire the snooze triggers that one published Event matches. */
|
|
8455
8483
|
async function fireInboxSnoozeTriggers(db, event, nowMs = Date.now()) {
|
|
@@ -8632,6 +8660,10 @@ function createHeartbeatContext(args) {
|
|
|
8632
8660
|
}) },
|
|
8633
8661
|
cache: createPluginCache(pluginName),
|
|
8634
8662
|
codeChanges: createCodeChangePublisher(pluginName),
|
|
8663
|
+
conversationChanges: createPluginConversationChanges({
|
|
8664
|
+
plugin: pluginName,
|
|
8665
|
+
show: args.showInboxItem ?? (async () => {})
|
|
8666
|
+
}),
|
|
8635
8667
|
nowMs: args.nowMs,
|
|
8636
8668
|
db: getDb(),
|
|
8637
8669
|
embedder: createPluginEmbedder(pluginName),
|
|
@@ -9359,7 +9391,7 @@ function reviewItemChange(action, user) {
|
|
|
9359
9391
|
kind: "taken",
|
|
9360
9392
|
user
|
|
9361
9393
|
};
|
|
9362
|
-
if (action === "submit") return {
|
|
9394
|
+
if (action === "submit" || action === "done") return {
|
|
9363
9395
|
kind: "submitted",
|
|
9364
9396
|
user
|
|
9365
9397
|
};
|
|
@@ -9403,6 +9435,11 @@ async function actOnInboxItem(args) {
|
|
|
9403
9435
|
const nowMs = args.nowMs ?? Date.now();
|
|
9404
9436
|
const db = getDb();
|
|
9405
9437
|
const item = await readInboxItemForUser(user, args.id);
|
|
9438
|
+
if (inboxItemTodo(item)) {
|
|
9439
|
+
if (action !== "done" && action !== "dismiss") throw new InboxItemActionError("invalid", "A To-do item takes only Done or Dismiss.");
|
|
9440
|
+
return await closeTodoItem(item, user, nowMs, action);
|
|
9441
|
+
}
|
|
9442
|
+
if (action === "done") throw new InboxItemActionError("invalid", "Only a To-do item can be marked done.");
|
|
9406
9443
|
if (action === "take") {
|
|
9407
9444
|
if (item.status !== "open") throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
9408
9445
|
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can take this item.");
|
|
@@ -9461,6 +9498,30 @@ async function actOnInboxItem(args) {
|
|
|
9461
9498
|
return closed;
|
|
9462
9499
|
}
|
|
9463
9500
|
/**
|
|
9501
|
+
* Close a To-do item for its assignee through its To-do: Done marks the
|
|
9502
|
+
* To-do done, and Dismiss drops it. The To-do change closes the item as
|
|
9503
|
+
* done or dismissed (`syncTodoInboxItems`), and the agent sees it in its
|
|
9504
|
+
* next `<todo-delta>`, so it sends no message and starts no Turn. A retry
|
|
9505
|
+
* after the item closed the same way by the same person succeeds.
|
|
9506
|
+
*/
|
|
9507
|
+
async function closeTodoItem(item, user, nowMs, action) {
|
|
9508
|
+
const todo = inboxItemTodo(item);
|
|
9509
|
+
if (item.status === "open") {
|
|
9510
|
+
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
9511
|
+
await setTodoStatusByUser(getSqlExecutor(), {
|
|
9512
|
+
assignedOnly: true,
|
|
9513
|
+
conversationId: todo.conversationId,
|
|
9514
|
+
id: todo.id,
|
|
9515
|
+
nowMs,
|
|
9516
|
+
status: action === "done" ? "done" : "dropped",
|
|
9517
|
+
userId: user.id
|
|
9518
|
+
});
|
|
9519
|
+
}
|
|
9520
|
+
const closed = await readInboxItemForUser(user, item.id);
|
|
9521
|
+
if (closed.status !== closedStatus(action) || closed.closedBy?.userId !== user.id) throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
9522
|
+
return closed;
|
|
9523
|
+
}
|
|
9524
|
+
/**
|
|
9464
9525
|
* Return whether a reply from this User answers an open action item, or is
|
|
9465
9526
|
* a retry of the reply from this User that closed it.
|
|
9466
9527
|
*/
|
|
@@ -10117,6 +10178,36 @@ async function reorderPinnedConversations(viewer, body) {
|
|
|
10117
10178
|
const updatedIds = new Set(updated.map((row) => row.rootConversationId));
|
|
10118
10179
|
return { conversationIds: ids.filter((id) => updatedIds.has(id)) };
|
|
10119
10180
|
}
|
|
10181
|
+
// src/chat/conversations/sql/title.ts
|
|
10182
|
+
/**
|
|
10183
|
+
* Replace one Conversation's title. Returns the stored title, or undefined
|
|
10184
|
+
* when the Conversation does not exist.
|
|
10185
|
+
*
|
|
10186
|
+
* recordActivity reads the title and writes it back under the mutation lock,
|
|
10187
|
+
* so this write takes the same lock. A concurrent Turn cannot restore the old
|
|
10188
|
+
* title.
|
|
10189
|
+
*/
|
|
10190
|
+
async function setConversationTitle(executor, conversationId, title) {
|
|
10191
|
+
return await withConversationMutationLock(executor, conversationId, async () => {
|
|
10192
|
+
const [row] = await executor.db().update(juniorConversations).set({
|
|
10193
|
+
detailVersion: nextDetailVersion,
|
|
10194
|
+
title
|
|
10195
|
+
}).where(eq(juniorConversations.conversationId, conversationId)).returning({ title: juniorConversations.title });
|
|
10196
|
+
return row?.title ?? void 0;
|
|
10197
|
+
});
|
|
10198
|
+
}
|
|
10199
|
+
// src/api/conversations/rename.ts
|
|
10200
|
+
/**
|
|
10201
|
+
* Rename one conversation. The title is shared, so only a participant can
|
|
10202
|
+
* change it, the same as pin and archive. Automatic titles are set once, so a
|
|
10203
|
+
* later Turn keeps this title.
|
|
10204
|
+
*/
|
|
10205
|
+
async function renameConversation(viewer, conversationId, body) {
|
|
10206
|
+
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
10207
|
+
const title = await setConversationTitle(getSqlExecutor(), conversationId, body.title);
|
|
10208
|
+
if (!title) throwApiError(404, "Conversation not found.");
|
|
10209
|
+
return { title };
|
|
10210
|
+
}
|
|
10120
10211
|
// src/api/conversations/stop.ts
|
|
10121
10212
|
/**
|
|
10122
10213
|
* Stop one Conversation for a participant: its active Turn, its session, and
|
|
@@ -10211,6 +10302,17 @@ const pinConversationOperation = defineApiOperation({
|
|
|
10211
10302
|
annotations: writeAnnotations,
|
|
10212
10303
|
run: (viewer, { conversationId, ...body }) => pinConversation(viewer, conversationId, body)
|
|
10213
10304
|
});
|
|
10305
|
+
/** Rename one Conversation for everyone in it. */
|
|
10306
|
+
const renameConversationOperation = defineApiOperation({
|
|
10307
|
+
name: "renameConversation",
|
|
10308
|
+
title: "Rename conversation",
|
|
10309
|
+
description: "Rename one of your conversations for everyone in it. Later turns keep the new title. The Slack thread does not change. Returns the stored title.",
|
|
10310
|
+
scope: "conversations:manage",
|
|
10311
|
+
input: renameConversationBodySchema.extend(conversationIdInput),
|
|
10312
|
+
output: renameConversationResponseSchema,
|
|
10313
|
+
annotations: writeAnnotations,
|
|
10314
|
+
run: (viewer, { conversationId, ...body }) => renameConversation(viewer, conversationId, body)
|
|
10315
|
+
});
|
|
10214
10316
|
/** Override the viewer's auto-archive default for one Conversation. */
|
|
10215
10317
|
const setConversationAutoArchiveOperation = defineApiOperation({
|
|
10216
10318
|
name: "setConversationAutoArchive",
|
|
@@ -10267,6 +10369,7 @@ const conversationOperations = [
|
|
|
10267
10369
|
archiveConversationOperation,
|
|
10268
10370
|
archiveDoneConversationsOperation,
|
|
10269
10371
|
pinConversationOperation,
|
|
10372
|
+
renameConversationOperation,
|
|
10270
10373
|
setConversationAutoArchiveOperation,
|
|
10271
10374
|
setConversationSubscriptionOperation,
|
|
10272
10375
|
stopConversationOperation
|
|
@@ -10397,15 +10500,18 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
10397
10500
|
attachmentStorage: services.attachmentStorage,
|
|
10398
10501
|
queue: services.queue
|
|
10399
10502
|
});
|
|
10400
|
-
const
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10503
|
+
const closeAnsweredAndRead = async () => {
|
|
10504
|
+
await closeInboxItemsAnsweredByReply({
|
|
10505
|
+
conversationId,
|
|
10506
|
+
delivery: {
|
|
10507
|
+
queue: services.queue,
|
|
10508
|
+
show: createInboxItemShow(getProductionSlackAdapter)
|
|
10509
|
+
},
|
|
10510
|
+
resolveUser: async () => viewer,
|
|
10511
|
+
text: body.message
|
|
10512
|
+
});
|
|
10513
|
+
await markConversationRead(viewer, conversationId, { lastReadSeq: Number.MAX_SAFE_INTEGER });
|
|
10514
|
+
};
|
|
10409
10515
|
try {
|
|
10410
10516
|
let accepted;
|
|
10411
10517
|
try {
|
|
@@ -10420,10 +10526,10 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
10420
10526
|
conversationId,
|
|
10421
10527
|
state
|
|
10422
10528
|
})]);
|
|
10423
|
-
if (work?.execution.inboundMessageIds.includes(messageId)) await
|
|
10529
|
+
if (work?.execution.inboundMessageIds.includes(messageId)) await closeAnsweredAndRead();
|
|
10424
10530
|
throw error;
|
|
10425
10531
|
}
|
|
10426
|
-
await
|
|
10532
|
+
await closeAnsweredAndRead();
|
|
10427
10533
|
return accepted;
|
|
10428
10534
|
} catch (error) {
|
|
10429
10535
|
throwApiError(500, "Unable to append message.", error);
|
|
@@ -11242,9 +11348,8 @@ const fork = alias(juniorConversations, "detail_fork");
|
|
|
11242
11348
|
const agentTreeRoot = alias(juniorConversations, "detail_agent_tree_root");
|
|
11243
11349
|
/**
|
|
11244
11350
|
* Return the root fields that label the agent tree of a child: its title and
|
|
11245
|
-
* channel name. The other labels cannot change once the child exists.
|
|
11246
|
-
*
|
|
11247
|
-
* spawn sets a title. Access to each node comes from the shared root, so the
|
|
11351
|
+
* channel name. The other labels cannot change once the child exists. Only
|
|
11352
|
+
* the spawn sets a child's title and agent name. Access to each node comes from the shared root, so the
|
|
11248
11353
|
* viewer's access covers it. This keeps the recursive lineage read out of
|
|
11249
11354
|
* every poll.
|
|
11250
11355
|
*/
|
|
@@ -12090,6 +12195,59 @@ function nestFeedThreads(records, tree, accessByRoot) {
|
|
|
12090
12195
|
}]];
|
|
12091
12196
|
}));
|
|
12092
12197
|
}
|
|
12198
|
+
// src/chat/inbox-items/waiting.ts
|
|
12199
|
+
const waitingRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItemConversations.conversationId})`.as("waiting_root_id");
|
|
12200
|
+
const waitingTodoRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItems.ownerId})`.as("waiting_root_id");
|
|
12201
|
+
/** Open items that need the User now, with the root where each one waits. */
|
|
12202
|
+
function waitingItemsQuery(db, userId) {
|
|
12203
|
+
const columns = {
|
|
12204
|
+
createdAt: juniorInboxItems.createdAt,
|
|
12205
|
+
dedupeKey: juniorInboxItems.dedupeKey,
|
|
12206
|
+
itemId: juniorInboxItems.id,
|
|
12207
|
+
title: juniorInboxItems.title
|
|
12208
|
+
};
|
|
12209
|
+
return db.select({
|
|
12210
|
+
conversationId: waitingRootId,
|
|
12211
|
+
...columns
|
|
12212
|
+
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorInboxItemConversations.conversationId)).where(inboxItemNeedsUserNow(userId)).union(db.select({
|
|
12213
|
+
conversationId: waitingTodoRootId,
|
|
12214
|
+
...columns
|
|
12215
|
+
}).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}%`))));
|
|
12216
|
+
}
|
|
12217
|
+
/**
|
|
12218
|
+
* Return a query for the ids of the root Conversations that wait on a User,
|
|
12219
|
+
* as `listWaitingConversations` lists them, to filter another query by.
|
|
12220
|
+
*/
|
|
12221
|
+
function waitingConversationIdsQuery(db, userId) {
|
|
12222
|
+
const items = waitingItemsQuery(db, userId).as("waiting_items");
|
|
12223
|
+
return db.select({ conversationId: items.conversationId }).from(items);
|
|
12224
|
+
}
|
|
12225
|
+
/**
|
|
12226
|
+
* List the root Conversations that wait on a User: each root or one of its
|
|
12227
|
+
* child conversations is linked to, or owns a To-do's, open item that needs
|
|
12228
|
+
* the User now (`inboxItemNeedsUserNow`), so a snoozed item leaves it out.
|
|
12229
|
+
*/
|
|
12230
|
+
async function listWaitingConversations(db, userId) {
|
|
12231
|
+
const rows = (await waitingItemsQuery(db, userId)).sort((left, right) => right.createdAt.getTime() - left.createdAt.getTime() || right.itemId.localeCompare(left.itemId));
|
|
12232
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
12233
|
+
for (const row of rows) {
|
|
12234
|
+
const plugin = inboxItemPlugin(row.dedupeKey);
|
|
12235
|
+
const item = {
|
|
12236
|
+
title: row.title,
|
|
12237
|
+
...plugin ? { plugin } : void 0
|
|
12238
|
+
};
|
|
12239
|
+
const current = waiting.get(row.conversationId);
|
|
12240
|
+
if (current) {
|
|
12241
|
+
current.items.push(item);
|
|
12242
|
+
current.waitingSince = row.createdAt.toISOString();
|
|
12243
|
+
} else waiting.set(row.conversationId, {
|
|
12244
|
+
conversationId: row.conversationId,
|
|
12245
|
+
items: [item],
|
|
12246
|
+
waitingSince: row.createdAt.toISOString()
|
|
12247
|
+
});
|
|
12248
|
+
}
|
|
12249
|
+
return [...waiting.values()].sort((left, right) => left.conversationId.localeCompare(right.conversationId));
|
|
12250
|
+
}
|
|
12093
12251
|
// src/api/conversations/priority.ts
|
|
12094
12252
|
/** Conversations with no known work leave Priority after this idle window. */
|
|
12095
12253
|
const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
|
|
@@ -12621,4 +12779,4 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12621
12779
|
async function readConversationFeed(options = {}) {
|
|
12622
12780
|
return readConversationFeedFromSql(options);
|
|
12623
12781
|
}
|
|
12624
|
-
export {
|
|
12782
|
+
export { createEventAppPublisher as $, decodeImageId as $t, stopConversationOperation as A, buildSlackInboundMessage as At, mcpMessageSchema as B, bindMessageAuthorIdentityId as Bt, archiveDoneConversationsOperation as C, viewerCanViewPluginLink as Ct, renameConversationOperation as D, createProductionConversationWorkOptions as Dt, pinConversationOperation as E, publicAddressLookup as Et, mcpConversation as F, AGENT_DISPATCH_MAX_AGE_MS as Ft, readMcpPendingWorkAfterSend as G, getThreadStopDecision as Gt, mcpMessages as H, stripLeadingBotMention as Ht, mcpConversationIdSchema as I, enqueueAgentDispatch as It, InboxItemActionError as J, readConversationRecordFromSql as Jt, requireConversationPendingMessages as K, resolvePersonLink as Kt, mcpConversationSchema as L, failStoppedDispatch as Lt, apiOperationHandler as M, slackInboundMessageId as Mt, mcpAcceptedMessageSchema as N, normalizeIncomingSlackThreadId as Nt, setConversationAutoArchiveOperation as O, createProductionSlackWebhookServices as Ot, mcpAuthorizationSchema as P, withNormalizedThreadId as Pt, reviewItemChange as Q, IMAGE_WIDTHS as Qt, mcpCursorSchema as R, recordSkippedConversationMessage as Rt, archiveConversationOperation as S, resolveObjectLinks as St, conversationOperations as T, isPublicAddress as Tt, mcpPendingMessagesSchema as U, parseContent as Ut, mcpMessageTextSchema as V, startProcessingReaction as Vt, readMcpPendingWork as W, SubscribedReplyReason as Wt, closeInboxItemsAnsweredByReply as X, readFirstHumanMessageTexts as Xt, actOnInboxItem as Y, conversationSummaryFromStoredConversation as Yt, readInboxItemForUser as Z, createViewerMcp as Zt, appendConversationMessageForViewer as _, readHealthReport as _t, listWaitingConversations as a, automationReplyAttribution as at, decodeConversationCursor as b, readObjectLinkTypes as bt, readConversationDetail as c, dispatchScheduledAutomation as ct, readConversationTreeMetricsFromSql as d, scheduleInboxSnoozeTimer as dt, ingestEventAutomations as et, conversationVersionsQuery as f, readSavingsRefill as ft, readConversationEvents as g, GET as gt, keepQuickQuestionForViewer as h, backfillCacheWarmingGaps as ht, encodePageCursor as i, updateUserSettings as it, reorderPinnedConversations as j, clearSlackPendingReactions as jt, setConversationSubscriptionOperation as k, getProductionSlackAdapter as kt, readConversationAuxiliaryCostsFromSql as l, getScheduledAutomationDispatch as lt, forkConversationForViewer as m, startSavingsRefill as mt, readConversationFeed as n, DEFAULT_USER_SETTINGS as nt, listedConversation as o, settleEventAutomationRuns as ot, readConversationDetailEtag as p, runSavingsRefillSlice as pt, resolveMentions as q, conversationRecordJoins as qt, decodePageCursor as r, readUserSettings as rt, notLeadConversation as s, createHeartbeatContext as st, conversationFeedVersionQuery as t, runAutoArchiveSweep as tt, childAgentTotalsReport as u, runInboxSnoozeTimers as ut, createConversationForViewer as v, OBJECT_LINK_TTL_MS as vt, cancelQueuedMessagesOperation as w, guardedFetch as wt, encodeConversationCursor as x, resolveObjectLinkNow as xt, requireWebMessageConversation as y, readLinkObjectType as yt, mcpIdempotencyKeySchema as z, createSlackWebApiStatusSender as zt };
|