@sentry/junior 0.318.0 → 0.319.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/{context-BKF_5zzI.js → adapter-8_S6Birm.js} +537 -537
- package/dist/{admin-UOHix_5P.js → admin-EsbUON1j.js} +1 -1
- package/dist/{agent-runner-DeYymwh2.js → agent-CtzMl32d.js} +18608 -5452
- package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
- package/dist/{agent-update-delivery-DH8bx7jU.js → agent-update-delivery-pAvsbuGL.js} +4 -5
- package/dist/api/schema.d.ts +43 -23
- package/dist/api/schema.js +4 -4
- package/dist/api.js +70 -80
- package/dist/{app-DKAOuaoC.d.ts → app-tACXxJPI.d.ts} +4 -4
- package/dist/app.d.ts +2 -2
- package/dist/app.js +213 -91
- package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
- package/dist/{channel-access-A0de5lRv.js → channel-access-DET5hzZM.js} +1 -1
- package/dist/{chat-core-engine-D3Wd7f5n.js → chat-core-engine-DpM3tMVi.js} +5 -5
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +8 -8
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -4
- package/dist/{continue-in-slack-YxwMQVeR.js → continue-in-slack-CFzDyxkH.js} +3 -3
- package/dist/{conversation-feed-Cj7IuBtM.js → conversation-feed-DEUdD7mb.js} +2 -106
- package/dist/{conversation-privacy-Cr_dNW1p.js → conversation-privacy-C2vYK55O.js} +1 -1
- package/dist/{create-Btl1y1rq.js → create-Ta3SEIB5.js} +115 -5
- package/dist/{credential-sync-DTarZ63K.js → credential-sync-DyRqDmY4.js} +15 -18
- package/dist/{db-of6e3sGt.js → db-BCaNWl9p.js} +4579 -717
- package/dist/{deployment-C0qXa0FD.js → deployment-CfOew1Tm.js} +3 -3
- package/dist/{engine-context-C_QL_bMQ.js → engine-context-CiExoy1B.js} +144 -149
- package/dist/{html-9_pS9SjY.js → html-Bb2Si1bR.js} +6 -8
- package/dist/instrumentation.js +7 -23
- package/dist/list-wwDcROh9.js +5007 -0
- package/dist/{logging-BnOG0qz2.js → logging-BRPTXAdf.js} +8 -33
- package/dist/{mailbox-turn-Byrry9o1.js → markers-9QoqW5ov.js} +1675 -1255
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +6 -7
- package/dist/{oauth-callback-server-CjnnUr4o.js → oauth-callback-server-vhL9b-PZ.js} +2 -2
- package/dist/{oauth-relay-BvHFH0fV.js → oauth-relay-CH2v7WiB.js} +1 -1
- package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
- package/dist/{profile-iHw1uu32.js → profile-D9LdwmZi.js} +16 -18
- package/dist/{prompt-DEkStuxG.js → prompt-3TqxEOtc.js} +1 -1
- package/dist/{reports-C1d9azyV.js → reports-K-tbtEyx.js} +2 -2
- package/dist/{resolve-DC6zBuDV.js → resolve-BBV2qf8A.js} +5 -5
- package/dist/{result-DxewDuXb.js → result-5IdGJP4M.js} +20 -9
- package/dist/{runner-99YxVN_r.js → runner-BK_joPlM.js} +7 -8
- package/dist/{sandbox-egress-signals-CgoX5CTI.js → sandbox-egress-signals-DXgWXXmm.js} +1 -1
- package/dist/{schema-BTojNBr5.js → schema-zWGG6VC1.js} +13 -7
- package/dist/{service-account-YDCPSByj.js → service-account-CateFyhw.js} +4 -5
- package/dist/{skills-CleC0Hze.js → skills-Ccjw8h2P.js} +9 -9
- package/dist/{slack-conversation-unfurl-BNQLC12R.js → slack-conversation-unfurl-ZC_TSpc4.js} +7 -7
- package/dist/storage-C9U7R5rM.js +273 -0
- package/dist/{system-prompt-table-Ci6Ck4gk.js → system-prompt-table-YBTHIFlP.js} +26 -84
- package/dist/topic-B2EWKKBT.js +6 -0
- package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
- package/dist/{types-DCzTAA63.js → types-BNHkJrOP.js} +25 -11
- package/dist/{users-Cb9c1k9q.js → users-CCRAqYb_.js} +1 -1
- package/dist/{validation-BiUmWPhy.js → validation-BCUpJa8K.js} +4 -4
- package/dist/{version-VEXiEcZu.js → version-BNm0JYj3.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-ChWYQdhm.js → worker-BhgpZ7_b.js} +4 -4
- package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
- package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
- package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
- package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
- package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
- package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
- package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
- package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
- package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
- package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
- package/package.json +9 -7
- package/dist/auth-pause-state-f9hJM_zO.js +0 -113
- package/dist/catalog-runtime-BfdAnztW.js +0 -6
- package/dist/child-message-peFWLcCZ.js +0 -15
- package/dist/conversation-turn-Bru4w_FD.js +0 -1250
- package/dist/job-runner-B2XEvpif.js +0 -1505
- package/dist/lineage-nh4z9iQN.js +0 -36
- package/dist/list-HRP3TIRl.js +0 -12631
- package/dist/markers-CTTtJqYn.js +0 -342
- package/dist/message-BRUuLgrY.js +0 -153
- package/dist/model-input-CFC62mf-.js +0 -82
- package/dist/registry-Cl7Labpe.js +0 -3279
- package/dist/run-conversation-Cz2ubZK-.js +0 -337
- package/dist/sender-actors-77zTQbSG.js +0 -84
- package/dist/spawn-DuZfodPa.js +0 -45
- package/dist/task-runner-BJ9Up3bG.js +0 -1529
- package/dist/topic-CRYYBYp-.js +0 -7
- package/dist/topics-BoCkoPJJ.js +0 -21
- package/dist/turn-membership-VT7XZh-L.js +0 -856
- package/dist/turn-wake-C7HeLHAM.js +0 -151
package/dist/app.js
CHANGED
|
@@ -1,43 +1,37 @@
|
|
|
1
|
-
import { E as parseSlackChannelId, F as slackMessageTsFromMs, G as loadConfig, I as slackMessageTsSchema, K as parseEnvList, L as botConfig, M as slackTeamIdSchema, P as parseSlackMessageTs, R as getChatConfig,
|
|
2
|
-
import {
|
|
3
|
-
import { C as withContext, D as GOOGLE_IDENTITY_PROVIDER, T as withSpan, f as logException, k as normalizeIdentityEmail, m as logWarn, n as createRequestContext, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import { A as createUserTokenStore, C as clearSandboxEgressSignals, D as parseSandboxEgressCredentialToken, P as normalizeSandboxEgressTracePropagationDomains, T as consumeSandboxEgressPermissionDeniedSignal, c as isVercelSandboxEgressRequest, l as proxyVercelSandboxEgressRequest, w as consumeSandboxEgressAuthRequiredSignal } from "./profile-
|
|
6
|
-
import { n as
|
|
7
|
-
import { $ as reviewItemChange, At as createProductionSlackWebhookServices, B as mcpIdempotencyKeySchema, Bt as startProcessingReaction, Dt as isPublicAddress, F as mcpAuthorizationSchema$1, Ft as normalizeIncomingSlackThreadId, G as readMcpPendingWork, H as mcpMessageTextSchema, Ht as parseContent, I as mcpConversation, It as withNormalizedThreadId, K as readMcpPendingWorkAfterSend, Kt as readConversationRecordFromSql, L as mcpConversationIdSchema, Lt as recordSkippedConversationMessage, Mt as buildSlackInboundMessage, Nt as clearSlackPendingReactions, Ot as publicAddressLookup, P as mcpAcceptedMessageSchema, Pt as slackInboundMessageId, Q as readInboxItemForUser, R as mcpConversationSchema, Rt as createSlackWebApiStatusSender, St as readObjectLinkTypes, U as mcpMessages, Ut as SubscribedReplyReason, V as mcpMessageSchema, Vt as stripLeadingBotMention, W as mcpPendingMessagesSchema, Wt as getThreadStopDecision, X as actOnInboxItem, Y as InboxItemActionError, Z as closeInboxItemsAnsweredByReply, _ as createConversationForViewer, _t as backfillCacheWarmingGaps, a as resolveInboxItemSubjects, b as encodeConversationCursor, ct as listOpenAutomationQuestions, dt as getScheduledAutomationDispatch, et as createEventAppPublisher, ft as runInboxSnoozeTimers, g as appendConversationMessageForViewer, ht as runSavingsRefillSlice, jt as getProductionSlackAdapter, kt as createProductionConversationWorkOptions, lt as createHeartbeatContext, n as readConversationFeed, nt as runAutoArchiveSweep, o as readConversationDetail, ot as automationReplyAttribution, st as settleEventAutomationRuns, tt as ingestEventAutomations, ut as dispatchScheduledAutomation, vt as GET$4, w as conversationOperations, y as decodeConversationCursor, z as mcpCursorSchema, zt as bindMessageAuthorIdentityId } from "./list-HRP3TIRl.js";
|
|
8
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BiUmWPhy.js";
|
|
1
|
+
import { C as parseActorUserId, E as parseSlackChannelId, F as slackMessageTsFromMs, G as loadConfig, I as slackMessageTsSchema, K as parseEnvList, L as botConfig, M as slackTeamIdSchema, P as parseSlackMessageTs, R as getChatConfig, W as installChatConfig, i as getStateAdapter, j as slackChannelIdSchema, l as fenceLock, s as MUTATION_LOCK_TTL_MS, u as withLock, v as createSlackActor } from "./adapter-8_S6Birm.js";
|
|
2
|
+
import { $ as canActOnInboxItem, $n as sendSlackReply, $r as renderSlackObjectCard, Ap as juniorTurns, Ar as readConversationAccessFromSql, Au as EVENT_INDEX_LOCK_TTL_MS, Ba as existingConversationId, Bi as slackMention, Bn as pushConversationInboxItemsNow, Bo as takeDueTimerWatches, Bp as juniorConversations, Br as resolveConversationWorkTopic, Ci as notifyAutomationBlocked, Cl as getDashboardConversationLink, Cn as hasRunnableConversationWork, Dc as recordGoogleSignIn, Dn as pruneActiveConversation, Dp as juniorConversationEmbeddings, Dt as getRegistrations, Ep as juniorConversationEventEmbeddings, Fd as getAppContext, Fi as slackExternalRefIdSchema, Gc as searchInboxItems, Gf as touchConversationDetail, Gn as findSlackThreadOwnerId, Gu as createConversationEmbedder, Hn as runInboxItemPushTimers, Id as installAppContext, Jn as parseSlackInboxItemClick, Kf as createSlackDestination, Lu as storeConversationEventLexemes, Ma as automationVersionOf, Mu as eventIndexLockKey, O as withConversationMutationLock, Oi as openSlackModal, Ot as validatePlugins, Pd as createAppContext, Pi as slackEntitySchema, Pl as projectConversationMessages, Qt as clearExpiredConversationLease, R as replaceConversationMetrics, Sp as juniorAgentBindings, Tn as isInvalidConversationRecordError, Tp as juniorConversationEventLexemes, Tt as inboxItemVisibility, U as conversationIsActiveSql, Un as resolveSlackInboxItemCardConversationId, Ur as conversationQueueMessageSchema, Uu as isEventEmbeddingsEnabled, Vr as verifyConversationQueueMessage, Wn as syncInboxItemSlackCards, Wr as isConversationQueueMessageRejectedError, Wt as appendAndEnqueueInboundMessage, Wu as backfillConversationEmbeddings, Yn as parseSlackInboxItemFormTarget, Yr as getQueueProvider, Za as refreshAutomationLastRun, Zc as itemQuestion, Zn as parseSlackUserInputSubmission, Zs as getSlackClient, _a as scheduledRunId, _i as listPendingDispatchMailboxAppends, _t as isPluginInboxItem, a as getDb, an as getConversation, at as inboxItemAddedByAnyAutomation, bc as resolveActorIdentityId, bp as juniorInboxItems, bs as listConversationAnnotations, cc as runWithWorkspaceTeamId, ci as confirmDispatchMailboxAppend, cn as listActiveConversationIds, cs as subjectKey, dt as inboxItemReaderForUser, ei as annotationKeyDigest, fa as listScheduledAutomationsForTeam, fc as readActorIdentity, fp as juniorAutomationRuns, ft as inboxItemReaderForUserInConversation, ga as saveScheduledAutomationInLock, gc as resolveViewerUser, gi as isTerminalDispatchStatus, go as slackChannelMessageEvent, hp as juniorAutomations, i as getConversationStore, in as ensureConversationWake, io as syncAutomationAlerts, js as isPublicConversation, ju as embedConversationEvents, ki as postSlackEphemeralMessage, kl as getDashboardTaskLink, kp as juniorConversationEvents, lp as juniorQuestions, lr as sendVercelPluginTask, m as deleteMessageLinks, ma as readScheduledAutomation, ml as deleteExpiredInboxSnoozes, mo as SLACK_EVENT_NAMESPACE, n as getConversationEventStore, ni as runWithSlackInstallation, np as juniorTurnInbox, nr as getPluginApiRoutes, o as getSqlExecutor, on as getConversationWorkState, or as createVercelPluginTaskCallback, pi as getDispatchRecord, qn as buildSlackInboxItemModal, qp as juniorDestinations, ri as verifySlackSignature, rr as getPluginRoutes, sc as getWorkspaceTeamId, sl as parseAvatarUrl, ti as decodeAnnotationRef, tp as juniorTurnOutbox, tr as createPluginEventPublisher, ts as resumeConversationDelivery, tt as canAnswerInboxItem, u as isPostgresErrorCode, ui as getDispatchConversationId, ur as queueCallback, v as withConversationEventLock, va as withScheduledAutomationLock, wl as getDashboardInboxItemLink, wr as canAddConversationMessages, wt as inboxItemOwnerConversationId, xi as markDispatchFailed, yn as CONVERSATION_WORK_STALE_ENQUEUE_MS, z as conversationCostOf, zc as dismissOpenInboxItems, zn as createInboxItemShow, zr as getVercelConversationWorkQueue } from "./db-BCaNWl9p.js";
|
|
3
|
+
import { C as withContext, D as GOOGLE_IDENTITY_PROVIDER, T as withSpan, f as logException, k as normalizeIdentityEmail, m as logWarn, n as createRequestContext, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-BRPTXAdf.js";
|
|
4
|
+
import { $ as slackInboundMessageId, C as verifyWorkspaceSnapshotJobMessage, Cn as recordWebConversationActivity, En as collectAttachmentUploadGarbage, F as markConversationRead, Ft as isPublicAddress, Gn as readPublicArtifact, Hn as requestAttachmentDeletion, It as publicAddressLookup, J as getProductionSlackAdapter, K as createProductionConversationWorkOptions, Kn as unpublishedArtifactHeaders, L as deliverInboxItemChange, Q as clearSlackPendingReactions, R as inboxItemChangeRecord, S as processWorkspaceSnapshotJob, Un as parseSlackThreadId, Ut as readConversationRecordFromSql, Wn as publicArtifactHeaders, Z as buildSlackInboundMessage, _t as recordSkippedConversationMessage, ar as readViewerAutomationSummary, at as enqueueAgentDispatch, b as verifyBackgroundCompactionMessage, bn as conversationTurnIdForMessage, cn as startProcessingReaction, dn as isRetryableSlackPostError, dr as effectiveTaskOutcomes, dt as readConversationEventPage, er as ViewerTaskNotFoundError, et as normalizeIncomingSlackThreadId, fn as SubscribedReplyReason, ft as readConversationEventPageAfter, ht as readConversationMessageEventSeq, i as scheduledAutomationRunAttributes, in as bindMessageAgent, kt as readObjectLinkTypes, ln as stripLeadingBotMention, lr as findAutomationSkill, mt as readConversationLastEventSeq, on as createAgentRunner, ot as failStoppedDispatch, pn as getThreadStopDecision, q as createProductionSlackWebhookServices, r as logScheduledAutomationRunSkipped, rr as readViewerAutomationExecutions, sn as bindMessageAuthorIdentityId, sr as readViewerAutomations, st as processPluginTask, t as executeAgentRun, tn as bindSpawnAgent, tt as withNormalizedThreadId, un as parseContent, ur as missingAutomationSkillReason, v as processBackgroundCompaction, vt as stopConversation, w as ingestEvent, wn as webActorFromUser, wt as readLiveAnnotations, x as createVercelCacheWarmupCallback, xn as createAndEnqueueConversation, y as vercelBackgroundCompactionQueue, yn as appendAndEnqueueWebMessage, yt as createSlackWebApiStatusSender, z as renderInboxItemMessage, zn as collectAttachmentGarbage } from "./agent-CtzMl32d.js";
|
|
5
|
+
import { A as createUserTokenStore, C as clearSandboxEgressSignals, D as parseSandboxEgressCredentialToken, P as normalizeSandboxEgressTracePropagationDomains, T as consumeSandboxEgressPermissionDeniedSignal, c as isVercelSandboxEgressRequest, l as proxyVercelSandboxEgressRequest, w as consumeSandboxEgressAuthRequiredSignal } from "./profile-D9LdwmZi.js";
|
|
6
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BCUpJa8K.js";
|
|
9
7
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-D_Ru4CWc.js";
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { h as createPluginLogger } from "./prompt-DEkStuxG.js";
|
|
8
|
+
import { $ as reviewItemChange, B as mcpIdempotencyKeySchema, F as mcpAuthorizationSchema$1, G as readMcpPendingWork, H as mcpMessageTextSchema, I as mcpConversation, K as readMcpPendingWorkAfterSend, L as mcpConversationIdSchema, P as mcpAcceptedMessageSchema, Q as readInboxItemForUser, R as mcpConversationSchema, U as mcpMessages, V as mcpMessageSchema, W as mcpPendingMessagesSchema, X as actOnInboxItem, Y as InboxItemActionError, Z as closeInboxItemsAnsweredByReply, _ as createConversationForViewer, _t as backfillCacheWarmingGaps, a as resolveInboxItemSubjects, b as encodeConversationCursor, ct as listOpenAutomationQuestions, dt as getScheduledAutomationDispatch, et as createEventAppPublisher, ft as runInboxSnoozeTimers, g as appendConversationMessageForViewer, ht as runSavingsRefillSlice, lt as createHeartbeatContext, n as readConversationFeed, nt as runAutoArchiveSweep, o as readConversationDetail, ot as automationReplyAttribution, st as settleEventAutomationRuns, tt as ingestEventAutomations, ut as dispatchScheduledAutomation, vt as GET$4, w as conversationOperations, y as decodeConversationCursor, z as mcpCursorSchema } from "./list-wwDcROh9.js";
|
|
9
|
+
import { I as getAuthPausedConversationTurnId, Kn as settleConversationTitleWork, Mt as renderTaskInput, Q as coerceThreadConversationState, Vn as appendConversationMessages, dn as isExperimentalFeatureEnabled, gt as parseEmail, ht as isTrustedSlackAuthor, mt as isAllowedDomain, pt as findTrustedUser, q as getLocationConfigurationService } from "./markers-9QoqW5ov.js";
|
|
10
|
+
import { Bt as annotationCard, Kt as automationCardStatus, On as automationTaskSchema, Pn as getNextRunAtMs, _ as automationListQuerySchema, in as scheduledRunSchema, kn as automationTaskText, p as automationExecutionStatusSchema, pn as inboxItemQuestion, vn as buttonUserInputField } from "./types-BNHkJrOP.js";
|
|
11
|
+
import { t as createEndStoppedChildWork } from "./result-5IdGJP4M.js";
|
|
12
|
+
import { h as createPluginLogger } from "./prompt-3TqxEOtc.js";
|
|
13
|
+
import { n as getAttachmentStorage } from "./storage-C9U7R5rM.js";
|
|
17
14
|
import { i as getActiveSpan, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
18
|
-
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
15
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-DyRqDmY4.js";
|
|
19
16
|
import { t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
20
17
|
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
21
|
-
import { a as resolveSlackActingUser, i as unfurlDashboardConversationLinks, n as handleSlackContinueHereClick, o as isSlackWorkspaceMember, s as slackWorkspaceBotId, t as SLACK_CONTINUE_HERE_ACTION_ID } from "./slack-conversation-unfurl-
|
|
22
|
-
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-
|
|
23
|
-
import { s as joinPublicChannel } from "./channel-access-
|
|
24
|
-
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
25
|
-
import { t as processConversationWork } from "./worker-
|
|
26
|
-
import { t as
|
|
27
|
-
import { t as
|
|
28
|
-
import {
|
|
29
|
-
import { c as replyText, d as publishTurnStep, f as countMetric, i as turnStepConsumer, l as createDeliveryConsumer, n as turnTools, o as findStalledTurns, p as withSpan$1, r as createGatewayModelClient, s as findStalledDeliveries, t as createEngineContext, u as publishDelivery } from "./engine-context-C_QL_bMQ.js";
|
|
30
|
-
import { t as JUNIOR_VERSION } from "./version-VEXiEcZu.js";
|
|
31
|
-
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed-Cj7IuBtM.js";
|
|
18
|
+
import { a as resolveSlackActingUser, i as unfurlDashboardConversationLinks, n as handleSlackContinueHereClick, o as isSlackWorkspaceMember, s as slackWorkspaceBotId, t as SLACK_CONTINUE_HERE_ACTION_ID } from "./slack-conversation-unfurl-ZC_TSpc4.js";
|
|
19
|
+
import { l as unlinkProvider, n as renderHtmlPage, r as requestHasSameOrigin, t as escapeHtml } from "./html-Bb2Si1bR.js";
|
|
20
|
+
import { s as joinPublicChannel } from "./channel-access-DET5hzZM.js";
|
|
21
|
+
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, d as JUNIOR_TURN_ENDED_CALLBACK_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE } from "./deployment-CfOew1Tm.js";
|
|
22
|
+
import { t as processConversationWork } from "./worker-BhgpZ7_b.js";
|
|
23
|
+
import { a as turnStepConsumer, c as findTurn, d as readTurnEndedMessages, f as publishTurnStep, g as withSpan$1, h as countMetric, i as createGatewayModelClient, l as replyText, m as loadTurnAgentHistory, n as turnTools, p as findTurnActor, r as turnUsage, s as findStalledTurns, t as createEngineContext, u as publishTurnEnded } from "./engine-context-CiExoy1B.js";
|
|
24
|
+
import { t as JUNIOR_VERSION } from "./version-BNm0JYj3.js";
|
|
25
|
+
import { D as conversationPendingMessageDeliverySchema, f as conversationTitleSchema, t as conversationFeedQuerySchema } from "./conversation-feed-DEUdD7mb.js";
|
|
32
26
|
import { t as isMissingVirtualModule } from "./virtual-module-BeKA_EII.js";
|
|
33
27
|
import { createRequire } from "node:module";
|
|
34
28
|
import { Hono } from "hono";
|
|
35
29
|
import * as z from "zod";
|
|
36
|
-
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, notExists, or, sql } from "drizzle-orm";
|
|
37
|
-
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
30
|
+
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, notExists, notInArray, or, sql } from "drizzle-orm";
|
|
31
|
+
import { alias, pgTable, text } from "drizzle-orm/pg-core";
|
|
38
32
|
import { destinationSchema, eventTriggerFiltersText, identityDispatchOptionsSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
39
|
-
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
40
33
|
import { pathToFileURL } from "node:url";
|
|
34
|
+
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
41
35
|
import { Message, ThreadImpl } from "chat";
|
|
42
36
|
import net from "node:net";
|
|
43
37
|
import { decodeJwt } from "jose";
|
|
@@ -110,7 +104,8 @@ async function listActiveConversations(db, args) {
|
|
|
110
104
|
const after = args.after;
|
|
111
105
|
return await withScanTimeout(db, async (tx) => await tx.select({
|
|
112
106
|
at: sql`to_char(${conversations.lastActivityAt} at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"')`,
|
|
113
|
-
conversationId: conversations.conversationId
|
|
107
|
+
conversationId: conversations.conversationId,
|
|
108
|
+
turnActive: conversationIsActiveSql(conversations)
|
|
114
109
|
}).from(conversations).where(and(gte(conversations.lastActivityAt, new Date(args.sinceMs)), after ? or(lt(conversations.lastActivityAt, sql`${after.at}::timestamptz`), and(eq(conversations.lastActivityAt, sql`${after.at}::timestamptz`), gt(conversations.conversationId, after.conversationId))) : void 0)).orderBy(desc(conversations.lastActivityAt), conversations.conversationId).limit(CONVERSATION_PAGE_SIZE));
|
|
115
110
|
}
|
|
116
111
|
async function hasMissingVector(tx, embedder, conversationId) {
|
|
@@ -154,6 +149,7 @@ async function backfillEventSearchIndex(args) {
|
|
|
154
149
|
const run = {
|
|
155
150
|
conversations: 0,
|
|
156
151
|
lexemes: 0,
|
|
152
|
+
running: 0,
|
|
157
153
|
skipped: 0,
|
|
158
154
|
vectors: 0
|
|
159
155
|
};
|
|
@@ -174,7 +170,12 @@ async function backfillEventSearchIndex(args) {
|
|
|
174
170
|
after,
|
|
175
171
|
sinceMs
|
|
176
172
|
});
|
|
177
|
-
for (const conversation of page) {
|
|
173
|
+
for (const { turnActive, ...conversation } of page) {
|
|
174
|
+
if (turnActive) {
|
|
175
|
+
run.running += 1;
|
|
176
|
+
after = conversation;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
178
179
|
const lexemeRoom = MAX_LEXEME_EVENTS_PER_RUN - run.lexemes;
|
|
179
180
|
const vectorRoom = MAX_VECTOR_EVENTS_PER_RUN - run.vectors;
|
|
180
181
|
if (Date.now() >= args.deadlineMs || lexemeRoom <= 0 || args.embedder && vectorRoom <= 0) return {
|
|
@@ -242,6 +243,7 @@ async function runEventSearchBackfill(args) {
|
|
|
242
243
|
setSpanAttributes({
|
|
243
244
|
"app.event_search.backfill.conversation.count": result.run.conversations,
|
|
244
245
|
"app.event_search.backfill.skipped.count": result.run.skipped,
|
|
246
|
+
"app.event_search.backfill.running.count": result.run.running,
|
|
245
247
|
"app.event_search.backfill.lexeme.count": result.run.lexemes,
|
|
246
248
|
"app.event_search.backfill.vector.count": result.run.vectors,
|
|
247
249
|
"app.event_search.backfill.pass.conversation.count": result.pass.conversations,
|
|
@@ -1608,7 +1610,10 @@ const eventSchema = z.object({
|
|
|
1608
1610
|
id: slackExternalRefIdSchema
|
|
1609
1611
|
})
|
|
1610
1612
|
});
|
|
1611
|
-
/**
|
|
1613
|
+
/**
|
|
1614
|
+
* Show an annotation's object, as the viewer can read it now, only to a
|
|
1615
|
+
* viewer who can read its Conversation.
|
|
1616
|
+
*/
|
|
1612
1617
|
async function presentSlackAnnotationDetails(event, teamId) {
|
|
1613
1618
|
const triggerId = event["trigger_id"];
|
|
1614
1619
|
if (typeof triggerId !== "string" || !triggerId) return;
|
|
@@ -1650,12 +1655,13 @@ async function presentSlackAnnotationDetails(event, teamId) {
|
|
|
1650
1655
|
await missing();
|
|
1651
1656
|
return;
|
|
1652
1657
|
}
|
|
1653
|
-
const
|
|
1654
|
-
if (!
|
|
1658
|
+
const saved = (await listConversationAnnotations(db, conversationId)).find((item) => annotationKeyDigest(item.plugin, item.key) === keyDigest);
|
|
1659
|
+
if (!saved) {
|
|
1655
1660
|
await missing();
|
|
1656
1661
|
return;
|
|
1657
1662
|
}
|
|
1658
|
-
const
|
|
1663
|
+
const [annotation] = await readLiveAnnotations(identity.user, [saved]);
|
|
1664
|
+
const entity = annotation && renderSlackObjectCard(annotationCard(annotation), conversationId, "details").entity;
|
|
1659
1665
|
if (!entity) {
|
|
1660
1666
|
await missing();
|
|
1661
1667
|
return;
|
|
@@ -3263,7 +3269,7 @@ function backgroundCompactionCallback() {
|
|
|
3263
3269
|
function createVercelBackgroundCompactionCallback() {
|
|
3264
3270
|
return backgroundCompactionCallback().create();
|
|
3265
3271
|
}
|
|
3266
|
-
// src/
|
|
3272
|
+
// src/delivery/deliver.ts
|
|
3267
3273
|
/**
|
|
3268
3274
|
* A send that failed but can work on a later try. The sender sets
|
|
3269
3275
|
* `retryAfterMs` when the provider says when to try again.
|
|
@@ -3283,22 +3289,23 @@ const RETRY_MAX_DELAY_MS = 6e4;
|
|
|
3283
3289
|
const tryLockResultSchema = z.object({ rows: z.tuple([z.object({ locked: z.boolean() })]) });
|
|
3284
3290
|
/**
|
|
3285
3291
|
* Sends the Conversation's pending outbox rows in event order, each to the
|
|
3286
|
-
* Destination stored on its row.
|
|
3292
|
+
* Destination stored on its row. To try again later, it sends the message
|
|
3293
|
+
* that the Turn ended again, with a delay.
|
|
3287
3294
|
*/
|
|
3288
3295
|
async function deliverTurn({ executor, queue }, message, delivery) {
|
|
3289
3296
|
while (true) {
|
|
3290
3297
|
const next = await executor.transaction(() => sendNextRow({ executor }, message.conversationId, delivery));
|
|
3291
3298
|
if (next.kind === "idle") return;
|
|
3292
3299
|
if (next.kind === "later") {
|
|
3293
|
-
await
|
|
3300
|
+
await publishTurnEnded({ queue }, message, { delayMs: next.delayMs });
|
|
3294
3301
|
return;
|
|
3295
3302
|
}
|
|
3296
3303
|
}
|
|
3297
3304
|
}
|
|
3298
3305
|
/**
|
|
3299
3306
|
* Sends the Conversation's first pending row, if this transaction gets the
|
|
3300
|
-
* Conversation's lock
|
|
3301
|
-
* rows after it wait.
|
|
3307
|
+
* Conversation's lock and the row's Turn has ended. A retryable failure
|
|
3308
|
+
* leaves the row pending, so the rows after it wait.
|
|
3302
3309
|
*/
|
|
3303
3310
|
async function sendNextRow({ executor }, conversationId, delivery) {
|
|
3304
3311
|
const db = executor.db();
|
|
@@ -3310,9 +3317,10 @@ async function sendNextRow({ executor }, conversationId, delivery) {
|
|
|
3310
3317
|
id: juniorTurnOutbox.id,
|
|
3311
3318
|
eventSeq: juniorTurnOutbox.eventSeq,
|
|
3312
3319
|
destination: juniorTurnOutbox.destination,
|
|
3313
|
-
attempts: juniorTurnOutbox.attempts
|
|
3314
|
-
|
|
3315
|
-
|
|
3320
|
+
attempts: juniorTurnOutbox.attempts,
|
|
3321
|
+
turnState: juniorTurns.state
|
|
3322
|
+
}).from(juniorTurnOutbox).innerJoin(juniorTurns, eq(juniorTurns.id, juniorTurnOutbox.turnId)).where(and(eq(juniorTurnOutbox.conversationId, conversationId), eq(juniorTurnOutbox.state, "pending"))).orderBy(asc(juniorTurnOutbox.eventSeq)).limit(1);
|
|
3323
|
+
if (!row || row.turnState === "queued" || row.turnState === "running") return { kind: "idle" };
|
|
3316
3324
|
const markFailed = async (error) => {
|
|
3317
3325
|
await db.update(juniorTurnOutbox).set({
|
|
3318
3326
|
state: "failed",
|
|
@@ -3321,7 +3329,12 @@ async function sendNextRow({ executor }, conversationId, delivery) {
|
|
|
3321
3329
|
}).where(eq(juniorTurnOutbox.id, row.id));
|
|
3322
3330
|
return { kind: "settled" };
|
|
3323
3331
|
};
|
|
3324
|
-
const
|
|
3332
|
+
const parsed = destinationSchema.safeParse(row.destination);
|
|
3333
|
+
if (!parsed.success) {
|
|
3334
|
+
logException(parsed.error, "turn.delivery.failed", { "gen_ai.conversation.id": conversationId });
|
|
3335
|
+
return markFailed("The Destination is not valid");
|
|
3336
|
+
}
|
|
3337
|
+
const destination = parsed.data;
|
|
3325
3338
|
const [event] = await db.select().from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.seq, row.eventSeq)));
|
|
3326
3339
|
const text = event ? replyText(event) : void 0;
|
|
3327
3340
|
if (!text) return markFailed("The event is not a reply");
|
|
@@ -3368,56 +3381,108 @@ async function sendNextRow({ executor }, conversationId, delivery) {
|
|
|
3368
3381
|
function retryDelayMs(error, attempts) {
|
|
3369
3382
|
return Math.min(error.retryAfterMs ?? RETRY_BASE_DELAY_MS * 2 ** (attempts - 1), RETRY_MAX_DELAY_MS);
|
|
3370
3383
|
}
|
|
3371
|
-
// src/
|
|
3384
|
+
// src/delivery/slack.ts
|
|
3385
|
+
/**
|
|
3386
|
+
* Creates the sender of replies to Slack Destinations. A Slack failure that a
|
|
3387
|
+
* later try can fix throws `DeliveryRetryableError`.
|
|
3388
|
+
*/
|
|
3389
|
+
function createSlackSender(args) {
|
|
3390
|
+
return async (reply) => {
|
|
3391
|
+
const { channelId, teamId, threadTs } = reply.destination;
|
|
3392
|
+
let messageIds;
|
|
3393
|
+
try {
|
|
3394
|
+
messageIds = await runWithSlackInstallation({
|
|
3395
|
+
adapter: args.getSlackAdapter(),
|
|
3396
|
+
installation: { teamId },
|
|
3397
|
+
task: async () => sendSlackReply({
|
|
3398
|
+
channelId,
|
|
3399
|
+
threadTs,
|
|
3400
|
+
conversationId: reply.conversationId,
|
|
3401
|
+
formatting: {
|
|
3402
|
+
configuration: await getLocationConfigurationService({
|
|
3403
|
+
platform: "slack",
|
|
3404
|
+
teamId,
|
|
3405
|
+
channelId
|
|
3406
|
+
}).resolveValues(),
|
|
3407
|
+
teamId
|
|
3408
|
+
},
|
|
3409
|
+
text: reply.text
|
|
3410
|
+
})
|
|
3411
|
+
});
|
|
3412
|
+
} catch (error) {
|
|
3413
|
+
if (isRetryableSlackPostError(error)) throw new DeliveryRetryableError("Slack did not take the reply", { cause: error });
|
|
3414
|
+
throw error;
|
|
3415
|
+
}
|
|
3416
|
+
const providerMessageId = messageIds.at(-1);
|
|
3417
|
+
return providerMessageId ? { providerMessageId } : {};
|
|
3418
|
+
};
|
|
3419
|
+
}
|
|
3420
|
+
// src/turn-steps/metrics.ts
|
|
3372
3421
|
/**
|
|
3373
|
-
*
|
|
3374
|
-
*
|
|
3422
|
+
* Writes the metrics of an ended Turn. A rerun replaces the same rows, so a
|
|
3423
|
+
* Turn counts once however often its Turn-ended message arrives. A Turn that
|
|
3424
|
+
* never ran or has not ended writes nothing.
|
|
3375
3425
|
*/
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3426
|
+
async function recordTurnMetrics(ctx, message) {
|
|
3427
|
+
const turn = await findTurn(ctx, message.turnId);
|
|
3428
|
+
if (!turn?.startedAt || !turn.endedAt) return;
|
|
3429
|
+
const [history, actorIdentityId] = await Promise.all([loadTurnAgentHistory(ctx, message.turnId), findTurnActor(ctx, message.turnId)]);
|
|
3430
|
+
const usage = await turnUsage(ctx, message.turnId, history);
|
|
3431
|
+
const { startedAt, endedAt } = turn;
|
|
3432
|
+
await withConversationMutationLock(ctx.executor, message.conversationId, () => replaceConversationMetrics(ctx.executor, {
|
|
3433
|
+
actorIdentityId,
|
|
3434
|
+
conversationId: message.conversationId,
|
|
3435
|
+
runId: message.turnId,
|
|
3436
|
+
occurredAtMs: startedAt.getTime(),
|
|
3437
|
+
updatedAtMs: endedAt.getTime(),
|
|
3438
|
+
durationMs: endedAt.getTime() - startedAt.getTime(),
|
|
3439
|
+
usage
|
|
3440
|
+
}));
|
|
3441
|
+
}
|
|
3442
|
+
// src/turn-steps/turn-ended.ts
|
|
3379
3443
|
/**
|
|
3380
|
-
*
|
|
3381
|
-
*
|
|
3444
|
+
* Creates the Delivery of this deployment. It sends replies to Slack
|
|
3445
|
+
* Destinations. Other platforms have no sender yet, so their replies fail.
|
|
3382
3446
|
*/
|
|
3383
|
-
function
|
|
3384
|
-
|
|
3447
|
+
function createDeploymentDelivery(args) {
|
|
3448
|
+
const sendToSlack = createSlackSender(args);
|
|
3449
|
+
return { send: async (reply) => {
|
|
3450
|
+
const { destination } = reply;
|
|
3451
|
+
if (destination.platform === "slack") return sendToSlack({
|
|
3452
|
+
...reply,
|
|
3453
|
+
destination
|
|
3454
|
+
});
|
|
3455
|
+
throw new Error(`No sender for ${destination.platform} Destinations`);
|
|
3456
|
+
} };
|
|
3385
3457
|
}
|
|
3386
|
-
// src/core/turn/sweep.ts
|
|
3387
|
-
const STALE_MS = 3e5;
|
|
3388
|
-
const BATCH = 100;
|
|
3389
3458
|
/**
|
|
3390
|
-
*
|
|
3391
|
-
*
|
|
3392
|
-
*
|
|
3459
|
+
* The queue consumer of the messages that a Turn ended. It records the Turn's
|
|
3460
|
+
* metrics, then sends its replies, so a send that waits does not hold back
|
|
3461
|
+
* the spend. The host mounts it on `engineCtx.queue`.
|
|
3393
3462
|
*/
|
|
3463
|
+
function turnEndedConsumer(engineCtx, delivery) {
|
|
3464
|
+
return readTurnEndedMessages(engineCtx, async (message) => {
|
|
3465
|
+
await recordTurnMetrics(engineCtx, message);
|
|
3466
|
+
await deliverTurn(engineCtx, message, delivery);
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
// src/core/turn/sweep.ts
|
|
3470
|
+
const STALE_MS$1 = 3e5;
|
|
3471
|
+
const BATCH$1 = 100;
|
|
3472
|
+
/** Sends the step message again for each Turn that no message will reach. */
|
|
3394
3473
|
async function sweepTurns(ctx) {
|
|
3395
3474
|
await withSpan$1("turn.sweep", {}, async (span) => {
|
|
3396
3475
|
const turns = await findStalledTurns(ctx, {
|
|
3397
|
-
staleMs: STALE_MS,
|
|
3398
|
-
limit: BATCH
|
|
3476
|
+
staleMs: STALE_MS$1,
|
|
3477
|
+
limit: BATCH$1
|
|
3399
3478
|
});
|
|
3400
3479
|
for (const turn of turns) {
|
|
3401
3480
|
await publishTurnStep(ctx, turn.turnId);
|
|
3402
3481
|
reportRequeued(turn);
|
|
3403
3482
|
}
|
|
3404
|
-
const deliveries = await findStalledDeliveries(ctx, {
|
|
3405
|
-
staleMs: STALE_MS,
|
|
3406
|
-
limit: BATCH
|
|
3407
|
-
});
|
|
3408
|
-
for (const delivery of deliveries) {
|
|
3409
|
-
await publishDelivery(ctx, {
|
|
3410
|
-
conversationId: delivery.conversationId,
|
|
3411
|
-
turnId: delivery.turnId
|
|
3412
|
-
});
|
|
3413
|
-
reportRequeued({
|
|
3414
|
-
...delivery,
|
|
3415
|
-
reason: "delivery_lost"
|
|
3416
|
-
});
|
|
3417
|
-
}
|
|
3418
3483
|
span.setAttributes({
|
|
3419
|
-
"app.turn.sweep.requeued": turns.length
|
|
3420
|
-
"app.turn.sweep.batch_full": turns.length === BATCH
|
|
3484
|
+
"app.turn.sweep.requeued": turns.length,
|
|
3485
|
+
"app.turn.sweep.batch_full": turns.length === BATCH$1
|
|
3421
3486
|
});
|
|
3422
3487
|
}, { newTrace: true });
|
|
3423
3488
|
}
|
|
@@ -3430,6 +3495,59 @@ function reportRequeued(found) {
|
|
|
3430
3495
|
"app.turn.sweep.stalled_ms": found.stalledMs
|
|
3431
3496
|
});
|
|
3432
3497
|
}
|
|
3498
|
+
// src/delivery/sweep.ts
|
|
3499
|
+
const STALE_MS = 3e5;
|
|
3500
|
+
const BATCH = 100;
|
|
3501
|
+
/**
|
|
3502
|
+
* Sends the message that a Turn ended again for each Conversation whose
|
|
3503
|
+
* replies no message will send.
|
|
3504
|
+
*/
|
|
3505
|
+
async function sweepDeliveries(ctx) {
|
|
3506
|
+
await withSpan$1("delivery.sweep", {}, async (span) => {
|
|
3507
|
+
const stalled = await findStalledDeliveries(ctx, {
|
|
3508
|
+
staleMs: STALE_MS,
|
|
3509
|
+
limit: BATCH
|
|
3510
|
+
});
|
|
3511
|
+
for (const delivery of stalled) {
|
|
3512
|
+
await publishTurnEnded(ctx, {
|
|
3513
|
+
conversationId: delivery.conversationId,
|
|
3514
|
+
turnId: delivery.turnId
|
|
3515
|
+
});
|
|
3516
|
+
countMetric("turn.sweep.requeued", { "app.turn.sweep.reason": "delivery_lost" });
|
|
3517
|
+
logWarn("turn.sweep.requeued", {
|
|
3518
|
+
"app.turn.id": delivery.turnId,
|
|
3519
|
+
"gen_ai.conversation.id": delivery.conversationId,
|
|
3520
|
+
"app.turn.sweep.reason": "delivery_lost",
|
|
3521
|
+
"app.turn.sweep.stalled_ms": delivery.stalledMs
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
span.setAttributes({
|
|
3525
|
+
"app.turn.sweep.requeued": stalled.length,
|
|
3526
|
+
"app.turn.sweep.batch_full": stalled.length === BATCH
|
|
3527
|
+
});
|
|
3528
|
+
}, { newTrace: true });
|
|
3529
|
+
}
|
|
3530
|
+
/**
|
|
3531
|
+
* Finds Conversations whose first pending reply belongs to an ended Turn and
|
|
3532
|
+
* has not changed for `staleMs` since the later of its last change and the
|
|
3533
|
+
* Turn's end. A row behind a first row that is still retried waits; it is
|
|
3534
|
+
* not stalled. A row of a running Turn waits for the Turn's end.
|
|
3535
|
+
*/
|
|
3536
|
+
async function findStalledDeliveries({ executor }, { staleMs, limit }) {
|
|
3537
|
+
const staleBefore = sql`now() - make_interval(secs => ${staleMs / 1e3})`;
|
|
3538
|
+
const earlier = alias(juniorTurnOutbox, "earlier");
|
|
3539
|
+
const rows = await executor.db().select({
|
|
3540
|
+
conversationId: juniorTurnOutbox.conversationId,
|
|
3541
|
+
turnId: juniorTurnOutbox.turnId,
|
|
3542
|
+
updatedAt: juniorTurnOutbox.updatedAt
|
|
3543
|
+
}).from(juniorTurnOutbox).innerJoin(juniorTurns, eq(juniorTurns.id, juniorTurnOutbox.turnId)).where(and(eq(juniorTurnOutbox.state, "pending"), lt(juniorTurnOutbox.createdAt, staleBefore), lt(juniorTurnOutbox.updatedAt, staleBefore), notInArray(juniorTurns.state, ["queued", "running"]), lt(juniorTurns.endedAt, staleBefore), notExists(executor.db().select({ one: sql`1` }).from(earlier).where(and(eq(earlier.conversationId, juniorTurnOutbox.conversationId), eq(earlier.state, "pending"), lt(earlier.eventSeq, juniorTurnOutbox.eventSeq)))))).limit(limit);
|
|
3544
|
+
const nowMs = Date.now();
|
|
3545
|
+
return rows.map((row) => ({
|
|
3546
|
+
conversationId: row.conversationId,
|
|
3547
|
+
turnId: row.turnId,
|
|
3548
|
+
stalledMs: Math.max(0, nowMs - row.updatedAt.getTime())
|
|
3549
|
+
}));
|
|
3550
|
+
}
|
|
3433
3551
|
// src/handlers/artifacts.ts
|
|
3434
3552
|
/** Serve one content-addressed public artifact without authentication. */
|
|
3435
3553
|
async function publicArtifactGET(args) {
|
|
@@ -7183,7 +7301,7 @@ function hasConfiguredPluginCatalog(config) {
|
|
|
7183
7301
|
return Boolean(config.inlineManifests?.length || config.packages?.length || Object.keys(config.manifests ?? {}).length);
|
|
7184
7302
|
}
|
|
7185
7303
|
function warnUnregisteredConfigDefaults(defaults) {
|
|
7186
|
-
for (const key of Object.keys(defaults ?? {})) if (!
|
|
7304
|
+
for (const key of Object.keys(defaults ?? {})) if (!getAppContext().catalog.isConfigKey(key)) logWarn("config.default.unregistered", { "app.config.key": key });
|
|
7187
7305
|
}
|
|
7188
7306
|
function pluginPackageNames(config) {
|
|
7189
7307
|
return config?.packages ?? [];
|
|
@@ -7226,12 +7344,13 @@ async function createApp(options) {
|
|
|
7226
7344
|
validatePlugins(plugins);
|
|
7227
7345
|
getDb();
|
|
7228
7346
|
const shouldValidatePluginCatalog = hasConfiguredPluginCatalog(pluginConfig) || Boolean(configuredPlugins?.registrations.length) || Boolean(Object.keys(options?.configDefaults ?? {}).length);
|
|
7229
|
-
const
|
|
7230
|
-
|
|
7347
|
+
const previousAppContext = installAppContext(createAppContext({
|
|
7348
|
+
plugins,
|
|
7349
|
+
pluginConfig
|
|
7350
|
+
}));
|
|
7231
7351
|
let restoreChatConfig;
|
|
7232
7352
|
const restoreRuntimeConfig = () => {
|
|
7233
|
-
|
|
7234
|
-
setPlugins(previousPlugins);
|
|
7353
|
+
installAppContext(previousAppContext);
|
|
7235
7354
|
restoreChatConfig?.();
|
|
7236
7355
|
};
|
|
7237
7356
|
let pluginRoutes = [];
|
|
@@ -7258,7 +7377,7 @@ async function createApp(options) {
|
|
|
7258
7377
|
dispatchForIdentity = createIdentityDispatcher({ conversationWorkQueue: () => conversationWorkQueue });
|
|
7259
7378
|
if (dashboard && !dashboard.disabled) signInConfig = resolveSignInAuthConfig(botConfig.userName, allowedDomains, dashboard);
|
|
7260
7379
|
if (shouldValidatePluginCatalog) {
|
|
7261
|
-
|
|
7380
|
+
getAppContext().catalog.getSignature();
|
|
7262
7381
|
validatePluginRegistrations(configuredPlugins?.registrations ?? []);
|
|
7263
7382
|
validatePluginEgressCredentialHooks(configuredPlugins?.registrations ?? []);
|
|
7264
7383
|
}
|
|
@@ -7454,7 +7573,7 @@ async function createApp(options) {
|
|
|
7454
7573
|
let pluginTaskPOST;
|
|
7455
7574
|
const chatConfig = getChatConfig();
|
|
7456
7575
|
const engineCtx = createEngineContext(chatConfig);
|
|
7457
|
-
const
|
|
7576
|
+
const turnEnds = turnEndedConsumer(engineCtx, createDeploymentDelivery({ getSlackAdapter: getProductionSlackAdapter }));
|
|
7458
7577
|
app.post(JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, (c) => {
|
|
7459
7578
|
agentContinuePOST ??= createVercelConversationWorkCallback(getConversationWorkOptions());
|
|
7460
7579
|
return agentContinuePOST(c.req.raw);
|
|
@@ -7491,10 +7610,10 @@ async function createApp(options) {
|
|
|
7491
7610
|
}));
|
|
7492
7611
|
return turnStepPOST(c.req.raw);
|
|
7493
7612
|
});
|
|
7494
|
-
let
|
|
7495
|
-
app.post(
|
|
7496
|
-
|
|
7497
|
-
return
|
|
7613
|
+
let turnEndedPOST;
|
|
7614
|
+
app.post(JUNIOR_TURN_ENDED_CALLBACK_ROUTE, (c) => {
|
|
7615
|
+
turnEndedPOST ??= engineCtx.queue.createCallback(turnEnds);
|
|
7616
|
+
return turnEndedPOST(c.req.raw);
|
|
7498
7617
|
});
|
|
7499
7618
|
app.get("/api/internal/heartbeat", (c) => {
|
|
7500
7619
|
return GET$3(c.req.raw, waitUntil, {
|
|
@@ -7503,7 +7622,10 @@ async function createApp(options) {
|
|
|
7503
7622
|
events,
|
|
7504
7623
|
sendPluginTask,
|
|
7505
7624
|
showInboxItem: createInboxItemShow(getProductionSlackAdapter),
|
|
7506
|
-
sweepTurns: () =>
|
|
7625
|
+
sweepTurns: async () => {
|
|
7626
|
+
await sweepTurns(engineCtx);
|
|
7627
|
+
await sweepDeliveries(engineCtx);
|
|
7628
|
+
}
|
|
7507
7629
|
});
|
|
7508
7630
|
});
|
|
7509
7631
|
app.get("/api/internal/retention", (c) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { LiveAnnotation, OwnedObjectAnnotation } from "@sentry/junior-plugin-api";
|
|
3
3
|
/**
|
|
4
4
|
* Largest file that Junior stores from Slack or the web, or loads into the
|
|
5
5
|
* sandbox.
|
|
@@ -179,10 +179,14 @@ declare const messageCardRefSchema: z.ZodObject<{
|
|
|
179
179
|
kind: z.ZodLiteral<"object">;
|
|
180
180
|
}, z.core.$strict>;
|
|
181
181
|
type MessageCardRef = z.output<typeof messageCardRefSchema>;
|
|
182
|
-
/**
|
|
183
|
-
declare function resolveMessageCards(refs: readonly MessageCardRef[], annotations: readonly
|
|
184
|
-
/**
|
|
185
|
-
|
|
182
|
+
/** Match each reference to the Annotation as it was read, in reference order. */
|
|
183
|
+
declare function resolveMessageCards(refs: readonly MessageCardRef[], annotations: readonly LiveAnnotation[]): OwnedObjectAnnotation[];
|
|
184
|
+
/**
|
|
185
|
+
* Return the card of a read Annotation without its timestamps, for Message
|
|
186
|
+
* delivery. An Annotation that shows only its label gets that label as its
|
|
187
|
+
* title.
|
|
188
|
+
*/
|
|
189
|
+
declare function annotationCard(annotation: LiveAnnotation): OwnedObjectAnnotation;
|
|
186
190
|
/** Where a failed turn stopped. */
|
|
187
191
|
declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
|
|
188
192
|
agent_run_failed: "agent_run_failed";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Zs as getSlackClient, ac as withSlackRetries, i as getConversationStore, qs as SlackActionError } from "./db-BCaNWl9p.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/chat/slack/channel.ts
|
|
4
4
|
const replySubtypeSchema = z.object({ subtype: z.string().optional() });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as getChatConfig } from "./
|
|
2
|
-
import {
|
|
1
|
+
import { R as getChatConfig } from "./adapter-8_S6Birm.js";
|
|
2
|
+
import { Ap as juniorTurns, d as createSqlConversationEventStore, i as getConversationStore, yc as SYSTEM_IDENTITY_ID } from "./db-BCaNWl9p.js";
|
|
3
3
|
import { t as startLocalVercelQueueServer } from "./local-server-CpnGhYml.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as TURN_STEP_TOPIC } from "./topic-
|
|
6
|
-
import { a as
|
|
4
|
+
import { fi as projectConversationEvents } from "./markers-9QoqW5ov.js";
|
|
5
|
+
import { n as TURN_STEP_TOPIC } from "./topic-B2EWKKBT.js";
|
|
6
|
+
import { a as turnStepConsumer, i as createGatewayModelClient, n as turnTools, o as scheduleInput, t as createEngineContext } from "./engine-context-CiExoy1B.js";
|
|
7
7
|
import { eq } from "drizzle-orm";
|
|
8
8
|
import { localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
package/dist/cli/chat.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-DhGXZjlu.js";
|
|
2
2
|
export declare const CHAT_USAGE = "usage: junior chat\n junior chat -p <message>\n junior chat --engine core -p <message>";
|
|
3
3
|
export type ChatCommandOptions = {
|
|
4
4
|
mode: "interactive";
|