@sentry/junior 0.299.0 → 0.301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-AgCNqqsG.js → adapter-CNjGEJO9.js} +5 -4
- package/dist/{admin-1VwEXztm.js → admin-CRJHvCGg.js} +2 -2
- package/dist/{agent-runner-Ciet8_nn.js → agent-runner-H4YhvNBj.js} +514 -270
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +327 -61
- package/dist/{app--ky-Eu33.d.ts → app-HDZglaIu.d.ts} +14 -3
- package/dist/app.d.ts +1 -1
- package/dist/app.js +60 -220
- package/dist/{automation-M3RFJUBf.js → automation-Cva5ZOwW.js} +2 -2
- package/dist/{background-compaction-queue-CnimvRdk.js → background-compaction-queue-CNrZ3QcU.js} +8 -4
- package/dist/{briefs-CwzvgdCa.js → briefs-x6Mzwxmg.js} +3 -3
- package/dist/{catalog-runtime-DaBaHY7u.js → catalog-runtime-BEY6EGRi.js} +1 -1
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{config-CAXIpWQb.js → config-CmjhyqgB.js} +39 -8
- package/dist/{connections-Dy0hPdUq.js → connections-CfIRm0xv.js} +6 -6
- package/dist/{continue-in-slack-DIOjFj76.js → continue-in-slack-DPoABVkB.js} +6 -6
- package/dist/{conversation-fCWD9Az3.js → conversation-BNXfq6Lb.js} +30 -9
- package/dist/{conversation-feed-BPK8vkkZ.js → conversation-feed-CfpyFMHP.js} +23 -2
- package/dist/{conversation-privacy-DUgtRkf8.js → conversation-privacy-0CM0V2qK.js} +1 -1
- package/dist/{conversation-turn-DkJB6yMF.js → conversation-turn-C0sxyvS-.js} +17 -17
- package/dist/{credential-sync-RX24Y8aY.js → credential-sync-tEMKZ_8M.js} +15 -15
- package/dist/{db-B07FtU9g.d.ts → db-BdUHQhrC.d.ts} +1 -1
- package/dist/{db-COYOGzYS.js → db-Czra10QW.js} +13 -8
- package/dist/{executor-BWmAgSyi.js → executor-D_023K0H.js} +9 -4
- package/dist/instrumentation.js +14 -5
- package/dist/{lineage-D-5jm_oj.js → lineage-DmMIE0VL.js} +2 -2
- package/dist/{logging-DPLEa8Bn.js → logging-DcjLDDqi.js} +1 -1
- package/dist/{message-BIHR1yRk.js → message-C0JY9RJP.js} +8 -8
- package/dist/{model-input-BPZYH8Nd.js → model-input-CBp-p24N.js} +4 -4
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-R7qvSzFG.js → oauth-callback-server-BRq9QNhU.js} +2 -2
- package/dist/{plugins-CBW2Prb_.js → plugins-BBX07Jzt.js} +1 -1
- package/dist/{projection-DEdP1q6f.js → projection-CQNDOi82.js} +911 -671
- package/dist/{prompt-4M98h_tC.js → prompt-DLUB5m72.js} +4 -4
- package/dist/{registry-BTKmKM-r.js → registry-Dj377ADs.js} +2 -2
- package/dist/{resolve-B8hXNVZ3.js → resolve-DJkh9Fky.js} +3 -3
- package/dist/{result-g-XAaOj6.js → result-C8iIpDl1.js} +9 -9
- package/dist/{runner-BlPSA5A8.js → runner-DZqrOy8C.js} +9 -9
- package/dist/{sandbox-egress-signals-Pai-MzEY.js → sandbox-egress-signals-CGwH86S9.js} +1 -1
- package/dist/{schema-DbuWR-DN.d.ts → schema-CdZFn7Qd.d.ts} +248 -6
- package/dist/{schema-BNnY_trV.js → schema-DyHXiQKI.js} +28 -16
- package/dist/{service-account-BYGZ08DQ.js → service-account-D6jGR4a1.js} +3 -3
- package/dist/{service-account-9OLNQMyz.js → service-account-suY004dx.js} +4 -4
- package/dist/{session-stop-2XJrcNCy.js → session-stop-BLmfFI3d.js} +121 -46
- package/dist/{skills-DpBQoeHV.js → skills-CmNG0dHb.js} +2 -2
- package/dist/{slack-conversation-unfurl-BcDIWo67.js → slack-conversation-unfurl-Bty-DlHe.js} +7 -7
- package/dist/{spawn-09GssFod.js → spawn-CNjkpXpk.js} +6 -6
- package/dist/{state-Cufq0_rH.js → state-CEbZuZD6.js} +2 -2
- package/dist/{statuses-B8mUfghF.js → statuses-Hn-HsOph.js} +86 -2
- package/dist/{stop-U7iUrR1g.js → stop-Bjy2-K4H.js} +967 -93
- package/dist/{store-BHiaHCQu.js → store-DmV4CoNr.js} +5 -5
- package/dist/{store-CSgUTMdv.js → store-Epv6t4vV.js} +9 -9
- package/dist/{task-queue-bMNq0clp.js → task-queue-AhG1tSXR.js} +3 -3
- package/dist/{task-runner-B__rxwxU.js → task-runner-BMxZI3o7.js} +8 -8
- package/dist/{thread-context-d0ceWbVT.js → thread-context-CXLnbg7g.js} +8 -8
- package/dist/{turn-session-routing-BVZHBFCF.js → turn-session-routing-BD3-jJl7.js} +5 -5
- package/dist/{turn-user-message-BEw7acTP.js → turn-user-message-DsUZi9gn.js} +3 -3
- package/dist/{users-BK3dbxZL.js → users-BxvYclQg.js} +3 -3
- package/dist/{validation-BDVJjO2E.js → validation-DOz8X9BU.js} +1 -1
- package/dist/{version-DQgZoQ3D.js → version-CGMRmMPK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CAWfFo29.js → viewer-H3EsMWtJ.js} +16 -114
- package/dist/{warmup-9ySPacF9.js → warmup-CdU5hR49.js} +51 -27
- package/dist/{worker-D8jJO-WO.js → worker-ClphajjD.js} +24 -20
- package/migrations/0107_attachment_deferred_download.sql +2 -0
- package/migrations/meta/0107_snapshot.json +4617 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +10 -8
- package/dist/media-BAHvgkok.js +0 -85
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { h as startSpan } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as loadTurnCheckpoint, $n as webActorUserIds, $o as
|
|
3
|
-
import {
|
|
4
|
-
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, W as normalizeIdentityEmail, 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, $n as webActorUserIds, $o as isSlackRequestTimeout, A as latestConversationMessageSeq, Ai as getDashboardLinkFilter, Ao as readLatestConversationBrief, Bo as getSlackFileId, Co as conversationIsMemberRoot, Cs as piMessageFromHistoryItem, D as estimateConversationMessagesTokens, Do as viewerMarksFromParticipant, E as buildConversationContext, Eo as conversationViewerMarks, F as turnHasReply, Fr as listReplyActionItems, Go as slackAttachmentsVersionQuery, Gr as canUserReadReviewItem, H as PluginCredentialFailureError, Ho as readAttachmentVisionSummary, Hr as canActOnReviewItem, Ht as releaseInboundMessage, I as upsertConversationMessage, Ii as isDashboardLink, Io as buildSentryConversationUrl, Ir as listWaitingConversations, K as AuthorizationFlowDisabledError, Ko as SlackActionError, Kr as isOnlyAssignee, Li as parseDashboardConversationLink, Ln as trimTrailingAssistantMessages, M as normalizeConversationText, Mi as getDashboardPersonLink, Mo as readConversationEventPageAfter, N as recordDeliveredAssistantMessage, No as readConversationEventPageAround, Nr as getReviewItem, O as getConversationMessageSlackTs, Oa as removeReactionFromMessage, P as trimConversationMessages, Qo as isDmChannel, Ri as parseDashboardPersonLink, S as resolveConversationTitle, So as conversationHasParticipantUser, To as conversationPinnedForUser, V as createPluginEgress, Wo as recordSlackAttachment, X as clearPendingAuth, Xo as getSlackClient, Xr as reviewItemNeedsSomeone, Yo as getHeaderString, Zn as createUserTokenStore, _o as createPluginLogger, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, ba as truncateStatusText, bn as persistWithRetry, bo as createConversationAccessReader, ct as listTurnSummaries, d as recordAuthorizationCompleted, di as cancelSubscriptions, ds as listConversationAnnotations, es as normalizeSlackConversationId, et as lostWorkerBeforeFirstSave, fa as SLACK_USER_MENTION_RE, fr as getPlugins, fs as listConversationAnnotationsById, ga as normalizeSlackStatusText, gs as lookupSlackUserNames, h as recordSubscribedReplyRoute, hs as lookupSlackUser, i as loadConversationProjection, it as completeTurnRecord, j as markConversationMessage, jo as readConversationEventPage, k as isHumanConversationMessage, ki as getDashboardConversationLink, kr as closeReviewItem, lt as recordTurnSummary, n as commitMessages, ns as streamPrivateSlackFile, nt as saveTurnCheckpoint, o as loadTurnProjection, qo as downloadPrivateSlackFile, rr as applyPluginFormatMarkdown, rs as withSlackRetries, rt as abandonTurnRecord, st as getTurnRecord, t as commitAcceptedReply, tn as buildTurnErrorResponse, tt as pauseLostWorkerTurn, un as getAssistantReplyText, v as hydrateConversationMessages, va as slackMentionedUserIds, w as fallbackShortTitle, wo as conversationIsNotUnsubscribedRoot, xa as addReactionToMessage, xo as readConversationAccessFromSql, xs as configValueSchema, y as persistConversationMessageWindow, ya as wrapBareSlackUserIds, yo as canAddConversationMessages, ys as createPluginCache, zo as notInheritedByForkChild, zr as takeReviewItem } from "./projection-CQNDOi82.js";
|
|
3
|
+
import { D as resolveGatewayModel, M as textCharsForTokens, R as escapeXml, c as getSlackClientSecret, i as getChatConfig, j as estimateTextTokens, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, q as isProviderRetryError, s as getSlackClientId, y as normalizeSlackEmojiName } from "./config-CmjhyqgB.js";
|
|
4
|
+
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, W as normalizeIdentityEmail, 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-DcjLDDqi.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-CGMRmMPK.js";
|
|
6
6
|
import { f as parseSlackTeamId, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
7
|
-
import { $ as resolveRootConversationId, D as conversationKindFromRow, J as addAgentTurnUsage, N as resolveActorIdentityId, O as locationFromRow, P as saveActorAvatar, Q as hasAgentTurnUsage, S as deliversFinalText, T as postsRunNotices, U as readCachedUserByEmail, W as createCache, Z as agentTurnUsageSchema, _ as loadConversationSlackTenantIds, a as getConversationStore, f as withConversationEventLock, g as setArchivedAt, h as readConversationTrees, it as createSlackDestination, nt as nextDetailVersion, o as getDb, ot as requireSlackDestination, p as conversationAncestors, q as parseSessionSource, r as getConversationEventStore, s as getSqlExecutor, v as lastMessageAtSql, w as isTopLevelKind } from "./db-
|
|
8
|
-
import { D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, b as juniorConversationBriefs, j as juniorConversations, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-
|
|
7
|
+
import { $ as resolveRootConversationId, D as conversationKindFromRow, J as addAgentTurnUsage, N as resolveActorIdentityId, O as locationFromRow, P as saveActorAvatar, Q as hasAgentTurnUsage, S as deliversFinalText, T as postsRunNotices, U as readCachedUserByEmail, W as createCache, Z as agentTurnUsageSchema, _ as loadConversationSlackTenantIds, a as getConversationStore, f as withConversationEventLock, g as setArchivedAt, h as readConversationTrees, it as createSlackDestination, nt as nextDetailVersion, o as getDb, ot as requireSlackDestination, p as conversationAncestors, q as parseSessionSource, r as getConversationEventStore, s as getSqlExecutor, v as lastMessageAtSql, w as isTopLevelKind } from "./db-Czra10QW.js";
|
|
8
|
+
import { D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, b as juniorConversationBriefs, j as juniorConversations, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-D_023K0H.js";
|
|
9
9
|
import { d as contextProvenance, p as instructionProvenanceFor, t as KNOWN_CONVERSATION_EVENT_TYPES } from "./history-IjdmO_r6.js";
|
|
10
|
-
import { a as setStateValues, i as getStateValues, r as getStateAdapter, s as acquireActiveLock } from "./adapter-
|
|
11
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
12
|
-
import {
|
|
13
|
-
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { J as readMessageAttachments, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-fCWD9Az3.js";
|
|
10
|
+
import { a as setStateValues, i as getStateValues, r as getStateAdapter, s as acquireActiveLock } from "./adapter-CNjGEJO9.js";
|
|
11
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-Dj377ADs.js";
|
|
12
|
+
import { C as renderBlockText, Dt as throwApiError, F as resolveSlackChannelIdFromMessage, I as resolveSlackChannelIdFromThreadId, It as shouldEmitDevAgentTrace, K as readConversationSourceTask, L as resolveDestinationVisibility, N as parseSlackThreadId, Nt as RetryableDeliveryError, P as readSlackRawMessageContext, S as renderAttachmentText, St as conversationReadPositionQuery, T as createSlackReviewItemShow, a as buildAuthPauseResponse, at as appendAndEnqueueWebMessage, bt as storeAttachment, ct as createConversationId, ft as AttachmentUploadError, ht as verifyAttachmentUploads, it as acceptsWebMessages, lt as recordWebConversationActivity, m as latestProgressStatus, n as executeAgentRun, st as createAndEnqueueConversation, t as createAgentRunner, tt as deliverReviewItemChange, ut as webActorFromUser, w as parseSlackMessageReference } from "./agent-runner-H4YhvNBj.js";
|
|
13
|
+
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-DLUB5m72.js";
|
|
14
|
+
import { f as identityAvatarUrl, g as userAvatarUrlsFromIdentities, h as readUserAvatarUrls } from "./viewer-H3EsMWtJ.js";
|
|
15
|
+
import { G as MAX_ATTACHMENT_BYTES, Y as readMessageAttachments, f as conversationEventPageSchema, u as conversationDetailReportSchema } from "./conversation-BNXfq6Lb.js";
|
|
17
16
|
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
18
|
-
import { $ as sendSlackReply, O as resolveMailboxTurnWork, Q as resolveSlackReplyTarget, X as maybePostAutomatedTurnLimitNotice, at as
|
|
19
|
-
import { Et as executeTurn, J as cancelSignInWait, K as stopChildAgentsBelow, Tt as AgentRunError, W as dropOwnUnreadLoopReplies, _t as getTurnAuthorization, c as listConversationWork, ft as supersedeTurnForInput, gt as wakePausedTurn, l as readLastUserMessageAtByConversation, mt as getPausedTurnRequest, pt as createPausedTurns, q as stopChildAgentsOf, s as isConversationWorkDone, v as getChildAgentLabel, vt as canJoinTurn, wt as getWebAuthorization, yt as canShareTurn } from "./warmup-
|
|
20
|
-
import {
|
|
21
|
-
import { L as buildDeterministicAssistantMessageId, R as buildDeterministicTurnId, a as ConversationTurnBoundaryError, c as TurnInputDeferredError, d as isTurnInputCommitLostError, 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, v as getTurnLifecycle } from "./turn-user-message-
|
|
22
|
-
import { D as stopConversationWork, E as steerWebPendingMessages, _ as getConversationWorkState, a as cancelHumanFacingPendingMessages, g as getConversation, h as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage } from "./store-
|
|
23
|
-
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-
|
|
24
|
-
import { c as isEmptyUserInputAnswer, l as normalizeUserInputAnswer } from "./statuses-
|
|
17
|
+
import { $ as sendSlackReply, O as resolveMailboxTurnWork, Q as resolveSlackReplyTarget, X as maybePostAutomatedTurnLimitNotice, at as conversationSubtree, b as isExperimentalFeatureEnabled, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as legacyWebMailboxMetadataSchema, l as savedInputInstruction, o as skipInputAfterConversationStop, ot as conversationSubtreeColumns, p as instructionActorFor, r as markConversationsStopped, rt as recordFinishedTurnForAutomatedLimit } from "./session-stop-BLmfFI3d.js";
|
|
18
|
+
import { Et as executeTurn, J as cancelSignInWait, K as stopChildAgentsBelow, Tt as AgentRunError, W as dropOwnUnreadLoopReplies, _t as getTurnAuthorization, c as listConversationWork, ft as supersedeTurnForInput, gt as wakePausedTurn, l as readLastUserMessageAtByConversation, mt as getPausedTurnRequest, pt as createPausedTurns, q as stopChildAgentsOf, s as isConversationWorkDone, v as getChildAgentLabel, vt as canJoinTurn, wt as getWebAuthorization, yt as canShareTurn } from "./warmup-CdU5hR49.js";
|
|
19
|
+
import { T as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-CNrZ3QcU.js";
|
|
20
|
+
import { L as buildDeterministicAssistantMessageId, R as buildDeterministicTurnId, a as ConversationTurnBoundaryError, c as TurnInputDeferredError, d as isTurnInputCommitLostError, 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, v as getTurnLifecycle } from "./turn-user-message-DsUZi9gn.js";
|
|
21
|
+
import { D as stopConversationWork, E as steerWebPendingMessages, _ as getConversationWorkState, a as cancelHumanFacingPendingMessages, g as getConversation, h as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage } from "./store-DmV4CoNr.js";
|
|
22
|
+
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-BD3-jJl7.js";
|
|
23
|
+
import { c as isEmptyUserInputAnswer, l as normalizeUserInputAnswer, m as isVisionImageMediaType, p as detectImageMediaType } from "./statuses-Hn-HsOph.js";
|
|
25
24
|
import { p as webMessageId } from "./reporting-window-DopzcOHh.js";
|
|
26
|
-
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-
|
|
27
|
-
import { a as runWithSlackInstallation, d as isConversationMember, f as isPublicSlackChannel, h as listThreadReplies, l as getChannelMessage, u as getConversationInfo } from "./users-
|
|
28
|
-
import { E as personObjectCard, T as messageObjectCard, l as conversationPendingMessagesReportSchema, n as conversationFeedSchema, p as healthReportSchema, t as conversationFeedBriefSchema, w as conversationObjectCard } from "./conversation-feed-
|
|
29
|
-
import { c as withTurnSpan, n as createConversationTurnWorker, o as getTurnInputSpanAttributes, r as canPauseConversationDelivery, s as turnInputTelemetry } from "./conversation-turn-
|
|
30
|
-
import { n as buildStoredAttachmentPromptText } from "./model-input-
|
|
31
|
-
import { i as enqueueAgentInvocationResult, n as createDeliverToParent, s as withAgentInvocationResultActors, t as createChildConversationWorker } from "./result-
|
|
32
|
-
import { t as bindMessageAgent } from "./message-
|
|
33
|
-
import { t as readConversationLineage } from "./lineage-
|
|
34
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
35
|
-
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-
|
|
36
|
-
import { n as scheduleSessionCompletedPluginTasks } from "./task-runner-
|
|
37
|
-
import { r as canContinueInSlack } from "./continue-in-slack-
|
|
25
|
+
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, o as getDispatchIdForConversation, p as markDispatchAwaitingResume, r as confirmDispatchMailboxAppend, s as getDispatchInputMessageId } from "./store-Epv6t4vV.js";
|
|
26
|
+
import { a as runWithSlackInstallation, d as isConversationMember, f as isPublicSlackChannel, h as listThreadReplies, l as getChannelMessage, u as getConversationInfo } from "./users-BxvYclQg.js";
|
|
27
|
+
import { D as webPageObjectCard, E as personObjectCard, T as messageObjectCard, l as conversationPendingMessagesReportSchema, n as conversationFeedSchema, p as healthReportSchema, t as conversationFeedBriefSchema, w as conversationObjectCard } from "./conversation-feed-CfpyFMHP.js";
|
|
28
|
+
import { c as withTurnSpan, n as createConversationTurnWorker, o as getTurnInputSpanAttributes, r as canPauseConversationDelivery, s as turnInputTelemetry } from "./conversation-turn-C0sxyvS-.js";
|
|
29
|
+
import { n as buildStoredAttachmentPromptText } from "./model-input-CBp-p24N.js";
|
|
30
|
+
import { i as enqueueAgentInvocationResult, n as createDeliverToParent, s as withAgentInvocationResultActors, t as createChildConversationWorker } from "./result-C8iIpDl1.js";
|
|
31
|
+
import { t as bindMessageAgent } from "./message-C0JY9RJP.js";
|
|
32
|
+
import { t as readConversationLineage } from "./lineage-DmMIE0VL.js";
|
|
33
|
+
import { t as bindSpawnAgent } from "./spawn-CNjkpXpk.js";
|
|
34
|
+
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-CXLnbg7g.js";
|
|
35
|
+
import { n as scheduleSessionCompletedPluginTasks } from "./task-runner-BMxZI3o7.js";
|
|
36
|
+
import { r as canContinueInSlack } from "./continue-in-slack-DPoABVkB.js";
|
|
38
37
|
import * as z from "zod";
|
|
39
38
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
40
39
|
import { and, asc, count, desc, eq, gt, inArray, isNotNull, isNull, lte, ne, not, or, sql } from "drizzle-orm";
|
|
41
|
-
import { conversationSidebarAnnotationSchema, createSlackSource, objectAnnotationSchema, objectLinkFilterMatches, objectLinkFilterSpecificity, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
|
|
40
|
+
import { conversationSidebarAnnotationSchema, createSlackSource, encodeObjectImageRef, objectAnnotationSchema, objectLinkFilterMatches, objectLinkFilterSpecificity, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
|
|
42
41
|
import { alias } from "drizzle-orm/pg-core";
|
|
43
|
-
import { SlackFormatConverter, createSlackAdapter } from "@chat-adapter/slack";
|
|
44
42
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
43
|
+
import net from "node:net";
|
|
44
|
+
import https from "node:https";
|
|
45
|
+
import { SlackFormatConverter, createSlackAdapter } from "@chat-adapter/slack";
|
|
46
|
+
import dns from "node:dns";
|
|
47
|
+
import { parse } from "parse5";
|
|
45
48
|
// src/api/conversations/first-message.ts
|
|
46
49
|
/**
|
|
47
50
|
* Read the text of the first human message for each untitled conversation.
|
|
@@ -430,11 +433,23 @@ function conversationSummaryFromStoredConversation(args) {
|
|
|
430
433
|
};
|
|
431
434
|
}
|
|
432
435
|
// src/api/objects/conversation.ts
|
|
436
|
+
async function readViewerAccess(viewer, conversationId) {
|
|
437
|
+
return (await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Return whether the viewer sees the private content of the linked
|
|
441
|
+
* Conversation: a public Conversation, or a private one that they take part
|
|
442
|
+
* in. A link to no Conversation returns false.
|
|
443
|
+
*/
|
|
444
|
+
async function canViewConversationLink(viewer, url) {
|
|
445
|
+
const conversationId = parseDashboardConversationLink(url.href);
|
|
446
|
+
if (!conversationId) return false;
|
|
447
|
+
return (await readViewerAccess(viewer, conversationId))?.canViewPrivateContent ?? false;
|
|
448
|
+
}
|
|
433
449
|
/**
|
|
434
|
-
* Resolve a dashboard Conversation link for
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
* returns nothing, the same as a link to no Conversation.
|
|
450
|
+
* Resolve a dashboard Conversation link for a viewer that
|
|
451
|
+
* `canViewConversationLink` allows. A link to no Conversation returns
|
|
452
|
+
* nothing.
|
|
438
453
|
*/
|
|
439
454
|
async function resolveConversationLink(viewer, url) {
|
|
440
455
|
const conversationId = parseDashboardConversationLink(url.href);
|
|
@@ -443,7 +458,7 @@ async function resolveConversationLink(viewer, url) {
|
|
|
443
458
|
const conversation = await getConversationStore().get({ conversationId });
|
|
444
459
|
if (!conversation) return void 0;
|
|
445
460
|
const db = getDb();
|
|
446
|
-
const access =
|
|
461
|
+
const access = await readViewerAccess(viewer, conversationId);
|
|
447
462
|
if (!access?.canViewPrivateContent) return void 0;
|
|
448
463
|
const [firstTexts, automationTitles, brief, participants] = await Promise.all([
|
|
449
464
|
readFirstHumanMessageTexts(db, [conversation]),
|
|
@@ -550,6 +565,16 @@ async function resolvePersonLink(url) {
|
|
|
550
565
|
url: canonicalUrl
|
|
551
566
|
});
|
|
552
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* Resolve the card of the one known person who linked this provider account.
|
|
570
|
+
* Only account-linking flows put a provider Identity on a User, so the match
|
|
571
|
+
* is verified. Two people with the same handle get no card.
|
|
572
|
+
*/
|
|
573
|
+
async function resolvePersonByAccount(account) {
|
|
574
|
+
const rows = await getDb().selectDistinct({ email: juniorUsers.primaryEmail }).from(juniorIdentities).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.provider, account.provider), isNotNull(juniorIdentities.userId), sql`lower(${juniorIdentities.handle}) = lower(${account.handle})`)).limit(2);
|
|
575
|
+
const link = rows.length === 1 && getDashboardPersonLink(rows[0].email);
|
|
576
|
+
return link ? await resolvePersonLink(new URL(link)) : void 0;
|
|
577
|
+
}
|
|
553
578
|
// src/chat/services/subscribed-reply-router-policy.ts
|
|
554
579
|
/**
|
|
555
580
|
* Passive subscribed-thread reply router policy.
|
|
@@ -2075,7 +2100,6 @@ function createSubscribedReplyPolicy(deps) {
|
|
|
2075
2100
|
};
|
|
2076
2101
|
};
|
|
2077
2102
|
}
|
|
2078
|
-
// src/chat/slack/vision-context.ts
|
|
2079
2103
|
const MAX_MESSAGE_IMAGE_ATTACHMENTS = 3;
|
|
2080
2104
|
const MAX_VISION_SUMMARY_CHARS = 500;
|
|
2081
2105
|
/** Report whether the current Slack message carries an image that needs vision hydration. */
|
|
@@ -2134,11 +2158,23 @@ function buildAttachmentResolutionFailurePromptText(args) {
|
|
|
2134
2158
|
`filename: ${args.filename ?? "unnamed"}`,
|
|
2135
2159
|
`media_type: ${args.mediaType}`,
|
|
2136
2160
|
"<resolution-error>",
|
|
2137
|
-
|
|
2161
|
+
`The user attached this file, but ${args.problem}. Tell the user the attachment could not be read; do not say no attachment was sent.`,
|
|
2138
2162
|
"</resolution-error>",
|
|
2139
2163
|
"</attachment>"
|
|
2140
2164
|
].join("\n");
|
|
2141
2165
|
}
|
|
2166
|
+
/** Point the model at a stored file, or say that the file could not be stored. */
|
|
2167
|
+
function buildFileReferencePromptText(args) {
|
|
2168
|
+
return args.attachmentId ? buildStoredAttachmentPromptText({
|
|
2169
|
+
attachmentId: args.attachmentId,
|
|
2170
|
+
filename: args.filename,
|
|
2171
|
+
mediaType: args.mediaType
|
|
2172
|
+
}) : buildAttachmentResolutionFailurePromptText({
|
|
2173
|
+
filename: args.filename,
|
|
2174
|
+
mediaType: args.mediaType,
|
|
2175
|
+
problem: "it could not be stored, so you cannot open it"
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2142
2178
|
function visionCost(conversationId) {
|
|
2143
2179
|
return conversationId ? { conversationId } : { owner: "none" };
|
|
2144
2180
|
}
|
|
@@ -2180,9 +2216,31 @@ function getCachedImageSummaries(args) {
|
|
|
2180
2216
|
function createImageAttachmentProcessingError(attachment) {
|
|
2181
2217
|
return new ImageAttachmentProcessingError(`Image attachment ${attachment.filename ? `"${attachment.filename}"` : "this image"} arrived, but the vision model could not read it`);
|
|
2182
2218
|
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Store one Slack file, or return no id when it cannot be stored. The model
|
|
2221
|
+
* then gets a note that it cannot open the file.
|
|
2222
|
+
*/
|
|
2223
|
+
async function storeSlackFile(args) {
|
|
2224
|
+
try {
|
|
2225
|
+
return (await storeAttachment({
|
|
2226
|
+
conversationId: args.conversationId,
|
|
2227
|
+
db: getSqlExecutor(),
|
|
2228
|
+
file: args.file,
|
|
2229
|
+
storage: args.storage
|
|
2230
|
+
})).id;
|
|
2231
|
+
} catch (error) {
|
|
2232
|
+
logWarn("attachment.storage.failed", {
|
|
2233
|
+
"exception.message": error instanceof Error ? error.message : String(error),
|
|
2234
|
+
"app.file.mime_type": args.file.mimeType,
|
|
2235
|
+
"file.name": args.file.filename
|
|
2236
|
+
});
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2183
2240
|
async function resolveUserAttachmentsWithDeps(attachments, context, deps) {
|
|
2184
2241
|
if (!attachments || attachments.length === 0) return [];
|
|
2185
2242
|
const results = [];
|
|
2243
|
+
let modelImageCount = 0;
|
|
2186
2244
|
const cachedImageSummaries = getCachedImageSummaries({
|
|
2187
2245
|
conversation: context.conversation,
|
|
2188
2246
|
messageTs: context.messageTs
|
|
@@ -2191,6 +2249,62 @@ async function resolveUserAttachmentsWithDeps(attachments, context, deps) {
|
|
|
2191
2249
|
for (const attachment of attachments) {
|
|
2192
2250
|
const mediaType = attachment.mimeType ?? "application/octet-stream";
|
|
2193
2251
|
const isImageAttachment = isVisionImageMediaType(mediaType);
|
|
2252
|
+
const declaredBytes = typeof attachment.size === "number" && Number.isFinite(attachment.size) ? attachment.size : void 0;
|
|
2253
|
+
if (declaredBytes !== void 0 && declaredBytes > 262144e3) {
|
|
2254
|
+
logWarn("attachment.size_limit.refused", {
|
|
2255
|
+
"file.size": declaredBytes,
|
|
2256
|
+
"app.file.mime_type": mediaType
|
|
2257
|
+
});
|
|
2258
|
+
results.push({
|
|
2259
|
+
mediaType,
|
|
2260
|
+
filename: attachment.name,
|
|
2261
|
+
promptText: buildAttachmentResolutionFailurePromptText({
|
|
2262
|
+
filename: attachment.name,
|
|
2263
|
+
mediaType,
|
|
2264
|
+
problem: `it is larger than the ${MAX_ATTACHMENT_BYTES / 1024 / 1024} MB file limit, so it was not downloaded and you cannot open it`
|
|
2265
|
+
})
|
|
2266
|
+
});
|
|
2267
|
+
continue;
|
|
2268
|
+
}
|
|
2269
|
+
const slackFileId = getSlackFileId(attachment);
|
|
2270
|
+
const url = attachment.url;
|
|
2271
|
+
if (context.conversationId && deps.attachmentStorage && slackFileId && url && declaredBytes !== void 0 && !(attachment.data instanceof Buffer) && !(isImageAttachment && declaredBytes <= 5242880)) {
|
|
2272
|
+
const file = {
|
|
2273
|
+
bytes: declaredBytes,
|
|
2274
|
+
filename: attachment.name ?? "attachment",
|
|
2275
|
+
mimeType: mediaType,
|
|
2276
|
+
source: {
|
|
2277
|
+
id: slackFileId,
|
|
2278
|
+
provider: "slack"
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
const attachmentId = await storeSlackFile({
|
|
2282
|
+
conversationId: context.conversationId,
|
|
2283
|
+
file: !isImageAttachment && declaredBytes > 26214400 ? {
|
|
2284
|
+
...file,
|
|
2285
|
+
deferred: true
|
|
2286
|
+
} : {
|
|
2287
|
+
...file,
|
|
2288
|
+
open: () => streamPrivateSlackFile(url)
|
|
2289
|
+
},
|
|
2290
|
+
storage: deps.attachmentStorage
|
|
2291
|
+
});
|
|
2292
|
+
results.push({
|
|
2293
|
+
attachmentId,
|
|
2294
|
+
mediaType,
|
|
2295
|
+
filename: attachment.name,
|
|
2296
|
+
promptText: attachmentId ? buildStoredAttachmentPromptText({
|
|
2297
|
+
attachmentId,
|
|
2298
|
+
filename: attachment.name,
|
|
2299
|
+
mediaType
|
|
2300
|
+
}) : buildAttachmentResolutionFailurePromptText({
|
|
2301
|
+
filename: attachment.name,
|
|
2302
|
+
mediaType,
|
|
2303
|
+
problem: "it could not be downloaded from Slack and stored, so you cannot open it"
|
|
2304
|
+
})
|
|
2305
|
+
});
|
|
2306
|
+
continue;
|
|
2307
|
+
}
|
|
2194
2308
|
let data;
|
|
2195
2309
|
try {
|
|
2196
2310
|
if (attachment.fetchData) data = await attachment.fetchData();
|
|
@@ -2201,63 +2315,53 @@ async function resolveUserAttachmentsWithDeps(attachments, context, deps) {
|
|
|
2201
2315
|
"exception.message": error instanceof Error ? error.message : String(error),
|
|
2202
2316
|
"app.file.mime_type": mediaType
|
|
2203
2317
|
});
|
|
2204
|
-
|
|
2318
|
+
results.push({
|
|
2205
2319
|
mediaType,
|
|
2206
2320
|
filename: attachment.name,
|
|
2207
2321
|
promptText: buildAttachmentResolutionFailurePromptText({
|
|
2208
2322
|
filename: attachment.name,
|
|
2209
|
-
mediaType
|
|
2323
|
+
mediaType,
|
|
2324
|
+
problem: "you could not download its content from Slack"
|
|
2210
2325
|
})
|
|
2211
2326
|
});
|
|
2212
2327
|
continue;
|
|
2213
2328
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
file: {
|
|
2221
|
-
bytes: data.byteLength,
|
|
2222
|
-
data,
|
|
2223
|
-
filename: attachment.name ?? "attachment",
|
|
2224
|
-
mimeType: mediaType,
|
|
2225
|
-
path: attachment.name ?? "attachment"
|
|
2226
|
-
},
|
|
2329
|
+
const attachmentId = context.conversationId && deps.attachmentStorage ? await storeSlackFile({
|
|
2330
|
+
conversationId: context.conversationId,
|
|
2331
|
+
file: {
|
|
2332
|
+
data,
|
|
2333
|
+
filename: attachment.name ?? "attachment",
|
|
2334
|
+
mimeType: mediaType,
|
|
2227
2335
|
...slackFileId ? { source: {
|
|
2228
2336
|
id: slackFileId,
|
|
2229
2337
|
provider: "slack"
|
|
2230
|
-
} } : void 0
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
"app.file.mime_type": mediaType,
|
|
2237
|
-
...attachment.name ? { "file.name": attachment.name } : void 0
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
if (results.length >= 3 || attachment.type !== "image" && attachment.type !== "file") continue;
|
|
2241
|
-
const resolvedAttachment = {
|
|
2242
|
-
attachmentId,
|
|
2243
|
-
mediaType,
|
|
2244
|
-
filename: attachment.name
|
|
2245
|
-
};
|
|
2246
|
-
if (data.byteLength > 5242880) {
|
|
2247
|
-
logWarn("attachment.size_limit.skipped", {
|
|
2338
|
+
} } : void 0
|
|
2339
|
+
},
|
|
2340
|
+
storage: deps.attachmentStorage
|
|
2341
|
+
}) : void 0;
|
|
2342
|
+
if (!isImageAttachment || data.byteLength > 5242880 || modelImageCount >= 3) {
|
|
2343
|
+
if (isImageAttachment && data.byteLength > 5242880) logWarn("attachment.size_limit.skipped", {
|
|
2248
2344
|
"file.size": data.byteLength,
|
|
2249
2345
|
"app.file.mime_type": mediaType
|
|
2250
2346
|
});
|
|
2251
|
-
|
|
2252
|
-
|
|
2347
|
+
results.push({
|
|
2348
|
+
attachmentId,
|
|
2349
|
+
mediaType,
|
|
2350
|
+
filename: attachment.name,
|
|
2351
|
+
promptText: buildFileReferencePromptText({
|
|
2253
2352
|
attachmentId,
|
|
2254
2353
|
filename: attachment.name,
|
|
2255
2354
|
mediaType
|
|
2256
|
-
})
|
|
2257
|
-
|
|
2258
|
-
}
|
|
2355
|
+
})
|
|
2356
|
+
});
|
|
2259
2357
|
continue;
|
|
2260
2358
|
}
|
|
2359
|
+
modelImageCount += 1;
|
|
2360
|
+
const resolvedAttachment = {
|
|
2361
|
+
attachmentId,
|
|
2362
|
+
mediaType,
|
|
2363
|
+
filename: attachment.name
|
|
2364
|
+
};
|
|
2261
2365
|
const nativeImageMediaType = isImageAttachment && agentModelAcceptsImages() ? detectImageMediaType(data) : void 0;
|
|
2262
2366
|
if (nativeImageMediaType) {
|
|
2263
2367
|
nextCachedImageSummaryIndex += 1;
|
|
@@ -2335,7 +2439,7 @@ async function resolveUserAttachmentsWithDeps(attachments, context, deps) {
|
|
|
2335
2439
|
results.push(resolvedAttachment);
|
|
2336
2440
|
continue;
|
|
2337
2441
|
}
|
|
2338
|
-
if (
|
|
2442
|
+
if (attachmentId) resolvedAttachment.promptText = buildStoredAttachmentPromptText({
|
|
2339
2443
|
attachmentId,
|
|
2340
2444
|
filename: attachment.name,
|
|
2341
2445
|
mediaType
|
|
@@ -3516,6 +3620,10 @@ function createSlackTurn(deps) {
|
|
|
3516
3620
|
const messageIds = await sendSlackReply({
|
|
3517
3621
|
cards,
|
|
3518
3622
|
channelId: outcome.destination.channelId,
|
|
3623
|
+
formatting: {
|
|
3624
|
+
configuration: preparedState.configuration,
|
|
3625
|
+
teamId: outcome.destination.teamId
|
|
3626
|
+
},
|
|
3519
3627
|
conversationId,
|
|
3520
3628
|
replyAttribution: options.execution?.dispatch?.replyAttribution,
|
|
3521
3629
|
text,
|
|
@@ -3532,6 +3640,10 @@ function createSlackTurn(deps) {
|
|
|
3532
3640
|
...replyTarget,
|
|
3533
3641
|
cards,
|
|
3534
3642
|
conversationId,
|
|
3643
|
+
formatting: {
|
|
3644
|
+
configuration: preparedState.configuration,
|
|
3645
|
+
teamId: destination.teamId
|
|
3646
|
+
},
|
|
3535
3647
|
replyAttribution: options.execution?.dispatch?.replyAttribution,
|
|
3536
3648
|
text
|
|
3537
3649
|
});
|
|
@@ -4467,7 +4579,14 @@ function createAgentDispatchConversationWorker(options) {
|
|
|
4467
4579
|
await markDispatchAwaitingResume(dispatch.id);
|
|
4468
4580
|
return { status: "yielded" };
|
|
4469
4581
|
}
|
|
4470
|
-
if (isTurnInputCommitLostError(error))
|
|
4582
|
+
if (isTurnInputCommitLostError(error)) {
|
|
4583
|
+
logWarn("agent.dispatch.lost_lease", {
|
|
4584
|
+
"app.dispatch.id": dispatch.id,
|
|
4585
|
+
"error.type": error.name,
|
|
4586
|
+
"exception.message": error.message
|
|
4587
|
+
});
|
|
4588
|
+
return { status: "lost_lease" };
|
|
4589
|
+
}
|
|
4471
4590
|
const blockingError = getDispatchBlockingError(error);
|
|
4472
4591
|
if (blockingError) {
|
|
4473
4592
|
await persistBlockedDispatchTurn(dispatch, blockingError);
|
|
@@ -4481,6 +4600,14 @@ function createAgentDispatchConversationWorker(options) {
|
|
|
4481
4600
|
}
|
|
4482
4601
|
};
|
|
4483
4602
|
}
|
|
4603
|
+
/**
|
|
4604
|
+
* Fail the dispatch of stopped Conversation work, so the Automation run that
|
|
4605
|
+
* waits on it settles instead of blocking later runs.
|
|
4606
|
+
*/
|
|
4607
|
+
async function failStoppedDispatch(conversationId) {
|
|
4608
|
+
const dispatchId = getDispatchIdForConversation(conversationId);
|
|
4609
|
+
if (dispatchId) await markDispatchFailed(dispatchId, "Dispatch work stopped after repeated failed attempts.");
|
|
4610
|
+
}
|
|
4484
4611
|
// src/chat/slack/dispatch-turn.ts
|
|
4485
4612
|
/** Build the Slack provider adapter for agent-dispatched conversation turns. */
|
|
4486
4613
|
function createSlackDispatchTurnRunner(options) {
|
|
@@ -5481,12 +5608,21 @@ async function resumeSlackTurnInContext(args) {
|
|
|
5481
5608
|
failureCode = "delivery_failed";
|
|
5482
5609
|
const cards = await loadPendingMessageCards(conversationId);
|
|
5483
5610
|
const deliveryState = await getDeliveryConversation();
|
|
5611
|
+
const configuration = {
|
|
5612
|
+
...savedRun.environment?.configuration,
|
|
5613
|
+
...await savedRun.environment?.locationConfiguration?.resolveValues()
|
|
5614
|
+
};
|
|
5615
|
+
const replyTeamId = savedRun.destination.platform === "slack" ? savedRun.destination.teamId : void 0;
|
|
5484
5616
|
let slackMessageTs = [];
|
|
5485
5617
|
try {
|
|
5486
5618
|
const outcomes = runArgs.run?.dispatch?.outcomes;
|
|
5487
5619
|
if (outcomes) for (const outcome of outcomes) slackMessageTs.push(...await sendSlackReply({
|
|
5488
5620
|
cards,
|
|
5489
5621
|
channelId: outcome.destination.channelId,
|
|
5622
|
+
formatting: {
|
|
5623
|
+
configuration,
|
|
5624
|
+
teamId: outcome.destination.teamId
|
|
5625
|
+
},
|
|
5490
5626
|
conversationId: runArgs.conversationId,
|
|
5491
5627
|
replyAttribution: runArgs.run?.dispatch?.replyAttribution,
|
|
5492
5628
|
text,
|
|
@@ -5495,6 +5631,10 @@ async function resumeSlackTurnInContext(args) {
|
|
|
5495
5631
|
else slackMessageTs = await sendSlackReply({
|
|
5496
5632
|
cards,
|
|
5497
5633
|
channelId: runArgs.channelId,
|
|
5634
|
+
...replyTeamId ? { formatting: {
|
|
5635
|
+
configuration,
|
|
5636
|
+
teamId: replyTeamId
|
|
5637
|
+
} } : void 0,
|
|
5498
5638
|
conversationId: runArgs.conversationId,
|
|
5499
5639
|
replyAttribution: runArgs.run?.dispatch?.replyAttribution,
|
|
5500
5640
|
text,
|
|
@@ -6304,6 +6444,14 @@ function createSlackSystemTurnDelivery(args) {
|
|
|
6304
6444
|
}),
|
|
6305
6445
|
cards,
|
|
6306
6446
|
conversationId,
|
|
6447
|
+
formatting: {
|
|
6448
|
+
configuration: await getLocationConfigurationService({
|
|
6449
|
+
platform: "slack",
|
|
6450
|
+
teamId: location.teamId,
|
|
6451
|
+
channelId: location.channelId
|
|
6452
|
+
}).resolveValues(),
|
|
6453
|
+
teamId: location.teamId
|
|
6454
|
+
},
|
|
6307
6455
|
text
|
|
6308
6456
|
})
|
|
6309
6457
|
});
|
|
@@ -6437,6 +6585,7 @@ function createConversationWork(options) {
|
|
|
6437
6585
|
return result;
|
|
6438
6586
|
};
|
|
6439
6587
|
return {
|
|
6588
|
+
beforeWorkStops: failStoppedDispatch,
|
|
6440
6589
|
conversationStore: options.conversationStore,
|
|
6441
6590
|
getSlackAdapter: options.getSlackAdapter,
|
|
6442
6591
|
queue: options.queue,
|
|
@@ -6677,11 +6826,625 @@ async function resolveSlackMessageLink(viewer, url) {
|
|
|
6677
6826
|
}));
|
|
6678
6827
|
}
|
|
6679
6828
|
}
|
|
6829
|
+
// src/chat/images/ids.ts
|
|
6830
|
+
/**
|
|
6831
|
+
* Opaque, signed ids for images that Junior serves. A browser never gets the
|
|
6832
|
+
* address of the image, and it cannot ask for an image that Junior did not
|
|
6833
|
+
* name.
|
|
6834
|
+
*/
|
|
6835
|
+
const IMAGE_ID_CONTEXT = "junior-image-id";
|
|
6836
|
+
/**
|
|
6837
|
+
* Widths that the image route serves. A fixed set keeps the cache small.
|
|
6838
|
+
* Callers ask for at least 2x the CSS width, so images stay sharp on
|
|
6839
|
+
* high-density screens.
|
|
6840
|
+
*/
|
|
6841
|
+
const IMAGE_WIDTHS = [
|
|
6842
|
+
64,
|
|
6843
|
+
128,
|
|
6844
|
+
320,
|
|
6845
|
+
640,
|
|
6846
|
+
1280
|
|
6847
|
+
];
|
|
6848
|
+
const imageIdPayloadSchema = z.object({
|
|
6849
|
+
ref: z.string().min(1),
|
|
6850
|
+
source: z.string().min(1)
|
|
6851
|
+
}).strict();
|
|
6852
|
+
function signature$1(payload) {
|
|
6853
|
+
const secret = readJuniorSecret();
|
|
6854
|
+
if (!secret) throw new Error("Cannot sign image ids without JUNIOR_SECRET");
|
|
6855
|
+
return createHmac("sha256", secret).update(`${IMAGE_ID_CONTEXT}:${payload}`).digest("base64url");
|
|
6856
|
+
}
|
|
6857
|
+
/** Return the signed id of one image. */
|
|
6858
|
+
function encodeImageId(image) {
|
|
6859
|
+
const payload = Buffer.from(JSON.stringify({
|
|
6860
|
+
ref: image.ref,
|
|
6861
|
+
source: image.source
|
|
6862
|
+
}), "utf8").toString("base64url");
|
|
6863
|
+
return `${payload}.${signature$1(payload)}`;
|
|
6864
|
+
}
|
|
6865
|
+
/** Return the image of a signed id, or nothing when the id is not valid. */
|
|
6866
|
+
function decodeImageId(id) {
|
|
6867
|
+
const [payload, actual, extra] = id.split(".");
|
|
6868
|
+
if (!payload || !actual || extra !== void 0) return void 0;
|
|
6869
|
+
const expected = Buffer.from(signature$1(payload));
|
|
6870
|
+
const given = Buffer.from(actual);
|
|
6871
|
+
if (expected.length !== given.length || !timingSafeEqual(expected, given)) return;
|
|
6872
|
+
try {
|
|
6873
|
+
const parsed = imageIdPayloadSchema.safeParse(JSON.parse(Buffer.from(payload, "base64url").toString("utf8")));
|
|
6874
|
+
return parsed.success ? parsed.data : void 0;
|
|
6875
|
+
} catch {
|
|
6876
|
+
return;
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
/**
|
|
6880
|
+
* Return the Junior API path of one image at one width. `version` changes
|
|
6881
|
+
* the path when the image changes, so a browser can keep each path.
|
|
6882
|
+
*/
|
|
6883
|
+
function imagePath(image, width, version) {
|
|
6884
|
+
const query = new URLSearchParams({ w: String(width) });
|
|
6885
|
+
if (version) query.set("v", version);
|
|
6886
|
+
return `/api/images/${encodeImageId(image)}?${query}`;
|
|
6887
|
+
}
|
|
6888
|
+
// src/net/public-address.ts
|
|
6889
|
+
/**
|
|
6890
|
+
* Own the public-address rule for fetches of URLs that any person can submit.
|
|
6891
|
+
*
|
|
6892
|
+
* Such a fetch must not reach loopback, private, link-local, cloud metadata,
|
|
6893
|
+
* or other special addresses. The lookup checks every resolved address at
|
|
6894
|
+
* connect time, so a second DNS answer cannot move the request to a blocked
|
|
6895
|
+
* address.
|
|
6896
|
+
*/
|
|
6897
|
+
/** Special-use ranges from RFC 6890 and the IANA special-purpose registries. */
|
|
6898
|
+
const BLOCKED_SUBNETS = [
|
|
6899
|
+
[
|
|
6900
|
+
"0.0.0.0",
|
|
6901
|
+
8,
|
|
6902
|
+
"ipv4"
|
|
6903
|
+
],
|
|
6904
|
+
[
|
|
6905
|
+
"10.0.0.0",
|
|
6906
|
+
8,
|
|
6907
|
+
"ipv4"
|
|
6908
|
+
],
|
|
6909
|
+
[
|
|
6910
|
+
"100.64.0.0",
|
|
6911
|
+
10,
|
|
6912
|
+
"ipv4"
|
|
6913
|
+
],
|
|
6914
|
+
[
|
|
6915
|
+
"127.0.0.0",
|
|
6916
|
+
8,
|
|
6917
|
+
"ipv4"
|
|
6918
|
+
],
|
|
6919
|
+
[
|
|
6920
|
+
"169.254.0.0",
|
|
6921
|
+
16,
|
|
6922
|
+
"ipv4"
|
|
6923
|
+
],
|
|
6924
|
+
[
|
|
6925
|
+
"172.16.0.0",
|
|
6926
|
+
12,
|
|
6927
|
+
"ipv4"
|
|
6928
|
+
],
|
|
6929
|
+
[
|
|
6930
|
+
"192.0.0.0",
|
|
6931
|
+
24,
|
|
6932
|
+
"ipv4"
|
|
6933
|
+
],
|
|
6934
|
+
[
|
|
6935
|
+
"192.0.2.0",
|
|
6936
|
+
24,
|
|
6937
|
+
"ipv4"
|
|
6938
|
+
],
|
|
6939
|
+
[
|
|
6940
|
+
"192.168.0.0",
|
|
6941
|
+
16,
|
|
6942
|
+
"ipv4"
|
|
6943
|
+
],
|
|
6944
|
+
[
|
|
6945
|
+
"198.18.0.0",
|
|
6946
|
+
15,
|
|
6947
|
+
"ipv4"
|
|
6948
|
+
],
|
|
6949
|
+
[
|
|
6950
|
+
"198.51.100.0",
|
|
6951
|
+
24,
|
|
6952
|
+
"ipv4"
|
|
6953
|
+
],
|
|
6954
|
+
[
|
|
6955
|
+
"203.0.113.0",
|
|
6956
|
+
24,
|
|
6957
|
+
"ipv4"
|
|
6958
|
+
],
|
|
6959
|
+
[
|
|
6960
|
+
"224.0.0.0",
|
|
6961
|
+
4,
|
|
6962
|
+
"ipv4"
|
|
6963
|
+
],
|
|
6964
|
+
[
|
|
6965
|
+
"240.0.0.0",
|
|
6966
|
+
4,
|
|
6967
|
+
"ipv4"
|
|
6968
|
+
],
|
|
6969
|
+
[
|
|
6970
|
+
"::",
|
|
6971
|
+
96,
|
|
6972
|
+
"ipv6"
|
|
6973
|
+
],
|
|
6974
|
+
[
|
|
6975
|
+
"64:ff9b::",
|
|
6976
|
+
96,
|
|
6977
|
+
"ipv6"
|
|
6978
|
+
],
|
|
6979
|
+
[
|
|
6980
|
+
"64:ff9b:1::",
|
|
6981
|
+
48,
|
|
6982
|
+
"ipv6"
|
|
6983
|
+
],
|
|
6984
|
+
[
|
|
6985
|
+
"100::",
|
|
6986
|
+
64,
|
|
6987
|
+
"ipv6"
|
|
6988
|
+
],
|
|
6989
|
+
[
|
|
6990
|
+
"2001::",
|
|
6991
|
+
32,
|
|
6992
|
+
"ipv6"
|
|
6993
|
+
],
|
|
6994
|
+
[
|
|
6995
|
+
"2001:db8::",
|
|
6996
|
+
32,
|
|
6997
|
+
"ipv6"
|
|
6998
|
+
],
|
|
6999
|
+
[
|
|
7000
|
+
"2002::",
|
|
7001
|
+
16,
|
|
7002
|
+
"ipv6"
|
|
7003
|
+
],
|
|
7004
|
+
[
|
|
7005
|
+
"fc00::",
|
|
7006
|
+
7,
|
|
7007
|
+
"ipv6"
|
|
7008
|
+
],
|
|
7009
|
+
[
|
|
7010
|
+
"fe80::",
|
|
7011
|
+
10,
|
|
7012
|
+
"ipv6"
|
|
7013
|
+
],
|
|
7014
|
+
[
|
|
7015
|
+
"fec0::",
|
|
7016
|
+
10,
|
|
7017
|
+
"ipv6"
|
|
7018
|
+
],
|
|
7019
|
+
[
|
|
7020
|
+
"ff00::",
|
|
7021
|
+
8,
|
|
7022
|
+
"ipv6"
|
|
7023
|
+
]
|
|
7024
|
+
];
|
|
7025
|
+
function blockedAddressList() {
|
|
7026
|
+
const list = new net.BlockList();
|
|
7027
|
+
for (const [network, prefix, family] of BLOCKED_SUBNETS) list.addSubnet(network, prefix, family);
|
|
7028
|
+
return list;
|
|
7029
|
+
}
|
|
7030
|
+
const blockedAddresses = blockedAddressList();
|
|
7031
|
+
/** Return true only for an IP address outside every blocked range. */
|
|
7032
|
+
function isPublicAddress(address) {
|
|
7033
|
+
const family = net.isIP(address);
|
|
7034
|
+
if (family === 0) return false;
|
|
7035
|
+
return !blockedAddresses.check(address, family === 4 ? "ipv4" : "ipv6");
|
|
7036
|
+
}
|
|
7037
|
+
function blockedAddressError(hostname) {
|
|
7038
|
+
return Object.assign(/* @__PURE__ */ new Error(`${hostname} does not resolve to a public address`), { code: "EADDRNOTPUBLIC" });
|
|
7039
|
+
}
|
|
7040
|
+
/**
|
|
7041
|
+
* Resolve a hostname for an outbound socket. Fail when any answer is not a
|
|
7042
|
+
* public address.
|
|
7043
|
+
*/
|
|
7044
|
+
const publicAddressLookup = (hostname, options, callback) => {
|
|
7045
|
+
dns.lookup(hostname, {
|
|
7046
|
+
all: true,
|
|
7047
|
+
verbatim: true
|
|
7048
|
+
}, (error, addresses) => {
|
|
7049
|
+
if (error) {
|
|
7050
|
+
callback(error, "", 0);
|
|
7051
|
+
return;
|
|
7052
|
+
}
|
|
7053
|
+
const allowed = addresses.filter((entry) => !options.family || entry.family === options.family || `IPv${entry.family}` === options.family);
|
|
7054
|
+
const first = allowed[0];
|
|
7055
|
+
if (!first || !addresses.every((entry) => isPublicAddress(entry.address))) {
|
|
7056
|
+
callback(blockedAddressError(hostname), "", 0);
|
|
7057
|
+
return;
|
|
7058
|
+
}
|
|
7059
|
+
if (options.all) {
|
|
7060
|
+
callback(null, allowed);
|
|
7061
|
+
return;
|
|
7062
|
+
}
|
|
7063
|
+
callback(null, first.address, first.family);
|
|
7064
|
+
});
|
|
7065
|
+
};
|
|
7066
|
+
// src/net/guarded-fetch.ts
|
|
7067
|
+
/**
|
|
7068
|
+
* Fetch an external URL for the server. Each hop must use `https` and reach
|
|
7069
|
+
* a public address, the body has a size limit, and the fetch has a time
|
|
7070
|
+
* limit.
|
|
7071
|
+
*/
|
|
7072
|
+
const MAX_REDIRECTS = 2;
|
|
7073
|
+
function blockedUrl(url, hosts) {
|
|
7074
|
+
if (url.protocol !== "https:") return true;
|
|
7075
|
+
if (url.username || url.password) return true;
|
|
7076
|
+
const host = url.hostname.toLowerCase();
|
|
7077
|
+
if (hosts && !hosts.some((allowed) => host === allowed || host.endsWith(`.${allowed}`))) return true;
|
|
7078
|
+
const address = host.replace(/^\[|\]$/g, "");
|
|
7079
|
+
return net.isIP(address) !== 0 && !isPublicAddress(address);
|
|
7080
|
+
}
|
|
7081
|
+
function requestHop(url, request, headers, signal) {
|
|
7082
|
+
return new Promise((resolve) => {
|
|
7083
|
+
const outgoing = https.request(url, {
|
|
7084
|
+
headers: {
|
|
7085
|
+
accept: request.accept,
|
|
7086
|
+
...request.userAgent && { "user-agent": request.userAgent },
|
|
7087
|
+
...headers
|
|
7088
|
+
},
|
|
7089
|
+
agent: false,
|
|
7090
|
+
lookup: publicAddressLookup,
|
|
7091
|
+
method: "GET",
|
|
7092
|
+
signal
|
|
7093
|
+
}, (response) => {
|
|
7094
|
+
const status = response.statusCode ?? 0;
|
|
7095
|
+
const location = response.headers.location;
|
|
7096
|
+
if (status >= 300 && status < 400 && location) {
|
|
7097
|
+
response.resume();
|
|
7098
|
+
resolve({ location });
|
|
7099
|
+
return;
|
|
7100
|
+
}
|
|
7101
|
+
if (status !== 200) {
|
|
7102
|
+
response.resume();
|
|
7103
|
+
resolve({ failure: `status_${status}` });
|
|
7104
|
+
return;
|
|
7105
|
+
}
|
|
7106
|
+
const contentType = response.headers["content-type"];
|
|
7107
|
+
const chunks = [];
|
|
7108
|
+
let size = 0;
|
|
7109
|
+
response.on("data", (chunk) => {
|
|
7110
|
+
const room = request.maxBytes - size;
|
|
7111
|
+
size += chunk.length;
|
|
7112
|
+
if (size <= request.maxBytes) {
|
|
7113
|
+
chunks.push(chunk);
|
|
7114
|
+
return;
|
|
7115
|
+
}
|
|
7116
|
+
outgoing.destroy();
|
|
7117
|
+
if (!request.truncate) {
|
|
7118
|
+
resolve({ failure: "too_large" });
|
|
7119
|
+
return;
|
|
7120
|
+
}
|
|
7121
|
+
chunks.push(chunk.subarray(0, room));
|
|
7122
|
+
resolve({
|
|
7123
|
+
bytes: Buffer.concat(chunks),
|
|
7124
|
+
contentType
|
|
7125
|
+
});
|
|
7126
|
+
});
|
|
7127
|
+
response.on("end", () => resolve({
|
|
7128
|
+
bytes: Buffer.concat(chunks),
|
|
7129
|
+
contentType
|
|
7130
|
+
}));
|
|
7131
|
+
response.on("error", () => resolve({ failure: "read_failed" }));
|
|
7132
|
+
});
|
|
7133
|
+
outgoing.on("error", (error) => resolve({ failure: error.code === "EADDRNOTPUBLIC" ? "blocked_address" : "fetch_failed" }));
|
|
7134
|
+
outgoing.end();
|
|
7135
|
+
});
|
|
7136
|
+
}
|
|
7137
|
+
/**
|
|
7138
|
+
* Fetch one `https` URL with `GET`. Follow up to 2 redirects, check the
|
|
7139
|
+
* address of each hop, and send the headers only to the first origin.
|
|
7140
|
+
*/
|
|
7141
|
+
async function guardedFetch(request) {
|
|
7142
|
+
const signal = AbortSignal.timeout(request.timeoutMs);
|
|
7143
|
+
const origin = URL.canParse(request.url) ? new URL(request.url).origin : "";
|
|
7144
|
+
let current = request.url;
|
|
7145
|
+
for (let redirects = 0;; redirects += 1) {
|
|
7146
|
+
if (!URL.canParse(current)) return { failure: "invalid_url" };
|
|
7147
|
+
const url = new URL(current);
|
|
7148
|
+
if (blockedUrl(url, request.hosts)) return { failure: "blocked_address" };
|
|
7149
|
+
const hop = await requestHop(url, request, url.origin === origin ? request.headers ?? {} : {}, signal);
|
|
7150
|
+
if ("failure" in hop) return hop;
|
|
7151
|
+
if ("location" in hop) {
|
|
7152
|
+
if (redirects >= MAX_REDIRECTS) return { failure: "too_many_redirects" };
|
|
7153
|
+
if (!URL.canParse(hop.location, url)) return { failure: "invalid_url" };
|
|
7154
|
+
current = new URL(hop.location, url).href;
|
|
7155
|
+
continue;
|
|
7156
|
+
}
|
|
7157
|
+
return {
|
|
7158
|
+
...hop,
|
|
7159
|
+
url: url.href
|
|
7160
|
+
};
|
|
7161
|
+
}
|
|
7162
|
+
}
|
|
7163
|
+
// src/api/objects/web-page/meta.ts
|
|
7164
|
+
/**
|
|
7165
|
+
* Read Open Graph and Twitter card meta tags from the `<head>` of an HTML
|
|
7166
|
+
* page. Junior reads only these tags and the `<title>`, never scripts or
|
|
7167
|
+
* other markup.
|
|
7168
|
+
*/
|
|
7169
|
+
function isElement(node, tagName) {
|
|
7170
|
+
return "tagName" in node && node.tagName === tagName;
|
|
7171
|
+
}
|
|
7172
|
+
function children(node) {
|
|
7173
|
+
return "childNodes" in node ? node.childNodes : [];
|
|
7174
|
+
}
|
|
7175
|
+
function attribute(element, name) {
|
|
7176
|
+
return element.attrs.find((attr) => attr.name === name)?.value;
|
|
7177
|
+
}
|
|
7178
|
+
function text$1(node) {
|
|
7179
|
+
if (node.nodeName === "#text" && "value" in node) return node.value;
|
|
7180
|
+
return children(node).map(text$1).join("");
|
|
7181
|
+
}
|
|
7182
|
+
function clean(value) {
|
|
7183
|
+
return value?.replace(/\s+/g, " ").trim() || void 0;
|
|
7184
|
+
}
|
|
7185
|
+
/** Read the Open Graph and Twitter card tags, then the `<title>`. */
|
|
7186
|
+
function parsePageMeta(html) {
|
|
7187
|
+
const root = children(parse(html)).find((node) => isElement(node, "html"));
|
|
7188
|
+
const head = root && children(root).find((node) => isElement(node, "head"));
|
|
7189
|
+
const tags = /* @__PURE__ */ new Map();
|
|
7190
|
+
let title;
|
|
7191
|
+
for (const node of head ? children(head) : []) {
|
|
7192
|
+
if (isElement(node, "title")) title ??= clean(text$1(node));
|
|
7193
|
+
if (!isElement(node, "meta")) continue;
|
|
7194
|
+
const name = (attribute(node, "property") ?? attribute(node, "name"))?.toLowerCase();
|
|
7195
|
+
const content = clean(attribute(node, "content"));
|
|
7196
|
+
if (name && content && !tags.has(name)) tags.set(name, content);
|
|
7197
|
+
}
|
|
7198
|
+
const first = (...names) => names.map((name) => tags.get(name)).find(Boolean);
|
|
7199
|
+
return {
|
|
7200
|
+
author: first("author", "twitter:creator"),
|
|
7201
|
+
description: first("og:description", "twitter:description", "description"),
|
|
7202
|
+
images: [
|
|
7203
|
+
"og:image:secure_url",
|
|
7204
|
+
"og:image",
|
|
7205
|
+
"og:image:url",
|
|
7206
|
+
"twitter:image",
|
|
7207
|
+
"twitter:image:src"
|
|
7208
|
+
].flatMap((name) => tags.get(name) ?? []),
|
|
7209
|
+
siteName: first("og:site_name", "application-name"),
|
|
7210
|
+
title: first("og:title", "twitter:title") ?? title
|
|
7211
|
+
};
|
|
7212
|
+
}
|
|
7213
|
+
// src/api/objects/web-page/oembed.ts
|
|
7214
|
+
/**
|
|
7215
|
+
* A short, hand-kept list of well-known oEmbed providers. Every other page
|
|
7216
|
+
* falls back to its Open Graph tags. Junior uses only the plain oEmbed
|
|
7217
|
+
* fields, never `html`. A provider that needs an access token, such as
|
|
7218
|
+
* Instagram, is not listed.
|
|
7219
|
+
*/
|
|
7220
|
+
const PATTERNS = [
|
|
7221
|
+
{
|
|
7222
|
+
endpoint: "https://www.youtube.com/oembed",
|
|
7223
|
+
schemes: [
|
|
7224
|
+
"https://{*.}?youtube.com/watch*",
|
|
7225
|
+
"https://{*.}?youtube.com/shorts/*",
|
|
7226
|
+
"https://{*.}?youtube.com/live/*",
|
|
7227
|
+
"https://{*.}?youtube.com/playlist*",
|
|
7228
|
+
"https://youtu.be/*"
|
|
7229
|
+
]
|
|
7230
|
+
},
|
|
7231
|
+
{
|
|
7232
|
+
endpoint: "https://vimeo.com/api/oembed.json",
|
|
7233
|
+
schemes: ["https://vimeo.com/*", "https://player.vimeo.com/video/*"]
|
|
7234
|
+
},
|
|
7235
|
+
{
|
|
7236
|
+
endpoint: "https://publish.x.com/oembed",
|
|
7237
|
+
schemes: ["https://{*.}?x.com/*/status/*"]
|
|
7238
|
+
},
|
|
7239
|
+
{
|
|
7240
|
+
endpoint: "https://publish.twitter.com/oembed",
|
|
7241
|
+
schemes: ["https://{*.}?twitter.com/*/status/*"]
|
|
7242
|
+
},
|
|
7243
|
+
{
|
|
7244
|
+
endpoint: "https://www.figma.com/api/oembed",
|
|
7245
|
+
schemes: ["https://www.figma.com/(file|design|board|slides|proto)/*"]
|
|
7246
|
+
},
|
|
7247
|
+
{
|
|
7248
|
+
endpoint: "https://www.loom.com/v1/oembed",
|
|
7249
|
+
schemes: ["https://{www.}?loom.com/(share|i)/*"]
|
|
7250
|
+
},
|
|
7251
|
+
{
|
|
7252
|
+
endpoint: "https://open.spotify.com/oembed",
|
|
7253
|
+
schemes: ["https://open.spotify.com/*", "https://spotify.link/*"]
|
|
7254
|
+
},
|
|
7255
|
+
{
|
|
7256
|
+
endpoint: "https://soundcloud.com/oembed",
|
|
7257
|
+
schemes: ["https://soundcloud.com/*", "https://on.soundcloud.com/*"]
|
|
7258
|
+
},
|
|
7259
|
+
{
|
|
7260
|
+
endpoint: "https://codepen.io/api/oembed",
|
|
7261
|
+
schemes: ["https://codepen.io/*/pen/*"]
|
|
7262
|
+
},
|
|
7263
|
+
{
|
|
7264
|
+
endpoint: "https://giphy.com/services/oembed",
|
|
7265
|
+
schemes: ["https://giphy.com/(gifs|clips)/*"]
|
|
7266
|
+
},
|
|
7267
|
+
{
|
|
7268
|
+
endpoint: "https://www.flickr.com/services/oembed/",
|
|
7269
|
+
schemes: ["https://{*.}?flickr.com/photos/*", "https://flic.kr/*"]
|
|
7270
|
+
},
|
|
7271
|
+
{
|
|
7272
|
+
endpoint: "https://www.tiktok.com/oembed",
|
|
7273
|
+
schemes: ["https://www.tiktok.com/*/video/*"]
|
|
7274
|
+
},
|
|
7275
|
+
{
|
|
7276
|
+
endpoint: "https://www.reddit.com/oembed",
|
|
7277
|
+
schemes: ["https://{www.}?reddit.com/r/*/comments/*"]
|
|
7278
|
+
},
|
|
7279
|
+
{
|
|
7280
|
+
endpoint: "https://www.slideshare.net/api/oembed/2",
|
|
7281
|
+
schemes: ["https://{*.}?slideshare.net/*/*"]
|
|
7282
|
+
},
|
|
7283
|
+
{
|
|
7284
|
+
endpoint: "https://speakerdeck.com/oembed.json",
|
|
7285
|
+
schemes: ["https://speakerdeck.com/*/*"]
|
|
7286
|
+
},
|
|
7287
|
+
{
|
|
7288
|
+
endpoint: "https://www.dailymotion.com/services/oembed",
|
|
7289
|
+
schemes: ["https://www.dailymotion.com/video/*", "https://dai.ly/*"]
|
|
7290
|
+
},
|
|
7291
|
+
{
|
|
7292
|
+
endpoint: "https://www.ted.com/services/v1/oembed.json",
|
|
7293
|
+
schemes: ["https://{www.}?ted.com/talks/*"]
|
|
7294
|
+
},
|
|
7295
|
+
{
|
|
7296
|
+
endpoint: "https://embed.bsky.app/oembed",
|
|
7297
|
+
schemes: ["https://bsky.app/profile/*/post/*"]
|
|
7298
|
+
}
|
|
7299
|
+
].map((provider) => ({
|
|
7300
|
+
endpoint: provider.endpoint,
|
|
7301
|
+
patterns: provider.schemes.map((scheme) => new URLPattern(scheme))
|
|
7302
|
+
}));
|
|
7303
|
+
/** Return the oEmbed request URL for a page, or nothing for other hosts. */
|
|
7304
|
+
function oembedRequestUrl(url) {
|
|
7305
|
+
const provider = PATTERNS.find((candidate) => candidate.patterns.some((pattern) => pattern.test(url.href)));
|
|
7306
|
+
if (!provider) return void 0;
|
|
7307
|
+
const request = new URL(provider.endpoint);
|
|
7308
|
+
request.searchParams.set("url", url.href);
|
|
7309
|
+
request.searchParams.set("format", "json");
|
|
7310
|
+
return request.href;
|
|
7311
|
+
}
|
|
7312
|
+
const optionalText = z.string().trim().min(1).optional().catch(void 0);
|
|
7313
|
+
const oembedResponseSchema = z.object({
|
|
7314
|
+
title: optionalText,
|
|
7315
|
+
author_name: optionalText,
|
|
7316
|
+
provider_name: optionalText,
|
|
7317
|
+
thumbnail_url: optionalText,
|
|
7318
|
+
cache_age: z.coerce.number().positive().optional().catch(void 0)
|
|
7319
|
+
});
|
|
7320
|
+
/** Read an oEmbed JSON body, or nothing when it is not one. */
|
|
7321
|
+
function parseOembedResponse(body) {
|
|
7322
|
+
try {
|
|
7323
|
+
const parsed = oembedResponseSchema.safeParse(JSON.parse(body));
|
|
7324
|
+
return parsed.success ? parsed.data : void 0;
|
|
7325
|
+
} catch {
|
|
7326
|
+
return;
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
// src/api/objects/web-page/resolve.ts
|
|
7330
|
+
/**
|
|
7331
|
+
* The catch-all link type: a card for any public web page. It reads the
|
|
7332
|
+
* oEmbed fields of a known provider first, then the Open Graph and Twitter
|
|
7333
|
+
* card meta tags of the page. Every fetch goes through the address guard.
|
|
7334
|
+
*/
|
|
7335
|
+
/** The largest oEmbed response or page start that Junior reads. */
|
|
7336
|
+
const MAX_WEB_PAGE_BYTES = 262144;
|
|
7337
|
+
const FETCH_TIMEOUT_MS = 3e3;
|
|
7338
|
+
const USER_AGENT = "junior-bot/0.1 (link preview)";
|
|
7339
|
+
const DEFAULT_TTL_MS = 36e5;
|
|
7340
|
+
const MIN_TTL_MS = 3e5;
|
|
7341
|
+
const MAX_TTL_MS = 864e5;
|
|
7342
|
+
const FAILURE_TTL_MS = 3e5;
|
|
7343
|
+
const THUMBNAIL_WIDTH = 640;
|
|
7344
|
+
const MAX_THUMBNAIL_URL_CHARS = 2e3;
|
|
7345
|
+
function fetchText(url, accept, truncate) {
|
|
7346
|
+
return guardedFetch({
|
|
7347
|
+
accept,
|
|
7348
|
+
maxBytes: MAX_WEB_PAGE_BYTES,
|
|
7349
|
+
timeoutMs: FETCH_TIMEOUT_MS,
|
|
7350
|
+
truncate,
|
|
7351
|
+
url,
|
|
7352
|
+
userAgent: USER_AGENT
|
|
7353
|
+
});
|
|
7354
|
+
}
|
|
7355
|
+
async function readOembed(url) {
|
|
7356
|
+
const request = oembedRequestUrl(url);
|
|
7357
|
+
if (!request) return void 0;
|
|
7358
|
+
const fetched = await fetchText(request, "application/json", false);
|
|
7359
|
+
if ("failure" in fetched) return void 0;
|
|
7360
|
+
const oembed = parseOembedResponse(fetched.bytes.toString("utf8"));
|
|
7361
|
+
if (!oembed?.title) return void 0;
|
|
7362
|
+
return {
|
|
7363
|
+
author: oembed.author_name,
|
|
7364
|
+
cacheAgeSeconds: oembed.cache_age,
|
|
7365
|
+
images: oembed.thumbnail_url ? [oembed.thumbnail_url] : [],
|
|
7366
|
+
siteName: oembed.provider_name,
|
|
7367
|
+
title: oembed.title
|
|
7368
|
+
};
|
|
7369
|
+
}
|
|
7370
|
+
async function readMetaTags(url) {
|
|
7371
|
+
const fetched = await fetchText(url.href, "text/html,application/xhtml+xml", true);
|
|
7372
|
+
if ("failure" in fetched) return void 0;
|
|
7373
|
+
if (!/^\s*(text\/html|application\/xhtml\+xml)\b/i.test(fetched.contentType ?? "")) return;
|
|
7374
|
+
return {
|
|
7375
|
+
...parsePageMeta(fetched.bytes.toString("utf8")),
|
|
7376
|
+
pageUrl: fetched.url
|
|
7377
|
+
};
|
|
7378
|
+
}
|
|
7379
|
+
function thumbnailPath(images, base) {
|
|
7380
|
+
for (const image of images) {
|
|
7381
|
+
const url = URL.parse(image, base);
|
|
7382
|
+
if (url?.protocol !== "https:") continue;
|
|
7383
|
+
if (url.href.length > MAX_THUMBNAIL_URL_CHARS) continue;
|
|
7384
|
+
return imagePath({
|
|
7385
|
+
ref: url.href,
|
|
7386
|
+
source: "public"
|
|
7387
|
+
}, THUMBNAIL_WIDTH);
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
async function loadWebPage(url) {
|
|
7391
|
+
const oembed = await readOembed(url);
|
|
7392
|
+
const page = oembed ? {
|
|
7393
|
+
...oembed,
|
|
7394
|
+
pageUrl: url.href
|
|
7395
|
+
} : await readMetaTags(url);
|
|
7396
|
+
if (!page?.title) return {
|
|
7397
|
+
value: null,
|
|
7398
|
+
ttlMs: FAILURE_TTL_MS
|
|
7399
|
+
};
|
|
7400
|
+
const ttlMs = page.cacheAgeSeconds ? Math.min(Math.max(page.cacheAgeSeconds * 1e3, MIN_TTL_MS), MAX_TTL_MS) : DEFAULT_TTL_MS;
|
|
7401
|
+
return {
|
|
7402
|
+
value: webPageObjectCard({
|
|
7403
|
+
author: page.author,
|
|
7404
|
+
description: page.description,
|
|
7405
|
+
siteName: page.siteName ?? url.hostname,
|
|
7406
|
+
thumbnailUrl: thumbnailPath(page.images, page.pageUrl),
|
|
7407
|
+
title: page.title,
|
|
7408
|
+
url: url.href
|
|
7409
|
+
}),
|
|
7410
|
+
ttlMs
|
|
7411
|
+
};
|
|
7412
|
+
}
|
|
7413
|
+
/**
|
|
7414
|
+
* Return the card of a public web page. A public page is the same for every
|
|
7415
|
+
* viewer, so one cached card per URL serves them all. Junior's own dashboard
|
|
7416
|
+
* pages get no card.
|
|
7417
|
+
*/
|
|
7418
|
+
async function resolveWebPageLink(url) {
|
|
7419
|
+
if (isDashboardLink(url)) return void 0;
|
|
7420
|
+
if (url.username || url.password) return void 0;
|
|
7421
|
+
const key = createHash("sha256").update(url.href).digest("hex");
|
|
7422
|
+
return await createCache(getStateAdapter(), "web-pages").getOrLoad(key, () => loadWebPage(url)) ?? void 0;
|
|
7423
|
+
}
|
|
7424
|
+
/**
|
|
7425
|
+
* The least specific link type. Any plugin or core link type that matches a
|
|
7426
|
+
* URL wins over it.
|
|
7427
|
+
*/
|
|
7428
|
+
function webPageLinkType() {
|
|
7429
|
+
return {
|
|
7430
|
+
cacheCards: false,
|
|
7431
|
+
canView: async () => true,
|
|
7432
|
+
filters: [{ scheme: "https" }],
|
|
7433
|
+
objectType: "web_page",
|
|
7434
|
+
owner: "junior",
|
|
7435
|
+
resolve: (_viewer, url) => resolveWebPageLink(url)
|
|
7436
|
+
};
|
|
7437
|
+
}
|
|
6680
7438
|
// src/api/objects/resolve.ts
|
|
6681
7439
|
/** A card is a short-lived read. A changed object shows within this time. */
|
|
6682
7440
|
const OBJECT_LINK_TTL_MS = 6e4;
|
|
7441
|
+
const OBJECT_LINK_SYSTEM_ACTOR = {
|
|
7442
|
+
platform: "system",
|
|
7443
|
+
name: "object-link"
|
|
7444
|
+
};
|
|
6683
7445
|
function coreLinkTypes() {
|
|
6684
7446
|
const slack = {
|
|
7447
|
+
canView: async () => true,
|
|
6685
7448
|
filters: [SLACK_MESSAGE_LINK_FILTER],
|
|
6686
7449
|
objectType: "message",
|
|
6687
7450
|
owner: "junior",
|
|
@@ -6689,10 +7452,13 @@ function coreLinkTypes() {
|
|
|
6689
7452
|
};
|
|
6690
7453
|
const conversations = getDashboardLinkFilter("/conversations/*");
|
|
6691
7454
|
const people = getDashboardLinkFilter("/people/*");
|
|
6692
|
-
|
|
7455
|
+
const webPages = webPageLinkType();
|
|
7456
|
+
if (!conversations || !people) return [slack, webPages];
|
|
6693
7457
|
return [
|
|
6694
7458
|
slack,
|
|
7459
|
+
webPages,
|
|
6695
7460
|
{
|
|
7461
|
+
canView: canViewConversationLink,
|
|
6696
7462
|
filters: [conversations],
|
|
6697
7463
|
objectType: "conversation",
|
|
6698
7464
|
owner: "junior",
|
|
@@ -6700,6 +7466,7 @@ function coreLinkTypes() {
|
|
|
6700
7466
|
},
|
|
6701
7467
|
{
|
|
6702
7468
|
cacheCards: false,
|
|
7469
|
+
canView: async () => true,
|
|
6703
7470
|
filters: [people, { scheme: "mailto" }],
|
|
6704
7471
|
objectType: "person",
|
|
6705
7472
|
owner: "junior",
|
|
@@ -6707,19 +7474,29 @@ function coreLinkTypes() {
|
|
|
6707
7474
|
}
|
|
6708
7475
|
];
|
|
6709
7476
|
}
|
|
7477
|
+
function objectLinkContext(name, viewer) {
|
|
7478
|
+
return {
|
|
7479
|
+
cache: createPluginCache(name),
|
|
7480
|
+
db: getDb(),
|
|
7481
|
+
egress: createPluginEgress({
|
|
7482
|
+
credentialContext: credentialContextForActor(OBJECT_LINK_SYSTEM_ACTOR),
|
|
7483
|
+
pluginAuth: { async handleAuthRequired() {} }
|
|
7484
|
+
}),
|
|
7485
|
+
findPerson: resolvePersonByAccount,
|
|
7486
|
+
log: createPluginLogger(name),
|
|
7487
|
+
plugin: { name },
|
|
7488
|
+
viewer
|
|
7489
|
+
};
|
|
7490
|
+
}
|
|
6710
7491
|
function pluginLinkTypes(plugin) {
|
|
6711
7492
|
const name = plugin.manifest.name;
|
|
6712
7493
|
return (plugin.objectLinks ?? []).map((link) => ({
|
|
7494
|
+
canView: (viewer, url) => link.canView(objectLinkContext(name, viewer), url),
|
|
6713
7495
|
filters: link.filters,
|
|
6714
7496
|
objectType: link.objectType,
|
|
6715
7497
|
owner: name,
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
db: getDb(),
|
|
6719
|
-
log: createPluginLogger(name),
|
|
6720
|
-
plugin: { name },
|
|
6721
|
-
viewer
|
|
6722
|
-
}, url)
|
|
7498
|
+
readTool: link.readTool,
|
|
7499
|
+
resolve: (viewer, url) => link.resolve(objectLinkContext(name, viewer), url)
|
|
6723
7500
|
}));
|
|
6724
7501
|
}
|
|
6725
7502
|
/**
|
|
@@ -6732,6 +7509,7 @@ function readObjectLinkTypes(plugins = getPlugins()) {
|
|
|
6732
7509
|
return linkTypes;
|
|
6733
7510
|
}
|
|
6734
7511
|
async function resolveWithLinkType(linkType, viewer, url) {
|
|
7512
|
+
if (!await linkType.canView(viewer, url)) return null;
|
|
6735
7513
|
const resolved = await linkType.resolve(viewer, url);
|
|
6736
7514
|
if (!resolved) return null;
|
|
6737
7515
|
const object = objectAnnotationSchema.parse(resolved);
|
|
@@ -6742,6 +7520,20 @@ async function resolveWithLinkType(linkType, viewer, url) {
|
|
|
6742
7520
|
});
|
|
6743
7521
|
}
|
|
6744
7522
|
/**
|
|
7523
|
+
* Resolve one link for one viewer without the card cache, so a change of
|
|
7524
|
+
* access counts at once. Returns nothing when no link type claims the URL
|
|
7525
|
+
* or the viewer cannot see the object.
|
|
7526
|
+
*/
|
|
7527
|
+
async function resolveObjectLinkNow(viewer, url) {
|
|
7528
|
+
const linkType = findObjectLinkType(readObjectLinkTypes(), url);
|
|
7529
|
+
if (!linkType) return void 0;
|
|
7530
|
+
const object = await resolveWithLinkType(linkType, viewer, url);
|
|
7531
|
+
return object ? {
|
|
7532
|
+
linkType,
|
|
7533
|
+
object
|
|
7534
|
+
} : void 0;
|
|
7535
|
+
}
|
|
7536
|
+
/**
|
|
6745
7537
|
* Resolve links to object cards for one viewer. A link without a link type,
|
|
6746
7538
|
* without access, or with a failed read gets no card. Nothing is saved on a
|
|
6747
7539
|
* Conversation.
|
|
@@ -8424,6 +9216,51 @@ async function readConversationAgentTree(conversation, readAccess) {
|
|
|
8424
9216
|
};
|
|
8425
9217
|
}));
|
|
8426
9218
|
}
|
|
9219
|
+
// src/api/conversations/display-markdown.ts
|
|
9220
|
+
function format(text, provider) {
|
|
9221
|
+
return applyPluginFormatMarkdown(text, {
|
|
9222
|
+
platform: "web",
|
|
9223
|
+
...provider ? { provider } : void 0
|
|
9224
|
+
});
|
|
9225
|
+
}
|
|
9226
|
+
/**
|
|
9227
|
+
* Apply plugin Markdown rewrites to transcript text for the dashboard, such
|
|
9228
|
+
* as GitHub reference and `@login` links that show as object cards. A reply
|
|
9229
|
+
* posted to a provider, and the summary of an Event from one, is that
|
|
9230
|
+
* provider's text. In a chat reply, a bare `@U123` is a Slack user, as in
|
|
9231
|
+
* Slack, and not an account of a plugin's provider. Raw Event text and user
|
|
9232
|
+
* text show as written.
|
|
9233
|
+
*/
|
|
9234
|
+
function formatConversationEventText(event) {
|
|
9235
|
+
const { data } = event;
|
|
9236
|
+
if (data.type === "reply_posted") return {
|
|
9237
|
+
...event,
|
|
9238
|
+
data: {
|
|
9239
|
+
...data,
|
|
9240
|
+
text: format(data.text, data.plugin)
|
|
9241
|
+
}
|
|
9242
|
+
};
|
|
9243
|
+
if (data.type !== "message" || data.redacted) return event;
|
|
9244
|
+
const provider = data.eventNamespace;
|
|
9245
|
+
if (provider) return {
|
|
9246
|
+
...event,
|
|
9247
|
+
data: {
|
|
9248
|
+
...data,
|
|
9249
|
+
...data.trustedSummary ? { trustedSummary: format(data.trustedSummary, provider) } : void 0,
|
|
9250
|
+
...data.events ? { events: data.events.map((item) => item.trustedSummary ? {
|
|
9251
|
+
...item,
|
|
9252
|
+
trustedSummary: format(item.trustedSummary, provider)
|
|
9253
|
+
} : item) } : void 0
|
|
9254
|
+
}
|
|
9255
|
+
};
|
|
9256
|
+
return data.role === "assistant" && data.text !== void 0 ? {
|
|
9257
|
+
...event,
|
|
9258
|
+
data: {
|
|
9259
|
+
...data,
|
|
9260
|
+
text: format(wrapBareSlackUserIds(data.text))
|
|
9261
|
+
}
|
|
9262
|
+
} : event;
|
|
9263
|
+
}
|
|
8427
9264
|
// src/api/conversations/mentions.ts
|
|
8428
9265
|
/** Text in one event that the dashboard renders with mentions. */
|
|
8429
9266
|
function eventMentionTexts(data) {
|
|
@@ -8637,7 +9474,7 @@ async function conversationEventPageReport(executor, args) {
|
|
|
8637
9474
|
seq
|
|
8638
9475
|
});
|
|
8639
9476
|
return {
|
|
8640
|
-
events: (await attachConversationMentions(executor, conversationId, { events: page.events })).events,
|
|
9477
|
+
events: (await attachConversationMentions(executor, conversationId, { events: page.events.map(formatConversationEventText) })).events,
|
|
8641
9478
|
eventHistory: args.eventHistory,
|
|
8642
9479
|
...page.previousSeq === void 0 ? void 0 : { previousCursor: cursorAt(page.previousSeq) },
|
|
8643
9480
|
...page.nextSeq === void 0 ? void 0 : { nextCursor: cursorAt(page.nextSeq) },
|
|
@@ -9136,6 +9973,37 @@ async function readConversationAuxiliaryCostsFromSql(db, conversationIds) {
|
|
|
9136
9973
|
}
|
|
9137
9974
|
return result;
|
|
9138
9975
|
}
|
|
9976
|
+
// src/chat/images/objects.ts
|
|
9977
|
+
/**
|
|
9978
|
+
* Preview images of object annotations, as Junior image paths. The browser
|
|
9979
|
+
* never gets the saved image URL in an image `src`, and the plugin that owns
|
|
9980
|
+
* the annotation checks each viewer when the image is read.
|
|
9981
|
+
*/
|
|
9982
|
+
const MAX_PREVIEW_IMAGES = 4;
|
|
9983
|
+
/**
|
|
9984
|
+
* Return the preview images of an object annotation at 1x and 2x of a 320
|
|
9985
|
+
* pixel card slot, when its plugin serves images. Return nothing for other
|
|
9986
|
+
* annotations.
|
|
9987
|
+
*/
|
|
9988
|
+
function objectPreviewImages(annotation) {
|
|
9989
|
+
if (annotation.kind !== "object") return void 0;
|
|
9990
|
+
const urls = annotation.facts?.type === "code_change" ? annotation.facts.previewImageUrls : void 0;
|
|
9991
|
+
if (!urls || !getPlugins().some((plugin) => plugin.manifest.name === annotation.plugin && plugin.images)) return;
|
|
9992
|
+
return urls.slice(0, MAX_PREVIEW_IMAGES).map((url) => {
|
|
9993
|
+
const image = {
|
|
9994
|
+
ref: encodeObjectImageRef({
|
|
9995
|
+
key: annotation.key,
|
|
9996
|
+
url
|
|
9997
|
+
}),
|
|
9998
|
+
source: annotation.plugin
|
|
9999
|
+
};
|
|
10000
|
+
const small = imagePath(image, 320);
|
|
10001
|
+
return {
|
|
10002
|
+
src: small,
|
|
10003
|
+
srcSet: `${small} 1x, ${imagePath(image, 640)} 2x`
|
|
10004
|
+
};
|
|
10005
|
+
});
|
|
10006
|
+
}
|
|
9139
10007
|
// src/api/conversations/detail.ts
|
|
9140
10008
|
/** Project stored metadata and a bounded event page into a signed history cursor. */
|
|
9141
10009
|
function projectConversationDetail(args) {
|
|
@@ -9228,7 +10096,13 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
9228
10096
|
conversationId,
|
|
9229
10097
|
...record.conversation.parentConversationId ? { parentConversationId: record.conversation.parentConversationId } : void 0
|
|
9230
10098
|
}, readAccess),
|
|
9231
|
-
listConversationAnnotations(getDb(), conversationId)
|
|
10099
|
+
listConversationAnnotations(getDb(), conversationId).then((saved) => saved.map((annotation) => {
|
|
10100
|
+
const previewImages = objectPreviewImages(annotation);
|
|
10101
|
+
return previewImages ? {
|
|
10102
|
+
...annotation,
|
|
10103
|
+
previewImages
|
|
10104
|
+
} : annotation;
|
|
10105
|
+
})),
|
|
9232
10106
|
readAutomationTitlesByConversationId([record.conversation]),
|
|
9233
10107
|
readConversationAuxiliaryCostsFromSql(getDb(), [conversationId]),
|
|
9234
10108
|
readLatestConversationBrief(getDb(), conversationId),
|
|
@@ -9252,7 +10126,7 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
9252
10126
|
op: "function"
|
|
9253
10127
|
}, () => attachConversationMentions(executor, conversationId, {
|
|
9254
10128
|
...brief ? { brief } : void 0,
|
|
9255
|
-
events: page.events
|
|
10129
|
+
events: page.events.map(formatConversationEventText)
|
|
9256
10130
|
})),
|
|
9257
10131
|
options.unreadPage && unreadAfterSeq !== void 0 ? readConversationEventPageAround(executor, {
|
|
9258
10132
|
canExposePayload,
|
|
@@ -9984,4 +10858,4 @@ function viewerWebMessages(messages, viewer) {
|
|
|
9984
10858
|
}] : [];
|
|
9985
10859
|
});
|
|
9986
10860
|
}
|
|
9987
|
-
export {
|
|
10861
|
+
export { decodeImageId as $, resolveAllowedDomains as A, runAutoArchiveSweep as B, readConversationPendingMessages as C, isAllowedDomain as D, assertNoLegacyAllowedDomains as E, readReviewItemForUser as F, OBJECT_LINK_TTL_MS as G, updateUserAutoArchiveSettings as H, reviewItemChange as I, resolveObjectLinks as J, readObjectLinkTypes as K, DEFAULT_AUTO_ARCHIVE_SETTINGS as L, ReviewItemActionError as M, actOnReviewItem as N, isAllowedSignInEmail as O, closeReviewItemsAnsweredByReply as P, IMAGE_WIDTHS as Q, archiveViewerDoneConversations as R, cancelConversationPendingMessagesForViewer as S, resolveMentions as T, GET as U, setConversationAutoArchive as V, readHealthReport as W, isPublicAddress as X, guardedFetch as Y, publicAddressLookup as Z, appendConversationMessageForViewer as _, SubscribedReplyReason as _t, pinConversation as a, slackInboundMessageId as at, decodeConversationCursor as b, readFirstHumanMessageTexts as bt, readConversationAuxiliaryCostsFromSql as c, AGENT_DISPATCH_MAX_AGE_MS as ct, conversationVersionQuery as d, recordSkippedConversationMessage as dt, createProductionConversationWorkOptions as et, readConversationDetailEtag as f, createSlackWebApiStatusSender as ft, readConversationRecordFromSql as g, parseContent as gt, readConversationEvents as h, stripLeadingBotMention as ht, readConversationFeed as i, clearSlackPendingReactions as it, stopConversation as j, readEnvList as k, childAgentTotalsReport as l, enqueueAgentDispatch as lt, keepQuickQuestionForViewer as m, startProcessingReaction as mt, steerConversationPendingMessagesForViewer as n, getProductionSlackAdapter as nt, reorderPinnedConversations as o, normalizeIncomingSlackThreadId as ot, forkConversationForViewer as p, bindMessageAuthorIdentityId as pt, resolveObjectLinkNow as q, conversationFeedVersionQuery as r, buildSlackInboundMessage as rt, readConversationDetail as s, withNormalizedThreadId as st, stopConversationTurnForViewer as t, createProductionSlackWebhookServices as tt, readConversationTreeMetricsFromSql as u, failStoppedDispatch as ut, createConversationForViewer as v, getThreadStopDecision as vt, requireConversationPendingMessages as w, encodeConversationCursor as x, requireWebMessageConversation as y, conversationSummaryFromStoredConversation as yt, readUserAutoArchiveSettings as z };
|