@sentry/junior 0.293.0 → 0.294.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-CMJfmHso.js → adapter-DxLhJEnO.js} +1 -1
- package/dist/{admin-uuecrKuD.js → admin-vt8aSiCD.js} +2 -2
- package/dist/{agent-runner-DHq1pjUg.js → agent-runner-DJu7w6mI.js} +68 -33
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +48 -28
- package/dist/{app-fWzCHFIb.d.ts → app--a5RLOrr.d.ts} +4 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +60 -69
- package/dist/{assistant-reply-CIApSfor.js → assistant-reply-iTtEdDyc.js} +1 -1
- package/dist/{automation-BE3z19VN.js → automation-BM-OBsKW.js} +1 -1
- package/dist/{background-compaction-queue-D7ncdEa6.js → background-compaction-queue-D2j-0XkH.js} +4 -4
- package/dist/{briefs-NpgMEFh1.js → briefs-JOAoCb6d.js} +3 -3
- package/dist/{catalog-runtime-DwbTyNRD.js → catalog-runtime-CLMA9AXd.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +7 -74
- package/dist/{config-B4b-NXH5.js → config-mIZeGEWv.js} +17 -7
- package/dist/{connections-Dz_AQg5p.js → connections-XhdVg7OR.js} +6 -6
- package/dist/{conversation-CtjR1Zcx.js → conversation-CDWejM4R.js} +1 -0
- package/dist/{conversation-pending-messages-1Kad1Mif.js → conversation-pending-messages-Dh2tfbaw.js} +1 -1
- package/dist/{conversation-privacy-DRsSgLGO.js → conversation-privacy-C6h-X2cZ.js} +1 -1
- package/dist/{credential-sync-ClCnnGVj.js → credential-sync-zigBlXS3.js} +13 -13
- package/dist/{db-CoA7_Xqu.js → db--xuNV7g6.js} +99 -6
- package/dist/{db-BbpttyKH.d.ts → db-DV5AbcGM.d.ts} +8 -6
- package/dist/{executor-SWyHhit0.js → executor-BItuRqAR.js} +58 -9
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BN5drSEZ.js → logging-Cb6MGvdt.js} +1 -1
- package/dist/{message-D4qjpW1C.js → message-BTGgSmaH.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-Xi-mTLOV.js → oauth-callback-server-Dvh1aOIi.js} +2 -2
- package/dist/{projection-DXl4ftyL.js → projection-DLQgfO5N.js} +15 -96
- package/dist/{prompt-Dmx6IfWZ.js → prompt-qp_LdxLX.js} +5 -6
- package/dist/{registry-DosVt9f9.js → registry-MtwokaqW.js} +1 -1
- package/dist/{resolve-BDjWJC9s.js → resolve-BnJA0UNE.js} +3 -3
- package/dist/{result-CaAFpf4B.js → result-ChL-1KyW.js} +8 -8
- package/dist/{runner-h96Mkss6.js → runner-BONN7Dp2.js} +8 -8
- package/dist/{sandbox-egress-signals-rK91BW7i.js → sandbox-egress-signals-nmlmI5Ab.js} +1 -1
- package/dist/{schema-CHsBmXIj.d.ts → schema-DgvcyJ1y.d.ts} +38 -1
- package/dist/{schema-C_v8wb80.js → schema-yr0ccDni.js} +29 -4
- package/dist/{service-account-WUMVuqVL.js → service-account-Bd0lBaGr.js} +3 -3
- package/dist/{service-account-BpGpScaT.js → service-account-kio5nXSD.js} +3 -3
- package/dist/{session-stop-xYK15HUu.js → session-stop-CeCXL3j9.js} +11 -11
- package/dist/{skills-DHApyCjj.js → skills-e3DDNlKO.js} +2 -2
- package/dist/{spawn-BQQrwGNe.js → spawn--cRxITWQ.js} +5 -5
- package/dist/{stop-CBeD6_Gs.js → stop-Iai5N2PU.js} +25 -26
- package/dist/{store-xtibD98L.js → store-C8LsaJwS.js} +3 -3
- package/dist/{task-runner-BYPN4BEO.js → task-runner-Dw7exu0-.js} +11 -11
- package/dist/{turn-failure-response-jNVl00MD.js → turn-failure-response-BqTTx3XG.js} +8 -8
- package/dist/{validation-DGeB_moV.js → validation-BrGahtnv.js} +1 -1
- package/dist/{version-C6nqU3Qc.js → version-Bdqhx8Qh.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-9KLQibjn.js → viewer-CjRFHR5U.js} +3 -3
- package/dist/{warmup-7S6z068f.js → warmup-DuxCtzKC.js} +69 -23
- package/dist/{work-xwX6unUE.js → work-BWBG1EGV.js} +11 -11
- package/dist/{worker-CiCCfwd4.js → worker-DAnBIVMs.js} +6 -6
- package/migrations/0062_plugin_report_index.sql +1 -20
- package/migrations/0078_plugin_conversation_index.sql +1 -20
- package/migrations/0079_conversation_event_author_index.sql +1 -20
- package/migrations/0080_conversation_event_latest_message_indexes.sql +2 -27
- package/migrations/0090_guardian_review_time_index.sql +1 -20
- package/migrations/0091_conversation_participant_unsubscribed_index.sql +1 -20
- package/migrations/0097_conversation_kind_automation.sql +6 -0
- package/migrations/meta/0097_snapshot.json +4490 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { F as renderCurrentInstruction, L as escapeXml, R as escapeXmlText, n as botConfig } from "./config-
|
|
4
|
-
import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
2
|
+
import { Bn as getPlugins, Cn as renderUntrustedTag, Ga as sandboxSkillPathResolution, Ha as SANDBOX_WORKSPACE_ROOT, In as getPluginSlackConversationLink, Li as escapeSlackMrkdwnText, Ln as getPluginSystemPromptContributions, M as normalizeConversationText, Ri as formatSlackLink, Sn as renderTag$1, Ua as sandboxSkillDir, Wa as sandboxSkillFile, Yi as postSlackMessage, _i as listWorkspaces, _n as TURN_CONTEXT_TAG, dn as normalizeToolNameFromResult, fn as retainRuntimeTurnContext, gn as SESSION_CONTEXT_SECTION_TAG, hn as REQUEST_CONTEXT_SECTION_TAG, ho as buildSentryConversationUrl, ii as getDashboardObjectIconLink, ln as isToolResultError, ni as JUNIOR_THREAD_STATE_TTL_MS, on as isAssistantMessage, ot as getTurnRecord, pn as stripRuntimeTurnContext, ri as getDashboardConversationLink, rn as hasRuntimeTurnContext, sr as getReviewItem, st as listTurnSummaries, ti as verifyTimerWatchCredentialSubject, ui as ToolInputError, un as isToolResultMessage, vn as escapeClosingTags, wn as tagJson, x as toStoredConversationMessage, xn as renderChildTag, yn as escapeTagText, za as SANDBOX_DATA_ROOT, zi as normalizeSlackReplyMarkdown, zn as getPluginUserPromptContributions, zr as cancelSubscriptions } from "./projection-DLQgfO5N.js";
|
|
3
|
+
import { F as renderCurrentInstruction, L as escapeXml, R as escapeXmlText, n as botConfig } from "./config-mIZeGEWv.js";
|
|
4
|
+
import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-Cb6MGvdt.js";
|
|
5
5
|
import { o as isUserActor, t as createActor } from "./actor-6jsm_v96.js";
|
|
6
|
-
import {
|
|
7
|
-
import { A as juniorConversations, M as juniorUsers } from "./executor-
|
|
6
|
+
import { $ as nextDetailVersion, A as SYSTEM_IDENTITY_ID, S as isPersonInput, a as getConversationStore, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db--xuNV7g6.js";
|
|
7
|
+
import { A as juniorConversations, M as juniorUsers } from "./executor-BItuRqAR.js";
|
|
8
8
|
import { i as isVisionImageMediaType } from "./media-BepyEUNm.js";
|
|
9
9
|
import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJhGdS4c.js";
|
|
10
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
11
|
-
import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-
|
|
12
|
-
import { r as getStateAdapter } from "./adapter-
|
|
13
|
-
import { i as NO_REPLY_TOOL_NAME, r as sanitizeAssistantText } from "./assistant-reply-
|
|
10
|
+
import { h as credentialSubjectSchema } from "./registry-MtwokaqW.js";
|
|
11
|
+
import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-qp_LdxLX.js";
|
|
12
|
+
import { r as getStateAdapter } from "./adapter-DxLhJEnO.js";
|
|
13
|
+
import { i as NO_REPLY_TOOL_NAME, r as sanitizeAssistantText } from "./assistant-reply-iTtEdDyc.js";
|
|
14
14
|
import { D as userCustomizationTextSchema, v as formatUserInputAnswer } from "./reporting-window-B3Ze-Qnt.js";
|
|
15
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
16
|
-
import { _t as CORE_EVENT_NAMESPACE, bt as eventCatalogEntry, xt as eventGuidance } from "./task-runner-
|
|
15
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-C8LsaJwS.js";
|
|
16
|
+
import { _t as CORE_EVENT_NAMESPACE, bt as eventCatalogEntry, xt as eventGuidance } from "./task-runner-Dw7exu0-.js";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { isDeepStrictEqual } from "node:util";
|
|
19
19
|
import * as z from "zod";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { h as logWarn } from "./logging-
|
|
2
|
+
import { h as logWarn } from "./logging-Cb6MGvdt.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CLMA9AXd.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { A as juniorConversations } from "./executor-
|
|
5
|
-
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-
|
|
6
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
2
|
+
import { n as botConfig } from "./config-mIZeGEWv.js";
|
|
3
|
+
import { E as conversationKindFromRow, o as getDb } from "./db--xuNV7g6.js";
|
|
4
|
+
import { A as juniorConversations } from "./executor-BItuRqAR.js";
|
|
5
|
+
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-DJu7w6mI.js";
|
|
6
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-BWBG1EGV.js";
|
|
7
7
|
import { desc, eq, sql } from "drizzle-orm";
|
|
8
8
|
// src/chat/conversations/lineage.ts
|
|
9
9
|
/**
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { h as startSpan } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as loadTurnCheckpoint, $
|
|
3
|
-
import { A as estimateTextTokens, E as resolveGatewayModel,
|
|
4
|
-
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { $ as loadTurnCheckpoint, $a as createConversationAccessReader, A as latestConversationMessageSeq, Ao as lookupSlackUser, Bi as normalizeSlackStatusText, Bn as getPlugins, D as estimateConversationMessagesTokens, Do as listConversationAnnotationsById, E as buildConversationContext, En as createUserTokenStore, Eo as listConversationAnnotations, F as turnHasReply, Gi as getSlackMessagePermalink, H as PluginCredentialFailureError, Hi as truncateStatusText, I as upsertConversationMessage, Io as piMessageFromHistoryItem, Jt as buildTurnErrorResponse, K as AuthorizationFlowDisabledError, Li as escapeSlackMrkdwnText, M as normalizeConversationText, Mo as createPluginCache, N as recordDeliveredAssistantMessage, Nt as moveIdleConversationDestination, O as getConversationMessageSlackTs, On as webActorUserIds, P as trimConversationMessages, Po as configValueSchema, Qa as canAddConversationMessages, Qt as persistWithRetry, Ri as formatSlackLink, Rt as releaseInboundMessage, S as resolveConversationTitle, So as slackAttachmentsVersionQuery, Ui as addReactionToMessage, Wi as deleteSlackMessage, X as clearPendingAuth, Xa as createPluginLogger, Xi as removeReactionFromMessage, Yi as postSlackMessage, _o as notInheritedByForkChild, a as loadProjection, aa as getHeaderString, ao as conversationViewerMarks, at as failTurnRecord, b as persistConversationMessages, bo as readAttachmentVisionSummary, br as isOnlyAssignee, ca as isDmChannel, ct as recordTurnSummary, d as recordAuthorizationCompleted, da as withSlackRetries, do as readConversationEventPageAfter, eo as readConversationAccessFromSql, et as lostWorkerBeforeFirstSave, fo as readConversationEventPageAround, gr as canActOnReviewItem, h as recordSubscribedReplyRoute, ho as buildSentryConversationUrl, i as loadConversationProjection, io as conversationPinnedForUser, it as completeTurnRecord, j as markConversationMessage, jo as lookupSlackUserNames, k as isHumanConversationMessage, la as normalizeSlackConversationId, lo as readLatestConversationBrief, lr as listReplyActionItems, mn as trimTrailingAssistantMessages, n as commitMessages, na as SlackActionError, no as conversationIsMemberRoot, nt as saveTurnCheckpoint, o as loadTurnProjection, oa as getSlackClient, oo as viewerMarksFromParticipant, ot as getTurnRecord, pr as takeReviewItem, ra as downloadPrivateSlackFile, ri as getDashboardConversationLink, ro as conversationIsNotUnsubscribedRoot, rr as closeReviewItem, rt as abandonTurnRecord, sr as getReviewItem, st as listTurnSummaries, t as commitAcceptedReply, to as conversationHasParticipantUser, tt as pauseLostWorkerTurn, uo as readConversationEventPage, ur as listWaitingConversations, v as hydrateConversationMessages, vo as getSlackFileId, w as fallbackShortTitle, wr as reviewItemNeedsSomeone, xo as recordSlackAttachment, y as persistConversationMessageWindow, yr as canUserReadReviewItem, zr as cancelSubscriptions } from "./projection-DLQgfO5N.js";
|
|
3
|
+
import { A as estimateTextTokens, E as resolveGatewayModel, K as isProviderRetryError, L as escapeXml, c as getSlackClientSecret, i as getChatConfig, j as textCharsForTokens, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-mIZeGEWv.js";
|
|
4
|
+
import { E as withSpan, G as isRecord, K as toOptionalNumber, S as setTags, T as withLogContext, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, q as toOptionalString, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-Cb6MGvdt.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-Bdqhx8Qh.js";
|
|
6
6
|
import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
7
|
-
import {
|
|
8
|
-
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, _ as juniorConversationReadPositions, b as juniorConversationBriefs, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-
|
|
7
|
+
import { $ as nextDetailVersion, C as isTopLevelKind, D as locationFromRow, E as conversationKindFromRow, G as addAgentTurnUsage, H as claimProviderConversation, J as agentTurnUsageSchema, M as resolveActorIdentityId, N as saveActorAvatar, O as setFirstConversationLocation, U as getConversationIdByProviderConversation, W as parseSessionSource, X as resolveRootConversationId, Y as hasAgentTurnUsage, _ as setArchivedAt, a as getConversationStore, b as withConversationMutationLock, g as readConversationTrees, m as conversationAncestors, o as getDb, p as withConversationEventLock, r as getConversationEventStore, rt as requireSlackDestination, s as getSqlExecutor, tt as createSlackDestination, v as loadConversationSlackTenantIds, w as postsRunNotices, x as deliversFinalText } from "./db--xuNV7g6.js";
|
|
8
|
+
import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, _ as juniorConversationReadPositions, b as juniorConversationBriefs, j as juniorIdentities, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-BItuRqAR.js";
|
|
9
9
|
import { _ as instructionProvenanceFor, a as KNOWN_CONVERSATION_EVENT_TYPES, h as contextProvenance, i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
10
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
11
|
-
import { A as runWithSlackInstallation, At as cancelSignInWait, B as listThreadReplies, Bt as canShareTurn, Dt as stopChildAgentsOf, Et as stopChildAgentsBelow, F as resolveSlackChannelIdFromThreadId, Ft as getPausedTurnRequest, I as checkSlackChannelReadAccess, Jt as withTurnSpan, Kt as getTurnInputSpanAttributes, L as joinPublicChannelForRead, Lt as wakePausedTurn, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as supersedeTurnForInput, P as resolveSlackChannelIdFromMessage, Pt as createPausedTurns, R as getConversationInfo, Rt as getTurnAuthorization, S as createSlackReviewItemShow, St as markConversationRead, Tt as throwApiError, Ut as AgentRunError, V as resolveDestinationVisibility, Wt as executeTurn, X as readConversationSourceTask, Xt as getWebAuthorization, Zt as canPauseConversationDelivery, at as deliverReviewItemChange, b as renderAttachmentText, ct as acceptsWebMessages, dt as createAndEnqueueConversation, ft as createConversationId, gn as shouldEmitDevAgentTrace, ht as decodeInputImages, i as buildAuthPauseResponse, jt as createConversationTurnWorker, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, on as listedConversation, p as latestProgressStatus, pn as RetryableDeliveryError, pt as recordWebConversationActivity, qt as turnInputTelemetry, t as createAgentRunner, x as renderBlockText, xt as conversationReadPositionQuery, yt as storeAttachment, zt as canJoinTurn } from "./agent-runner-
|
|
12
|
-
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-
|
|
10
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-MtwokaqW.js";
|
|
11
|
+
import { A as runWithSlackInstallation, At as cancelSignInWait, B as listThreadReplies, Bt as canShareTurn, Dt as stopChildAgentsOf, Et as stopChildAgentsBelow, F as resolveSlackChannelIdFromThreadId, Ft as getPausedTurnRequest, I as checkSlackChannelReadAccess, Jt as withTurnSpan, Kt as getTurnInputSpanAttributes, L as joinPublicChannelForRead, Lt as wakePausedTurn, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as supersedeTurnForInput, P as resolveSlackChannelIdFromMessage, Pt as createPausedTurns, R as getConversationInfo, Rt as getTurnAuthorization, S as createSlackReviewItemShow, St as markConversationRead, Tt as throwApiError, Ut as AgentRunError, V as resolveDestinationVisibility, Wt as executeTurn, X as readConversationSourceTask, Xt as getWebAuthorization, Zt as canPauseConversationDelivery, at as deliverReviewItemChange, b as renderAttachmentText, ct as acceptsWebMessages, dt as createAndEnqueueConversation, ft as createConversationId, gn as shouldEmitDevAgentTrace, ht as decodeInputImages, i as buildAuthPauseResponse, jt as createConversationTurnWorker, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, on as listedConversation, p as latestProgressStatus, pn as RetryableDeliveryError, pt as recordWebConversationActivity, qt as turnInputTelemetry, t as createAgentRunner, x as renderBlockText, xt as conversationReadPositionQuery, yt as storeAttachment, zt as canJoinTurn } from "./agent-runner-DJu7w6mI.js";
|
|
12
|
+
import { a as EVENT_SYSTEM_ACTOR, c as completeDecision, o as isEventConversationMessage, u as completeText } from "./prompt-qp_LdxLX.js";
|
|
13
13
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-
|
|
15
|
-
import { a as setStateValues, i as getStateValues, r as getStateAdapter } from "./adapter-
|
|
16
|
-
import { W as readMessageAttachments, d as conversationEventPageSchema, l as conversationDetailReportSchema, m as conversationFeedSchema } from "./conversation-
|
|
17
|
-
import { c as listConversationWork, l as readLastUserMessageAtByConversation, s as isConversationWorkDone } from "./warmup-
|
|
18
|
-
import { g as getVercelConversationWorkQueue, k as getTurnRequestDeadline } from "./background-compaction-queue-
|
|
19
|
-
import { a as persistAuthPauseTurnState, at as getConversationTurnBoundaryError, b as getChildAgentLabel, c as getTurnUserSlackMessageTs, ct as isTurnInputDeferredError, d as loadThreadContextTrimFloor, dt as markTurnFailed, ft as startActiveTurn, i as completeAuthPauseTurn, it as TurnInputDeferredError, l as buildDeliveredTurnStatePatch, lt as markTurnClosed, m as loadPendingMessageCards, mt as buildDeterministicTurnId, n as getAgentTurnDiagnosticsAttributes, nt as CooperativeTurnYieldError, o as getTurnUserMessage, ot as isCooperativeTurnYieldError, p as getTurnLifecycle, pt as buildDeterministicAssistantMessageId, r as requireTurnFailureEventId, rt as TurnInputCommitLostError, s as getTurnUserReplyAttachmentContext, st as isTurnInputCommitLostError, t as finalizeFailedTurnReplyWithEvent, tt as ConversationTurnBoundaryError, u as buildTurnThreadContext, ut as markTurnCompleted } from "./turn-failure-response-
|
|
20
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
21
|
-
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, H as resolveSlackReplyTarget, K as recordFinishedTurnForAutomatedLimit, U as sendSlackReply, X as buildSteeringPiMessage, b as conversationSubtree, c as loadReviewItemInput, dt as finishedRunReply, g as resolveMailboxTurnWork, l as savedInputInstruction, mt as runDispatchOutcome, o as skipInputAfterConversationStop, r as markConversationsStopped, rt as isExperimentalFeatureEnabled, x as conversationSubtreeColumns, y as legacyWebMailboxMetadataSchema } from "./session-stop-
|
|
14
|
+
import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-CjRFHR5U.js";
|
|
15
|
+
import { a as setStateValues, i as getStateValues, r as getStateAdapter } from "./adapter-DxLhJEnO.js";
|
|
16
|
+
import { W as readMessageAttachments, d as conversationEventPageSchema, l as conversationDetailReportSchema, m as conversationFeedSchema } from "./conversation-CDWejM4R.js";
|
|
17
|
+
import { c as listConversationWork, l as readLastUserMessageAtByConversation, s as isConversationWorkDone } from "./warmup-DuxCtzKC.js";
|
|
18
|
+
import { g as getVercelConversationWorkQueue, k as getTurnRequestDeadline } from "./background-compaction-queue-D2j-0XkH.js";
|
|
19
|
+
import { a as persistAuthPauseTurnState, at as getConversationTurnBoundaryError, b as getChildAgentLabel, c as getTurnUserSlackMessageTs, ct as isTurnInputDeferredError, d as loadThreadContextTrimFloor, dt as markTurnFailed, ft as startActiveTurn, i as completeAuthPauseTurn, it as TurnInputDeferredError, l as buildDeliveredTurnStatePatch, lt as markTurnClosed, m as loadPendingMessageCards, mt as buildDeterministicTurnId, n as getAgentTurnDiagnosticsAttributes, nt as CooperativeTurnYieldError, o as getTurnUserMessage, ot as isCooperativeTurnYieldError, p as getTurnLifecycle, pt as buildDeterministicAssistantMessageId, r as requireTurnFailureEventId, rt as TurnInputCommitLostError, s as getTurnUserReplyAttachmentContext, st as isTurnInputCommitLostError, t as finalizeFailedTurnReplyWithEvent, tt as ConversationTurnBoundaryError, u as buildTurnThreadContext, ut as markTurnCompleted } from "./turn-failure-response-BqTTx3XG.js";
|
|
20
|
+
import { n as getAssistantReplyText } from "./assistant-reply-iTtEdDyc.js";
|
|
21
|
+
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, H as resolveSlackReplyTarget, K as recordFinishedTurnForAutomatedLimit, U as sendSlackReply, X as buildSteeringPiMessage, b as conversationSubtree, c as loadReviewItemInput, dt as finishedRunReply, g as resolveMailboxTurnWork, l as savedInputInstruction, mt as runDispatchOutcome, o as skipInputAfterConversationStop, r as markConversationsStopped, rt as isExperimentalFeatureEnabled, x as conversationSubtreeColumns, y as legacyWebMailboxMetadataSchema } from "./session-stop-CeCXL3j9.js";
|
|
22
22
|
import { b as normalizeUserInputAnswer, p as webMessageId, y as isEmptyUserInputAnswer } from "./reporting-window-B3Ze-Qnt.js";
|
|
23
|
-
import { T as stopConversationWork, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage, w as steerWebPendingMessages } from "./store-
|
|
24
|
-
import { _ as markDispatchBlocked, a as claimDispatchMailboxAppend, at as readAutomationTitlesByConversationId, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, dt as getLocationConfigurationService, f as getDispatchTurnId, ft as getPersistedSandboxState, g as markDispatchAwaitingResume, gt as coerceThreadConversationState, ht as persistThreadStateById, lt as resolveConversationRouting, m as isTerminalDispatchStatus, mt as persistThreadRuntimeState, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, pt as getPersistedThreadState, u as getDispatchInputMessageId, ut as resolveTurnSessionRouting, v as markDispatchCompleted, y as markDispatchFailed } from "./task-runner-
|
|
25
|
-
import { d as healthReportSchema, s as conversationPendingMessagesReportSchema } from "./conversation-pending-messages-
|
|
26
|
-
import { r as endActiveAgentInvocations, s as resolveThreadTurnWork } from "./work-
|
|
27
|
-
import { a as withAgentInvocationResultActors, n as enqueueAgentInvocationResult, t as createChildConversationWorker } from "./result-
|
|
28
|
-
import { t as bindMessageAgent } from "./message-
|
|
29
|
-
import { r as readConversationLineage, t as bindSpawnAgent } from "./spawn
|
|
23
|
+
import { T as stopConversationWork, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, s as claimInboundMessage, w as steerWebPendingMessages } from "./store-C8LsaJwS.js";
|
|
24
|
+
import { _ as markDispatchBlocked, a as claimDispatchMailboxAppend, at as readAutomationTitlesByConversationId, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, dt as getLocationConfigurationService, f as getDispatchTurnId, ft as getPersistedSandboxState, g as markDispatchAwaitingResume, gt as coerceThreadConversationState, ht as persistThreadStateById, lt as resolveConversationRouting, m as isTerminalDispatchStatus, mt as persistThreadRuntimeState, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, pt as getPersistedThreadState, u as getDispatchInputMessageId, ut as resolveTurnSessionRouting, v as markDispatchCompleted, y as markDispatchFailed } from "./task-runner-Dw7exu0-.js";
|
|
25
|
+
import { d as healthReportSchema, s as conversationPendingMessagesReportSchema } from "./conversation-pending-messages-Dh2tfbaw.js";
|
|
26
|
+
import { r as endActiveAgentInvocations, s as resolveThreadTurnWork } from "./work-BWBG1EGV.js";
|
|
27
|
+
import { a as withAgentInvocationResultActors, n as enqueueAgentInvocationResult, t as createChildConversationWorker } from "./result-ChL-1KyW.js";
|
|
28
|
+
import { t as bindMessageAgent } from "./message-BTGgSmaH.js";
|
|
29
|
+
import { r as readConversationLineage, t as bindSpawnAgent } from "./spawn--cRxITWQ.js";
|
|
30
30
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
31
31
|
import * as z from "zod";
|
|
32
32
|
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -1164,7 +1164,6 @@ async function summarizeImageWithVision(args) {
|
|
|
1164
1164
|
if (!visionModelId) return;
|
|
1165
1165
|
return (await args.completeText({
|
|
1166
1166
|
modelId: visionModelId,
|
|
1167
|
-
temperature: 0,
|
|
1168
1167
|
maxTokens: args.maxTokens,
|
|
1169
1168
|
operation: "vision_summary",
|
|
1170
1169
|
cost: args.cost,
|
|
@@ -9237,7 +9236,7 @@ async function setPin(db, viewer, conversationId, pinned) {
|
|
|
9237
9236
|
rootConversationId: juniorConversations.rootConversationId
|
|
9238
9237
|
}).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId)).limit(1).for("no key update");
|
|
9239
9238
|
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
9240
|
-
if (conversationKindFromRow(conversation)
|
|
9239
|
+
if (!isTopLevelKind(conversationKindFromRow(conversation))) throwApiError(409, `A child conversation cannot be pinned or unpinned. It uses its root's pin: ${conversation.rootConversationId ?? conversation.parentConversationId}.`);
|
|
9241
9240
|
if (!pinned) {
|
|
9242
9241
|
await db.update(juniorConversationParticipants).set({
|
|
9243
9242
|
pinnedAt: null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Bt as requestConversationWork$1, Ct as deadLetterAttempt$1, Et as getConversationWorkState$1, Ft as recordAttemptFailure$1, Ht as steerWebPendingMessages$1, It as recordConversationRetry$1, Lt as releaseConversationWork$1, Mt as markConversationWorkEnqueued$1, Ot as hasRunnableConversationWork, Rt as releaseInboundMessage, Tt as getConversation$1, Ut as stopConversationWork$1, Vt as startConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, jt as listActiveConversationIds$1, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as requestAnotherSlice$1 } from "./projection-
|
|
2
|
-
import { a as getConversationStore } from "./db
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { Bt as requestConversationWork$1, Ct as deadLetterAttempt$1, Et as getConversationWorkState$1, Ft as recordAttemptFailure$1, Ht as steerWebPendingMessages$1, It as recordConversationRetry$1, Lt as releaseConversationWork$1, Mt as markConversationWorkEnqueued$1, Ot as hasRunnableConversationWork, Rt as releaseInboundMessage, Tt as getConversation$1, Ut as stopConversationWork$1, Vt as startConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, jt as listActiveConversationIds$1, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as requestAnotherSlice$1 } from "./projection-DLQgfO5N.js";
|
|
2
|
+
import { a as getConversationStore } from "./db--xuNV7g6.js";
|
|
3
|
+
import "./background-compaction-queue-D2j-0XkH.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-
|
|
2
|
+
import { Bn as getPlugins, Ia as createPluginEmbedder, Ki as openSlackDirectMessage, La as createPluginModel, Li as escapeSlackMrkdwnText, Mo as createPluginCache, No as createDurableLocationConfigurationService, Ri as formatSlackLink, Un as coreTaskRegistrations, Xa as createPluginLogger, Ya as createPluginModelCostRecorder, Yi as postSlackMessage, an as instructionTextForProjection, b as persistConversationMessages, di as createPluginState, dn as normalizeToolNameFromResult, en as getPiMessageRole, ln as isToolResultError, ni as JUNIOR_THREAD_STATE_TTL_MS, ot as getTurnRecord, pn as stripRuntimeTurnContext, si as getDashboardTaskLink, so as createPluginConversationEvents, ui as ToolInputError, un as isToolResultMessage, v as hydrateConversationMessages, w as fallbackShortTitle } from "./projection-DLQgfO5N.js";
|
|
3
|
+
import { n as botConfig } from "./config-mIZeGEWv.js";
|
|
4
|
+
import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-Cb6MGvdt.js";
|
|
5
5
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
6
|
-
import {
|
|
7
|
-
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-
|
|
6
|
+
import { K as agentTurnCostUsd, a as getConversationStore, o as getDb, q as agentTurnTotalTokens } from "./db--xuNV7g6.js";
|
|
7
|
+
import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-BItuRqAR.js";
|
|
8
8
|
import { v as sameActorIdentity } from "./media-BepyEUNm.js";
|
|
9
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
10
|
-
import { i as readActorIdentity } from "./viewer-
|
|
11
|
-
import { r as getStateAdapter } from "./adapter-
|
|
12
|
-
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-
|
|
13
|
-
import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-
|
|
9
|
+
import { h as credentialSubjectSchema } from "./registry-MtwokaqW.js";
|
|
10
|
+
import { i as readActorIdentity } from "./viewer-CjRFHR5U.js";
|
|
11
|
+
import { r as getStateAdapter } from "./adapter-DxLhJEnO.js";
|
|
12
|
+
import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-D2j-0XkH.js";
|
|
13
|
+
import { B as automationTaskColumns, H as automationTaskSchema, M as scheduledAutomationSchema, S as automationVersionSchema, V as automationTaskDescription, k as eventAutomationSchema, z as automationSkillNameSchema } from "./automation-BM-OBsKW.js";
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
15
15
|
import * as z from "zod";
|
|
16
16
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -349,7 +349,7 @@ function slackSourceForDestination(args) {
|
|
|
349
349
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
350
350
|
*/
|
|
351
351
|
async function resolveConversationRouting(args) {
|
|
352
|
-
const conversationStore = args.conversationStore ?? (await import("./db
|
|
352
|
+
const conversationStore = args.conversationStore ?? (await import("./db--xuNV7g6.js").then((n) => n.n)).getConversationStore();
|
|
353
353
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
354
354
|
let destination;
|
|
355
355
|
let source;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { H as
|
|
3
|
-
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-
|
|
1
|
+
import { E as buildConversationContext, Eo as listConversationAnnotations, X as clearPendingAuth, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-DLQgfO5N.js";
|
|
2
|
+
import { H as findProviderError, U as getProviderErrorAttributes, W as getProviderErrorUserMessage, g as TURN_REASONING_LEVELS, z as ProviderError } from "./config-mIZeGEWv.js";
|
|
3
|
+
import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-Cb6MGvdt.js";
|
|
4
4
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
5
|
-
import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db
|
|
6
|
-
import { g as juniorAgentInvocations } from "./executor-
|
|
7
|
-
import { p as credentialContextSchema } from "./registry-
|
|
8
|
-
import { B as resolveMessageCards, R as readMessageCardRefs, z as removedCardSchema } from "./conversation-
|
|
5
|
+
import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db--xuNV7g6.js";
|
|
6
|
+
import { g as juniorAgentInvocations } from "./executor-BItuRqAR.js";
|
|
7
|
+
import { p as credentialContextSchema } from "./registry-MtwokaqW.js";
|
|
8
|
+
import { B as resolveMessageCards, R as readMessageCardRefs, z as removedCardSchema } from "./conversation-CDWejM4R.js";
|
|
9
9
|
import { C as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, S as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B3Ze-Qnt.js";
|
|
10
|
-
import { gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-
|
|
10
|
+
import { gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-Dw7exu0-.js";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import * as z from "zod";
|
|
13
13
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CLMA9AXd.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.294.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-Bdqhx8Qh.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
-
import {
|
|
3
|
-
import { M as juniorUsers, j as juniorIdentities } from "./executor-
|
|
1
|
+
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-Cb6MGvdt.js";
|
|
2
|
+
import { j as findActorIdentityId, o as getDb } from "./db--xuNV7g6.js";
|
|
3
|
+
import { M as juniorUsers, j as juniorIdentities } from "./executor-BItuRqAR.js";
|
|
4
4
|
import { r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
5
5
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as captureMessage, v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { E as resolveGatewayModel,
|
|
4
|
-
import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import { A as juniorConversations, C as isUserInstruction, j as juniorIdentities, w as juniorConversationEvents } from "./executor-
|
|
7
|
-
import { u as completeText } from "./prompt-
|
|
8
|
-
import { r as getStateAdapter } from "./adapter-
|
|
9
|
-
import { E as sendCacheWarmup } from "./background-compaction-queue-
|
|
2
|
+
import { Bn as getPlugins, Mo as createPluginCache, Xa as createPluginLogger } from "./projection-DLQgfO5N.js";
|
|
3
|
+
import { E as resolveGatewayModel, K as isProviderRetryError, i as getChatConfig } from "./config-mIZeGEWv.js";
|
|
4
|
+
import { E as withSpan, h as logWarn, m as logInfo, x as setSpanStatus } from "./logging-Cb6MGvdt.js";
|
|
5
|
+
import { Z as rootConversationIsArchived, a as getConversationStore, o as getDb, s as getSqlExecutor } from "./db--xuNV7g6.js";
|
|
6
|
+
import { A as juniorConversations, C as isUserInstruction, j as juniorIdentities, w as juniorConversationEvents } from "./executor-BItuRqAR.js";
|
|
7
|
+
import { u as completeText } from "./prompt-qp_LdxLX.js";
|
|
8
|
+
import { r as getStateAdapter } from "./adapter-DxLhJEnO.js";
|
|
9
|
+
import { E as sendCacheWarmup } from "./background-compaction-queue-D2j-0XkH.js";
|
|
10
10
|
import { streamSimple } from "@earendil-works/pi-ai/compat";
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
@@ -49,20 +49,19 @@ const GAP_BIN_EDGES_MS = [
|
|
|
49
49
|
];
|
|
50
50
|
const GAP_BIN_COUNT = GAP_BIN_EDGES_MS.length;
|
|
51
51
|
/**
|
|
52
|
-
* Gaps that a
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* segment starts with its parent's return chances, so it can warm before it
|
|
56
|
-
* has gaps of its own.
|
|
52
|
+
* Gaps that a segment needs before its gaps replace its parent segment's
|
|
53
|
+
* gaps (`parentGapSegment`). A new or rare segment starts with its parent's
|
|
54
|
+
* return chances, so it can warm before it has gaps of its own.
|
|
57
55
|
*/
|
|
58
56
|
const BLEND_PSEUDOCOUNT = 20;
|
|
59
57
|
/**
|
|
60
|
-
* Gaps that a
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
58
|
+
* Gaps that a Conversation needs before its gaps replace its segment's gaps.
|
|
59
|
+
* One Conversation has few gaps, and a few unusual replies say little about
|
|
60
|
+
* its next one. A backtest of time-ordered decisions showed that a weight
|
|
61
|
+
* this slow predicts returns better than both a faster weight and no
|
|
62
|
+
* Conversation weight at all.
|
|
64
63
|
*/
|
|
65
|
-
const
|
|
64
|
+
const CONVERSATION_BLEND_PSEUDOCOUNT = 100;
|
|
66
65
|
/** Below this prefix size, one cache miss costs too little to warm for. */
|
|
67
66
|
const MIN_WARMUP_PREFIX_TOKENS = 5e4;
|
|
68
67
|
/**
|
|
@@ -99,9 +98,9 @@ function histogramOf(gapsMs) {
|
|
|
99
98
|
total: gapsMs.length
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
|
-
function blendHistograms(own, prior) {
|
|
101
|
+
function blendHistograms(own, prior, pseudocount) {
|
|
103
102
|
if (own.total === 0 || prior.total === 0) return own.total === 0 ? prior : own;
|
|
104
|
-
const weight = Math.min(own.total /
|
|
103
|
+
const weight = Math.min(own.total / pseudocount, 1);
|
|
105
104
|
return {
|
|
106
105
|
counts: own.counts.map((count, index) => weight * count / own.total + (1 - weight) * prior.counts[index] / prior.total),
|
|
107
106
|
total: 1
|
|
@@ -146,6 +145,53 @@ function gapSegment(input) {
|
|
|
146
145
|
const depth = input.endedTurns === 0 ? "1" : input.endedTurns < 3 ? "2-3" : "4+";
|
|
147
146
|
return `${input.userActor ? "user" : "system"}:${depth}:${input.workState}`;
|
|
148
147
|
}
|
|
148
|
+
/** Each segment that `gapSegment` returns, in display order. */
|
|
149
|
+
const GAP_SEGMENTS = [...[true, false].flatMap((userActor) => [
|
|
150
|
+
0,
|
|
151
|
+
1,
|
|
152
|
+
3
|
|
153
|
+
].flatMap((endedTurns) => [
|
|
154
|
+
"open",
|
|
155
|
+
"done",
|
|
156
|
+
"none"
|
|
157
|
+
].map((workState) => gapSegment({
|
|
158
|
+
userActor,
|
|
159
|
+
endedTurns,
|
|
160
|
+
workState,
|
|
161
|
+
archived: false
|
|
162
|
+
})))), ...[
|
|
163
|
+
"open",
|
|
164
|
+
"done",
|
|
165
|
+
"none"
|
|
166
|
+
].map((workState) => gapSegment({
|
|
167
|
+
userActor: false,
|
|
168
|
+
endedTurns: 0,
|
|
169
|
+
workState,
|
|
170
|
+
archived: true
|
|
171
|
+
}))];
|
|
172
|
+
/**
|
|
173
|
+
* Count gaps in the bins that `decideWarmup` uses, for reports. A gap at or
|
|
174
|
+
* after `IDLE_HORIZON_MS` is a no-reply gap, as the recorder stores it. The
|
|
175
|
+
* bins after the horizon never get a gap, so they are left out.
|
|
176
|
+
*/
|
|
177
|
+
function gapHistogramReport(gapsMs) {
|
|
178
|
+
const { counts } = histogramOf(gapsMs.filter((gapMs) => gapMs < IDLE_HORIZON_MS));
|
|
179
|
+
const bins = [];
|
|
180
|
+
for (const [index, endMs] of GAP_BIN_EDGES_MS.entries()) {
|
|
181
|
+
const startMs = index > 0 ? GAP_BIN_EDGES_MS[index - 1] : 0;
|
|
182
|
+
if (startMs >= 33e5) break;
|
|
183
|
+
bins.push({
|
|
184
|
+
startMs,
|
|
185
|
+
endMs: Math.min(endMs, IDLE_HORIZON_MS),
|
|
186
|
+
count: counts[index]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
bins,
|
|
191
|
+
noReply: gapsMs.filter((gapMs) => gapMs >= IDLE_HORIZON_MS).length,
|
|
192
|
+
total: gapsMs.length
|
|
193
|
+
};
|
|
194
|
+
}
|
|
149
195
|
/**
|
|
150
196
|
* Segment whose gaps a thin segment leans on: the `none` segment with the
|
|
151
197
|
* same Actor and Turn depth. The backfill and most traffic keep the `none`
|
|
@@ -183,7 +229,7 @@ function decideWarmup(input) {
|
|
|
183
229
|
const conversation = histogramOf(input.conversationGapsMs);
|
|
184
230
|
const global = histogramOf(input.globalGapsMs);
|
|
185
231
|
const parent = input.parentGapsMs && segmentNeedsParent(global.total) ? histogramOf(input.parentGapsMs) : void 0;
|
|
186
|
-
const histogram = blendHistograms(conversation, parent ? blendHistograms(global, parent) : global);
|
|
232
|
+
const histogram = blendHistograms(conversation, parent ? blendHistograms(global, parent, BLEND_PSEUDOCOUNT) : global, CONVERSATION_BLEND_PSEUDOCOUNT);
|
|
187
233
|
const probability = returnProbability(histogram, input.idleMs, Math.min(input.cacheTtlMs, IDLE_HORIZON_MS - input.idleMs));
|
|
188
234
|
const perWarmup = returnsPerWarmup(histogram, input.idleMs, input.cacheExpiryIdleMs, input.cacheTtlMs);
|
|
189
235
|
const decision = (reason) => ({
|
|
@@ -197,7 +243,7 @@ function decideWarmup(input) {
|
|
|
197
243
|
if (input.prefixTokens < 5e4) return decision("prefix_too_small");
|
|
198
244
|
if (threshold >= 1) return decision("no_savings");
|
|
199
245
|
if (input.idleMs >= 33e5) return decision("horizon");
|
|
200
|
-
if (conversation.total + global.total + (parent?.total ?? 0) <
|
|
246
|
+
if (conversation.total + global.total + (parent?.total ?? 0) < 20) return decision("few_gaps");
|
|
201
247
|
return decision(perWarmup >= threshold ? "warm" : "unlikely_return");
|
|
202
248
|
}
|
|
203
249
|
function returnsPerWarmup(histogram, idleMs, cacheExpiryIdleMs, ttlMs) {
|
|
@@ -990,4 +1036,4 @@ async function runCacheWarmup(message) {
|
|
|
990
1036
|
}, startedAtMs, warm);
|
|
991
1037
|
}, attributes);
|
|
992
1038
|
}
|
|
993
|
-
export { segmentGapsKey as a, listConversationWork as c,
|
|
1039
|
+
export { segmentGapsKey as a, listConversationWork as c, IDLE_HORIZON_MS as d, MINUTE_MS as f, gapSegment as g, gapHistogramReport as h, createCacheWarmingRecorder as i, readLastUserMessageAtByConversation as l, NO_REPLY_GAP_MS as m, GLOBAL_GAPS_MAX as n, warmup_exports as o, MIN_WARMUP_PREFIX_TOKENS as p, GLOBAL_GAPS_TTL_MS as r, isConversationWorkDone as s, CONVERSATION_STATE_TTL_MS as t, GAP_SEGMENTS as u };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-
|
|
1
|
+
import { H as PluginCredentialFailureError, K as AuthorizationFlowDisabledError, Sn as renderTag, Xt as isTurnExecutionLimitExceededError, at as failTurnRecord, et as lostWorkerBeforeFirstSave, go as loadForkHistory, nt as saveTurnCheckpoint, ot as getTurnRecord, rt as abandonTurnRecord, s as openConversationProjection, tn as getTerminalAssistantMessages, tt as pauseLostWorkerTurn, v as hydrateConversationMessages, vn as escapeClosingTags } from "./projection-DLQgfO5N.js";
|
|
2
|
+
import { n as botConfig } from "./config-mIZeGEWv.js";
|
|
3
|
+
import { A as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore, s as getSqlExecutor } from "./db--xuNV7g6.js";
|
|
4
|
+
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-BItuRqAR.js";
|
|
5
5
|
import { h as contextProvenance, m as agentInstructionProvenance, v as sameActorIdentity } from "./media-BepyEUNm.js";
|
|
6
|
-
import { Dt as stopChildAgentsOf, Gt as finishTurn, Mt as supersedeOpenMailboxTurns, Ot as recordSubagentEnded, Ut as AgentRunError, Wt as executeTurn, an as AgentNameInUseError, kt as recordSubagentStarted, rn as AgentMessageQueueFullError, tn as AgentInvocationLimitError } from "./agent-runner-
|
|
7
|
-
import { k as getTurnRequestDeadline } from "./background-compaction-queue-
|
|
8
|
-
import { $ as getUnnamedAgentConversationId, A as markAgentInvocationPaused, C as isTerminalAgentInvocation, H as agentTypeStartsWithParentHistory, J as getAgentInvocationMessageId, L as agentBindingSchema, M as markAgentInvocationSteered, N as reportReplacedAgentInvocation, O as markAgentInvocationMailboxAppended, Q as getNamedAgentConversationId, T as listOpenAgentInvocations, V as agentTypeInstructions, W as getAgentInvocationId, X as getAgentInvocationTurnId, Z as getChildAgentLockName, _ as completeAgentInvocation, at as getConversationTurnBoundaryError, f as ConversationTurnLifecycleService, g as NON_TERMINAL_AGENT_INVOCATION_STATUSES, h as ACTIVE_AGENT_INVOCATION_STATUSES, j as markAgentInvocationRunning, rt as TurnInputCommitLostError, st as isTurnInputCommitLostError, v as getActiveAgentInvocationForConversation, w as listAgentInvocationsForConversation, x as getLatestAgentInvocationForConversation, y as getAgentInvocation, z as createAgentInvocationSchema } from "./turn-failure-response-
|
|
9
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
10
|
-
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, K as recordFinishedTurnForAutomatedLimit, X as buildSteeringPiMessage, Z as instructionForInputs, ct as readBlockedReport, h as parseWebMessages, i as resumeStoppedConversationTree, p as listActiveMailboxTurns, q as resetAutomatedTurnLimit, u as getActiveConversationTurnId } from "./session-stop-
|
|
11
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
12
|
-
import { ft as getPersistedSandboxState, gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-
|
|
6
|
+
import { Dt as stopChildAgentsOf, Gt as finishTurn, Mt as supersedeOpenMailboxTurns, Ot as recordSubagentEnded, Ut as AgentRunError, Wt as executeTurn, an as AgentNameInUseError, kt as recordSubagentStarted, rn as AgentMessageQueueFullError, tn as AgentInvocationLimitError } from "./agent-runner-DJu7w6mI.js";
|
|
7
|
+
import { k as getTurnRequestDeadline } from "./background-compaction-queue-D2j-0XkH.js";
|
|
8
|
+
import { $ as getUnnamedAgentConversationId, A as markAgentInvocationPaused, C as isTerminalAgentInvocation, H as agentTypeStartsWithParentHistory, J as getAgentInvocationMessageId, L as agentBindingSchema, M as markAgentInvocationSteered, N as reportReplacedAgentInvocation, O as markAgentInvocationMailboxAppended, Q as getNamedAgentConversationId, T as listOpenAgentInvocations, V as agentTypeInstructions, W as getAgentInvocationId, X as getAgentInvocationTurnId, Z as getChildAgentLockName, _ as completeAgentInvocation, at as getConversationTurnBoundaryError, f as ConversationTurnLifecycleService, g as NON_TERMINAL_AGENT_INVOCATION_STATUSES, h as ACTIVE_AGENT_INVOCATION_STATUSES, j as markAgentInvocationRunning, rt as TurnInputCommitLostError, st as isTurnInputCommitLostError, v as getActiveAgentInvocationForConversation, w as listAgentInvocationsForConversation, x as getLatestAgentInvocationForConversation, y as getAgentInvocation, z as createAgentInvocationSchema } from "./turn-failure-response-BqTTx3XG.js";
|
|
9
|
+
import { n as getAssistantReplyText } from "./assistant-reply-iTtEdDyc.js";
|
|
10
|
+
import { $ as withoutSavedSteeringMessages, B as maybePostAutomatedTurnLimitNotice, K as recordFinishedTurnForAutomatedLimit, X as buildSteeringPiMessage, Z as instructionForInputs, ct as readBlockedReport, h as parseWebMessages, i as resumeStoppedConversationTree, p as listActiveMailboxTurns, q as resetAutomatedTurnLimit, u as getActiveConversationTurnId } from "./session-stop-CeCXL3j9.js";
|
|
11
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-C8LsaJwS.js";
|
|
12
|
+
import { ft as getPersistedSandboxState, gt as coerceThreadConversationState, ht as persistThreadStateById, pt as getPersistedThreadState } from "./task-runner-Dw7exu0-.js";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { and, eq } from "drizzle-orm";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { At as isInvalidConversationRecordError, Dt as hasConversationStop, St as countPendingConversationMessages, kt as isFinalAttempt } from "./projection-
|
|
3
|
-
import {
|
|
4
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
5
|
-
import { Ht as selectAttemptMessages, Vt as isAttemptInterrupt } from "./agent-runner-
|
|
6
|
-
import { k as getTurnRequestDeadline, y as ConversationQueueMessageRejectedError } from "./background-compaction-queue-
|
|
7
|
-
import { C as startConversationWork, b as releaseConversationWork, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, v as recordAttemptFailure, x as requestAnotherSlice, y as recordConversationRetry } from "./store-
|
|
2
|
+
import { At as isInvalidConversationRecordError, Dt as hasConversationStop, St as countPendingConversationMessages, kt as isFinalAttempt } from "./projection-DLQgfO5N.js";
|
|
3
|
+
import { K as isProviderRetryError, i as getChatConfig } from "./config-mIZeGEWv.js";
|
|
4
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-Cb6MGvdt.js";
|
|
5
|
+
import { Ht as selectAttemptMessages, Vt as isAttemptInterrupt } from "./agent-runner-DJu7w6mI.js";
|
|
6
|
+
import { k as getTurnRequestDeadline, y as ConversationQueueMessageRejectedError } from "./background-compaction-queue-D2j-0XkH.js";
|
|
7
|
+
import { C as startConversationWork, b as releaseConversationWork, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, v as recordAttemptFailure, x as requestAnotherSlice, y as recordConversationRetry } from "./store-C8LsaJwS.js";
|
|
8
8
|
// src/chat/task-execution/worker.ts
|
|
9
9
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
-- CREATE INDEX CONCURRENTLY, so the build below does not block writes.
|
|
3
|
-
DO $$
|
|
4
|
-
BEGIN
|
|
5
|
-
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
6
|
-
IF to_regclass('junior_conversation_events_plugin_report_idx') IS NULL THEN
|
|
7
|
-
-- junior:concurrent-index
|
|
8
|
-
CREATE INDEX "junior_conversation_events_plugin_report_idx" ON "junior_conversation_events" USING btree (("payload"->>'namespace'),("payload"->>'name'),"created_at") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
9
|
-
END IF;
|
|
10
|
-
|
|
11
|
-
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
-
IF NOT EXISTS (
|
|
13
|
-
SELECT 1 FROM pg_index
|
|
14
|
-
WHERE indexrelid = 'junior_conversation_events_plugin_report_idx'::regclass
|
|
15
|
-
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
-
AND indisvalid AND indisready
|
|
17
|
-
) THEN
|
|
18
|
-
RAISE EXCEPTION 'The plugin report index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
-
END IF;
|
|
20
|
-
END $$;
|
|
1
|
+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_conversation_events_plugin_report_idx" ON "junior_conversation_events" USING btree (("payload"->>'namespace'),("payload"->>'name'),"created_at") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
-- CREATE INDEX CONCURRENTLY, so the build below does not block writes.
|
|
3
|
-
DO $$
|
|
4
|
-
BEGIN
|
|
5
|
-
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
6
|
-
IF to_regclass('junior_conversation_events_plugin_conversation_idx') IS NULL THEN
|
|
7
|
-
-- junior:concurrent-index
|
|
8
|
-
CREATE INDEX "junior_conversation_events_plugin_conversation_idx" ON "junior_conversation_events" USING btree ("conversation_id",("payload"->>'namespace'),("payload"->>'name'),"seq") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
9
|
-
END IF;
|
|
10
|
-
|
|
11
|
-
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
-
IF NOT EXISTS (
|
|
13
|
-
SELECT 1 FROM pg_index
|
|
14
|
-
WHERE indexrelid = 'junior_conversation_events_plugin_conversation_idx'::regclass
|
|
15
|
-
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
-
AND indisvalid AND indisready
|
|
17
|
-
) THEN
|
|
18
|
-
RAISE EXCEPTION 'The plugin conversation index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
-
END IF;
|
|
20
|
-
END $$;
|
|
1
|
+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_conversation_events_plugin_conversation_idx" ON "junior_conversation_events" USING btree ("conversation_id",("payload"->>'namespace'),("payload"->>'name'),"seq") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
-- CREATE INDEX CONCURRENTLY, so the build below does not block writes.
|
|
3
|
-
DO $$
|
|
4
|
-
BEGIN
|
|
5
|
-
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
6
|
-
IF to_regclass('junior_conversation_events_author_idx') IS NULL THEN
|
|
7
|
-
-- junior:concurrent-index
|
|
8
|
-
CREATE INDEX "junior_conversation_events_author_idx" ON "junior_conversation_events" USING btree ("conversation_id","actor_identity_id","seq") WHERE "junior_conversation_events"."actor_identity_id" is not null;
|
|
9
|
-
END IF;
|
|
10
|
-
|
|
11
|
-
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
-
IF NOT EXISTS (
|
|
13
|
-
SELECT 1 FROM pg_index
|
|
14
|
-
WHERE indexrelid = 'junior_conversation_events_author_idx'::regclass
|
|
15
|
-
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
-
AND indisvalid AND indisready
|
|
17
|
-
) THEN
|
|
18
|
-
RAISE EXCEPTION 'The conversation event author index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
-
END IF;
|
|
20
|
-
END $$;
|
|
1
|
+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_conversation_events_author_idx" ON "junior_conversation_events" USING btree ("conversation_id","actor_identity_id","seq") WHERE "junior_conversation_events"."actor_identity_id" is not null;
|