@sentry/junior 0.296.0 → 0.298.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-z_lgDi-z.js → admin-BF3DbYGf.js} +2 -2
- package/dist/{agent-runner-HoQiUKLL.js → agent-runner-Q9GkoerG.js} +407 -1895
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +38 -267
- package/dist/{app-C75Ft-A_.d.ts → app-DOg_mCtV.d.ts} +7 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +64 -44
- package/dist/attempt-selection-ClP3MMPr.js +61 -0
- package/dist/{automation-yJX3C7i3.js → automation-Cn8qmbdr.js} +1 -1
- package/dist/{background-compaction-queue-Cre1wFt9.js → background-compaction-queue-BZhGFOK6.js} +4 -88
- package/dist/{briefs-BXECHduJ.js → briefs-CQrCRF6-.js} +3 -3
- package/dist/{catalog-runtime-CpCmlD9L.js → catalog-runtime-DZeD2WbL.js} +1 -1
- package/dist/cli/chat.js +19 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-CCPHvTqx.js → config-BOByVnxe.js} +2 -2
- package/dist/{connections-B5pWh8e2.js → connections-BNN5cJam.js} +6 -6
- package/dist/{conversation-CMkSmi02.js → conversation-DCkzvxqB.js} +51 -17
- package/dist/{conversation-feed-BVAOga0H.js → conversation-feed-CMA12Rjs.js} +1 -1
- package/dist/{conversation-privacy-CZD5soDW.js → conversation-privacy-C0eRxsgb.js} +1 -1
- package/dist/conversation-turn-D9qvcDX6.js +805 -0
- package/dist/{credential-sync-DwLkIvXI.js → credential-sync-B_iUpxGL.js} +14 -13
- package/dist/{db-C1M1y-bh.js → db-CoMNr2Zm.js} +43 -15
- package/dist/{db-B3iyr_Or.d.ts → db-DoMcnYol.d.ts} +13 -1
- package/dist/{executor-DUSEwXaO.js → executor-C-m8VrzX.js} +14 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-D0svFM8r.js → logging-CJTi5niy.js} +1 -1
- package/dist/{message-BFnIwKpx.js → message-Q6_5DAWR.js} +15 -13
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -2
- package/dist/{session-stop-hYNTNpVf.js → notification-Bv25xbj0.js} +11 -930
- package/dist/{oauth-callback-server-BXRtD6Fk.js → oauth-callback-server-CH5XAyo-.js} +2 -2
- package/dist/{projection-B6VS7kbo.js → projection-BgwEE36_.js} +333 -106
- package/dist/{prompt-CD11tfG8.js → prompt-DXc9DYT9.js} +4 -4
- package/dist/prompt-input-BUr4J9RO.js +1424 -0
- package/dist/{registry-CHewwYEo.js → registry-9XwqSnM-.js} +1 -1
- package/dist/reporting-window-DopzcOHh.js +137 -0
- package/dist/{resolve-1owMH4qo.js → resolve-DUIAbcRL.js} +3 -3
- package/dist/result-C2Vn8QGn.js +463 -0
- package/dist/{runner-BtWvJslp.js → runner-CXGtw-Mc.js} +9 -8
- package/dist/{sandbox-egress-signals-ByftwJVt.js → sandbox-egress-signals-Di3S_dO7.js} +1 -1
- package/dist/{schema-Ct1Zf2xy.d.ts → schema-BnbZ-rKv.d.ts} +14 -107
- package/dist/{schema-D2iGyYIp.js → schema-Dyp7racy.js} +11 -48
- package/dist/{service-account-BZEuMKdo.js → service-account-DM3KBBeG.js} +3 -3
- package/dist/{service-account-DLoeoHww.js → service-account-GzAMUQ8a.js} +3 -3
- package/dist/session-stop-D4i7e6iT.js +181 -0
- package/dist/{skills-DXgd5Inh.js → skills-DCK9SD_l.js} +2 -2
- package/dist/{spawn-YeqlNDv8.js → spawn-6cX6xE9G.js} +6 -5
- package/dist/{state-C3CbtD_m.js → state-CSuA2J1V.js} +2 -2
- package/dist/{stop-Cze_pEL8.js → stop-Dh2DfwpK.js} +66 -159
- package/dist/{store-CZ9vqR4P.js → store-B1zepKG8.js} +11 -4
- package/dist/{task-runner-CMiNGsER.js → store-DrA17Fbz.js} +939 -1593
- package/dist/task-queue-D1rXWfFN.js +89 -0
- package/dist/task-runner-CT4M8oDz.js +291 -0
- package/dist/thread-context-DnqUkbzN.js +248 -0
- package/dist/turn-cancel-l460pfGW.js +201 -0
- package/dist/turn-session-routing-VXDVXLRl.js +380 -0
- package/dist/{turn-failure-response-pXhZ2wMK.js → turn-user-message-BSPmkm7X.js} +181 -392
- package/dist/turn-wake-DVFVXyhX.js +161 -0
- package/dist/{reporting-window-B3Ze-Qnt.js → user-input-request-CXNIov9n.js} +24 -143
- package/dist/{validation-Du7NdkOR.js → validation-zxAJBDDy.js} +1 -1
- package/dist/{version-EN3Wnq-R.js → version-DcZ40a0g.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-Agxi_o5c.js → viewer-CgiGjW10.js} +3 -3
- package/dist/warmup-CwKbxQLl.js +2698 -0
- package/dist/{worker-BALVdWbv.js → worker-CbDUzaBA.js} +20 -8
- package/migrations/0102_code_change_last_activity.sql +1 -0
- package/migrations/0103_agent_invocation_fork.sql +8 -0
- package/migrations/meta/0102_snapshot.json +4502 -0
- package/migrations/meta/0103_snapshot.json +4509 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/dist/result-CEqQFrEf.js +0 -305
- package/dist/result-event-type-DD6BAgT7.js +0 -11
- package/dist/warmup-CY2ArYag.js +0 -2017
- package/dist/work-EA98F0ia.js +0 -768
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
import { h as startSpan } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as loadTurnCheckpoint, $
|
|
3
|
-
import { A as estimateTextTokens, E as resolveGatewayModel, K as isProviderRetryError, L as escapeXml, c as getSlackClientSecret, i as getChatConfig, j as textCharsForTokens, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-
|
|
4
|
-
import { E as withSpan, G as isRecord, K as toOptionalNumber, 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, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { $ as loadTurnCheckpoint, $i as escapeSlackMrkdwnText, $o as configValueSchema, A as latestConversationMessageSeq, An as trimTrailingAssistantMessages, Br as reviewItemNeedsSomeone, Cr as getReviewItem, D as estimateConversationMessagesTokens, Da as withSlackRetries, Do as readConversationEventPageAfter, E as buildConversationContext, Eo as readConversationEventPage, Er as listWaitingConversations, F as turnHasReply, Fo as getSlackFileId, Fr as canUserReadReviewItem, H as PluginCredentialFailureError, Hn as createUserTokenStore, I as upsertConversationMessage, Ir as isOnlyAssignee, Jo as lookupSlackUserNames, K as AuthorizationFlowDisabledError, Lo as readAttachmentVisionSummary, M as normalizeConversationText, Mr as canActOnReviewItem, N as recordDeliveredAssistantMessage, O as getConversationMessageSlackTs, Oo as readConversationEventPageAround, P as trimConversationMessages, Po as notInheritedByForkChild, Pt as moveIdleConversationDestination, Ro as recordSlackAttachment, S as resolveConversationTitle, Sa as getSlackClient, So as viewerMarksFromParticipant, Ta as normalizeSlackConversationId, To as readLatestConversationBrief, Tr as listReplyActionItems, Uo as listConversationAnnotations, Wn as webActorUserIds, Wo as listConversationAnnotationsById, X as clearPendingAuth, Xt as buildTurnErrorResponse, Zo as createPluginCache, _o as conversationHasParticipantUser, a as loadProjection, aa as addReactionToMessage, an as getAssistantReplyText, at as failTurnRecord, b as persistConversationMessages, bo as conversationPinnedForUser, ct as recordTurnSummary, d as recordAuthorizationCompleted, da as postSlackMessage, ea as formatSlackLink, et as lostWorkerBeforeFirstSave, fa as removeReactionFromMessage, fo as createPluginLogger, go as readConversationAccessFromSql, h as recordSubscribedReplyRoute, ho as createConversationAccessReader, i as loadConversationProjection, ia as truncateStatusText, it as completeTurnRecord, j as markConversationMessage, jo as buildSentryConversationUrl, k as isHumanConversationMessage, kr as takeReviewItem, mn as persistWithRetry, mo as canAddConversationMessages, n as commitMessages, na as normalizeSlackStatusText, nr as getPlugins, nt as saveTurnCheckpoint, o as loadTurnProjection, oa as deleteSlackMessage, ot as getTurnRecord, qo as lookupSlackUser, rt as abandonTurnRecord, sa as getSlackMessagePermalink, st as listTurnSummaries, t as commitAcceptedReply, ti as cancelSubscriptions, ts as piMessageFromHistoryItem, tt as pauseLostWorkerTurn, v as hydrateConversationMessages, va as SlackActionError, vo as conversationIsMemberRoot, w as fallbackShortTitle, wa as isDmChannel, xa as getHeaderString, xo as conversationViewerMarks, y as persistConversationMessageWindow, ya as downloadPrivateSlackFile, yi as getDashboardConversationLink, yo as conversationIsNotUnsubscribedRoot, yr as closeReviewItem, zo as slackAttachmentsVersionQuery, zt as releaseInboundMessage } from "./projection-BgwEE36_.js";
|
|
3
|
+
import { A as estimateTextTokens, E as resolveGatewayModel, K as isProviderRetryError, L as escapeXml, c as getSlackClientSecret, i as getChatConfig, j as textCharsForTokens, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-BOByVnxe.js";
|
|
4
|
+
import { E as withSpan, G as isRecord, K as toOptionalNumber, 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, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-CJTi5niy.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-DcZ40a0g.js";
|
|
6
6
|
import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
7
|
-
import { A as setFirstConversationLocation, C as deliversFinalText, E as postsRunNotices, F as saveActorAvatar, G as
|
|
8
|
-
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations,
|
|
7
|
+
import { A as setFirstConversationLocation, C as deliversFinalText, E as postsRunNotices, F as saveActorAvatar, G as parseSessionSource, K as addAgentTurnUsage, O as conversationKindFromRow, P as resolveActorIdentityId, S as withConversationMutationLock, T as isTopLevelKind, U as claimProviderConversation, W as getConversationIdByProviderConversation, X as hasAgentTurnUsage, Y as agentTurnUsageSchema, Z as resolveRootConversationId, _ as setArchivedAt, a as getConversationStore, et as nextDetailVersion, g as readConversationTrees, it as requireSlackDestination, k as locationFromRow, m as conversationAncestors, nt as createSlackDestination, o as getDb, p as withConversationEventLock, r as getConversationEventStore, s as getSqlExecutor, v as loadConversationSlackTenantIds, y as lastMessageAtSql } from "./db-CoMNr2Zm.js";
|
|
8
|
+
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, b as juniorConversationBriefs, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-C-m8VrzX.js";
|
|
9
9
|
import { _ as instructionProvenanceFor, a as KNOWN_CONVERSATION_EVENT_TYPES, h as contextProvenance, i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
10
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
11
|
-
import {
|
|
12
|
-
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-
|
|
10
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-9XwqSnM-.js";
|
|
11
|
+
import { C as createSlackReviewItemShow, Ct as conversationReadPositionQuery, F as resolveSlackChannelIdFromMessage, H as resolveDestinationVisibility, I as resolveSlackChannelIdFromThreadId, L as checkSlackChannelReadAccess, Lt as shouldEmitDevAgentTrace, N as parseSlackThreadId, Ot as throwApiError, P as readSlackRawMessageContext, Pt as RetryableDeliveryError, R as joinPublicChannelForRead, S as renderBlockText, V as listThreadReplies, Z as readConversationSourceTask, _t as decodeInputImages, a as buildAuthPauseResponse, ft as createAndEnqueueConversation, ht as webActorFromUser, j as runWithSlackInstallation, kt as listedConversation, lt as acceptsWebMessages, m as latestProgressStatus, mt as recordWebConversationActivity, n as executeAgentRun, ot as deliverReviewItemChange, pt as createConversationId, t as createAgentRunner, ut as appendAndEnqueueWebMessage, x as renderAttachmentText, xt as storeAttachment, z as getConversationInfo } from "./agent-runner-Q9GkoerG.js";
|
|
12
|
+
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-DXc9DYT9.js";
|
|
13
13
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-
|
|
15
|
-
import { a as getStateAdapter, o as getStateValues, s as setStateValues } from "./state-
|
|
16
|
-
import {
|
|
14
|
+
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-CgiGjW10.js";
|
|
15
|
+
import { a as getStateAdapter, o as getStateValues, s as setStateValues } from "./state-CSuA2J1V.js";
|
|
16
|
+
import { K as readMessageAttachments, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-DCkzvxqB.js";
|
|
17
17
|
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { a as
|
|
28
|
-
import { t as
|
|
29
|
-
import {
|
|
18
|
+
import { C as legacyWebMailboxMetadataSchema, b as resolveMailboxTurnWork, l as withoutSavedSteeringMessages, n as loadReviewItemInput, o as buildSteeringPiMessage, p as isExperimentalFeatureEnabled, r as savedInputInstruction } from "./prompt-input-BUr4J9RO.js";
|
|
19
|
+
import { C as dropOwnUnreadLoopReplies, E as stopChildAgentsOf, T as stopChildAgentsBelow, c as listConversationWork, l as readLastUserMessageAtByConversation, s as isConversationWorkDone } from "./warmup-CwKbxQLl.js";
|
|
20
|
+
import { l as getVercelConversationWorkQueue, w as getTurnRequestDeadline } from "./background-compaction-queue-BZhGFOK6.js";
|
|
21
|
+
import { c as conversationSubtreeColumns, o as skipInputAfterConversationStop, r as markConversationsStopped, s as conversationSubtree } from "./session-stop-D4i7e6iT.js";
|
|
22
|
+
import { T as getChildAgentLabel, a as ConversationTurnBoundaryError, c as TurnInputDeferredError, d as isTurnInputCommitLostError, dt as buildDeterministicTurnId, f as isTurnInputDeferredError, g as startActiveTurn, h as markTurnFailed, i as getTurnUserSlackMessageTs, l as getConversationTurnBoundaryError, m as markTurnCompleted, o as CooperativeTurnYieldError, p as markTurnClosed, r as getTurnUserReplyAttachmentContext, s as TurnInputCommitLostError, t as getTurnUserMessage, u as isCooperativeTurnYieldError, ut as buildDeterministicAssistantMessageId, v as getTurnLifecycle } from "./turn-user-message-BSPmkm7X.js";
|
|
23
|
+
import { S as sendSlackReply, T as recordFinishedTurnForAutomatedLimit, x as resolveSlackReplyTarget, y as maybePostAutomatedTurnLimitNotice } from "./notification-Bv25xbj0.js";
|
|
24
|
+
import { E as stopConversationWork, T as steerWebPendingMessages, _ as getConversationWorkState, a as cancelHumanFacingPendingMessages, g as getConversation, h as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage } from "./store-B1zepKG8.js";
|
|
25
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, n as resolveTurnSessionRouting, o as persistThreadRuntimeState, r as getLocationConfigurationService, s as persistThreadStateById, t as resolveConversationRouting } from "./turn-session-routing-VXDVXLRl.js";
|
|
26
|
+
import { a as isEmptyUserInputAnswer, o as normalizeUserInputAnswer } from "./user-input-request-CXNIov9n.js";
|
|
27
|
+
import { a as AgentRunError, i as supersedeTurnForInput, o as executeTurn, t as cancelSignInWait } from "./turn-cancel-l460pfGW.js";
|
|
28
|
+
import { a as getTurnAuthorization, c as getWebAuthorization, i as wakePausedTurn, n as getPausedTurnRequest, t as createPausedTurns } from "./turn-wake-DVFVXyhX.js";
|
|
29
|
+
import { n as canShareTurn, t as canJoinTurn } from "./attempt-selection-ClP3MMPr.js";
|
|
30
|
+
import { p as webMessageId } from "./reporting-window-DopzcOHh.js";
|
|
31
|
+
import { D as readAutomationTitlesByConversationId, _ as markDispatchRunning, a as getDispatchConversationId, c as getDispatchRecord, d as isTerminalDispatchStatus, g as markDispatchFailed, h as markDispatchCompleted, l as getDispatchTurnId, m as markDispatchBlocked, n as claimDispatchMailboxAppend, p as markDispatchAwaitingResume, r as confirmDispatchMailboxAppend, s as getDispatchInputMessageId } from "./store-DrA17Fbz.js";
|
|
32
|
+
import { l as conversationPendingMessagesReportSchema, n as conversationFeedSchema, p as healthReportSchema, t as conversationFeedBriefSchema } from "./conversation-feed-CMA12Rjs.js";
|
|
33
|
+
import { i as enqueueAgentInvocationResult, n as createDeliverToParent, s as withAgentInvocationResultActors, t as createChildConversationWorker } from "./result-C2Vn8QGn.js";
|
|
34
|
+
import { a as withTurnSpan, i as turnInputTelemetry, n as createConversationTurnWorker, o as canPauseConversationDelivery, r as getTurnInputSpanAttributes } from "./conversation-turn-D9qvcDX6.js";
|
|
35
|
+
import { t as bindMessageAgent } from "./message-Q6_5DAWR.js";
|
|
36
|
+
import { r as readConversationLineage, t as bindSpawnAgent } from "./spawn-6cX6xE9G.js";
|
|
37
|
+
import { n as scheduleSessionCompletedPluginTasks } from "./task-runner-CT4M8oDz.js";
|
|
38
|
+
import { a as requireTurnFailureEventId, c as buildDeliveredTurnStatePatch, i as getAgentTurnDiagnosticsAttributes, l as loadPendingMessageCards, n as loadThreadContextTrimFloor, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, s as persistAuthPauseTurnState, t as buildTurnThreadContext } from "./thread-context-DnqUkbzN.js";
|
|
30
39
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
31
40
|
import * as z from "zod";
|
|
32
|
-
import { and, asc, count, desc, eq, gt, inArray, isNotNull, isNull, lte,
|
|
41
|
+
import { and, asc, count, desc, eq, gt, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
|
|
33
42
|
import { conversationSidebarAnnotationSchema, createSlackSource, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
34
43
|
import { alias } from "drizzle-orm/pg-core";
|
|
35
44
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
@@ -102,16 +111,27 @@ async function enqueueAgentDispatch(dispatch, options) {
|
|
|
102
111
|
const nowMs = options.nowMs ?? Date.now();
|
|
103
112
|
const claimedDispatch = await claimDispatchMailboxAppend(dispatch.id);
|
|
104
113
|
if (!claimedDispatch) return;
|
|
105
|
-
|
|
114
|
+
const conversationStore = options.conversationStore ?? getConversationStore();
|
|
115
|
+
const conversationId = getDispatchConversationId(claimedDispatch);
|
|
116
|
+
const destination = claimedDispatch.destination;
|
|
117
|
+
await conversationStore.recordActivity({
|
|
106
118
|
activityAtMs: claimedDispatch.createdAtMs,
|
|
107
|
-
conversationId
|
|
108
|
-
destination
|
|
119
|
+
conversationId,
|
|
120
|
+
destination,
|
|
109
121
|
kind: isAutomationRun(claimedDispatch) ? "automation" : "root",
|
|
110
122
|
nowMs,
|
|
111
123
|
source: "plugin",
|
|
112
124
|
sessionSource: claimedDispatch.source,
|
|
113
125
|
...claimedDispatch.title ? { title: claimedDispatch.title } : void 0
|
|
114
126
|
});
|
|
127
|
+
if (destination.platform === "slack" && destination.threadTs) await conversationStore.claimProviderConversation({
|
|
128
|
+
atMs: nowMs,
|
|
129
|
+
conversationId,
|
|
130
|
+
provider: "slack",
|
|
131
|
+
providerDestinationId: destination.channelId,
|
|
132
|
+
providerTenantId: destination.teamId,
|
|
133
|
+
providerConversationId: destination.threadTs
|
|
134
|
+
});
|
|
115
135
|
await appendAndEnqueueInboundMessage({
|
|
116
136
|
message: buildAgentDispatchInboundMessage(claimedDispatch, nowMs, await resolveActorIdentityId(getSqlExecutor(), claimedDispatch.actor)),
|
|
117
137
|
conversationStore: options.conversationStore,
|
|
@@ -1701,6 +1721,7 @@ async function stopConversation(args) {
|
|
|
1701
1721
|
nowMs: stoppedAtMs,
|
|
1702
1722
|
state: args.state
|
|
1703
1723
|
});
|
|
1724
|
+
await dropOwnUnreadLoopReplies(args.conversationId, args.state);
|
|
1704
1725
|
await cancelSignInWait(args.conversationId);
|
|
1705
1726
|
const result = await stopConversationWork({
|
|
1706
1727
|
conversationId: args.conversationId,
|
|
@@ -4746,7 +4767,7 @@ function createSlackTurn(deps) {
|
|
|
4746
4767
|
slackMessageTs.push(...messageIds);
|
|
4747
4768
|
messageDestinations.push(...messageIds.map((messageId) => ({
|
|
4748
4769
|
destination: outcome.destination,
|
|
4749
|
-
messageId
|
|
4770
|
+
messageId: outcome.destination.threadTs ?? messageId
|
|
4750
4771
|
})));
|
|
4751
4772
|
}
|
|
4752
4773
|
else {
|
|
@@ -6777,16 +6798,20 @@ function createConversationWork(options) {
|
|
|
6777
6798
|
queue: options.queue,
|
|
6778
6799
|
state: options.state
|
|
6779
6800
|
});
|
|
6801
|
+
const conversationTurnWorker = createConversationTurnWorker(options.agentRunner, createSlackSystemTurnDelivery({
|
|
6802
|
+
getSlackAdapter: options.getSlackAdapter,
|
|
6803
|
+
state: options.state
|
|
6804
|
+
}), createDeliverToParent({
|
|
6805
|
+
queue: options.queue,
|
|
6806
|
+
state: options.state
|
|
6807
|
+
}));
|
|
6780
6808
|
const childWorker = createChildConversationWorker(options.agentRunner, {
|
|
6781
6809
|
enqueueResult,
|
|
6782
6810
|
maxAgentDepth: botConfig.maxAgentDepth,
|
|
6783
6811
|
queue: options.queue,
|
|
6812
|
+
runTurn: conversationTurnWorker,
|
|
6784
6813
|
state: options.state
|
|
6785
6814
|
});
|
|
6786
|
-
const conversationTurnWorker = createConversationTurnWorker(options.agentRunner, createSlackSystemTurnDelivery({
|
|
6787
|
-
getSlackAdapter: options.getSlackAdapter,
|
|
6788
|
-
state: options.state
|
|
6789
|
-
}));
|
|
6790
6815
|
const destinationWorker = async (context) => {
|
|
6791
6816
|
const destination = context.destination;
|
|
6792
6817
|
if (!destination) throw new Error(`Conversation ${context.conversationId} is missing a destination`);
|
|
@@ -6812,16 +6837,7 @@ function createConversationWork(options) {
|
|
|
6812
6837
|
if ("skipped" in stopped) return stopped.skipped;
|
|
6813
6838
|
const { context } = stopped;
|
|
6814
6839
|
const conversation = await options.conversationStore.get({ conversationId: context.conversationId });
|
|
6815
|
-
if (conversation?.kind
|
|
6816
|
-
const threadTurn = await resolveThreadTurnWork(context);
|
|
6817
|
-
if (!threadTurn) return await childWorker(context);
|
|
6818
|
-
if (threadTurn.kind === "mailbox") await endActiveAgentInvocations(context.conversationId, {
|
|
6819
|
-
enqueueResult,
|
|
6820
|
-
errorMessage: "A person sent a Message in this Thread, so this task ended without a result. Send messageAgent again if you still need this work."
|
|
6821
|
-
});
|
|
6822
|
-
return await conversationTurnWorker(context, threadTurn);
|
|
6823
|
-
}
|
|
6824
|
-
if (conversation?.parentConversationId) return await childWorker(context);
|
|
6840
|
+
if (!isTopLevelKind(conversation?.kind ?? "root")) return await childWorker(context);
|
|
6825
6841
|
const readStopSignal = context.stopSignal;
|
|
6826
6842
|
let stopSignal;
|
|
6827
6843
|
const stopLateChildAgents = async () => {
|
|
@@ -8062,7 +8078,6 @@ function conversationSummaryFromStoredConversation(args) {
|
|
|
8062
8078
|
const channelName = channelNameFromConversation(conversation, canViewPrivateContent, visibility);
|
|
8063
8079
|
const channelNameRedacted = channelNameRedactedFromConversation(conversation, canViewPrivateContent);
|
|
8064
8080
|
const status = statusFromConversation(conversation);
|
|
8065
|
-
const unread = (status === "completed" || status === "stopped") && args.unreadReply === true;
|
|
8066
8081
|
return {
|
|
8067
8082
|
conversationId: conversation.conversationId,
|
|
8068
8083
|
cumulativeDurationMs: durationMs,
|
|
@@ -8091,7 +8106,6 @@ function conversationSummaryFromStoredConversation(args) {
|
|
|
8091
8106
|
archivedAt: conversation.archivedAtMs === void 0 ? null : new Date(conversation.archivedAtMs).toISOString(),
|
|
8092
8107
|
pinnedAt: args.pinnedAtMs === void 0 ? null : new Date(args.pinnedAtMs).toISOString(),
|
|
8093
8108
|
...args.pinPosition === void 0 ? void 0 : { pinPosition: args.pinPosition },
|
|
8094
|
-
...unread ? { unread: true } : void 0,
|
|
8095
8109
|
...slackThread ? { channel: slackThread.channelId } : void 0,
|
|
8096
8110
|
...channelName ? { channelName } : void 0,
|
|
8097
8111
|
...channelNameRedacted ? { channelNameRedacted: true } : void 0,
|
|
@@ -8144,7 +8158,9 @@ async function readConversationAgentTree(conversation, readAccess) {
|
|
|
8144
8158
|
return {
|
|
8145
8159
|
conversationId: id,
|
|
8146
8160
|
kind,
|
|
8147
|
-
label: agent?.title ?? agent?.agentName ?? childLabel(kind)
|
|
8161
|
+
label: agent?.title ?? agent?.agentName ?? childLabel(kind),
|
|
8162
|
+
...agent?.agentType ? { agentType: agent.agentType } : void 0,
|
|
8163
|
+
...agent?.fork ? { fork: true } : void 0
|
|
8148
8164
|
};
|
|
8149
8165
|
}));
|
|
8150
8166
|
}
|
|
@@ -8414,103 +8430,6 @@ async function readConversationForks(conversationId, links, readAccess) {
|
|
|
8414
8430
|
} : void 0
|
|
8415
8431
|
};
|
|
8416
8432
|
}
|
|
8417
|
-
// src/api/conversations/unread.ts
|
|
8418
|
-
/**
|
|
8419
|
-
* Junior's newest reply in the outer Conversation that the transcript shows
|
|
8420
|
-
* as its own row. Quiet replies fold into activity, like tools and status
|
|
8421
|
-
* events, so they do not count. It walks the message role index from the
|
|
8422
|
-
* newest Message, so it stops at the first reply that is not quiet.
|
|
8423
|
-
*/
|
|
8424
|
-
function latestVisibleReply(db, conversationId) {
|
|
8425
|
-
return db.select({ seq: juniorConversationEvents.seq }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), sql`${juniorConversationEvents.payload}->>'role' = 'assistant'`, sql`(${juniorConversationEvents.payload}->'meta'->>'quiet') is distinct from 'true'`)).orderBy(desc(juniorConversationEvents.createdAt), desc(juniorConversationEvents.seq)).limit(1);
|
|
8426
|
-
}
|
|
8427
|
-
/** The seq of the user's latest Message in the outer Conversation. */
|
|
8428
|
-
function viewerMessageSeq(db, userId, conversationId) {
|
|
8429
|
-
return db.select({ seq: max(juniorConversationEvents.seq) }).from(juniorConversationEvents).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationEvents.actorIdentityId)).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), eq(juniorIdentities.userId, userId)));
|
|
8430
|
-
}
|
|
8431
|
-
/**
|
|
8432
|
-
* Whether Junior's latest visible reply is after the viewer's read position
|
|
8433
|
-
* in one outer Conversation. The position is at least the viewer's own
|
|
8434
|
-
* latest Message. No reply reads as false.
|
|
8435
|
-
*/
|
|
8436
|
-
function unreadReplySql(db, userId, conversationId, lastReadSeq) {
|
|
8437
|
-
return sql`coalesce((${latestVisibleReply(db, conversationId)}) > greatest(coalesce(${lastReadSeq}, -1), coalesce((${viewerMessageSeq(db, userId, conversationId)}), -1)), false)`;
|
|
8438
|
-
}
|
|
8439
|
-
/**
|
|
8440
|
-
* Return the Conversations that have a visible Junior reply after the
|
|
8441
|
-
* user's read position. The position is at least the user's own latest
|
|
8442
|
-
* Message, so a reply in Slack or the dashboard counts as read.
|
|
8443
|
-
*
|
|
8444
|
-
* A Conversation with no stored read position counts from its start. The
|
|
8445
|
-
* read-position backfill migration gave each root in a user's feed a
|
|
8446
|
-
* position at its last event, so only Conversations that start after it
|
|
8447
|
-
* have none.
|
|
8448
|
-
*/
|
|
8449
|
-
async function readUnreadConversationIds(db, conversationIds, userId) {
|
|
8450
|
-
if (conversationIds.length === 0) return /* @__PURE__ */ new Set();
|
|
8451
|
-
const rows = await db.select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).leftJoin(juniorConversationReadPositions, and(eq(juniorConversationReadPositions.conversationId, juniorConversations.conversationId), eq(juniorConversationReadPositions.userId, userId))).where(and(inArray(juniorConversations.conversationId, [...conversationIds]), unreadReplySql(db, userId, juniorConversations.conversationId, juniorConversationReadPositions.lastReadSeq)));
|
|
8452
|
-
return new Set(rows.map((row) => row.conversationId));
|
|
8453
|
-
}
|
|
8454
|
-
/**
|
|
8455
|
-
* Store a read report and say whether Junior's latest visible reply is still
|
|
8456
|
-
* unread, so the dashboard can clear its unread flag without a refetch.
|
|
8457
|
-
*
|
|
8458
|
-
* Only a viewer who may read the transcript can report: a participant, or
|
|
8459
|
-
* anyone for a public Conversation. Others get the same 404 as a missing
|
|
8460
|
-
* Conversation.
|
|
8461
|
-
*/
|
|
8462
|
-
async function reportConversationRead(viewer, conversationId, body) {
|
|
8463
|
-
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.canViewPrivateContent) throwApiError(404, "Conversation not found.");
|
|
8464
|
-
const readPosition = await markConversationRead(viewer, conversationId, body);
|
|
8465
|
-
const unread = await readUnreadConversationIds(getDb(), [conversationId], viewer.id);
|
|
8466
|
-
return {
|
|
8467
|
-
...readPosition,
|
|
8468
|
-
unreadReply: unread.has(conversationId)
|
|
8469
|
-
};
|
|
8470
|
-
}
|
|
8471
|
-
/**
|
|
8472
|
-
* Mark one Conversation read or unread for the signed-in viewer. Both write
|
|
8473
|
-
* the read position of the root, which the feed reads.
|
|
8474
|
-
*
|
|
8475
|
-
* Read moves the position to the last event. Unread is the one write that
|
|
8476
|
-
* moves it back: to just before Junior's latest visible reply, so the
|
|
8477
|
-
* transcript shows that reply as new again. A reply at seq 0 has no seq
|
|
8478
|
-
* before it, so unread removes the position and the Conversation counts from
|
|
8479
|
-
* its start. The viewer's own latest Message also counts as read, so unread
|
|
8480
|
-
* fails when that Message is after the reply.
|
|
8481
|
-
*/
|
|
8482
|
-
async function markConversationUnread(viewer, conversationId, body) {
|
|
8483
|
-
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
8484
|
-
const rootConversationId = await resolveRootConversationId(getSqlExecutor(), conversationId);
|
|
8485
|
-
if (!body.unread) {
|
|
8486
|
-
await markConversationRead(viewer, rootConversationId, { lastReadSeq: Number.MAX_SAFE_INTEGER });
|
|
8487
|
-
return { unreadReply: false };
|
|
8488
|
-
}
|
|
8489
|
-
const db = getDb();
|
|
8490
|
-
const reply = latestVisibleReply(db, juniorConversations.conversationId).as("latest_visible_reply");
|
|
8491
|
-
const [row] = await db.select({
|
|
8492
|
-
replySeq: reply.seq,
|
|
8493
|
-
viewerSeq: sql`(${viewerMessageSeq(db, viewer.id, juniorConversations.conversationId)})`
|
|
8494
|
-
}).from(juniorConversations).innerJoinLateral(reply, sql`true`).where(eq(juniorConversations.conversationId, rootConversationId));
|
|
8495
|
-
if (!row || row.viewerSeq !== null && row.viewerSeq >= row.replySeq) throwApiError(409, "Conversation has no reply after your last message.");
|
|
8496
|
-
if (row.replySeq === 0) {
|
|
8497
|
-
await db.delete(juniorConversationReadPositions).where(and(eq(juniorConversationReadPositions.userId, viewer.id), eq(juniorConversationReadPositions.conversationId, rootConversationId)));
|
|
8498
|
-
return { unreadReply: true };
|
|
8499
|
-
}
|
|
8500
|
-
await db.insert(juniorConversationReadPositions).values({
|
|
8501
|
-
conversationId: rootConversationId,
|
|
8502
|
-
lastReadSeq: row.replySeq - 1,
|
|
8503
|
-
updatedAt: /* @__PURE__ */ new Date(),
|
|
8504
|
-
userId: viewer.id
|
|
8505
|
-
}).onConflictDoUpdate({
|
|
8506
|
-
target: [juniorConversationReadPositions.userId, juniorConversationReadPositions.conversationId],
|
|
8507
|
-
set: {
|
|
8508
|
-
lastReadSeq: sql`excluded.last_read_seq`,
|
|
8509
|
-
updatedAt: sql`excluded.updated_at`
|
|
8510
|
-
}
|
|
8511
|
-
});
|
|
8512
|
-
return { unreadReply: true };
|
|
8513
|
-
}
|
|
8514
8433
|
// src/api/conversations/detail-etag.ts
|
|
8515
8434
|
const detailViewer = alias(juniorUsers, "detail_viewer");
|
|
8516
8435
|
const forkSource = alias(juniorConversations, "detail_fork_source");
|
|
@@ -8597,7 +8516,6 @@ async function readDetailStateRow(conversationId, viewer) {
|
|
|
8597
8516
|
pinnedAt: juniorConversationParticipants.pinnedAt,
|
|
8598
8517
|
pinPosition: juniorConversationParticipants.pinPosition,
|
|
8599
8518
|
rootConversationId,
|
|
8600
|
-
unreadReply: viewer ? unreadReplySql(db, viewer.id, rootConversationId, sql`(${db.select({ seq: juniorConversationReadPositions.lastReadSeq }).from(juniorConversationReadPositions).where(and(eq(juniorConversationReadPositions.userId, viewer.id), eq(juniorConversationReadPositions.conversationId, rootConversationId)))})`) : sql`false`,
|
|
8601
8519
|
unsubscribedAt: juniorConversationParticipants.unsubscribedAt,
|
|
8602
8520
|
version: sql`(${conversationVersionQuery(db, conversationId, viewer?.id)})`
|
|
8603
8521
|
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).leftJoin(forkSource, eq(forkSource.conversationId, juniorConversations.forkedFromConversationId)).leftJoin(juniorConversationParticipants, viewerParticipant).leftJoin(detailViewer, viewer ? eq(detailViewer.id, viewer.id) : sql`false`).where(eq(juniorConversations.conversationId, conversationId));
|
|
@@ -8634,7 +8552,6 @@ async function readDetailState(conversationId, viewer, readAccess) {
|
|
|
8634
8552
|
...row?.lastReadSeq != null ? { readPosition: { lastReadSeq: row.lastReadSeq } } : void 0,
|
|
8635
8553
|
...viewer ? { subscribed: !row?.unsubscribedAt } : void 0,
|
|
8636
8554
|
transcriptVersion,
|
|
8637
|
-
...viewer && row ? { unreadReply: row.unreadReply } : void 0,
|
|
8638
8555
|
...viewerMarks ? { viewerMarks } : void 0
|
|
8639
8556
|
},
|
|
8640
8557
|
version: row?.version ?? void 0
|
|
@@ -8678,7 +8595,6 @@ async function readConversationDetailEtag(conversationId, options) {
|
|
|
8678
8595
|
limit: options.limit ?? null,
|
|
8679
8596
|
subscribed: state.subscribed ?? null,
|
|
8680
8597
|
version,
|
|
8681
|
-
unreadReply: state.unreadReply ?? false,
|
|
8682
8598
|
viewerMarks: state.viewerMarks ?? null
|
|
8683
8599
|
});
|
|
8684
8600
|
return {
|
|
@@ -9061,7 +8977,6 @@ function projectConversationDetail(args) {
|
|
|
9061
8977
|
...conversationSummaryFromStoredConversation({
|
|
9062
8978
|
access: args.access,
|
|
9063
8979
|
pinnedAtMs: args.pinnedAtMs,
|
|
9064
|
-
unreadReply: args.unreadReply,
|
|
9065
8980
|
automationTitle: args.automationTitle,
|
|
9066
8981
|
auxiliaryCosts: args.auxiliaryCosts,
|
|
9067
8982
|
...args.childAgentTotals ? { childAgentTotals: args.childAgentTotals } : void 0,
|
|
@@ -9193,7 +9108,6 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
9193
9108
|
transcript: state.transcriptVersion
|
|
9194
9109
|
}) },
|
|
9195
9110
|
...state.viewerMarks,
|
|
9196
|
-
unreadReply: state.unreadReply,
|
|
9197
9111
|
automationTitle: automationTitleByConversation.get(conversationId),
|
|
9198
9112
|
annotations,
|
|
9199
9113
|
sidebarAnnotations,
|
|
@@ -9585,14 +9499,11 @@ const feedAnnotated = alias(juniorConversations, "feed_annotated");
|
|
|
9585
9499
|
* token holds its minute. The end of the Turn moves the status.
|
|
9586
9500
|
* The rows are in feed order, so a move that reorders them moves the token.
|
|
9587
9501
|
* The newest Message of each role stands for the preview and participants.
|
|
9588
|
-
* The row shows only whether a reply is unread, so a scroll that moves the
|
|
9589
|
-
* read position does not move the token.
|
|
9590
9502
|
* Threads and annotations show from the whole tree. Waiting roots outside
|
|
9591
9503
|
* the page move the Review items token.
|
|
9592
9504
|
*/
|
|
9593
9505
|
function conversationFeedVersionQuery(db, userId) {
|
|
9594
9506
|
const pin = juniorConversationParticipants;
|
|
9595
|
-
const read = juniorConversationReadPositions;
|
|
9596
9507
|
const conversationId = juniorConversations.conversationId;
|
|
9597
9508
|
const tree = db.select({ version: sql`concat_ws(':',
|
|
9598
9509
|
count(*) filter (where ${feedTree.archivedAt} is not null),
|
|
@@ -9617,10 +9528,9 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
9617
9528
|
activity: shownActivityMinute(juniorConversations.executionStatus, juniorConversations.lastActivityAt).as("activity"),
|
|
9618
9529
|
assistantSeq: sql`(${latestMessageSeqQuery(db, "assistant", conversationId)})`.as("assistant_seq"),
|
|
9619
9530
|
userSeq: sql`(${latestMessageSeqQuery(db, "user", conversationId)})`.as("user_seq"),
|
|
9620
|
-
unread: unreadReplySql(db, userId, conversationId, read.lastReadSeq).as("unread"),
|
|
9621
9531
|
threads: sql`(${tree})`.as("threads"),
|
|
9622
9532
|
annotations: sql`(${annotations})`.as("annotations")
|
|
9623
|
-
}).from(juniorConversations).leftJoin(pin, and(eq(pin.rootConversationId, conversationId), eq(pin.userId, userId))).
|
|
9533
|
+
}).from(juniorConversations).leftJoin(pin, and(eq(pin.rootConversationId, conversationId), eq(pin.userId, userId))).where(and(listedConversation(), conversationFeedMembershipFilter("active", {
|
|
9624
9534
|
kind: "viewer",
|
|
9625
9535
|
userId
|
|
9626
9536
|
}))).orderBy(desc(isNotNull(pin.pinnedAt)), desc(juniorConversations.lastActivityAt), asc(conversationId)).limit(CONVERSATION_FEED_LIMIT).as("feed_page");
|
|
@@ -9632,7 +9542,6 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
9632
9542
|
status: byRow(page.executionStatus, page.stoppedAt),
|
|
9633
9543
|
activity: byRow(page.activity),
|
|
9634
9544
|
messages: byRow(page.assistantSeq, page.userSeq),
|
|
9635
|
-
unread: byRow(page.unread),
|
|
9636
9545
|
threads: byRow(page.threads),
|
|
9637
9546
|
annotations: byRow(page.annotations)
|
|
9638
9547
|
};
|
|
@@ -9678,7 +9587,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9678
9587
|
if (filter?.kind === "viewer" && status === "active") rows.push(...await waitingRowsOutsidePage(db, filter, rows));
|
|
9679
9588
|
const conversations = rows.map((row) => conversationFromRecordRow(row));
|
|
9680
9589
|
const conversationIds = conversations.map((conversation) => conversation.conversationId);
|
|
9681
|
-
const [accessByConversation, viewerMarksByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, briefByConversation, automationTitleByConversation, firstHumanMessageTextByConversation
|
|
9590
|
+
const [accessByConversation, viewerMarksByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, briefByConversation, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
|
|
9682
9591
|
readConversationAccessFromSql(db, conversationIds, options.viewer),
|
|
9683
9592
|
conversationViewerMarks(db, conversationIds, filter ? feedMember(filter) : void 0),
|
|
9684
9593
|
listConversationAnnotationsById(db, conversationIds),
|
|
@@ -9693,8 +9602,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9693
9602
|
readConversationActivityPreviews(db, conversationIds),
|
|
9694
9603
|
readConversationFeedBriefs(db, conversationIds),
|
|
9695
9604
|
readAutomationTitlesByConversationId(conversations),
|
|
9696
|
-
readFirstHumanMessageTexts(db, conversations)
|
|
9697
|
-
filter?.kind === "viewer" ? readUnreadConversationIds(db, conversationIds, filter.userId) : /* @__PURE__ */ new Set()
|
|
9605
|
+
readFirstHumanMessageTexts(db, conversations)
|
|
9698
9606
|
]);
|
|
9699
9607
|
const visibleActivityPreviews = await attachActivityPreviewMentions(getSqlExecutor(), new Map([...activityPreviewByConversation].filter(([conversationId]) => accessByConversation.get(conversationId)?.canViewPrivateContent)));
|
|
9700
9608
|
const visibleAnnotationsByConversation = new Map(conversationIds.map((conversationId) => [conversationId, accessByConversation.get(conversationId)?.canViewPrivateContent ? annotationsByConversation.get(conversationId) ?? [] : []]));
|
|
@@ -9713,7 +9621,6 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
9713
9621
|
const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
|
|
9714
9622
|
const summary = conversationSummaryFromStoredConversation({
|
|
9715
9623
|
...viewerMarksByConversation.get(conversation.conversationId),
|
|
9716
|
-
unreadReply: unreadConversationIds.has(conversation.conversationId),
|
|
9717
9624
|
automationTitle: automationTitleByConversation.get(conversation.conversationId),
|
|
9718
9625
|
conversation,
|
|
9719
9626
|
access,
|
|
@@ -9841,4 +9748,4 @@ function viewerWebMessages(messages, viewer) {
|
|
|
9841
9748
|
}] : [];
|
|
9842
9749
|
});
|
|
9843
9750
|
}
|
|
9844
|
-
export {
|
|
9751
|
+
export { reviewItemChange as $, assertNoLegacyAllowedDomains as A, normalizeIncomingSlackThreadId as B, cancelConversationPendingMessagesForViewer as C, createProductionConversationWorkOptions as D, resolveMentions as E, startProcessingReaction as F, stopConversation as G, createSlackWebApiStatusSender as H, buildSlackInboundMessage as I, bindMessageAuthorIdentityId as J, parseContent as K, clearSlackPendingReactions as L, isAllowedSignInEmail as M, readEnvList as N, createProductionSlackWebhookServices as O, resolveAllowedDomains as P, readReviewItemForUser as Q, slackInboundMessageId as R, encodeConversationCursor as S, requireConversationPendingMessages as T, SubscribedReplyReason as U, withNormalizedThreadId as V, getThreadStopDecision as W, actOnReviewItem as X, ReviewItemActionError as Y, closeReviewItemsAnsweredByReply as Z, conversationSummaryFromStoredConversation as _, pinConversation as a, archiveViewerDoneConversations as at, createConversationForViewer as b, readConversationAuxiliaryCostsFromSql as c, setConversationAutoArchive as ct, conversationVersionQuery as d, enqueueAgentDispatch as dt, alreadyContinuesInSlackMessage as et, readConversationDetailEtag as f, GET as ft, readConversationRecordFromSql as g, readConversationEvents as h, readConversationFeed as i, DEFAULT_AUTO_ARCHIVE_SETTINGS as it, isAllowedDomain as j, getProductionSlackAdapter as k, childAgentTotalsReport as l, updateUserAutoArchiveSettings as lt, keepQuickQuestionForViewer as m, steerConversationPendingMessagesForViewer as n, continueConversationInSlack as nt, reorderPinnedConversations as o, readUserAutoArchiveSettings as ot, forkConversationForViewer as p, readHealthReport as pt, recordSkippedConversationMessage as q, conversationFeedVersionQuery as r, isMovableToSlack as rt, readConversationDetail as s, runAutoArchiveSweep as st, stopConversationTurnForViewer as t, canContinueInSlack as tt, readConversationTreeMetricsFromSql as u, AGENT_DISPATCH_MAX_AGE_MS as ut, readFirstHumanMessageTexts as v, readConversationPendingMessages as w, decodeConversationCursor as x, appendConversationMessageForViewer as y, stripLeadingBotMention as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Bt as
|
|
2
|
-
import { a as getConversationStore } from "./db-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { Bt as requestAnotherSlice$1, Ct as deadLetterAttempt$1, Dt as getConversationWorkState$1, Et as getConversation$1, Ht as startConversationWork$1, It as recordAttemptFailure$1, Lt as recordConversationRetry$1, Mt as listActiveConversationIds$1, Nt as markConversationWorkEnqueued$1, Rt as releaseConversationWork$1, Tt as dropPendingMessages$1, Ut as steerWebPendingMessages$1, Vt as requestConversationWork$1, Wt as stopConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, kt as hasRunnableConversationWork, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as releaseInboundMessage } from "./projection-BgwEE36_.js";
|
|
2
|
+
import { a as getConversationStore } from "./db-CoMNr2Zm.js";
|
|
3
|
+
import "./background-compaction-queue-BZhGFOK6.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -169,6 +169,7 @@ async function appendAndEnqueueInboundMessage(args) {
|
|
|
169
169
|
appendResult: await appendInboundMessage({
|
|
170
170
|
message: args.message,
|
|
171
171
|
nowMs,
|
|
172
|
+
renderText: args.renderText,
|
|
172
173
|
state: args.state
|
|
173
174
|
}),
|
|
174
175
|
nowMs
|
|
@@ -255,6 +256,12 @@ async function cancelHumanFacingPendingMessages(args) {
|
|
|
255
256
|
if (result.cancelledInboundMessageIds.length > 0) await recordExecutionMetadata(args);
|
|
256
257
|
return result;
|
|
257
258
|
}
|
|
259
|
+
/** Drop pending mailbox rows by id without requiring a worker lease. */
|
|
260
|
+
async function dropPendingMessages(args) {
|
|
261
|
+
const dropped = await dropPendingMessages$1(args);
|
|
262
|
+
if (dropped.length > 0) await recordExecutionMetadata(args);
|
|
263
|
+
return dropped;
|
|
264
|
+
}
|
|
258
265
|
/** Mark one author's queued web messages as interrupts. */
|
|
259
266
|
async function steerWebPendingMessages(args) {
|
|
260
267
|
return await steerWebPendingMessages$1(args);
|
|
@@ -305,4 +312,4 @@ async function clearExpiredConversationLease(args) {
|
|
|
305
312
|
async function listActiveConversationIds(args = {}) {
|
|
306
313
|
return await listActiveConversationIds$1(args);
|
|
307
314
|
}
|
|
308
|
-
export {
|
|
315
|
+
export { requestConversationWork as C, stopConversationWork as E, requestAnotherSlice as S, steerWebPendingMessages as T, getConversationWorkState as _, cancelHumanFacingPendingMessages as a, recordConversationRetry as b, clearConsumedConversationWake as c, completeConversationWork as d, deadLetterAttempt as f, getConversation as g, ensureConversationWake as h, beginConversationResume as i, clearExpiredConversationLease as l, dropPendingMessages as m, appendAndEnqueueExclusiveInboundMessage as n, checkInConversationWork as o, drainConversationMailbox as p, appendAndEnqueueInboundMessage as r, claimInboundMessage as s, ackMessages as t, completeConversationStop as u, listActiveConversationIds as v, startConversationWork as w, releaseConversationWork as x, recordAttemptFailure as y };
|