@sentry/junior 0.293.0 → 0.295.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-uuecrKuD.js → admin-ifgjyfpF.js} +2 -2
- package/dist/{agent-runner-DHq1pjUg.js → agent-runner-DjMTPWEO.js} +192 -100
- 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 +73 -29
- package/dist/{app-fWzCHFIb.d.ts → app-uiTzRbvq.d.ts} +5 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +64 -74
- package/dist/{automation-BE3z19VN.js → automation-yJX3C7i3.js} +3 -3
- package/dist/{background-compaction-queue-D7ncdEa6.js → background-compaction-queue-DUkHZjmL.js} +7 -9
- package/dist/{briefs-NpgMEFh1.js → briefs-CbNYM-q2.js} +3 -3
- package/dist/{catalog-runtime-DwbTyNRD.js → catalog-runtime-DgouZKZm.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +2 -0
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +7 -74
- package/dist/{config-B4b-NXH5.js → config-DvnTPCfp.js} +58 -7
- package/dist/{connections-Dz_AQg5p.js → connections-CWaIVl_1.js} +6 -6
- package/dist/{conversation-CtjR1Zcx.js → conversation-CMkSmi02.js} +3 -11
- package/dist/{conversation-pending-messages-1Kad1Mif.js → conversation-feed-BVAOga0H.js} +27 -2
- package/dist/{conversation-privacy-DRsSgLGO.js → conversation-privacy-DPjv4SnA.js} +1 -1
- package/dist/{credential-sync-ClCnnGVj.js → credential-sync-BhbaZfmO.js} +16 -15
- package/dist/{db-BbpttyKH.d.ts → db-CCUqQe0E.d.ts} +13 -6
- package/dist/{db-CoA7_Xqu.js → db-Dts2XvLu.js} +144 -7
- package/dist/{executor-SWyHhit0.js → executor-Ck73J0wP.js} +64 -10
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BN5drSEZ.js → logging-9OAq-fdg.js} +2 -1
- package/dist/{message-D4qjpW1C.js → message-CtaPzC7m.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-Xi-mTLOV.js → oauth-callback-server-C_LXY1d4.js} +2 -2
- package/dist/{oauth-relay-D6xxVywK.js → oauth-relay-CsfIazeF.js} +2 -1
- package/dist/{plugins-DtmjkTza.d.ts → plugins-B_0Cr0MO.d.ts} +0 -1
- package/dist/{projection-DXl4ftyL.js → projection-BzJQncZV.js} +251 -161
- package/dist/{prompt-Dmx6IfWZ.js → prompt-Cbq5b4SO.js} +5 -6
- package/dist/{registry-DosVt9f9.js → registry-cbpOxO4M.js} +3 -13
- package/dist/{resolve-BDjWJC9s.js → resolve-t-pmRdwS.js} +3 -3
- package/dist/{result-CaAFpf4B.js → result-DhgjR3nQ.js} +8 -8
- package/dist/{runner-h96Mkss6.js → runner-CHv9X9TH.js} +8 -8
- package/dist/{sandbox-egress-signals-rK91BW7i.js → sandbox-egress-signals-Yy3fSCbg.js} +1 -1
- package/dist/{schema-C_v8wb80.js → schema-BhneuGYv.js} +39 -7
- package/dist/{schema-CHsBmXIj.d.ts → schema-TSEisVJR.d.ts} +87 -14
- package/dist/secrets-DebYU866.js +18 -0
- package/dist/{service-account-WUMVuqVL.js → service-account-C4rBP8ne.js} +3 -3
- package/dist/{service-account-BpGpScaT.js → service-account-DjPIwCMj.js} +42 -26
- package/dist/{session-stop-xYK15HUu.js → session-stop-DkxI5vc3.js} +20 -775
- package/dist/{skills-DHApyCjj.js → skills-BZE2DP8I.js} +2 -2
- package/dist/{spawn-BQQrwGNe.js → spawn-BvULxIiu.js} +5 -5
- package/dist/{adapter-CMJfmHso.js → state-CO9ETDzk.js} +132 -2
- package/dist/{stop-CBeD6_Gs.js → stop-CL-rdtQb.js} +85 -32
- package/dist/{store-xtibD98L.js → store-DgD78_NK.js} +3 -3
- package/dist/{task-runner-BYPN4BEO.js → task-runner-CKOj6xla.js} +11 -11
- package/dist/{turn-failure-response-jNVl00MD.js → turn-failure-response-BTSo6SMJ.js} +8 -8
- package/dist/{validation-DGeB_moV.js → validation-CXeYgBzq.js} +1 -1
- package/dist/{version-C6nqU3Qc.js → version-AQa7Fr2H.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-9KLQibjn.js → viewer-Bqkb678l.js} +3 -3
- package/dist/warmup-h6u1e9n0.js +1869 -0
- package/dist/{work-xwX6unUE.js → work-yN_GAuXY.js} +11 -11
- package/dist/{worker-CiCCfwd4.js → worker-Hl7N292I.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/0098_review_item_plugin_actions.sql +5 -0
- package/migrations/0099_conversation_last_message_at.sql +1 -0
- package/migrations/0100_automation_task_kind_repair.sql +48 -0
- package/migrations/meta/0097_snapshot.json +4490 -0
- package/migrations/meta/0098_snapshot.json +4490 -0
- package/migrations/meta/0099_snapshot.json +4720 -0
- package/migrations/meta/0100_snapshot.json +4496 -0
- package/migrations/meta/_journal.json +28 -0
- package/package.json +5 -5
- package/dist/assistant-reply-CIApSfor.js +0 -58
- package/dist/warmup-7S6z068f.js +0 -993
package/dist/app.js
CHANGED
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import { i as getActiveSpan, n as captureMessage, u as sentry_exports } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $r as
|
|
3
|
-
import { d as restoreRuntimeConfig, f as setBotModelConfig, h as snapshotRuntimeConfig, i as getChatConfig, m as setSlackReactionConfig, n as botConfig, o as getSlackBotToken, p as setRuntimeLimits,
|
|
4
|
-
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, H as GOOGLE_IDENTITY_PROVIDER, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, W as normalizeIdentityEmail, b as setSpanAttributes, h as logWarn, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { $r as verifyScheduledAutomationCredentialSubject, Aa as normalizeSandboxEgressTracePropagationDomains, Ai as isVercelSandboxEgressRequest, At as isInvalidConversationRecordError, Bn as getPlugins, Bo as getConfigDefaults, C as settleConversationTitleWork, Ca as consumeSandboxEgressAuthRequiredSignal, Co as resolveRootVisibility, Dr as reviewItemReaderForUserInConversation, Ea as parseSandboxEgressCredentialToken, En as createUserTokenStore, Eo as listConversationAnnotations, Er as reviewItemReaderForUser, Fi as resolveBaseUrl, Fn as getPluginRoutes, Gn as setBriefsConfig, Gr as findMatchingWatches, Hn as validatePlugins, Ia as createPluginEmbedder, Ji as postSlackEphemeralMessage, Jr as takeDueTimerWatches, Li as escapeSlackMrkdwnText, Mn as createPluginEventPublisher, Ot as hasRunnableConversationWork, Pn as getPluginApiRoutes, Po as createPluginCache, Pt as pruneActiveConversation, Qr as verifyEventAutomationCredentialSubject, Ri as formatSlackLink, Sa as clearSandboxEgressSignals, Vi as slackMention, Vn as setPlugins, Vo as setConfigDefaults, Vr as collectEventMatchKeys, Xa as createPluginLogger, Xr as bindScheduledAutomationCredentialSubject, Yr as bindEventAutomationCredentialSubject, Zi as unfurlSlackLinks, Zr as bindSlackDirectCredentialSubject, _ as appendConversationMessages, ai as getDashboardReviewItemLink, ar as dismissOpenReviewItems, ca as isDmChannel, ci as parseDashboardConversationLink, di as createPluginState, do as readConversationEventPageAfter, ea as slackEntitySchema, ei as verifySlackDirectCredentialSubject, eo as readConversationAccessFromSql, fa as getWorkspaceTeamId, fr as searchReviewItems, gr as canActOnReviewItem, ji as proxyVercelSandboxEgressRequest, li as setDashboardConversationLinkOptions, lo as readLatestConversationBrief, mo as readConversationMessageEventSeq, oa as getSlackClient, pa as runWithWorkspaceTeamId, po as readConversationLastEventSeq, qi as openSlackModal, ri as getDashboardConversationLink, si as getDashboardTaskLink, ta as slackExternalRefIdSchema, tr as projectConversationMessages, uo as readConversationEventPage, ut as CONVERSATION_WORK_STALE_ENQUEUE_MS, wa as consumeSandboxEgressPermissionDeniedSignal } from "./projection-BzJQncZV.js";
|
|
3
|
+
import { Y as getAttachmentStorage, d as restoreRuntimeConfig, f as setBotModelConfig, h as snapshotRuntimeConfig, i as getChatConfig, m as setSlackReactionConfig, n as botConfig, o as getSlackBotToken, p as setRuntimeLimits, u as resetRuntimeConfig } from "./config-DvnTPCfp.js";
|
|
4
|
+
import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, E as withSpan, H as GOOGLE_IDENTITY_PROVIDER, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as withLogContext, W as normalizeIdentityEmail, b as setSpanAttributes, h as logWarn, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-9OAq-fdg.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-AQa7Fr2H.js";
|
|
6
6
|
import { _ as slackMessageTsSchema, f as parseSlackTeamId, g as slackMessageTsFromMs, h as parseSlackMessageTs, m as slackChannelIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
7
|
-
import {
|
|
8
|
-
import { A as juniorConversations, N as juniorDestinations, b as juniorConversationBriefs, f as juniorAutomations, g as juniorAgentInvocations, h as juniorAgentBindings, l as juniorReviewItems, u as juniorAutomationRuns, w as juniorConversationEvents } from "./executor-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { $ as readViewerAutomationSummary, $t as resumeConversationDelivery, A as runWithSlackInstallation, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, E as buildSlackReviewItemModal, H as logScheduledAutomationRunSkipped, I as checkSlackChannelReadAccess, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as recordSubagentEnded, S as createSlackReviewItemShow, St as markConversationRead, U as scheduledAutomationRunAttributes, Y as ViewerTaskNotFoundError, Z as readViewerAutomationExecutions, _ as unpublishedArtifactHeaders, at as deliverReviewItemChange, bt as archiveConversation, dn as findAutomationSkill, fn as missingAutomationSkillReason, g as readPublicArtifact, gt as collectAttachmentGarbage, h as publicArtifactHeaders, j as verifySlackSignature, k as parseSlackUserInputSubmission, ln as processWorkspaceSnapshotJob, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, ot as renderReviewItemMessage, pt as recordWebConversationActivity, r as processBackgroundCompaction, rt as effectiveTaskOutcomes, st as reviewItemChangeRecord, t as createAgentRunner, tt as readViewerAutomations, un as ingestEvent, ut as conversationTurnIdForMessage, v as setConversationSubscription, vt as requestAttachmentDeletion, w as syncReviewItemSlackCards, y as lookupSlackUserProfile, z as joinPublicChannel } from "./agent-runner-
|
|
7
|
+
import { B as recordGoogleSignIn, G as getConversationIdByProviderConversation, O as conversationKindFromRow, P as resolveActorIdentityId, S as withConversationMutationLock, a as getConversationStore, nt as touchConversationDetail, o as getDb, p as withConversationEventLock, r as getConversationEventStore, rt as createSlackDestination, s as getSqlExecutor, t as closeDb } from "./db-Dts2XvLu.js";
|
|
8
|
+
import { A as juniorConversations, N as juniorDestinations, b as juniorConversationBriefs, f as juniorAutomations, g as juniorAgentInvocations, h as juniorAgentBindings, l as juniorReviewItems, u as juniorAutomationRuns, w as juniorConversationEvents } from "./executor-Ck73J0wP.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
|
|
10
|
+
import { $ as readViewerAutomationSummary, $t as resumeConversationDelivery, A as runWithSlackInstallation, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, E as buildSlackReviewItemModal, H as logScheduledAutomationRunSkipped, I as checkSlackChannelReadAccess, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as recordSubagentEnded, S as createSlackReviewItemShow, St as markConversationRead, U as scheduledAutomationRunAttributes, Y as ViewerTaskNotFoundError, Z as readViewerAutomationExecutions, _ as unpublishedArtifactHeaders, at as deliverReviewItemChange, bt as archiveConversation, dn as findAutomationSkill, fn as missingAutomationSkillReason, g as readPublicArtifact, gt as collectAttachmentGarbage, h as publicArtifactHeaders, j as verifySlackSignature, k as parseSlackUserInputSubmission, ln as processWorkspaceSnapshotJob, lt as appendAndEnqueueWebMessage, mt as webActorFromUser, n as executeAgentRun, ot as renderReviewItemMessage, pt as recordWebConversationActivity, r as processBackgroundCompaction, rt as effectiveTaskOutcomes, st as reviewItemChangeRecord, t as createAgentRunner, tt as readViewerAutomations, un as ingestEvent, ut as conversationTurnIdForMessage, v as setConversationSubscription, vt as requestAttachmentDeletion, w as syncReviewItemSlackCards, y as lookupSlackUserProfile, z as joinPublicChannel } from "./agent-runner-DjMTPWEO.js";
|
|
11
11
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
|
|
12
|
-
import { g as createCache, i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-
|
|
13
|
-
import {
|
|
12
|
+
import { g as createCache, i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl } from "./viewer-Bqkb678l.js";
|
|
13
|
+
import { a as getStateAdapter, r as disconnectStateAdapter } from "./state-CO9ETDzk.js";
|
|
14
14
|
import { a as getNextRunAtMs } from "./schedule-cP0AACm1.js";
|
|
15
|
-
import {
|
|
15
|
+
import { J as conversationBriefSchema, O as conversationTitleSchema, P as annotationCard, b as conversationSurfaceSchema, p as conversationFeedQuerySchema, v as conversationReportStatusSchema } from "./conversation-CMkSmi02.js";
|
|
16
16
|
import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
17
|
+
import { n as readSchedulerSecret, r as readSignInSecret } from "./secrets-DebYU866.js";
|
|
18
|
+
import { a as segmentGapsKey, f as MINUTE_MS, g as gapSegment, m as NO_REPLY_GAP_MS, n as GLOBAL_GAPS_MAX, p as MIN_WARMUP_PREFIX_TOKENS, r as GLOBAL_GAPS_TTL_MS, t as CONVERSATION_STATE_TTL_MS } from "./warmup-h6u1e9n0.js";
|
|
19
|
+
import { A as getQueueProvider, C as cacheWarmupQueueConsumer, O as queueCallback, T as registerVercelCacheWarmupDevConsumer, _ as resolveConversationWorkQueueTopic, b as conversationQueueMessageSchema, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, g as getVercelConversationWorkQueue, h as verifyWorkspaceSnapshotJobMessage, i as verifyBackgroundCompactionMessage, l as pluginTaskQueueConsumer, o as createVercelPluginTaskCallback, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as registerVercelPluginTaskDevConsumer, v as verifyConversationQueueMessage, w as createVercelCacheWarmupCallback, x as isConversationQueueMessageRejectedError } from "./background-compaction-queue-DUkHZjmL.js";
|
|
20
|
+
import { D as listPendingAgentInvocationResults, E as listPendingAgentInvocationMailboxAppends } from "./turn-failure-response-BTSo6SMJ.js";
|
|
21
|
+
import { M as slackChannelMessageReplyThreadTs, N as slackChannelMessageRunsAutomation, O as getEventCatalog, W as renderSlackObjectCard, d as getAuthPausedConversationTurnId, it as setExperimentalFeatures, j as slackChannelMessageEvent, k as SLACK_EVENT_NAMESPACE, nt as getExperimentalFeatures, rt as isExperimentalFeatureEnabled, z as renderTaskInput } from "./session-stop-DkxI5vc3.js";
|
|
21
22
|
import { _ as buttonUserInputField } from "./reporting-window-B3Ze-Qnt.js";
|
|
22
|
-
import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-
|
|
23
|
-
import { _ as listActiveConversationIds, g as getConversationWorkState, h as getConversation, l as clearExpiredConversationLease, m as ensureConversationWake, r as appendAndEnqueueInboundMessage } from "./store-
|
|
24
|
-
import { A as withScheduledAutomationLock, E as readScheduledAutomation, F as findMatchingEventAutomations, H as eventAutomationRunLimitReason, M as collectEventAutomationMatchKeys, O as saveScheduledAutomationInLock, Q as existingConversationId, V as admitEventAutomationRun, W as automationVersionOf, c as getDispatchConversationId, d as getDispatchRecord, gt as coerceThreadConversationState, h as listPendingDispatchMailboxAppends, i as buildDispatchId, j as blockEventAutomation, k as scheduledRunId, m as isTerminalDispatchStatus, o as confirmDispatchMailboxAppend, ot as recordAutomationExecution, p as getPluginDispatchProjection, s as createOrGetDispatch, t as processPluginTask, w as listScheduledAutomationsForTeam, x as notifyAutomationBlocked, xt as eventGuidance, y as markDispatchFailed } from "./task-runner-
|
|
25
|
-
import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-
|
|
26
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
23
|
+
import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-t-pmRdwS.js";
|
|
24
|
+
import { _ as listActiveConversationIds, g as getConversationWorkState, h as getConversation, l as clearExpiredConversationLease, m as ensureConversationWake, r as appendAndEnqueueInboundMessage } from "./store-DgD78_NK.js";
|
|
25
|
+
import { A as withScheduledAutomationLock, E as readScheduledAutomation, F as findMatchingEventAutomations, H as eventAutomationRunLimitReason, M as collectEventAutomationMatchKeys, O as saveScheduledAutomationInLock, Q as existingConversationId, V as admitEventAutomationRun, W as automationVersionOf, c as getDispatchConversationId, d as getDispatchRecord, gt as coerceThreadConversationState, h as listPendingDispatchMailboxAppends, i as buildDispatchId, j as blockEventAutomation, k as scheduledRunId, m as isTerminalDispatchStatus, o as confirmDispatchMailboxAppend, ot as recordAutomationExecution, p as getPluginDispatchProjection, s as createOrGetDispatch, t as processPluginTask, w as listScheduledAutomationsForTeam, x as notifyAutomationBlocked, xt as eventGuidance, y as markDispatchFailed } from "./task-runner-CKOj6xla.js";
|
|
26
|
+
import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-yJX3C7i3.js";
|
|
27
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-CXeYgBzq.js";
|
|
27
28
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-HYh_JOdw.js";
|
|
28
|
-
import {
|
|
29
|
-
import { $ as actOnReviewItem, A as createProductionConversationWorkOptions, B as clearSlackPendingReactions, C as createConversationForViewer, D as readConversationPendingMessages, E as cancelConversationPendingMessagesForViewer, F as isAllowedSignInEmail, G as createSlackWebApiStatusSender, H as stripLeadingBotMention, I as readEnvList, J as stopConversation, K as SubscribedReplyReason, L as resolveAllowedDomains, M as getProductionSlackAdapter, N as assertNoLegacyAllowedDomains, P as isAllowedDomain, Q as ReviewItemActionError, R as startProcessingReaction, S as appendConversationMessageForViewer, T as encodeConversationCursor, U as normalizeIncomingSlackThreadId, V as slackInboundMessageId, W as withNormalizedThreadId, X as recordSkippedConversationMessage, Y as parseContent, Z as bindMessageAuthorIdentityId, a as pinConversation, at as continueConversationInSlack, b as readConversationRecordFromSql, ct as archiveViewerDoneConversations, dt as setConversationAutoArchive, et as closeReviewItemsAnsweredByReply, ht as GET$4, i as readConversationFeed, it as canContinueInSlack, j as createProductionSlackWebhookServices, mt as enqueueAgentDispatch, n as steerConversationPendingMessagesForViewer, nt as reviewItemChange, ot as isMovableToSlack, q as getThreadStopDecision, rt as alreadyContinuesInSlackMessage, s as readConversationDetail, t as stopConversationTurnForViewer, tt as readReviewItemForUser, ut as runAutoArchiveSweep, w as decodeConversationCursor, z as buildSlackInboundMessage } from "./stop-
|
|
30
|
-
import { a as enqueueAgentInvocation, i as endAgentInvocationsOfStoppedWork } from "./work-
|
|
31
|
-
import { n as enqueueAgentInvocationResult } from "./result-
|
|
32
|
-
import { o as unlinkProvider } from "./connections-
|
|
33
|
-
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
29
|
+
import { s as conversationPendingMessageDeliverySchema } from "./conversation-feed-BVAOga0H.js";
|
|
30
|
+
import { $ as actOnReviewItem, A as createProductionConversationWorkOptions, B as clearSlackPendingReactions, C as createConversationForViewer, D as readConversationPendingMessages, E as cancelConversationPendingMessagesForViewer, F as isAllowedSignInEmail, G as createSlackWebApiStatusSender, H as stripLeadingBotMention, I as readEnvList, J as stopConversation, K as SubscribedReplyReason, L as resolveAllowedDomains, M as getProductionSlackAdapter, N as assertNoLegacyAllowedDomains, P as isAllowedDomain, Q as ReviewItemActionError, R as startProcessingReaction, S as appendConversationMessageForViewer, T as encodeConversationCursor, U as normalizeIncomingSlackThreadId, V as slackInboundMessageId, W as withNormalizedThreadId, X as recordSkippedConversationMessage, Y as parseContent, Z as bindMessageAuthorIdentityId, a as pinConversation, at as continueConversationInSlack, b as readConversationRecordFromSql, ct as archiveViewerDoneConversations, dt as setConversationAutoArchive, et as closeReviewItemsAnsweredByReply, ht as GET$4, i as readConversationFeed, it as canContinueInSlack, j as createProductionSlackWebhookServices, mt as enqueueAgentDispatch, n as steerConversationPendingMessagesForViewer, nt as reviewItemChange, ot as isMovableToSlack, q as getThreadStopDecision, rt as alreadyContinuesInSlackMessage, s as readConversationDetail, t as stopConversationTurnForViewer, tt as readReviewItemForUser, ut as runAutoArchiveSweep, w as decodeConversationCursor, z as buildSlackInboundMessage } from "./stop-CL-rdtQb.js";
|
|
31
|
+
import { a as enqueueAgentInvocation, i as endAgentInvocationsOfStoppedWork } from "./work-yN_GAuXY.js";
|
|
32
|
+
import { n as enqueueAgentInvocationResult } from "./result-DhgjR3nQ.js";
|
|
33
|
+
import { o as unlinkProvider } from "./connections-CWaIVl_1.js";
|
|
34
|
+
import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-BhbaZfmO.js";
|
|
34
35
|
import { t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
|
|
35
|
-
import { t as processConversationWork } from "./worker-
|
|
36
|
-
import { t as bindMessageAgent } from "./message-
|
|
37
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
36
|
+
import { t as processConversationWork } from "./worker-Hl7N292I.js";
|
|
37
|
+
import { t as bindMessageAgent } from "./message-CtaPzC7m.js";
|
|
38
|
+
import { t as bindSpawnAgent } from "./spawn-BvULxIiu.js";
|
|
38
39
|
import { createRequire } from "node:module";
|
|
39
40
|
import { Hono } from "hono";
|
|
40
41
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
41
42
|
import * as z from "zod";
|
|
42
|
-
import { and, asc, eq, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
|
|
43
|
+
import { and, asc, desc, eq, gte, inArray, isNotNull, isNull, lte, ne, or, sql } from "drizzle-orm";
|
|
43
44
|
import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, dispatchOptionsSchema, eventSchema, eventTriggerFiltersText, isSlackDestination, userSchema } from "@sentry/junior-plugin-api";
|
|
44
45
|
import { pathToFileURL } from "node:url";
|
|
45
46
|
import pLimit from "p-limit";
|
|
@@ -59,8 +60,8 @@ import { getSessionCookie } from "better-auth/cookies";
|
|
|
59
60
|
import { betterAuth } from "better-auth/minimal";
|
|
60
61
|
// src/chat/cache-warming/backfill.ts
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
-
* history.
|
|
63
|
+
* Fill of the empty cache warming gap lists from stored Conversation
|
|
64
|
+
* history, about once a month.
|
|
64
65
|
*
|
|
65
66
|
* `warmup.ts` learns reply gaps only from idle periods after it is deployed.
|
|
66
67
|
* Until a `gapSegment` has gaps, Junior sends no warmups for it. This replays
|
|
@@ -82,8 +83,9 @@ import { betterAuth } from "better-auth/minimal";
|
|
|
82
83
|
* this fills. Each idle period still records its gap, so the segment fills
|
|
83
84
|
* from live idle periods.
|
|
84
85
|
*/
|
|
85
|
-
const BACKFILL_KEY = "junior:cache_warming:backfill:work_state";
|
|
86
|
+
const BACKFILL_KEY = "junior:cache_warming:backfill:work_state:v2";
|
|
86
87
|
const BACKFILL_CLAIM_TTL_MS = 60 * MINUTE_MS;
|
|
88
|
+
const BACKFILL_DONE_TTL_MS = GLOBAL_GAPS_TTL_MS;
|
|
87
89
|
const CONVERSATION_BATCH_SIZE = 10;
|
|
88
90
|
const QUERY_CANCELED = "57014";
|
|
89
91
|
const BACKFILL_BUDGET_MS = 6e4;
|
|
@@ -103,40 +105,29 @@ function historySegment(userActor, endedTurns) {
|
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
async function loadConversations(windowStartMs) {
|
|
106
|
-
return await
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
return await getDb().select({
|
|
109
|
+
conversationId: juniorConversations.conversationId,
|
|
110
|
+
kind: juniorConversations.kind,
|
|
111
|
+
parentConversationId: juniorConversations.parentConversationId
|
|
112
|
+
}).from(juniorConversations).where(and(gte(juniorConversations.lastActivityAt, new Date(windowStartMs)), isNull(juniorConversations.transcriptPurgedAt))).orderBy(desc(juniorConversations.lastActivityAt), juniorConversations.conversationId);
|
|
111
113
|
}
|
|
112
114
|
async function loadEvents(conversationIds) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
) m
|
|
130
|
-
WHERE e.conversation_id = ANY($1::text[])
|
|
131
|
-
AND (
|
|
132
|
-
e.type = 'assistant_message'
|
|
133
|
-
OR (
|
|
134
|
-
e.type = 'user_message'
|
|
135
|
-
AND (e.payload->'provenance'->>'authority') = 'instruction'
|
|
136
|
-
)
|
|
137
|
-
)
|
|
138
|
-
AND e.created_at >= c.created_at
|
|
139
|
-
ORDER BY e.conversation_id, e.seq`, [conversationIds]);
|
|
115
|
+
const events = juniorConversationEvents;
|
|
116
|
+
const isUserMessage = sql`${events.type} = 'user_message'`;
|
|
117
|
+
const message = sql`CASE
|
|
118
|
+
WHEN ${events.type} <> 'assistant_message' THEN NULL
|
|
119
|
+
WHEN ${events.schemaVersion} >= 2 THEN (${events.payload}->>'message')::jsonb
|
|
120
|
+
ELSE ${events.payload}
|
|
121
|
+
END`;
|
|
122
|
+
return await getDb().select({
|
|
123
|
+
conversationId: events.conversationId,
|
|
124
|
+
type: sql`${events.type}`,
|
|
125
|
+
personInstruction: sql`CASE WHEN ${isUserMessage} THEN (${events.payload}->'provenance'->'actor'->>'userId') IS NOT NULL END`,
|
|
126
|
+
stopReason: sql`(${message})->>'stopReason'`,
|
|
127
|
+
startedAtMs: sql`(${message})->>'timestamp'`,
|
|
128
|
+
cacheRead: sql`${events.payload}->'usage'->>'cacheRead'`,
|
|
129
|
+
cacheWrite: sql`${events.payload}->'usage'->>'cacheWrite'`
|
|
130
|
+
}).from(events).innerJoin(juniorConversations, eq(juniorConversations.conversationId, events.conversationId)).where(and(inArray(events.conversationId, conversationIds), or(eq(events.type, "assistant_message"), and(isUserMessage, sql`(${events.payload}->'provenance'->>'authority') = 'instruction'`)), gte(events.createdAt, juniorConversations.createdAt))).orderBy(events.conversationId, events.seq);
|
|
140
131
|
}
|
|
141
132
|
/**
|
|
142
133
|
* Replay the model calls of one Conversation the way the recorder in
|
|
@@ -255,9 +246,9 @@ async function collectGaps(nowMs, budgetMs) {
|
|
|
255
246
|
};
|
|
256
247
|
}
|
|
257
248
|
/**
|
|
258
|
-
* Fill each empty cache warming gap list
|
|
259
|
-
*
|
|
260
|
-
*
|
|
249
|
+
* Fill each empty cache warming gap list from the stored Conversation
|
|
250
|
+
* history. The heartbeat calls it each minute. After a run completes, a call
|
|
251
|
+
* makes one state request and returns, until the completed run expires.
|
|
261
252
|
*
|
|
262
253
|
* A run that uses its scan budget writes the gaps that it has and also
|
|
263
254
|
* completes. Some gaps are better than none, and a run that cannot finish
|
|
@@ -298,7 +289,7 @@ async function backfillCacheWarmingGaps(args) {
|
|
|
298
289
|
gapCount += newest.length;
|
|
299
290
|
segmentCount += 1;
|
|
300
291
|
}
|
|
301
|
-
await state.set(BACKFILL_KEY, "done");
|
|
292
|
+
await state.set(BACKFILL_KEY, "done", BACKFILL_DONE_TTL_MS);
|
|
302
293
|
const completed = {
|
|
303
294
|
...logAttributes,
|
|
304
295
|
"app.cache_warming.backfill.gap_count": gapCount,
|
|
@@ -1614,12 +1605,9 @@ async function runHeartbeat(args) {
|
|
|
1614
1605
|
}
|
|
1615
1606
|
}
|
|
1616
1607
|
// src/handlers/scheduler-auth.ts
|
|
1617
|
-
function getSchedulerSecret() {
|
|
1618
|
-
return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
|
|
1619
|
-
}
|
|
1620
1608
|
/** Check the bearer secret that internal cron requests must send. */
|
|
1621
1609
|
function verifySchedulerRequest(request) {
|
|
1622
|
-
const secret =
|
|
1610
|
+
const secret = readSchedulerSecret();
|
|
1623
1611
|
if (!secret) return false;
|
|
1624
1612
|
const authorization = request.headers.get("authorization")?.trim();
|
|
1625
1613
|
if (!authorization?.startsWith("Bearer ")) return false;
|
|
@@ -7798,7 +7786,7 @@ function required(value, name) {
|
|
|
7798
7786
|
return value.trim();
|
|
7799
7787
|
}
|
|
7800
7788
|
function createBetterAuth(config) {
|
|
7801
|
-
const secret = required(config.secret ??
|
|
7789
|
+
const secret = required(config.secret ?? readSignInSecret(), "JUNIOR_SECRET or BETTER_AUTH_SECRET");
|
|
7802
7790
|
const sessionMaxAgeSeconds = config.sessionMaxAgeSeconds ?? DEFAULT_SESSION_MAX_AGE_SECONDS;
|
|
7803
7791
|
const { allowedDomains } = config;
|
|
7804
7792
|
const hostedDomain = allowedDomains.length === 0 ? void 0 : allowedDomains.length === 1 ? allowedDomains[0] : "*";
|
|
@@ -8014,6 +8002,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
8014
8002
|
"/api/automations",
|
|
8015
8003
|
"/api/automations/*",
|
|
8016
8004
|
"/api/skills",
|
|
8005
|
+
"/api/skills/*",
|
|
8017
8006
|
"/api/board",
|
|
8018
8007
|
"/api/code",
|
|
8019
8008
|
"/api/code/*",
|
|
@@ -8022,6 +8011,7 @@ function dashboardHostRoutePaths(dashboard, authenticatedRoutes = []) {
|
|
|
8022
8011
|
"/api/notifications",
|
|
8023
8012
|
"/api/notifications/*",
|
|
8024
8013
|
"/api/stats",
|
|
8014
|
+
"/api/reply-times",
|
|
8025
8015
|
"/api/versions",
|
|
8026
8016
|
"/api/conversations",
|
|
8027
8017
|
"/api/conversations/*",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveLocalScheduleAtMs, i as getFirstRunAtMs, o as getZonedDateTimeParts, s as isValidTimeZone } from "./schedule-cP0AACm1.js";
|
|
2
|
-
import { i as actorIdentitySchema } from "./conversation-
|
|
2
|
+
import { i as actorIdentitySchema } from "./conversation-CMkSmi02.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
5
5
|
// src/chat/automations/task.ts
|
|
@@ -437,9 +437,9 @@ const automationTitleSchema = z.string().trim().min(1).max(60);
|
|
|
437
437
|
* instruction names exact targets. It calls the creator "the Automation
|
|
438
438
|
* creator". It names every other person with their mention.
|
|
439
439
|
*/
|
|
440
|
-
const automationInstructionToolSchema = automationTaskTextSchema.describe("Work to perform when the Automation runs. The run does not see this conversation, so words like \"this channel\" or \"here\" will mean nothing then.
|
|
440
|
+
const automationInstructionToolSchema = automationTaskTextSchema.describe("Work to perform when the Automation runs. Say what to do, what to post, and when to post nothing. Do not say where to post: the outcomes set that, a run triggered by a Slack message replies in its thread, and each run ends with one message at most. The run does not see this conversation, so words like \"this channel\" or \"here\" will mean nothing then. Where the run reads or changes something, write the exact target, such as a channel mention, a repo, or a link. Call the person who created the Automation \"the Automation creator\", not \"me\"; each run knows who that is. Name every other person with their Slack mention, such as <@U123>, including a requester who did not create the Automation. Preserve the user's scope, targets, and constraints. Do not add permissions or side effects the user did not request.");
|
|
441
441
|
/** Context input for agent tools. It follows the same rules as an instruction. */
|
|
442
|
-
const automationContextToolSchema = automationTaskTextSchema.describe("What a skill run needs beyond the skill, such as a repo, a threshold, or who to tag. Follow the same rules as an instruction: write exact targets, call the creator \"the Automation creator\", and name other people with their Slack mention.");
|
|
442
|
+
const automationContextToolSchema = automationTaskTextSchema.describe("What a skill run needs beyond the skill, such as a repo, a threshold, or who to tag. Leave out what the skill already says. Follow the same rules as an instruction: do not say where to post, write exact targets, call the creator \"the Automation creator\", and name other people with their Slack mention.");
|
|
443
443
|
const automationEditFieldsSchema = z.object({
|
|
444
444
|
title: automationTitleSchema.optional(),
|
|
445
445
|
/** Replaces the whole task, so a mode switch drops the other mode's text. */
|
package/dist/{background-compaction-queue-D7ncdEa6.js → background-compaction-queue-DUkHZjmL.js}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
-
import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
1
|
+
import { i as getChatConfig } from "./config-DvnTPCfp.js";
|
|
2
|
+
import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-9OAq-fdg.js";
|
|
3
|
+
import { t as readJuniorSecret } from "./secrets-DebYU866.js";
|
|
3
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
5
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
5
6
|
import * as z from "zod";
|
|
@@ -237,9 +238,6 @@ function queueCallback(options) {
|
|
|
237
238
|
// src/chat/queue/sign.ts
|
|
238
239
|
/** Sign and check queue messages before public callbacks run them. */
|
|
239
240
|
const QUEUE_SIGNATURE_MAX_AGE_MS = 36e5;
|
|
240
|
-
function secret() {
|
|
241
|
-
return process.env.JUNIOR_SECRET?.trim() || void 0;
|
|
242
|
-
}
|
|
243
241
|
function digest(args) {
|
|
244
242
|
return createHmac("sha256", args.secret).update([
|
|
245
243
|
args.context,
|
|
@@ -258,7 +256,7 @@ function body(value) {
|
|
|
258
256
|
}
|
|
259
257
|
/** Sign one queue message. */
|
|
260
258
|
function signQueueMessage(config, message, nowMs = Date.now()) {
|
|
261
|
-
const key =
|
|
259
|
+
const key = readJuniorSecret();
|
|
262
260
|
if (!key) throw new Error("Cannot sign queue message without JUNIOR_SECRET");
|
|
263
261
|
if (!Number.isFinite(nowMs)) throw new Error("Cannot sign queue message with an invalid clock");
|
|
264
262
|
const separator = config.separator ?? "\0";
|
|
@@ -291,7 +289,7 @@ function verifyQueueMessage(config, value, nowMs = Date.now()) {
|
|
|
291
289
|
status: "rejected",
|
|
292
290
|
reason: "malformed"
|
|
293
291
|
};
|
|
294
|
-
const key =
|
|
292
|
+
const key = readJuniorSecret();
|
|
295
293
|
if (!key) return {
|
|
296
294
|
status: "unavailable",
|
|
297
295
|
reason: "missing_secret"
|
|
@@ -371,7 +369,7 @@ function cacheWarmupCallback() {
|
|
|
371
369
|
maxDeliveries: 1,
|
|
372
370
|
onRejected: logCacheWarmupRejected,
|
|
373
371
|
run: async (message) => {
|
|
374
|
-
const { runCacheWarmup } = await import("./warmup-
|
|
372
|
+
const { runCacheWarmup } = await import("./warmup-h6u1e9n0.js").then((n) => n.o);
|
|
375
373
|
await runCacheWarmup(message);
|
|
376
374
|
},
|
|
377
375
|
skip: () => !getChatConfig().cacheWarmingEnabled,
|
|
@@ -560,7 +558,7 @@ function pluginTaskCallback() {
|
|
|
560
558
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
561
559
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
562
560
|
run: async (message) => {
|
|
563
|
-
const { processPluginTask } = await import("./task-runner-
|
|
561
|
+
const { processPluginTask } = await import("./task-runner-CKOj6xla.js").then((n) => n.r);
|
|
564
562
|
await processPluginTask(message);
|
|
565
563
|
},
|
|
566
564
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
2
|
-
import {
|
|
1
|
+
import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-Cbq5b4SO.js";
|
|
2
|
+
import { W as briefCodeChangeSchema, Y as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema, q as briefResourceLabel } from "./conversation-CMkSmi02.js";
|
|
3
3
|
import { CLI_USAGE } from "./cli/run.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import * as z from "zod";
|
|
@@ -262,7 +262,7 @@ async function parseRunOptions(argv) {
|
|
|
262
262
|
* token.
|
|
263
263
|
*/
|
|
264
264
|
async function configuredBriefModelId() {
|
|
265
|
-
const { botConfig } = await import("./config-
|
|
265
|
+
const { botConfig } = await import("./config-DvnTPCfp.js").then((n) => n.r);
|
|
266
266
|
return botConfig.fastModelId;
|
|
267
267
|
}
|
|
268
268
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-cbpOxO4M.js";
|
|
3
3
|
// src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
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-B_0Cr0MO.js";
|
|
2
2
|
export declare const CHAT_USAGE = "usage: junior chat\n junior chat -p <message>";
|
|
3
3
|
export type ChatCommandOptions = {
|
|
4
4
|
mode: "interactive";
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DjMTPWEO.js";
|
|
2
2
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
|
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
101
|
import("../plugins-HYh_JOdw.js").then((n) => n.o),
|
|
102
|
-
import("../projection-
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation-
|
|
105
|
-
import("../db-
|
|
102
|
+
import("../projection-BzJQncZV.js").then((n) => n.jn),
|
|
103
|
+
import("../catalog-runtime-DgouZKZm.js").then((n) => n.t),
|
|
104
|
+
import("../validation-CXeYgBzq.js").then((n) => n.r),
|
|
105
|
+
import("../db-Dts2XvLu.js").then((n) => n.n)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,18 +152,18 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const { setBriefsConfig } = await import("../projection-
|
|
155
|
+
const { setBriefsConfig } = await import("../projection-BzJQncZV.js").then((n) => n.Wn);
|
|
156
156
|
setBriefsConfig({ enabled: true });
|
|
157
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
158
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
159
|
-
const { createLocalOAuthState } = await import("../oauth-relay-
|
|
160
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
161
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
162
|
-
const { bindMessageAgent } = await import("../message-
|
|
163
|
-
const { createChildConversationWorker } = await import("../result-
|
|
164
|
-
const { skipInputAfterConversationStop } = await import("../session-stop-
|
|
157
|
+
const { runLocalAgentTurn } = await import("../runner-CHv9X9TH.js");
|
|
158
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-C_LXY1d4.js");
|
|
159
|
+
const { createLocalOAuthState } = await import("../oauth-relay-CsfIazeF.js").then((n) => n.t);
|
|
160
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-Yy3fSCbg.js");
|
|
161
|
+
const { bindSpawnAgent } = await import("../spawn-BvULxIiu.js").then((n) => n.n);
|
|
162
|
+
const { bindMessageAgent } = await import("../message-CtaPzC7m.js").then((n) => n.n);
|
|
163
|
+
const { createChildConversationWorker } = await import("../result-DhgjR3nQ.js").then((n) => n.i);
|
|
164
|
+
const { skipInputAfterConversationStop } = await import("../session-stop-DkxI5vc3.js").then((n) => n.a);
|
|
165
165
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
166
|
-
const { processConversationWork } = await import("../worker-
|
|
166
|
+
const { processConversationWork } = await import("../worker-Hl7N292I.js").then((n) => n.n);
|
|
167
167
|
let agentRunner;
|
|
168
168
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
169
169
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
2
|
-
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-9OAq-fdg.js";
|
|
2
|
+
import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-cbpOxO4M.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-BZE2DP8I.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/cli/init.js
CHANGED
|
@@ -158,6 +158,8 @@ async function runInit(dir, log = console.log) {
|
|
|
158
158
|
fs.writeFileSync(path.join(target, ".env.example"), `SLACK_BOT_TOKEN=
|
|
159
159
|
SLACK_SIGNING_SECRET=
|
|
160
160
|
JUNIOR_SECRET=
|
|
161
|
+
JUNIOR_ENCRYPTION_KEYS=
|
|
162
|
+
JUNIOR_ENCRYPTION_KEY_ID=
|
|
161
163
|
JUNIOR_BOT_NAME=
|
|
162
164
|
AI_MODEL=
|
|
163
165
|
AI_FAST_MODEL=
|
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-ifgjyfpF.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-C4rBP8ne.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-CbNYM-q2.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
1
|
+
import { n as JuniorPluginSet } from "../plugins-B_0Cr0MO.js";
|
|
2
2
|
import { PluginCliIo } from "@sentry/junior-plugin-api";
|
|
3
3
|
export type PluginCommandIo = PluginCliIo;
|
|
4
4
|
export interface CliPluginCommandDispatcher {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as getDb } from "../db-
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { Hn as validatePlugins, Vn as setPlugins, Xa as createPluginLogger } from "../projection-BzJQncZV.js";
|
|
2
|
+
import { o as getDb } from "../db-Dts2XvLu.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-DgouZKZm.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-CXeYgBzq.js";
|
|
5
5
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-HYh_JOdw.js";
|
|
6
6
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
3
|
-
import {
|
|
4
|
-
import { n as resolve } from "../resolve-
|
|
1
|
+
import { Ti as create, ja as SANDBOX_RUNTIME } from "../projection-BzJQncZV.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-DgouZKZm.js";
|
|
3
|
+
import { r as disconnectStateAdapter } from "../state-CO9ETDzk.js";
|
|
4
|
+
import { n as resolve } from "../resolve-t-pmRdwS.js";
|
|
5
5
|
// src/cli/snapshot-create.ts
|
|
6
6
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
7
7
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
1
|
+
import { i as getChatConfig } from "../config-DvnTPCfp.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-Ck73J0wP.js";
|
|
3
|
+
import { t as createPluginCatalogRuntime } from "../registry-cbpOxO4M.js";
|
|
4
4
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-HYh_JOdw.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -8,69 +8,6 @@ import { createHash } from "node:crypto";
|
|
|
8
8
|
import { readMigrationFiles } from "drizzle-orm/migrator";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { createJiti } from "jiti";
|
|
11
|
-
// src/db/concurrent-indexes.ts
|
|
12
|
-
const CONCURRENT_INDEX_MARKER = "-- junior:concurrent-index";
|
|
13
|
-
const INDEX_STATEMENT = /^CREATE INDEX "([a-z0-9_]+)" ON "([a-z0-9_]+)" .+;$/;
|
|
14
|
-
function markedIndexes(migration) {
|
|
15
|
-
const lines = migration.sql.join("").split("\n").map((line) => line.trim());
|
|
16
|
-
const indexes = [];
|
|
17
|
-
for (const [index, line] of lines.entries()) {
|
|
18
|
-
if (line !== CONCURRENT_INDEX_MARKER) continue;
|
|
19
|
-
const statement = lines[index + 1] ?? "";
|
|
20
|
-
const match = INDEX_STATEMENT.exec(statement);
|
|
21
|
-
if (!match?.[1] || !match[2]) throw new Error(`Migration ${migration.folderMillis}: the line after "${CONCURRENT_INDEX_MARKER}" must be one CREATE INDEX statement on one line.`);
|
|
22
|
-
indexes.push({
|
|
23
|
-
name: match[1],
|
|
24
|
-
statement,
|
|
25
|
-
table: match[2]
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return indexes;
|
|
29
|
-
}
|
|
30
|
-
/** Remove the schema name so indexes on same-name tables compare equal. */
|
|
31
|
-
function withoutSchema(definition) {
|
|
32
|
-
return definition.replace(/ ON [^ ]+\./, " ON ");
|
|
33
|
-
}
|
|
34
|
-
async function readIndexState(executor, name) {
|
|
35
|
-
const [row] = await executor.query(`SELECT pg_get_indexdef(indexrelid) AS definition,
|
|
36
|
-
indisvalid AND indisready AS usable
|
|
37
|
-
FROM pg_index
|
|
38
|
-
WHERE indexrelid = to_regclass($1)`, [name]);
|
|
39
|
-
return row;
|
|
40
|
-
}
|
|
41
|
-
async function expectedDefinition(executor, index) {
|
|
42
|
-
return await executor.transaction(async () => {
|
|
43
|
-
await executor.execute(`CREATE TEMPORARY TABLE "${index.table}" (LIKE "${index.table}") ON COMMIT DROP`);
|
|
44
|
-
await executor.execute(index.statement);
|
|
45
|
-
const [row] = await executor.query(`SELECT pg_get_indexdef(format('pg_temp.%I', $1::text)::regclass) AS definition`, [index.name]);
|
|
46
|
-
if (!row) throw new Error(`Index ${index.name} was not built on the empty copy.`);
|
|
47
|
-
return withoutSchema(row.definition);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async function buildConcurrentIndex(executor, index) {
|
|
51
|
-
const [table] = await executor.query(`SELECT to_regclass($1) IS NOT NULL AS "exists"`, [index.table]);
|
|
52
|
-
if (!table?.exists) return;
|
|
53
|
-
const expected = await expectedDefinition(executor, index);
|
|
54
|
-
let state = await readIndexState(executor, index.name);
|
|
55
|
-
if (state && !state.usable) {
|
|
56
|
-
await executor.execute(`DROP INDEX CONCURRENTLY IF EXISTS "${index.name}"`);
|
|
57
|
-
state = void 0;
|
|
58
|
-
}
|
|
59
|
-
if (!state) {
|
|
60
|
-
await executor.execute(index.statement.replace(/^CREATE INDEX /, "CREATE INDEX CONCURRENTLY "));
|
|
61
|
-
state = await readIndexState(executor, index.name);
|
|
62
|
-
}
|
|
63
|
-
if (!state?.usable || withoutSchema(state.definition) !== expected) throw new Error(`Index ${index.name} does not match its migration. Expected "${expected}", found "${state?.definition ?? "no index"}". Drop the index, then run junior upgrade again.`);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Build the marked indexes of pending migrations before the transactional
|
|
67
|
-
* migrate, so that the migrate does not block writes to existing tables.
|
|
68
|
-
* Call it while the migration lock is held.
|
|
69
|
-
*/
|
|
70
|
-
async function buildPendingConcurrentIndexes(executor, migrations, appliedAt) {
|
|
71
|
-
const pending = migrations.filter((migration) => appliedAt === void 0 || migration.folderMillis > appliedAt);
|
|
72
|
-
for (const index of pending.flatMap(markedIndexes)) await buildConcurrentIndex(executor, index);
|
|
73
|
-
}
|
|
74
11
|
// src/db/postgres-error.ts
|
|
75
12
|
/** Return whether an unknown PostgreSQL failure has the requested SQLSTATE. */
|
|
76
13
|
function isPostgresErrorCode(error, code) {
|
|
@@ -142,7 +79,6 @@ async function migrateSchema(executor) {
|
|
|
142
79
|
const lockedState = await loadCoreMigrationState(executor);
|
|
143
80
|
if (isCurrentMigrationState(lockedState, latestMigration.folderMillis)) return migrationResult(migrations, lockedState);
|
|
144
81
|
assertSupportedMigrationState(lockedState);
|
|
145
|
-
await buildPendingConcurrentIndexes(executor, migrations, lockedState.appliedAt);
|
|
146
82
|
await executor.migrate({
|
|
147
83
|
migrationsFolder,
|
|
148
84
|
migrationsTable: MIGRATIONS_TABLE
|
|
@@ -257,13 +193,10 @@ async function migratePluginSchemas(executor, roots, options = {}) {
|
|
|
257
193
|
table
|
|
258
194
|
});
|
|
259
195
|
const existing = appliedCount(migrations, currentTime);
|
|
260
|
-
if (existing < migrations.length) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
migrationsTable: table
|
|
265
|
-
});
|
|
266
|
-
}
|
|
196
|
+
if (existing < migrations.length) await executor.migrate({
|
|
197
|
+
migrationsFolder: root.dir,
|
|
198
|
+
migrationsTable: table
|
|
199
|
+
});
|
|
267
200
|
return {
|
|
268
201
|
existing,
|
|
269
202
|
migrated: migrations.length - existing,
|