@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.
Files changed (85) hide show
  1. package/dist/{admin-uuecrKuD.js → admin-ifgjyfpF.js} +2 -2
  2. package/dist/{agent-runner-DHq1pjUg.js → agent-runner-DjMTPWEO.js} +192 -100
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +5 -5
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +73 -29
  7. package/dist/{app-fWzCHFIb.d.ts → app-uiTzRbvq.d.ts} +5 -3
  8. package/dist/app.d.ts +2 -2
  9. package/dist/app.js +64 -74
  10. package/dist/{automation-BE3z19VN.js → automation-yJX3C7i3.js} +3 -3
  11. package/dist/{background-compaction-queue-D7ncdEa6.js → background-compaction-queue-DUkHZjmL.js} +7 -9
  12. package/dist/{briefs-NpgMEFh1.js → briefs-CbNYM-q2.js} +3 -3
  13. package/dist/{catalog-runtime-DwbTyNRD.js → catalog-runtime-DgouZKZm.js} +1 -1
  14. package/dist/cli/chat.d.ts +1 -1
  15. package/dist/cli/chat.js +15 -15
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/init.js +2 -0
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.d.ts +1 -1
  20. package/dist/cli/plugins.js +4 -4
  21. package/dist/cli/snapshot-create.js +4 -4
  22. package/dist/cli/upgrade.d.ts +2 -2
  23. package/dist/cli/upgrade.js +7 -74
  24. package/dist/{config-B4b-NXH5.js → config-DvnTPCfp.js} +58 -7
  25. package/dist/{connections-Dz_AQg5p.js → connections-CWaIVl_1.js} +6 -6
  26. package/dist/{conversation-CtjR1Zcx.js → conversation-CMkSmi02.js} +3 -11
  27. package/dist/{conversation-pending-messages-1Kad1Mif.js → conversation-feed-BVAOga0H.js} +27 -2
  28. package/dist/{conversation-privacy-DRsSgLGO.js → conversation-privacy-DPjv4SnA.js} +1 -1
  29. package/dist/{credential-sync-ClCnnGVj.js → credential-sync-BhbaZfmO.js} +16 -15
  30. package/dist/{db-BbpttyKH.d.ts → db-CCUqQe0E.d.ts} +13 -6
  31. package/dist/{db-CoA7_Xqu.js → db-Dts2XvLu.js} +144 -7
  32. package/dist/{executor-SWyHhit0.js → executor-Ck73J0wP.js} +64 -10
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{logging-BN5drSEZ.js → logging-9OAq-fdg.js} +2 -1
  35. package/dist/{message-D4qjpW1C.js → message-CtaPzC7m.js} +9 -9
  36. package/dist/nitro.d.ts +2 -2
  37. package/dist/nitro.js +2 -2
  38. package/dist/{oauth-callback-server-Xi-mTLOV.js → oauth-callback-server-C_LXY1d4.js} +2 -2
  39. package/dist/{oauth-relay-D6xxVywK.js → oauth-relay-CsfIazeF.js} +2 -1
  40. package/dist/{plugins-DtmjkTza.d.ts → plugins-B_0Cr0MO.d.ts} +0 -1
  41. package/dist/{projection-DXl4ftyL.js → projection-BzJQncZV.js} +251 -161
  42. package/dist/{prompt-Dmx6IfWZ.js → prompt-Cbq5b4SO.js} +5 -6
  43. package/dist/{registry-DosVt9f9.js → registry-cbpOxO4M.js} +3 -13
  44. package/dist/{resolve-BDjWJC9s.js → resolve-t-pmRdwS.js} +3 -3
  45. package/dist/{result-CaAFpf4B.js → result-DhgjR3nQ.js} +8 -8
  46. package/dist/{runner-h96Mkss6.js → runner-CHv9X9TH.js} +8 -8
  47. package/dist/{sandbox-egress-signals-rK91BW7i.js → sandbox-egress-signals-Yy3fSCbg.js} +1 -1
  48. package/dist/{schema-C_v8wb80.js → schema-BhneuGYv.js} +39 -7
  49. package/dist/{schema-CHsBmXIj.d.ts → schema-TSEisVJR.d.ts} +87 -14
  50. package/dist/secrets-DebYU866.js +18 -0
  51. package/dist/{service-account-WUMVuqVL.js → service-account-C4rBP8ne.js} +3 -3
  52. package/dist/{service-account-BpGpScaT.js → service-account-DjPIwCMj.js} +42 -26
  53. package/dist/{session-stop-xYK15HUu.js → session-stop-DkxI5vc3.js} +20 -775
  54. package/dist/{skills-DHApyCjj.js → skills-BZE2DP8I.js} +2 -2
  55. package/dist/{spawn-BQQrwGNe.js → spawn-BvULxIiu.js} +5 -5
  56. package/dist/{adapter-CMJfmHso.js → state-CO9ETDzk.js} +132 -2
  57. package/dist/{stop-CBeD6_Gs.js → stop-CL-rdtQb.js} +85 -32
  58. package/dist/{store-xtibD98L.js → store-DgD78_NK.js} +3 -3
  59. package/dist/{task-runner-BYPN4BEO.js → task-runner-CKOj6xla.js} +11 -11
  60. package/dist/{turn-failure-response-jNVl00MD.js → turn-failure-response-BTSo6SMJ.js} +8 -8
  61. package/dist/{validation-DGeB_moV.js → validation-CXeYgBzq.js} +1 -1
  62. package/dist/{version-C6nqU3Qc.js → version-AQa7Fr2H.js} +1 -1
  63. package/dist/version.js +1 -1
  64. package/dist/{viewer-9KLQibjn.js → viewer-Bqkb678l.js} +3 -3
  65. package/dist/warmup-h6u1e9n0.js +1869 -0
  66. package/dist/{work-xwX6unUE.js → work-yN_GAuXY.js} +11 -11
  67. package/dist/{worker-CiCCfwd4.js → worker-Hl7N292I.js} +6 -6
  68. package/migrations/0062_plugin_report_index.sql +1 -20
  69. package/migrations/0078_plugin_conversation_index.sql +1 -20
  70. package/migrations/0079_conversation_event_author_index.sql +1 -20
  71. package/migrations/0080_conversation_event_latest_message_indexes.sql +2 -27
  72. package/migrations/0090_guardian_review_time_index.sql +1 -20
  73. package/migrations/0091_conversation_participant_unsubscribed_index.sql +1 -20
  74. package/migrations/0097_conversation_kind_automation.sql +6 -0
  75. package/migrations/0098_review_item_plugin_actions.sql +5 -0
  76. package/migrations/0099_conversation_last_message_at.sql +1 -0
  77. package/migrations/0100_automation_task_kind_repair.sql +48 -0
  78. package/migrations/meta/0097_snapshot.json +4490 -0
  79. package/migrations/meta/0098_snapshot.json +4490 -0
  80. package/migrations/meta/0099_snapshot.json +4720 -0
  81. package/migrations/meta/0100_snapshot.json +4496 -0
  82. package/migrations/meta/_journal.json +28 -0
  83. package/package.json +5 -5
  84. package/dist/assistant-reply-CIApSfor.js +0 -58
  85. 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 bindEventAutomationCredentialSubject, Aa as parseSandboxEgressCredentialToken, An as createUserTokenStore, Ao as listConversationAnnotations, Ar as reviewItemReaderForUser, At as isInvalidConversationRecordError, Ba as createPluginEmbedder, C as settleConversationTitleWork, Da as consumeSandboxEgressAuthRequiredSignal, Do as resolveRootVisibility, Ea as clearSandboxEgressSignals, Fi as proxyVercelSandboxEgressRequest, Gi as slackMention, Gn as setPlugins, Gr as collectEventMatchKeys, Hi as formatSlackLink, Ho as getConfigDefaults, In as createPluginEventPublisher, Io as createPluginCache, Kn as validatePlugins, Oa as consumeSandboxEgressPermissionDeniedSignal, Ot as hasRunnableConversationWork, Pa as normalizeSandboxEgressTracePropagationDomains, Pi as isVercelSandboxEgressRequest, Pt as pruneActiveConversation, Qi as postSlackEphemeralMessage, Qr as takeDueTimerWatches, Rn as getPluginApiRoutes, Uo as setConfigDefaults, Vi as escapeSlackMrkdwnText, Wn as getPlugins, Yn as setBriefsConfig, Yr as findMatchingWatches, Zi as openSlackModal, _ as appendConversationMessages, _a as runWithWorkspaceTeamId, _o as readConversationLastEventSeq, aa as slackExternalRefIdSchema, ar as projectConversationMessages, br as canActOnReviewItem, di as getDashboardTaskLink, ei as bindScheduledAutomationCredentialSubject, eo as createPluginLogger, fa as isDmChannel, fi as parseDashboardConversationLink, ga as getWorkspaceTeamId, gr as searchReviewItems, hi as createPluginState, ho as readConversationEventPageAfter, ia as slackEntitySchema, ii as verifySlackDirectCredentialSubject, io as readConversationAccessFromSql, jr as reviewItemReaderForUserInConversation, li as getDashboardReviewItemLink, lr as dismissOpenReviewItems, mo as readConversationEventPage, ni as verifyEventAutomationCredentialSubject, pi as setDashboardConversationLinkOptions, po as readLatestConversationBrief, ri as verifyScheduledAutomationCredentialSubject, si as getDashboardConversationLink, ta as unfurlSlackLinks, ti as bindSlackDirectCredentialSubject, ua as getSlackClient, ut as CONVERSATION_WORK_STALE_ENQUEUE_MS, vo as readConversationMessageEventSeq, zi as resolveBaseUrl, zn as getPluginRoutes } from "./projection-DXl4ftyL.js";
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, q as getAttachmentStorage, u as resetRuntimeConfig } from "./config-B4b-NXH5.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-BN5drSEZ.js";
5
- import { t as JUNIOR_VERSION } from "./version-C6nqU3Qc.js";
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 { D as resolveActorIdentityId, N as recordGoogleSignIn, R as getConversationIdByProviderConversation, X as createSlackDestination, Y as touchConversationDetail, a as getConversationStore, b as withConversationMutationLock, o as getDb, p as withConversationEventLock, r as getConversationEventStore, s as getSqlExecutor, t as closeDb, x as conversationKindFromRow } from "./db-CoA7_Xqu.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-SWyHhit0.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DwbTyNRD.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-DHq1pjUg.js";
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-9KLQibjn.js";
13
- import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-CMJfmHso.js";
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 { F as annotationCard, Y as conversationBriefSchema, k as conversationTitleSchema, p as conversationFeedQuerySchema, x as conversationSurfaceSchema, y as conversationReportStatusSchema } from "./conversation-CtjR1Zcx.js";
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 { a as segmentGapsKey, d as MINUTE_MS, f as MIN_WARMUP_PREFIX_TOKENS, m as gapSegment, n as GLOBAL_GAPS_MAX, p as NO_REPLY_GAP_MS, r as GLOBAL_GAPS_TTL_MS, t as CONVERSATION_STATE_TTL_MS } from "./warmup-7S6z068f.js";
18
- 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-D7ncdEa6.js";
19
- import { D as listPendingAgentInvocationResults, E as listPendingAgentInvocationMailboxAppends } from "./turn-failure-response-jNVl00MD.js";
20
- 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-xYK15HUu.js";
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-BDjWJC9s.js";
23
- import { _ as listActiveConversationIds, g as getConversationWorkState, h as getConversation, l as clearExpiredConversationLease, m as ensureConversationWake, r as appendAndEnqueueInboundMessage } from "./store-xtibD98L.js";
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-BYPN4BEO.js";
25
- import { H as automationTaskSchema, N as scheduledRunSchema, U as automationTaskText, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-BE3z19VN.js";
26
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DGeB_moV.js";
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 { a as conversationPendingMessageDeliverySchema } from "./conversation-pending-messages-1Kad1Mif.js";
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-CBeD6_Gs.js";
30
- import { a as enqueueAgentInvocation, i as endAgentInvocationsOfStoppedWork } from "./work-xwX6unUE.js";
31
- import { n as enqueueAgentInvocationResult } from "./result-CaAFpf4B.js";
32
- import { o as unlinkProvider } from "./connections-Dz_AQg5p.js";
33
- import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-ClCnnGVj.js";
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-CiCCfwd4.js";
36
- import { t as bindMessageAgent } from "./message-D4qjpW1C.js";
37
- import { t as bindSpawnAgent } from "./spawn-BQQrwGNe.js";
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
- * One-time fill of the cache warming gap lists from stored Conversation
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 getSqlExecutor().query(`SELECT conversation_id AS "conversationId", kind,
107
- parent_conversation_id AS "parentConversationId"
108
- FROM junior_conversations
109
- WHERE last_activity_at >= $1 AND transcript_purged_at IS NULL
110
- ORDER BY last_activity_at DESC, conversation_id`, [new Date(windowStartMs).toISOString()]);
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
- return await getSqlExecutor().query(`SELECT e.conversation_id AS "conversationId", e.type,
114
- CASE WHEN e.type = 'user_message' THEN
115
- (e.payload->'provenance'->'actor'->>'userId') IS NOT NULL
116
- END AS "personInstruction",
117
- m.message->>'stopReason' AS "stopReason",
118
- m.message->>'timestamp' AS "startedAtMs",
119
- e.payload->'usage'->>'cacheRead' AS "cacheRead",
120
- e.payload->'usage'->>'cacheWrite' AS "cacheWrite"
121
- FROM junior_conversation_events e
122
- JOIN junior_conversations c ON c.conversation_id = e.conversation_id
123
- CROSS JOIN LATERAL (
124
- SELECT CASE
125
- WHEN e.type <> 'assistant_message' THEN NULL
126
- WHEN e.schema_version >= 2 THEN (e.payload->>'message')::jsonb
127
- ELSE e.payload
128
- END AS message
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 once per install from the stored
259
- * Conversation history. The heartbeat calls it each minute. After one run
260
- * completes, a call makes one state request and returns.
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 = getSchedulerSecret();
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 ?? process.env.BETTER_AUTH_SECRET ?? process.env.JUNIOR_SECRET, "JUNIOR_SECRET or BETTER_AUTH_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-CtjR1Zcx.js";
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. Write the exact target instead, such as a channel mention 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.");
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. */
@@ -1,5 +1,6 @@
1
- import { i as getChatConfig } from "./config-B4b-NXH5.js";
2
- import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-BN5drSEZ.js";
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 = secret();
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 = secret();
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-7S6z068f.js").then((n) => n.o);
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-BYPN4BEO.js").then((n) => n.r);
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-Dmx6IfWZ.js";
2
- import { G as briefCodeChangeSchema, J as briefResourceLabel, X as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CtjR1Zcx.js";
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-B4b-NXH5.js").then((n) => n.r);
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-DosVt9f9.js";
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();
@@ -1,4 +1,4 @@
1
- import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
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-DHq1pjUg.js";
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-DXl4ftyL.js").then((n) => n.Fn),
103
- import("../catalog-runtime-DwbTyNRD.js").then((n) => n.t),
104
- import("../validation-DGeB_moV.js").then((n) => n.r),
105
- import("../db-CoA7_Xqu.js").then((n) => n.n)
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-DXl4ftyL.js").then((n) => n.Jn);
155
+ const { setBriefsConfig } = await import("../projection-BzJQncZV.js").then((n) => n.Wn);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-h96Mkss6.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-Xi-mTLOV.js");
159
- const { createLocalOAuthState } = await import("../oauth-relay-D6xxVywK.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-rK91BW7i.js");
161
- const { bindSpawnAgent } = await import("../spawn-BQQrwGNe.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-D4qjpW1C.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-CaAFpf4B.js").then((n) => n.i);
164
- const { skipInputAfterConversationStop } = await import("../session-stop-xYK15HUu.js").then((n) => n.a);
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-CiCCfwd4.js").then((n) => n.n);
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-BN5drSEZ.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-DosVt9f9.js";
3
- import { i as parseSkillFile } from "../skills-DHApyCjj.js";
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-uuecrKuD.js")).runAdmin(argv);
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-WUMVuqVL.js")).runServiceAccount(argv);
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-NpgMEFh1.js")).runBriefs(argv);
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];
@@ -1,4 +1,4 @@
1
- import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
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 {
@@ -1,7 +1,7 @@
1
- import { Gn as setPlugins, Kn as validatePlugins, eo as createPluginLogger } from "../projection-DXl4ftyL.js";
2
- import { o as getDb } from "../db-CoA7_Xqu.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-DwbTyNRD.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DGeB_moV.js";
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 { Fa as SANDBOX_RUNTIME, ki as create } from "../projection-DXl4ftyL.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-DwbTyNRD.js";
3
- import { t as disconnectStateAdapter } from "../adapter-CMJfmHso.js";
4
- import { n as resolve } from "../resolve-BDjWJC9s.js";
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) {
@@ -1,5 +1,5 @@
1
- import "../db-BbpttyKH.js";
2
- import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
1
+ import "../db-CCUqQe0E.js";
2
+ import { n as JuniorPluginSet } from "../plugins-B_0Cr0MO.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
5
5
  }
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-B4b-NXH5.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-SWyHhit0.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-DosVt9f9.js";
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
- await buildPendingConcurrentIndexes(executor, migrations, currentTime);
262
- await executor.migrate({
263
- migrationsFolder: root.dir,
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,