@sentry/junior 0.279.0 → 0.280.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/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
- package/dist/{adapter-phTTgw7H.js → adapter-DVN3iwf9.js} +1 -1
- package/dist/{admin-PcpJDugZ.js → admin-Q_UI--9W.js} +1 -1
- package/dist/{agent-runner-DwvT1BY0.js → agent-runner-_PYLv4Qo.js} +26 -27
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +3 -3
- package/dist/api.js +181 -85
- package/dist/{app-DVs6noo7.d.ts → app-CL2zzzE0.d.ts} +4 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +33 -34
- package/dist/{assistant-reply-BXfxczd7.js → assistant-reply-DbebsAxi.js} +1 -1
- package/dist/{automation-BehArCcq.js → automation-CPqRFjIa.js} +2 -2
- package/dist/{background-compaction-queue-CcbuLJrZ.js → background-compaction-queue-B9lmh8Ml.js} +3 -3
- package/dist/{briefs-Dd_ezwED.js → briefs-Dej7V0Bz.js} +5 -5
- package/dist/{catalog-runtime-BWVMeZhW.js → catalog-runtime-DpN0sWQ6.js} +1 -1
- package/dist/cli/chat.js +15 -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/{client-Bpxe4vKa.js → client-h2A2ZPzY.js} +2 -2
- package/dist/{config-C_bmRhrJ.js → config-CusBFORe.js} +2 -2
- package/dist/{connections-B2rHe5W5.js → connections-C4h6mGha.js} +11 -11
- package/dist/{conversation-CIiJtx5q.js → conversation-DExTZw8B.js} +16 -6
- package/dist/{conversation-pending-messages-CnBvE6-6.js → conversation-pending-messages-Dgz6hrJs.js} +2 -2
- package/dist/{conversation-privacy-CzOfcz0U.js → conversation-privacy-2cm6OpNg.js} +1 -1
- package/dist/{credential-sync-Dal_unpv.js → credential-sync-DK06Jgt-.js} +16 -16
- package/dist/{db-CyLrV9C7.d.ts → db-Dsvk1Tp1.d.ts} +2 -2
- package/dist/{executor-BfYH-Wws.js → executor-Cmr0J8W3.js} +149 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-CkT3_Xxp.js → logging-CGnh65_X.js} +1 -1
- package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
- package/dist/{message-Q5dkgaJ5.js → message-RpAnqHPY.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-BDRaqe8O.js → oauth-callback-server-BBnhVKuX.js} +2 -2
- package/dist/{oauth-relay-D0G3T16m.js → oauth-relay-D6xxVywK.js} +1 -1
- package/dist/{projection-DWxX7pb1.js → projection-C1MghKyI.js} +148 -106
- package/dist/{prompt--dwus7Y-.js → prompt-BcHg-BMy.js} +2 -2
- package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
- package/dist/{registry-DnrdeO4s.js → registry-DR7DjX9H.js} +3 -3
- package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
- package/dist/{resolve-C_QXfqD_.js → resolve-0Ful4oDv.js} +4 -4
- package/dist/{result-DNmOxT-N.js → result-Dd9kCuQ-.js} +11 -11
- package/dist/{runner-zd_noJ1l.js → runner-yiY8gUUu.js} +11 -11
- package/dist/{sandbox-egress-signals-DQjv-nbG.js → sandbox-egress-signals-BzQVHCMz.js} +1 -1
- package/dist/{schema-e90H5FIN.d.ts → schema-BkMmF552.d.ts} +28 -5
- package/dist/{schema-CNJNzvr8.js → schema-C5pEgfHc.js} +30 -7
- package/dist/{service-account-BK26XlHo.js → service-account-Cu7HFLZQ.js} +3 -3
- package/dist/{service-account-CCH2Hv4h.js → service-account-PIMpWZHF.js} +3 -3
- package/dist/{session-stop-6Tf--T7G.js → session-stop-CDEMsNtv.js} +13 -14
- package/dist/{skills-BNrk8gi4.js → skills-B2xIoe0f.js} +3 -3
- package/dist/{spawn-C75hAB9l.js → spawn-C0DySQRV.js} +2 -2
- package/dist/{stop-RYbf7PWi.js → stop-Dj5-nrAo.js} +255 -144
- package/dist/{store-CO5vGjwD.js → store-Dlio-o6u.js} +6 -6
- package/dist/{store-G3h2djJU.js → store-QzOfDwKA.js} +3 -3
- package/dist/{task-queue-DlN58XeM.js → task-queue-Cp1V_XW3.js} +4 -4
- package/dist/{task-runner-B-Bdm23d.js → task-runner-CQkkUj3o.js} +8 -8
- package/dist/{thread-state-Cj_7Slru.js → thread-state-Bn87cfzE.js} +4 -4
- package/dist/{turn-failure-response-CE7gaoC7.js → turn-failure-response-CQebxByj.js} +8 -8
- package/dist/{turn-lifecycle-7sXwXLJ6.js → turn-lifecycle-CJJsOhXB.js} +1 -1
- package/dist/{turn-session-routing-FBdaH1zf.js → turn-session-routing-bmG330Cf.js} +10 -11
- package/dist/{validation-DLWxEzWW.js → validation-D1wcf7hp.js} +1 -1
- package/dist/{version-DtQ8WFIZ.js → version-BeHSXUK6.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-vsM8_90o.js → viewer-BZ0Hp5Nb.js} +5 -6
- package/dist/{work-DsoFRO_0.js → work-BTcCIbWu.js} +12 -12
- package/dist/{worker-6kZEsCXs.js → worker-D3fDK6zc.js} +6 -6
- package/package.json +5 -5
- package/dist/agent-invocations-CUg_SODU.js +0 -181
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as completeTurnRecord, $a as
|
|
3
|
-
import { a as completeText, c as resolveGatewayModel, m as escapeXml, r as completeDecision, x as isProviderRetryError } from "./client-
|
|
4
|
-
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName, y as createS3AttachmentStorage } from "./config-
|
|
5
|
-
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, S as setTags, T as withLogContext, W as isRecord, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { g as instructionProvenanceFor, m as contextProvenance, n as detectImageMediaType, r as isVisionImageMediaType } from "./media-
|
|
11
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
12
|
-
import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, S as createSlackReviewItemShow, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, lt as createAndEnqueueConversation, m as latestProgressStatus, mt as decodeInputImages, n as executeAgentRun, ot as acceptsWebMessages, pt as resolveConversationDestination, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-
|
|
2
|
+
import { $ as completeTurnRecord, $a as notInheritedByForkChild, $n as takeReviewItem, A as getConversationMessageSlackTs, Aa as createPluginLogger, Ai as removeReactionFromMessage, Ba as conversationViewerMarks, Ci as addReactionToMessage, D as buildConversationContext, E as appendThreadContextMessages, En as webActorUserIds, F as turnHasReply, Fa as conversationHasParticipantUser, Fi as SlackActionError, Ga as readLatestConversationBrief, H as AuthorizationFlowDisabledError, Ha as viewerConversationMembership, Hi as normalizeSlackConversationId, I as upsertConversationMessage, Ia as conversationIsMemberRoot, Ii as downloadPrivateSlackFile, J as wasPendingAuthStopped, Ja as readConversationEventPageAround, Jn as getReviewItem, K as clearPendingAuth, Ka as readConversationEventPage, La as conversationNotArchivedForEmail, Ln as getPlugins, Lr as verifyTimerWatchCredentialSubject, M as markConversationMessage, Ma as readConversationAccessFromSql, N as normalizeConversationText, Na as conversationArchivedForEmail, O as createConversationMemoryService, P as recordDeliveredAssistantMessage, Pa as conversationArchivedForUser, Q as abandonTurnRecord, R as PluginCredentialFailureError, Ra as conversationNotArchivedForUser, Ri as getHeaderString, Rr as JUNIOR_THREAD_STATE_TTL_MS, S as resolveConversationTitle, Si as truncateStatusText, Sn as isExperimentalFeatureEnabled, Ut as persistWithRetry, Va as readConversationViewerMarks, Vi as isDmChannel, Wi as withSlackRetries, Wn as closeReviewItem, X as loadTurnCheckpoint, Xn as listReplyActionItems, Z as saveTurnCheckpoint, Za as buildSentryConversationUrl, Zn as listWaitingConversations, a as loadProjection, an as trimTrailingAssistantMessages, ar as isOnlyAssignee, bi as normalizeSlackStatusText, co as listConversationAnnotationsById, d as recordAuthorizationCompleted, do as lookupSlackUser, eo as getSlackFileId, et as failTurnRecord, fn as decideSubscribedThreadReply, fo as createPluginCache, go as piMessageFromHistoryItem, h as recordSubscribedReplyRoute, i as loadConversationProjection, ir as canReadReviewItem, j as isHumanConversationMessage, k as estimateConversationContextTokens, ln as buildDeterministicAssistantMessageId, lr as reviewItemNeedsUser, mn as getThreadStopDecision, mo as configValueSchema, n as commitMessages, no as readAttachmentVisionSummary, nr as canActOnReviewItem, nt as listTurnSummaries, o as loadTurnProjection, pn as getSubscribedReplyPreflightDecision, qa as readConversationEventPageAfter, ro as recordSlackAttachment, rt as recordTurnSummary, so as listConversationAnnotations, t as commitAcceptedReply, tt as getTurnRecord, un as buildDeterministicTurnId, ur as reviewItemReaderForUser, v as hydrateConversationMessages, w as fallbackShortTitle, wn as createUserTokenStore, x as persistConversationMessageSummaries, xr as cancelSubscriptions, y as persistConversationMessages, za as conversationPinnedForUser, zi as getSlackClient, zt as buildTurnErrorResponse } from "./projection-C1MghKyI.js";
|
|
3
|
+
import { a as completeText, c as resolveGatewayModel, m as escapeXml, r as completeDecision, x as isProviderRetryError } from "./client-h2A2ZPzY.js";
|
|
4
|
+
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName, y as createS3AttachmentStorage } from "./config-CusBFORe.js";
|
|
5
|
+
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, S as setTags, T as withLogContext, W as isRecord, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-CGnh65_X.js";
|
|
6
|
+
import { t as JUNIOR_VERSION } from "./version-BeHSXUK6.js";
|
|
7
|
+
import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
8
|
+
import { $ as agentTurnUsageSchema, A as loadConversationSlackTenantIds, C as getSqlExecutor, I as resolveActorIdentityId, J as nextDetailVersion, K as parseSessionSource, L as saveActorAvatar, N as locationFromRow, S as getDb, X as addAgentTurnUsage, et as hasAgentTurnUsage, f as identityAvatarUrl, h as readUserAvatarUrls, it as requireSlackDestination, k as withConversationEventLock, nt as createSlackDestination, q as conversationDetailTouch, tt as resolveRootConversationId, x as getConversationStore, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
|
|
9
|
+
import { A as juniorIdentities, M as juniorDestinations, O as conversationReadColumns, S as juniorConversationEvents, T as juniorCodeChanges, _ as juniorConversationParticipants, c as juniorReviewItems, g as juniorConversationReadPositions, j as juniorUsers, k as juniorConversations, o as juniorReviewItemConversations, y as juniorConversationBriefs } from "./executor-Cmr0J8W3.js";
|
|
10
|
+
import { g as instructionProvenanceFor, m as contextProvenance, n as detectImageMediaType, r as isVisionImageMediaType } from "./media-Dq9_svfQ.js";
|
|
11
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-DR7DjX9H.js";
|
|
12
|
+
import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, S as createSlackReviewItemShow, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, lt as createAndEnqueueConversation, m as latestProgressStatus, mt as decodeInputImages, n as executeAgentRun, ot as acceptsWebMessages, pt as resolveConversationDestination, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-_PYLv4Qo.js";
|
|
13
13
|
import { a as withLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { r as getStateAdapter } from "./adapter-
|
|
15
|
-
import { R as readMessageAttachments, c as conversationDetailReportSchema, p as conversationFeedSchema, u as conversationEventPageSchema } from "./conversation-
|
|
16
|
-
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt
|
|
17
|
-
import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-
|
|
18
|
-
import { n as getAssistantReplyText, t as decideReply } from "./assistant-reply-
|
|
19
|
-
import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-
|
|
20
|
-
import { _ as isEmptyUserInputAnswer, b as webMessageId, v as normalizeUserInputAnswer } from "./reporting-window-
|
|
21
|
-
import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-
|
|
22
|
-
import { D as stopConversationWork, E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-
|
|
23
|
-
import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-
|
|
24
|
-
import { d as healthReportSchema, s as conversationPendingMessagesReportSchema, u as apiErrorSchema } from "./conversation-pending-messages-
|
|
25
|
-
import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-
|
|
26
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
27
|
-
import { o as AgentRunError, s as executeTurn } from "./work-
|
|
28
|
-
import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-
|
|
29
|
-
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, l as getWebAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-
|
|
30
|
-
import { t as bindMessageAgent } from "./message-
|
|
31
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
32
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
33
|
-
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-
|
|
14
|
+
import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
|
|
15
|
+
import { R as readMessageAttachments, c as conversationDetailReportSchema, p as conversationFeedSchema, u as conversationEventPageSchema } from "./conversation-DExTZw8B.js";
|
|
16
|
+
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-BcHg-BMy.js";
|
|
17
|
+
import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-Dlio-o6u.js";
|
|
18
|
+
import { n as getAssistantReplyText, t as decideReply } from "./assistant-reply-DbebsAxi.js";
|
|
19
|
+
import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-CDEMsNtv.js";
|
|
20
|
+
import { _ as isEmptyUserInputAnswer, b as webMessageId, v as normalizeUserInputAnswer } from "./reporting-window-B-QP9zX1.js";
|
|
21
|
+
import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-B9lmh8Ml.js";
|
|
22
|
+
import { D as stopConversationWork, E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-QzOfDwKA.js";
|
|
23
|
+
import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-bmG330Cf.js";
|
|
24
|
+
import { d as healthReportSchema, s as conversationPendingMessagesReportSchema, u as apiErrorSchema } from "./conversation-pending-messages-Dgz6hrJs.js";
|
|
25
|
+
import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-Dd9kCuQ-.js";
|
|
26
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-CJJsOhXB.js";
|
|
27
|
+
import { o as AgentRunError, s as executeTurn } from "./work-BTcCIbWu.js";
|
|
28
|
+
import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-Bn87cfzE.js";
|
|
29
|
+
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, l as getWebAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-C4h6mGha.js";
|
|
30
|
+
import { t as bindMessageAgent } from "./message-RpAnqHPY.js";
|
|
31
|
+
import { t as bindSpawnAgent } from "./spawn-C0DySQRV.js";
|
|
32
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CQkkUj3o.js";
|
|
33
|
+
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-CQebxByj.js";
|
|
34
34
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
35
|
-
import
|
|
35
|
+
import * as z from "zod";
|
|
36
36
|
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
37
37
|
import { conversationSidebarAnnotationSchema, createSlackSource, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
38
38
|
import { alias } from "drizzle-orm/pg-core";
|
|
@@ -8857,31 +8857,27 @@ async function readConversationFeed(options = {}) {
|
|
|
8857
8857
|
return conversationFeedSchema.parse(await readConversationFeedFromSql(options));
|
|
8858
8858
|
}
|
|
8859
8859
|
// src/api/conversations/event-list.ts
|
|
8860
|
-
/** Read one bounded page of reporting events before, after, or around a
|
|
8860
|
+
/** Read one bounded page of reporting events before, after, or around a boundary. */
|
|
8861
8861
|
async function readConversationEvents(conversationId, boundary, options = {}) {
|
|
8862
8862
|
const record = await readConversationRecordFromSql(conversationId);
|
|
8863
8863
|
if (!record) return void 0;
|
|
8864
|
-
const
|
|
8865
|
-
conversationId,
|
|
8866
|
-
cursor: "after" in boundary ? boundary.after : "around" in boundary ? boundary.around : boundary.before
|
|
8867
|
-
});
|
|
8868
|
-
if (!cursor) throwApiError(400, "Invalid conversation cursor.");
|
|
8864
|
+
const position = await boundaryPosition(conversationId, boundary);
|
|
8869
8865
|
const canExposePayload = (await readConversationAccessFromSql(getDb(), [conversationId], options.viewer)).get(conversationId)?.canViewPrivateContent ?? false;
|
|
8870
8866
|
const transcriptPurgedAtMs = record.conversation.transcriptPurgedAtMs;
|
|
8871
8867
|
const pageArgs = {
|
|
8872
8868
|
canExposePayload,
|
|
8873
8869
|
conversationId,
|
|
8874
|
-
limit: options.limit ??
|
|
8870
|
+
limit: options.limit ?? 150
|
|
8875
8871
|
};
|
|
8876
|
-
const page = transcriptPurgedAtMs !== void 0 ? { events: [] } : "after"
|
|
8872
|
+
const page = transcriptPurgedAtMs !== void 0 ? { events: [] } : position.direction === "after" ? await readConversationEventPageAfter(getSqlExecutor(), {
|
|
8877
8873
|
...pageArgs,
|
|
8878
|
-
afterSeq:
|
|
8879
|
-
}) : "around"
|
|
8874
|
+
afterSeq: position.seq
|
|
8875
|
+
}) : position.direction === "around" ? await readConversationEventPageAround(getSqlExecutor(), {
|
|
8880
8876
|
...pageArgs,
|
|
8881
|
-
seq:
|
|
8877
|
+
seq: position.seq
|
|
8882
8878
|
}) : await readConversationEventPage(getSqlExecutor(), {
|
|
8883
8879
|
...pageArgs,
|
|
8884
|
-
beforeSeq:
|
|
8880
|
+
beforeSeq: position.seq
|
|
8885
8881
|
});
|
|
8886
8882
|
return conversationEventPageSchema.parse(await conversationEventPageReport(getSqlExecutor(), {
|
|
8887
8883
|
conversationId,
|
|
@@ -8892,6 +8888,39 @@ async function readConversationEvents(conversationId, boundary, options = {}) {
|
|
|
8892
8888
|
page
|
|
8893
8889
|
}));
|
|
8894
8890
|
}
|
|
8891
|
+
/** Resolve a page boundary to a direction and an event seq. */
|
|
8892
|
+
async function boundaryPosition(conversationId, boundary) {
|
|
8893
|
+
if ("event" in boundary) return {
|
|
8894
|
+
direction: "around",
|
|
8895
|
+
seq: boundary.event
|
|
8896
|
+
};
|
|
8897
|
+
if ("turn" in boundary) {
|
|
8898
|
+
const seq = await readTurnStartedSeq(conversationId, boundary.turn);
|
|
8899
|
+
if (seq === void 0) throwApiError(404, "Turn not found.");
|
|
8900
|
+
return {
|
|
8901
|
+
direction: "around",
|
|
8902
|
+
seq
|
|
8903
|
+
};
|
|
8904
|
+
}
|
|
8905
|
+
const [direction, value] = "after" in boundary ? ["after", boundary.after] : "around" in boundary ? ["around", boundary.around] : ["before", boundary.before];
|
|
8906
|
+
const cursor = decodeConversationCursor({
|
|
8907
|
+
conversationId,
|
|
8908
|
+
cursor: value
|
|
8909
|
+
});
|
|
8910
|
+
if (!cursor) throwApiError(400, "Invalid conversation cursor.");
|
|
8911
|
+
return {
|
|
8912
|
+
direction,
|
|
8913
|
+
seq: cursor.seq
|
|
8914
|
+
};
|
|
8915
|
+
}
|
|
8916
|
+
/**
|
|
8917
|
+
* Find the event that started a Turn. The `(conversation_id, type, seq)`
|
|
8918
|
+
* index reads only this Conversation's `turn_started` rows.
|
|
8919
|
+
*/
|
|
8920
|
+
async function readTurnStartedSeq(conversationId, turnId) {
|
|
8921
|
+
const [row] = await getDb().select({ seq: juniorConversationEvents.seq }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "turn_started"), sql`${juniorConversationEvents.payload}->>'turnId' = ${turnId}`)).limit(1);
|
|
8922
|
+
return row?.seq;
|
|
8923
|
+
}
|
|
8895
8924
|
/** Attach mentions and signed cursors to one bounded page of events. */
|
|
8896
8925
|
async function conversationEventPageReport(executor, args) {
|
|
8897
8926
|
const { conversationId, page } = args;
|
|
@@ -8907,6 +8936,57 @@ async function conversationEventPageReport(executor, args) {
|
|
|
8907
8936
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
8908
8937
|
};
|
|
8909
8938
|
}
|
|
8939
|
+
// src/api/conversations/agent-tree.ts
|
|
8940
|
+
/** Bound the parent chain that one agent tree reads. */
|
|
8941
|
+
const MAX_AGENT_TREE_DEPTH = 16;
|
|
8942
|
+
const CHILD_LABEL = "Subagent";
|
|
8943
|
+
async function readParentConversationId(conversationId) {
|
|
8944
|
+
const [row] = await getDb().select({ parentId: juniorConversations.parentConversationId }).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId));
|
|
8945
|
+
return row?.parentId ?? void 0;
|
|
8946
|
+
}
|
|
8947
|
+
/**
|
|
8948
|
+
* Read the agent tree of a child Conversation: its parent chain, root first,
|
|
8949
|
+
* with the child last. Returns undefined for a root Conversation. Each
|
|
8950
|
+
* Conversation has its own access check, so a viewer sees a label only where
|
|
8951
|
+
* they can see private content.
|
|
8952
|
+
*/
|
|
8953
|
+
async function readConversationAgentTree(conversationId, viewer) {
|
|
8954
|
+
const ids = [conversationId];
|
|
8955
|
+
let parentId = await readParentConversationId(conversationId);
|
|
8956
|
+
while (parentId && !ids.includes(parentId) && ids.length < MAX_AGENT_TREE_DEPTH) {
|
|
8957
|
+
ids.unshift(parentId);
|
|
8958
|
+
parentId = await readParentConversationId(parentId);
|
|
8959
|
+
}
|
|
8960
|
+
if (ids.length < 2) return;
|
|
8961
|
+
const root = parentId ? void 0 : await getConversationStore().get({ conversationId: ids[0] });
|
|
8962
|
+
const [access, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
|
|
8963
|
+
readConversationAccessFromSql(getDb(), ids, viewer),
|
|
8964
|
+
readAutomationTitlesByConversationId(root ? [root] : []),
|
|
8965
|
+
readFirstHumanMessageTexts(getDb(), root ? [root] : [])
|
|
8966
|
+
]);
|
|
8967
|
+
return await Promise.all(ids.map(async (id) => {
|
|
8968
|
+
const itemAccess = access.get(id);
|
|
8969
|
+
if (root?.conversationId === id) return {
|
|
8970
|
+
conversationId: id,
|
|
8971
|
+
label: conversationSummaryFromStoredConversation({
|
|
8972
|
+
access: itemAccess,
|
|
8973
|
+
automationTitle: automationTitleByConversation.get(id),
|
|
8974
|
+
conversation: root,
|
|
8975
|
+
durationMs: 0,
|
|
8976
|
+
firstHumanMessageText: firstHumanMessageTextByConversation.get(id)
|
|
8977
|
+
}).displayTitle
|
|
8978
|
+
};
|
|
8979
|
+
if (!itemAccess?.canViewPrivateContent) return {
|
|
8980
|
+
conversationId: id,
|
|
8981
|
+
label: CHILD_LABEL
|
|
8982
|
+
};
|
|
8983
|
+
const agent = await getChildAgentLabel(id);
|
|
8984
|
+
return {
|
|
8985
|
+
conversationId: id,
|
|
8986
|
+
label: agent?.title ?? agent?.agentName ?? CHILD_LABEL
|
|
8987
|
+
};
|
|
8988
|
+
}));
|
|
8989
|
+
}
|
|
8910
8990
|
// src/api/conversations/fork.ts
|
|
8911
8991
|
/** Fork a Conversation that the viewer can read into a new root they own. */
|
|
8912
8992
|
async function forkConversationForViewer(viewer, sourceConversationId, body) {
|
|
@@ -8964,63 +9044,21 @@ async function readConversationForks(conversationId, viewer) {
|
|
|
8964
9044
|
}
|
|
8965
9045
|
return result;
|
|
8966
9046
|
}
|
|
8967
|
-
// src/api/conversations/
|
|
8968
|
-
/** Bound the parent chain that one agent tree reads. */
|
|
8969
|
-
const MAX_AGENT_TREE_DEPTH = 16;
|
|
8970
|
-
const CHILD_LABEL = "Subagent";
|
|
8971
|
-
async function readParentConversationId(conversationId) {
|
|
8972
|
-
const [row] = await getDb().select({ parentId: juniorConversations.parentConversationId }).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId));
|
|
8973
|
-
return row?.parentId ?? void 0;
|
|
8974
|
-
}
|
|
9047
|
+
// src/api/conversations/read-position.ts
|
|
8975
9048
|
/**
|
|
8976
|
-
* Read the
|
|
8977
|
-
*
|
|
8978
|
-
*
|
|
8979
|
-
*
|
|
9049
|
+
* Read how far the viewer has read one Conversation, if they have read it.
|
|
9050
|
+
*
|
|
9051
|
+
* The viewer saw every Message up to one they wrote, also one sent from
|
|
9052
|
+
* Slack, so the position is at least their latest Message.
|
|
8980
9053
|
*/
|
|
8981
|
-
async function readConversationAgentTree(conversationId, viewer) {
|
|
8982
|
-
const ids = [conversationId];
|
|
8983
|
-
let parentId = await readParentConversationId(conversationId);
|
|
8984
|
-
while (parentId && !ids.includes(parentId) && ids.length < MAX_AGENT_TREE_DEPTH) {
|
|
8985
|
-
ids.unshift(parentId);
|
|
8986
|
-
parentId = await readParentConversationId(parentId);
|
|
8987
|
-
}
|
|
8988
|
-
if (ids.length < 2) return;
|
|
8989
|
-
const root = parentId ? void 0 : await getConversationStore().get({ conversationId: ids[0] });
|
|
8990
|
-
const [access, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
|
|
8991
|
-
readConversationAccessFromSql(getDb(), ids, viewer),
|
|
8992
|
-
readAutomationTitlesByConversationId(root ? [root] : []),
|
|
8993
|
-
readFirstHumanMessageTexts(getDb(), root ? [root] : [])
|
|
8994
|
-
]);
|
|
8995
|
-
return await Promise.all(ids.map(async (id) => {
|
|
8996
|
-
const itemAccess = access.get(id);
|
|
8997
|
-
if (root?.conversationId === id) return {
|
|
8998
|
-
conversationId: id,
|
|
8999
|
-
label: conversationSummaryFromStoredConversation({
|
|
9000
|
-
access: itemAccess,
|
|
9001
|
-
automationTitle: automationTitleByConversation.get(id),
|
|
9002
|
-
conversation: root,
|
|
9003
|
-
durationMs: 0,
|
|
9004
|
-
firstHumanMessageText: firstHumanMessageTextByConversation.get(id)
|
|
9005
|
-
}).displayTitle
|
|
9006
|
-
};
|
|
9007
|
-
if (!itemAccess?.canViewPrivateContent) return {
|
|
9008
|
-
conversationId: id,
|
|
9009
|
-
label: CHILD_LABEL
|
|
9010
|
-
};
|
|
9011
|
-
const agent = await getChildAgentLabel(id);
|
|
9012
|
-
return {
|
|
9013
|
-
conversationId: id,
|
|
9014
|
-
label: agent?.title ?? agent?.agentName ?? CHILD_LABEL
|
|
9015
|
-
};
|
|
9016
|
-
}));
|
|
9017
|
-
}
|
|
9018
|
-
// src/api/conversations/read-position.ts
|
|
9019
|
-
/** Read how far the viewer has read one Conversation, if they have read it. */
|
|
9020
9054
|
async function readConversationReadPosition(viewer, conversationId) {
|
|
9021
|
-
const [row] = await getDb().select({ lastReadSeq: juniorConversationReadPositions.lastReadSeq }).from(juniorConversationReadPositions).where(and(eq(juniorConversationReadPositions.userId, viewer.id), eq(juniorConversationReadPositions.conversationId, conversationId))).limit(1);
|
|
9055
|
+
const [row] = await getDb().select({ lastReadSeq: sql`greatest(${juniorConversationReadPositions.lastReadSeq}, (${latestViewerMessageSeq(viewer, conversationId)}))` }).from(juniorConversationReadPositions).where(and(eq(juniorConversationReadPositions.userId, viewer.id), eq(juniorConversationReadPositions.conversationId, conversationId))).limit(1);
|
|
9022
9056
|
return row;
|
|
9023
9057
|
}
|
|
9058
|
+
/** The seq of the latest Message that one of the viewer's Identities wrote. */
|
|
9059
|
+
function latestViewerMessageSeq(viewer, conversationId) {
|
|
9060
|
+
return getDb().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, viewer.id)));
|
|
9061
|
+
}
|
|
9024
9062
|
/**
|
|
9025
9063
|
* Move the viewer's read position forward.
|
|
9026
9064
|
*
|
|
@@ -9032,7 +9070,7 @@ async function markConversationRead(viewer, conversationId, body) {
|
|
|
9032
9070
|
const db = getDb();
|
|
9033
9071
|
const [conversation] = await db.select({ lastSeq: max(juniorConversationEvents.seq) }).from(juniorConversations).leftJoin(juniorConversationEvents, eq(juniorConversationEvents.conversationId, juniorConversations.conversationId)).where(eq(juniorConversations.conversationId, conversationId)).groupBy(juniorConversations.conversationId);
|
|
9034
9072
|
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
9035
|
-
|
|
9073
|
+
await db.insert(juniorConversationReadPositions).values({
|
|
9036
9074
|
conversationId,
|
|
9037
9075
|
lastReadSeq: Math.min(body.lastReadSeq, conversation.lastSeq ?? 0),
|
|
9038
9076
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
@@ -9043,8 +9081,76 @@ async function markConversationRead(viewer, conversationId, body) {
|
|
|
9043
9081
|
lastReadSeq: sql`greatest(${juniorConversationReadPositions.lastReadSeq}, excluded.last_read_seq)`,
|
|
9044
9082
|
updatedAt: sql`excluded.updated_at`
|
|
9045
9083
|
}
|
|
9046
|
-
})
|
|
9047
|
-
return
|
|
9084
|
+
});
|
|
9085
|
+
return await readConversationReadPosition(viewer, conversationId);
|
|
9086
|
+
}
|
|
9087
|
+
// src/api/conversations/detail-etag.ts
|
|
9088
|
+
/**
|
|
9089
|
+
* Sum the detail versions of a Conversation and its child agents. Child
|
|
9090
|
+
* writes bump only their own row, and the row count changes when a child
|
|
9091
|
+
* starts, so the parent needs no bump of its own.
|
|
9092
|
+
*/
|
|
9093
|
+
async function readSubtreeDetailVersion(conversationId) {
|
|
9094
|
+
const [row] = await getDb().select({
|
|
9095
|
+
conversations: sql`count(*)::int`,
|
|
9096
|
+
version: sql`coalesce(sum(${juniorConversations.detailVersion}), 0)::text`
|
|
9097
|
+
}).from(juniorConversations).innerJoin(conversationSubtree([conversationId]), eq(conversationSubtreeColumns.conversationId, juniorConversations.conversationId));
|
|
9098
|
+
return row ?? {
|
|
9099
|
+
conversations: 0,
|
|
9100
|
+
version: "0"
|
|
9101
|
+
};
|
|
9102
|
+
}
|
|
9103
|
+
/** Read the detail state that the ETag hashes and the report shows. */
|
|
9104
|
+
async function readConversationDetailState(conversationId, viewer) {
|
|
9105
|
+
const [access, viewerMarks, forks, agentTree, readPosition, autoArchive] = await Promise.all([
|
|
9106
|
+
readConversationAccessFromSql(getDb(), [conversationId], viewer),
|
|
9107
|
+
viewer ? readConversationViewerMarks(viewer, conversationId) : void 0,
|
|
9108
|
+
readConversationForks(conversationId, viewer),
|
|
9109
|
+
readConversationAgentTree(conversationId, viewer),
|
|
9110
|
+
viewer ? readConversationReadPosition(viewer, conversationId) : void 0,
|
|
9111
|
+
viewer ? readConversationAutoArchive(viewer, conversationId) : void 0
|
|
9112
|
+
]);
|
|
9113
|
+
return {
|
|
9114
|
+
access: access.get(conversationId),
|
|
9115
|
+
agentTree,
|
|
9116
|
+
autoArchive,
|
|
9117
|
+
forks,
|
|
9118
|
+
readPosition,
|
|
9119
|
+
viewerMarks
|
|
9120
|
+
};
|
|
9121
|
+
}
|
|
9122
|
+
/**
|
|
9123
|
+
* Return the detail ETag without building the report, or undefined for a
|
|
9124
|
+
* missing Conversation. The state comes back too, so the report reuses it
|
|
9125
|
+
* and matches the ETag.
|
|
9126
|
+
*
|
|
9127
|
+
* Shared content is covered by `detail_version`. The detail state is cheap,
|
|
9128
|
+
* so it is read on each request. Names, avatars, Automation titles, and
|
|
9129
|
+
* plugin sidebar labels are not covered: they refresh with the next detail
|
|
9130
|
+
* change or a reload.
|
|
9131
|
+
*
|
|
9132
|
+
* The read position is not hashed. The dashboard writes it as the reader
|
|
9133
|
+
* scrolls and puts the stored value in its cached detail, so a poll after a
|
|
9134
|
+
* read can answer 304. Other tabs and devices get it with the next detail
|
|
9135
|
+
* change or a reload.
|
|
9136
|
+
*/
|
|
9137
|
+
async function readConversationDetailEtag(conversationId, options) {
|
|
9138
|
+
const [subtree, state] = await Promise.all([readSubtreeDetailVersion(conversationId), readConversationDetailState(conversationId, options.viewer)]);
|
|
9139
|
+
if (subtree.conversations === 0) return void 0;
|
|
9140
|
+
const basis = JSON.stringify({
|
|
9141
|
+
access: state.access ?? null,
|
|
9142
|
+
agentTree: state.agentTree ?? null,
|
|
9143
|
+
autoArchive: state.autoArchive ?? null,
|
|
9144
|
+
forks: state.forks,
|
|
9145
|
+
junior: JUNIOR_VERSION,
|
|
9146
|
+
limit: options.limit ?? null,
|
|
9147
|
+
subtree,
|
|
9148
|
+
viewerMarks: state.viewerMarks ?? null
|
|
9149
|
+
});
|
|
9150
|
+
return {
|
|
9151
|
+
etag: createHash("sha256").update(basis).digest("hex"),
|
|
9152
|
+
state
|
|
9153
|
+
};
|
|
9048
9154
|
}
|
|
9049
9155
|
// src/api/conversations/detail.ts
|
|
9050
9156
|
/** Project stored metadata and a bounded event page into a signed history cursor. */
|
|
@@ -9099,12 +9205,13 @@ function projectConversationDetail(args) {
|
|
|
9099
9205
|
};
|
|
9100
9206
|
}
|
|
9101
9207
|
async function readConversationDetailFromSql(conversationId, options) {
|
|
9102
|
-
const record = await readConversationRecordFromSql(conversationId);
|
|
9208
|
+
const [record, state] = await Promise.all([readConversationRecordFromSql(conversationId), options.state ?? readConversationDetailState(conversationId, options.viewer)]);
|
|
9103
9209
|
if (!record) return void 0;
|
|
9104
|
-
const
|
|
9210
|
+
const { access, readPosition } = state;
|
|
9211
|
+
const canExposePayload = access?.canViewPrivateContent ?? false;
|
|
9105
9212
|
const executor = getSqlExecutor();
|
|
9106
|
-
const
|
|
9107
|
-
|
|
9213
|
+
const purgedPage = { events: [] };
|
|
9214
|
+
const [annotations, automationTitleByConversation, auxiliaryCostsByConversation, briefVersion, firstHumanMessageTextByConversation, modelUsage, metricsByConversation, people, sourceTask, teamDomainByTeamId, page] = await Promise.all([
|
|
9108
9215
|
listConversationAnnotations(getDb(), conversationId),
|
|
9109
9216
|
readAutomationTitlesByConversationId([record.conversation]),
|
|
9110
9217
|
readConversationAuxiliaryCostsFromSql(getDb(), [conversationId]),
|
|
@@ -9113,44 +9220,45 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
9113
9220
|
record.conversation.transcriptPurgedAtMs === void 0 ? readConversationModelUsageFromSql(executor, { conversationId }) : Promise.resolve([]),
|
|
9114
9221
|
readConversationTreeMetricsFromSql(getDb(), [conversationId]),
|
|
9115
9222
|
readConversationAuthors(getDb(), conversationId),
|
|
9116
|
-
options.viewer ? readConversationReadPosition(options.viewer, conversationId) : void 0,
|
|
9117
9223
|
readConversationSourceTask({
|
|
9118
9224
|
conversationId,
|
|
9119
9225
|
...options.viewer ? { viewer: options.viewer } : void 0
|
|
9120
9226
|
}),
|
|
9121
|
-
resolveSlackTeamDomains(record.conversation.location?.provider === "slack" ? [record.conversation.location.teamId] : [])
|
|
9227
|
+
resolveSlackTeamDomains(record.conversation.location?.provider === "slack" ? [record.conversation.location.teamId] : []),
|
|
9228
|
+
record.conversation.transcriptPurgedAtMs === void 0 ? readConversationEventPage(executor, {
|
|
9229
|
+
canExposePayload,
|
|
9230
|
+
conversationId,
|
|
9231
|
+
latestTurns: options.latestTurns,
|
|
9232
|
+
limit: options.limit
|
|
9233
|
+
}) : purgedPage
|
|
9122
9234
|
]);
|
|
9123
|
-
const access = accessByConversation.get(conversationId);
|
|
9124
|
-
const sidebarAnnotations = access?.canViewPrivateContent ? (await listConversationSidebarAnnotations([conversationId], /* @__PURE__ */ new Map([[conversationId, annotations]])))[conversationId] : void 0;
|
|
9125
|
-
const canExposePayload = access?.canViewPrivateContent ?? false;
|
|
9126
|
-
const page = record.conversation.transcriptPurgedAtMs === void 0 ? await readConversationEventPage(executor, {
|
|
9127
|
-
canExposePayload,
|
|
9128
|
-
conversationId,
|
|
9129
|
-
limit: options.limit
|
|
9130
|
-
}) : { events: [] };
|
|
9131
9235
|
const firstSeq = page.events[0]?.seq;
|
|
9132
9236
|
const unreadAfterSeq = readPosition !== void 0 && page.previousSeq !== void 0 && firstSeq !== void 0 && readPosition.lastReadSeq + 1 < firstSeq ? readPosition.lastReadSeq : void 0;
|
|
9133
|
-
const brief =
|
|
9134
|
-
const [{ briefMentions, events }, unreadPage] = await Promise.all([
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9237
|
+
const brief = canExposePayload ? briefVersion?.content : void 0;
|
|
9238
|
+
const [{ briefMentions, events }, unreadPage, sidebarAnnotations] = await Promise.all([
|
|
9239
|
+
attachConversationMentions(executor, conversationId, {
|
|
9240
|
+
...brief ? { brief } : void 0,
|
|
9241
|
+
events: page.events
|
|
9242
|
+
}),
|
|
9243
|
+
options.unreadPage && unreadAfterSeq !== void 0 ? readConversationEventPageAround(executor, {
|
|
9244
|
+
canExposePayload,
|
|
9245
|
+
conversationId,
|
|
9246
|
+
limit: options.limit,
|
|
9247
|
+
seq: unreadAfterSeq
|
|
9248
|
+
}).then((around) => conversationEventPageReport(executor, {
|
|
9249
|
+
conversationId,
|
|
9250
|
+
eventHistory: conversationEventHistory({ canExposePayload }),
|
|
9251
|
+
page: around
|
|
9252
|
+
})).catch(() => void 0) : void 0,
|
|
9253
|
+
canExposePayload ? listConversationSidebarAnnotations([conversationId], /* @__PURE__ */ new Map([[conversationId, annotations]])).then((byConversation) => byConversation[conversationId]) : void 0
|
|
9254
|
+
]);
|
|
9147
9255
|
const metrics = metricsByConversation.get(conversationId);
|
|
9148
9256
|
const auxiliaryCosts = auxiliaryCostsByConversation.get(conversationId);
|
|
9149
9257
|
const childAgentTotals = childAgentTotalsReport(metrics, auxiliaryCosts);
|
|
9150
|
-
|
|
9258
|
+
const report = projectConversationDetail({
|
|
9151
9259
|
...record,
|
|
9152
9260
|
access,
|
|
9153
|
-
...viewerMarks,
|
|
9261
|
+
...state.viewerMarks,
|
|
9154
9262
|
automationTitle: automationTitleByConversation.get(conversationId),
|
|
9155
9263
|
annotations,
|
|
9156
9264
|
sidebarAnnotations,
|
|
@@ -9176,25 +9284,28 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
9176
9284
|
...unreadPage ? { unreadPage } : void 0,
|
|
9177
9285
|
usage: metrics?.usage ?? record.usage ?? void 0
|
|
9178
9286
|
});
|
|
9287
|
+
return {
|
|
9288
|
+
...report,
|
|
9289
|
+
...state.forks,
|
|
9290
|
+
...state.agentTree ? { agentTree: state.agentTree } : void 0,
|
|
9291
|
+
...report.isParticipant && state.autoArchive !== void 0 ? { autoArchive: state.autoArchive } : void 0
|
|
9292
|
+
};
|
|
9179
9293
|
}
|
|
9180
|
-
/**
|
|
9294
|
+
/** Turns in the default page: enough to read the latest exchange in context. */
|
|
9295
|
+
const DETAIL_LATEST_TURNS = 3;
|
|
9296
|
+
/**
|
|
9297
|
+
* Load one conversation from its canonical event history. Without `limit`,
|
|
9298
|
+
* events hold the latest Turns, up to the default limit.
|
|
9299
|
+
*/
|
|
9181
9300
|
async function readConversationDetail(conversationId, options = {}) {
|
|
9182
9301
|
const report = await readConversationDetailFromSql(conversationId, {
|
|
9183
9302
|
...options,
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
readConversationForks(conversationId, options.viewer),
|
|
9189
|
-
readConversationAgentTree(conversationId, options.viewer),
|
|
9190
|
-
options.viewer && report.isParticipant ? readConversationAutoArchive(options.viewer, conversationId) : void 0
|
|
9191
|
-
]);
|
|
9192
|
-
return conversationDetailReportSchema.parse({
|
|
9193
|
-
...report,
|
|
9194
|
-
...forks,
|
|
9195
|
-
...agentTree ? { agentTree } : void 0,
|
|
9196
|
-
...autoArchive === void 0 ? void 0 : { autoArchive }
|
|
9303
|
+
...options.limit === void 0 ? {
|
|
9304
|
+
latestTurns: DETAIL_LATEST_TURNS,
|
|
9305
|
+
limit: 150
|
|
9306
|
+
} : { limit: options.limit }
|
|
9197
9307
|
});
|
|
9308
|
+
return report ? conversationDetailReportSchema.parse(report) : void 0;
|
|
9198
9309
|
}
|
|
9199
9310
|
// src/api/conversations/pin.ts
|
|
9200
9311
|
/**
|
|
@@ -9303,4 +9414,4 @@ function viewerWebMessages(messages, viewer) {
|
|
|
9303
9414
|
}] : [];
|
|
9304
9415
|
});
|
|
9305
9416
|
}
|
|
9306
|
-
export {
|
|
9417
|
+
export { DEFAULT_AUTO_ARCHIVE_SETTINGS as $, assertNoLegacyAllowedDomains as A, normalizeIncomingSlackThreadId as B, requireConversationPendingMessages as C, createProductionSlackWebhookServices as D, createProductionConversationWorkOptions as E, recordSkippedConversationMessage as F, startProcessingReaction as G, stopConversationTurn as H, buildSlackInboundMessage as I, ReviewItemActionError as J, stripLeadingBotMention as K, clearSlackPendingReactions as L, isAllowedSignInEmail as M, readEnvList as N, getProductionSlackAdapter as O, resolveAllowedDomains as P, reviewItemChange as Q, isSlackMessageStopped as R, readConversationPendingMessages as S, archiveConversation as T, THREAD_OPTOUT_ACK as U, withNormalizedThreadId as V, bindMessageAuthorIdentityId as W, closeReviewItemsAnsweredByReply as X, actOnReviewItem as Y, readReviewItemForUser as Z, appendConversationMessageForViewer as _, readConversationDetailEtag as a, emptyResponse as at, encodeConversationCursor as b, keepQuickQuestionForViewer as c, getAttachmentStorage as ct, readConversationRecordFromSql as d, GET as dt, archiveViewerDoneConversations as et, readConversationAuxiliaryCostsFromSql as f, readHealthReport as ft, readFirstHumanMessageTexts as g, conversationSummaryFromStoredConversation as h, readConversationDetail as i, updateUserAutoArchiveSettings as it, isAllowedDomain as j, createSlackWebApiStatusSender as k, readConversationEvents as l, AGENT_DISPATCH_MAX_AGE_MS as lt, readConversationTreeMetricsFromSql as m, steerConversationPendingMessagesForViewer as n, runAutoArchiveSweep as nt, markConversationRead as o, jsonResponse as ot, childAgentTotalsReport as p, parseContent as q, pinConversation as r, setConversationAutoArchive as rt, forkConversationForViewer as s, throwApiError as st, stopConversationTurnForViewer as t, readUserAutoArchiveSettings as tt, readConversationFeed as u, enqueueAgentDispatch as ut, createConversationForViewer as v, resolveMentions as w, cancelConversationPendingMessagesForViewer as x, decodeConversationCursor as y, stopSlackThread as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as TURN_REASONING_LEVELS } from "./config-
|
|
2
|
-
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
1
|
+
import { g as TURN_REASONING_LEVELS } from "./config-CusBFORe.js";
|
|
2
|
+
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
|
|
3
|
+
import { h as juniorAgentInvocations, m as juniorAgentBindings } from "./executor-Cmr0J8W3.js";
|
|
4
|
+
import { p as credentialContextSchema } from "./registry-DR7DjX9H.js";
|
|
5
|
+
import { S as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, x as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B-QP9zX1.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
-
import
|
|
7
|
+
import * as z from "zod";
|
|
8
8
|
import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
|
|
9
9
|
import { actorSchema, destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
|
|
10
10
|
// src/chat/runtime/turn.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-
|
|
2
|
-
import { x as getConversationStore } from "./viewer-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-C1MghKyI.js";
|
|
2
|
+
import { x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
|
|
3
|
+
import "./background-compaction-queue-B9lmh8Ml.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
2
|
-
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-
|
|
1
|
+
import { h as logWarn } from "./logging-CGnh65_X.js";
|
|
2
|
+
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-B9lmh8Ml.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import
|
|
4
|
+
import * as z from "zod";
|
|
5
5
|
// src/chat/queue/callback.ts
|
|
6
6
|
/** Shared queue callback wiring for signed messages. */
|
|
7
7
|
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
|
|
|
110
110
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
111
111
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
112
112
|
run: async (message) => {
|
|
113
|
-
const { processPluginTask } = await import("./task-runner-
|
|
113
|
+
const { processPluginTask } = await import("./task-runner-CQkkUj3o.js").then((n) => n.r);
|
|
114
114
|
await processPluginTask(message);
|
|
115
115
|
},
|
|
116
116
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection,
|
|
3
|
-
import { h as parseSlackMessageTs } from "./actor-
|
|
4
|
-
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-
|
|
5
|
-
import { _ as sameActorIdentity } from "./media-
|
|
6
|
-
import { r as getStateAdapter } from "./adapter-
|
|
7
|
-
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-
|
|
8
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
9
|
-
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-
|
|
2
|
+
import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection, en as isToolResultError, fo as createPluginCache, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginModelCostRecorder, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-C1MghKyI.js";
|
|
3
|
+
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
4
|
+
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
|
|
5
|
+
import { _ as sameActorIdentity } from "./media-Dq9_svfQ.js";
|
|
6
|
+
import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
|
|
7
|
+
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-bmG330Cf.js";
|
|
8
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.js";
|
|
9
|
+
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-Cp1V_XW3.js";
|
|
10
10
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
11
11
|
// src/chat/plugins/task-runner.ts
|
|
12
12
|
/**
|