@sentry/junior 0.281.0 → 0.283.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 (76) hide show
  1. package/dist/{adapter-RVQGEa98.js → adapter-D8-lqOBF.js} +1 -1
  2. package/dist/{admin-DQpHx6Og.js → admin-Dnw5SCXp.js} +1 -1
  3. package/dist/{agent-runner-B229gXUY.js → agent-runner-Bj7GhysW.js} +52 -29
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -6
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +94 -59
  8. package/dist/{app-BQ9RZS43.d.ts → app-CMBP-N43.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +30 -30
  11. package/dist/{assistant-reply-DQbtwc6j.js → assistant-reply-CdYsLbXL.js} +1 -1
  12. package/dist/{automation-sIsmIXH7.js → automation-MLWOrghe.js} +1 -1
  13. package/dist/{background-compaction-queue-oegyrxSe.js → background-compaction-queue-Bbsqx8Vm.js} +2 -2
  14. package/dist/{briefs-BwzGWJgR.js → briefs-C4qBY-jb.js} +4 -4
  15. package/dist/{catalog-runtime-ClKzLvbN.js → catalog-runtime-B7NRB7eH.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +74 -7
  23. package/dist/{client-DkG0Tj53.js → client-a3Ib6wxr.js} +2 -2
  24. package/dist/{config-3AZ11aSM.js → config-DFVlYCeY.js} +97 -4
  25. package/dist/{connections-C0ut_6RW.js → connections-BtnvpBEV.js} +10 -10
  26. package/dist/{conversation-DNtcULyX.js → conversation-DdT7SNar.js} +3 -1
  27. package/dist/{conversation-pending-messages-LlFnr9-m.js → conversation-pending-messages-Dct5pheX.js} +1 -1
  28. package/dist/{conversation-privacy-DAgeBGLN.js → conversation-privacy-DLq-abjU.js} +1 -1
  29. package/dist/{credential-sync-Bg8NPuvj.js → credential-sync-B4XFVcjM.js} +13 -13
  30. package/dist/{db-BCFM0CUX.d.ts → db-A_WrTY-s.d.ts} +2 -1
  31. package/dist/{executor-DLKnzP6S.js → executor-HPgHGAWK.js} +20 -3
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-DHzrobea.js → logging-2BXvW7Mp.js} +1 -1
  34. package/dist/{media-Dq9_svfQ.js → media-Bu9C6lz0.js} +3 -1
  35. package/dist/{message-LR8z5jXJ.js → message-BG1v1lXX.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +3 -11
  38. package/dist/{oauth-callback-server-EWdpj0_y.js → oauth-callback-server-CXNZJymo.js} +2 -2
  39. package/dist/{projection-Bhz1tp0G.js → projection-BfKkpOGQ.js} +42 -18
  40. package/dist/{prompt-DI6KCtwb.js → prompt-CCtaGgbI.js} +1 -1
  41. package/dist/{registry-EjhulgQW.js → registry-CLooHPAz.js} +1 -1
  42. package/dist/{resolve-Cw6OW4Fj.js → resolve-D3MK9oRJ.js} +3 -3
  43. package/dist/{result-BoD0jevy.js → result-BPCjUefO.js} +9 -9
  44. package/dist/{runner-D22bsBDS.js → runner-Ds31u3rB.js} +11 -11
  45. package/dist/{sandbox-egress-signals-BG5GYacQ.js → sandbox-egress-signals-CLd5RPUw.js} +1 -1
  46. package/dist/{schema-BN34Jy-U.js → schema-CHNP0GfH.js} +11 -4
  47. package/dist/{schema-CsqJzkP5.d.ts → schema-jW3ccLjp.d.ts} +22 -1
  48. package/dist/{service-account-xo-CeMqI.js → service-account-CWpTsoIM.js} +3 -3
  49. package/dist/{service-account-Dd1nnAQZ.js → service-account-D6AMahy7.js} +3 -3
  50. package/dist/{session-stop-CHSYB2uw.js → session-stop-D8LGC3H6.js} +12 -12
  51. package/dist/{skills-BGJr6xtW.js → skills-DuOKByQH.js} +2 -2
  52. package/dist/{spawn-Cl8WS7zi.js → spawn-CNIQGgAS.js} +2 -2
  53. package/dist/{stop-C9lHWpvl.js → stop-DX2oOIgl.js} +291 -204
  54. package/dist/{store-DeTnwVJt.js → store-61mD4ZSh.js} +4 -4
  55. package/dist/{store-C4z8gOgZ.js → store-DAJntSEv.js} +3 -3
  56. package/dist/{task-queue-BBos68l0.js → task-queue-BE70Pb9p.js} +3 -3
  57. package/dist/{task-runner-BSF9zO-H.js → task-runner-CmmfddSZ.js} +7 -7
  58. package/dist/{thread-state-DGq1o5JX.js → thread-state-0UfRMWYd.js} +4 -4
  59. package/dist/{turn-failure-response--9bA4uLP.js → turn-failure-response-DKdzxJHE.js} +7 -7
  60. package/dist/{turn-lifecycle-t5fimxwQ.js → turn-lifecycle-24sBZ4Ip.js} +1 -1
  61. package/dist/{turn-session-routing-RBtUe-3y.js → turn-session-routing-CzCnNAUO.js} +9 -9
  62. package/dist/{validation-DrR0leBT.js → validation-Cs_knhR8.js} +1 -1
  63. package/dist/{version-D_HFt_Dq.js → version-ZMC4cXWN.js} +1 -1
  64. package/dist/version.js +1 -1
  65. package/dist/{viewer-DWlpSFdj.js → viewer-CYB9T4rm.js} +19 -7
  66. package/dist/{work-pPoqtRea.js → work-J1n6RQkY.js} +11 -11
  67. package/dist/{worker-CoVKgJ-O.js → worker-s1fCvj1z.js} +6 -6
  68. package/migrations/0062_plugin_report_index.sql +3 -3
  69. package/migrations/0078_plugin_conversation_index.sql +3 -3
  70. package/migrations/0079_conversation_event_author_index.sql +3 -3
  71. package/migrations/0080_conversation_event_latest_message_indexes.sql +27 -0
  72. package/migrations/0081_conversation_pin_position.sql +1 -0
  73. package/migrations/meta/0080_snapshot.json +4265 -0
  74. package/migrations/meta/0081_snapshot.json +4271 -0
  75. package/migrations/meta/_journal.json +14 -0
  76. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  import { n as ConversationWorkQueue, t as ConversationQueueMessage } from "./queue-CZyYgPF0.js";
2
- import { t as ConversationStore } from "./db-BCFM0CUX.js";
3
- import "./schema-CsqJzkP5.js";
2
+ import { t as ConversationStore } from "./db-A_WrTY-s.js";
3
+ import "./schema-jW3ccLjp.js";
4
4
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
5
5
  import "./sentry-DrKC2NeM.js";
6
6
  import { Hono } from "hono";
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-BQ9RZS43.js";
1
+ import { i as JuniorDashboardOptions, n as JuniorAppOptions, r as createApp, t as JuniorApp } from "./app-CMBP-N43.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-DtmjkTza.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
4
4
  export { JUNIOR_VERSION, JuniorApp, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, createApp, defineJuniorPlugins };
package/dist/app.js CHANGED
@@ -1,41 +1,41 @@
1
1
  import { i as getActiveSpan, n as captureMessage, u as sentry_exports } from "./sentry-BRTJqumy.js";
2
- import { Aa as createPluginLogger, Ar as takeDueTimerWatches, C as settleConversationTitleWork, Cn as setExperimentalFeatures, Cr as collectEventMatchKeys, Ct as isInvalidConversationRecordError, Di as openSlackModal, Dr as findMatchingWatches, Fr as verifyScheduledAutomationCredentialSubject, Gi as getWorkspaceTeamId, Gr as createPluginState, Hn as setBriefsConfig, Hr as getDashboardTaskLink, Ir as verifySlackDirectCredentialSubject, Ka as readConversationEventPage, Ki as runWithWorkspaceTeamId, Kn as dismissOpenReviewItems, Ln as getPlugins, Ma as readConversationAccessFromSql, Mn as getPluginRoutes, Mr as bindScheduledAutomationCredentialSubject, Ni as slackEntitySchema, Nr as bindSlackDirectCredentialSubject, Oi as postSlackEphemeralMessage, Pi as slackExternalRefIdSchema, Pr as verifyEventAutomationCredentialSubject, Qn as searchReviewItems, Rn as setPlugins, Sn as isExperimentalFeatureEnabled, So as setConfigDefaults, Ur as setDashboardConversationLinkOptions, Vi as isDmChannel, Vr as getDashboardReviewItemLink, Xa as readConversationMessageEventSeq, Ya as readConversationLastEventSeq, _ as appendConversationMessages, aa as parseSandboxEgressCredentialToken, ao as resolveRootVisibility, at as CONVERSATION_WORK_STALE_ENQUEUE_MS, b as projectConversationMessages, co as listConversationAnnotations, di as proxyVercelSandboxEgressRequest, dn as SubscribedReplyReason, ha as createPluginEmbedder, hi as resolveBaseUrl, jn as getPluginApiRoutes, jr as bindEventAutomationCredentialSubject, la as normalizeSandboxEgressTracePropagationDomains, mn as getThreadStopDecision, na as consumeSandboxEgressAuthRequiredSignal, nr as canActOnReviewItem, po as createPluginCache, qa as readConversationEventPageAfter, ra as consumeSandboxEgressPermissionDeniedSignal, ta as clearSandboxEgressSignals, ui as isVercelSandboxEgressRequest, ur as reviewItemReaderForUser, wn as createUserTokenStore, xi as slackMention, xn as getExperimentalFeatures, xo as getConfigDefaults, xt as hasRunnableConversationWork, zi as getSlackClient, zn as validatePlugins, zr as getDashboardConversationLink } from "./projection-Bhz1tp0G.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, u as resetRuntimeConfig } from "./config-3AZ11aSM.js";
4
- import { E as withSpan, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, T as withLogContext, U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, b as setSpanAttributes, h as logWarn, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-DHzrobea.js";
5
- import { t as JUNIOR_VERSION } from "./version-D_HFt_Dq.js";
2
+ import { Aa as createPluginLogger, Ar as takeDueTimerWatches, C as settleConversationTitleWork, Cn as setExperimentalFeatures, Co as setConfigDefaults, Cr as collectEventMatchKeys, Ct as isInvalidConversationRecordError, Di as openSlackModal, Dr as findMatchingWatches, Fr as verifyScheduledAutomationCredentialSubject, Gi as getWorkspaceTeamId, Gr as createPluginState, Hn as setBriefsConfig, Hr as getDashboardTaskLink, Ir as verifySlackDirectCredentialSubject, Ja as readConversationEventPageAfter, Ki as runWithWorkspaceTeamId, Kn as dismissOpenReviewItems, Ln as getPlugins, Mn as getPluginRoutes, Mr as bindScheduledAutomationCredentialSubject, Na as readConversationAccessFromSql, Ni as slackEntitySchema, Nr as bindSlackDirectCredentialSubject, Oi as postSlackEphemeralMessage, Pi as slackExternalRefIdSchema, Pr as verifyEventAutomationCredentialSubject, Qn as searchReviewItems, Rn as setPlugins, Sn as isExperimentalFeatureEnabled, So as getConfigDefaults, Ur as setDashboardConversationLinkOptions, Vi as isDmChannel, Vr as getDashboardReviewItemLink, Xa as readConversationLastEventSeq, Za as readConversationMessageEventSeq, _ as appendConversationMessages, aa as parseSandboxEgressCredentialToken, at as CONVERSATION_WORK_STALE_ENQUEUE_MS, b as projectConversationMessages, di as proxyVercelSandboxEgressRequest, dn as SubscribedReplyReason, ha as createPluginEmbedder, hi as resolveBaseUrl, jn as getPluginApiRoutes, jr as bindEventAutomationCredentialSubject, la as normalizeSandboxEgressTracePropagationDomains, lo as listConversationAnnotations, mn as getThreadStopDecision, mo as createPluginCache, na as consumeSandboxEgressAuthRequiredSignal, nr as canActOnReviewItem, oo as resolveRootVisibility, qa as readConversationEventPage, ra as consumeSandboxEgressPermissionDeniedSignal, ta as clearSandboxEgressSignals, ui as isVercelSandboxEgressRequest, ur as reviewItemReaderForUser, wn as createUserTokenStore, xi as slackMention, xn as getExperimentalFeatures, xt as hasRunnableConversationWork, zi as getSlackClient, zn as validatePlugins, zr as getDashboardConversationLink } from "./projection-BfKkpOGQ.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, u as resetRuntimeConfig, y as getAttachmentStorage } from "./config-DFVlYCeY.js";
4
+ import { E as withSpan, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, T as withLogContext, U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, b as setSpanAttributes, h as logWarn, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, m as logInfo, p as logException, r as createRequestContext, w as withContext } from "./logging-2BXvW7Mp.js";
5
+ import { t as JUNIOR_VERSION } from "./version-ZMC4cXWN.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 { C as getSqlExecutor, H as recordGoogleSignIn, I as resolveActorIdentityId, M as withConversationMutationLock, S as getDb, Y as touchConversationDetail, _ as closeDb, g as createCache, i as readActorIdentity, k as withConversationEventLock, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore } from "./viewer-DWlpSFdj.js";
8
- import { M as juniorDestinations, S as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, h as juniorAgentInvocations, k as juniorConversations, l as juniorAutomationRuns, m as juniorAgentBindings, y as juniorConversationBriefs } from "./executor-DLKnzP6S.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-ClKzLvbN.js";
10
- import { $ as readViewerAutomations, A as runWithSlackInstallation, B as logScheduledAutomationRunSkipped, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, Dt as processWorkspaceSnapshotJob, E as buildSlackReviewItemModal, L as joinPublicChannel, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as ingestEvent, S as createSlackReviewItemShow, V as scheduledAutomationRunAttributes, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, _ as readPublicArtifact, _t as requestAttachmentDeletion, at as reviewItemChangeRecord, bt as stopConversationSession, ct as conversationTurnIdForMessage, dt as recordWebConversationActivity, ft as webActorFromUser, g as publicArtifactHeaders, ht as collectAttachmentGarbage, it as renderReviewItemMessage, j as verifySlackSignature, k as parseSlackUserInputSubmission, n as executeAgentRun, q as ViewerTaskNotFoundError, r as processBackgroundCompaction, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, tt as effectiveTaskOutcomes, v as unpublishedArtifactHeaders, w as syncReviewItemSlackCards, xt as recordSubagentEnded, y as lookupSlackUserProfile } from "./agent-runner-B229gXUY.js";
7
+ import { C as getSqlExecutor, H as recordGoogleSignIn, I as resolveActorIdentityId, M as withConversationMutationLock, S as getDb, Y as touchConversationDetail, _ as closeDb, g as createCache, i as readActorIdentity, k as withConversationEventLock, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore } from "./viewer-CYB9T4rm.js";
8
+ import { A as juniorConversations, C as juniorConversationEvents, N as juniorDestinations, c as juniorReviewItems, d as juniorAutomations, h as juniorAgentInvocations, l as juniorAutomationRuns, m as juniorAgentBindings, y as juniorConversationBriefs } from "./executor-HPgHGAWK.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B7NRB7eH.js";
10
+ import { $ as readViewerAutomations, A as runWithSlackInstallation, B as logScheduledAutomationRunSkipped, C as readSlackReviewItemCardConversationId, D as parseSlackReviewItemClick, Dt as processWorkspaceSnapshotJob, E as buildSlackReviewItemModal, L as joinPublicChannel, M as parseSlackThreadId, O as parseSlackReviewItemFormTarget, Ot as ingestEvent, S as createSlackReviewItemShow, V as scheduledAutomationRunAttributes, Y as readViewerAutomationExecutions, Z as readViewerAutomationSummary, _ as readPublicArtifact, _t as requestAttachmentDeletion, at as reviewItemChangeRecord, bt as stopConversationSession, ct as conversationTurnIdForMessage, dt as recordWebConversationActivity, ft as webActorFromUser, g as publicArtifactHeaders, ht as collectAttachmentGarbage, it as renderReviewItemMessage, j as verifySlackSignature, k as parseSlackUserInputSubmission, n as executeAgentRun, q as ViewerTaskNotFoundError, r as processBackgroundCompaction, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, tt as effectiveTaskOutcomes, v as unpublishedArtifactHeaders, w as syncReviewItemSlackCards, xt as recordSubagentEnded, y as lookupSlackUserProfile } from "./agent-runner-Bj7GhysW.js";
11
11
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
12
- import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-RVQGEa98.js";
12
+ import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-D8-lqOBF.js";
13
13
  import { n as getNextRunAtMs } from "./cadence-R7Em4RjE.js";
14
- import { H as conversationBriefSchema, b as conversationSurfaceSchema, f as conversationFeedQuerySchema, k as annotationCard, v as conversationReportStatusSchema } from "./conversation-DNtcULyX.js";
14
+ import { H as conversationBriefSchema, b as conversationSurfaceSchema, f as conversationFeedQuerySchema, k as annotationCard, v as conversationReportStatusSchema } from "./conversation-DdT7SNar.js";
15
15
  import { t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
16
- import { S as listPendingAgentInvocationResults, x as listPendingAgentInvocationMailboxAppends } from "./store-DeTnwVJt.js";
17
- import { A as renderSlackObjectCard, T as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-CHSYB2uw.js";
16
+ import { S as listPendingAgentInvocationResults, x as listPendingAgentInvocationMailboxAppends } from "./store-61mD4ZSh.js";
17
+ import { A as renderSlackObjectCard, T as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-D8LGC3H6.js";
18
18
  import { h as buttonUserInputField } from "./reporting-window-B-QP9zX1.js";
19
- import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-Cw6OW4Fj.js";
20
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, b as isConversationQueueMessageRejectedError, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, h as getQueueProvider, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, y as conversationQueueMessageSchema } from "./background-compaction-queue-oegyrxSe.js";
21
- import { S as removeActiveConversation, _ as hasRunnableConversationWork$1, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-C4z8gOgZ.js";
22
- import { B as readScheduledAutomation, G as blockEventAutomation, H as saveScheduledAutomationInLock, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, W as withScheduledAutomationLock, Y as findMatchingEventAutomations, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, ht as eventGuidance, it as automationVersionOf, m as listPendingDispatchMailboxAppends, nt as eventAutomationRunLimitReason, o as createOrGetDispatch, p as isTerminalDispatchStatus, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed } from "./turn-session-routing-RBtUe-3y.js";
23
- import { M as scheduledRunSchema, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-sIsmIXH7.js";
24
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DrR0leBT.js";
19
+ import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-D3MK9oRJ.js";
20
+ import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, b as isConversationQueueMessageRejectedError, c as verifyWorkspaceSnapshotJobMessage, d as verifyConversationQueueMessage, h as getQueueProvider, i as verifyBackgroundCompactionMessage, l as getVercelConversationWorkQueue, r as vercelBackgroundCompactionQueue, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic, y as conversationQueueMessageSchema } from "./background-compaction-queue-Bbsqx8Vm.js";
21
+ import { S as removeActiveConversation, _ as hasRunnableConversationWork$1, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-DAJntSEv.js";
22
+ import { B as readScheduledAutomation, G as blockEventAutomation, H as saveScheduledAutomationInLock, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, W as withScheduledAutomationLock, Y as findMatchingEventAutomations, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, ht as eventGuidance, it as automationVersionOf, m as listPendingDispatchMailboxAppends, nt as eventAutomationRunLimitReason, o as createOrGetDispatch, p as isTerminalDispatchStatus, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed } from "./turn-session-routing-CzCnNAUO.js";
23
+ import { M as scheduledRunSchema, l as automationListQuerySchema, s as automationExecutionStatusSchema } from "./automation-MLWOrghe.js";
24
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Cs_knhR8.js";
25
25
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-HYh_JOdw.js";
26
- import { a as conversationPendingMessageDeliverySchema } from "./conversation-pending-messages-LlFnr9-m.js";
27
- import { A as assertNoLegacyAllowedDomains, B as normalizeIncomingSlackThreadId, D as createProductionSlackWebhookServices, E as createProductionConversationWorkOptions, F as recordSkippedConversationMessage, G as startProcessingReaction, H as stopConversationTurn, I as buildSlackInboundMessage, J as ReviewItemActionError, K as stripLeadingBotMention, L as clearSlackPendingReactions, M as isAllowedSignInEmail, N as readEnvList, O as getProductionSlackAdapter, P as resolveAllowedDomains, Q as reviewItemChange, R as isSlackMessageStopped, S as readConversationPendingMessages, T as archiveConversation, U as THREAD_OPTOUT_ACK, V as withNormalizedThreadId, W as bindMessageAuthorIdentityId, X as closeReviewItemsAnsweredByReply, Y as actOnReviewItem, Z as readReviewItemForUser, _ as appendConversationMessageForViewer, b as encodeConversationCursor, ct as getAttachmentStorage, d as readConversationRecordFromSql, dt as GET$4, et as archiveViewerDoneConversations, i as readConversationDetail, j as isAllowedDomain, k as createSlackWebApiStatusSender, n as steerConversationPendingMessagesForViewer, nt as runAutoArchiveSweep, o as markConversationRead, q as parseContent, r as pinConversation, rt as setConversationAutoArchive, t as stopConversationTurnForViewer, u as readConversationFeed, ut as enqueueAgentDispatch, v as createConversationForViewer, x as cancelConversationPendingMessagesForViewer, y as decodeConversationCursor, z as stopSlackThread } from "./stop-C9lHWpvl.js";
28
- import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-BoD0jevy.js";
29
- import { i as enqueueAgentInvocation, r as endAgentInvocationsOfStoppedWork } from "./work-pPoqtRea.js";
30
- import { o as coerceThreadConversationState } from "./thread-state-DGq1o5JX.js";
31
- import { o as unlinkProvider } from "./connections-C0ut_6RW.js";
32
- import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-Bg8NPuvj.js";
26
+ import { a as conversationPendingMessageDeliverySchema } from "./conversation-pending-messages-Dct5pheX.js";
27
+ import { $ as reviewItemChange, A as createSlackWebApiStatusSender, B as stopSlackThread, C as readConversationPendingMessages, D as createProductionConversationWorkOptions, E as archiveConversation, F as resolveAllowedDomains, G as bindMessageAuthorIdentityId, H as withNormalizedThreadId, I as recordSkippedConversationMessage, J as parseContent, K as startProcessingReaction, L as buildSlackInboundMessage, M as isAllowedDomain, N as isAllowedSignInEmail, O as createProductionSlackWebhookServices, P as readEnvList, Q as readReviewItemForUser, R as clearSlackPendingReactions, S as cancelConversationPendingMessagesForViewer, U as stopConversationTurn, V as normalizeIncomingSlackThreadId, W as THREAD_OPTOUT_ACK, X as actOnReviewItem, Y as ReviewItemActionError, Z as closeReviewItemsAnsweredByReply, a as readConversationDetail, b as decodeConversationCursor, d as readConversationFeed, dt as GET$4, f as readConversationRecordFromSql, it as setConversationAutoArchive, j as assertNoLegacyAllowedDomains, k as getProductionSlackAdapter, n as steerConversationPendingMessagesForViewer, q as stripLeadingBotMention, r as pinConversation, rt as runAutoArchiveSweep, s as markConversationRead, t as stopConversationTurnForViewer, tt as archiveViewerDoneConversations, ut as enqueueAgentDispatch, v as appendConversationMessageForViewer, x as encodeConversationCursor, y as createConversationForViewer, z as isSlackMessageStopped } from "./stop-DX2oOIgl.js";
28
+ import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-BPCjUefO.js";
29
+ import { i as enqueueAgentInvocation, r as endAgentInvocationsOfStoppedWork } from "./work-J1n6RQkY.js";
30
+ import { o as coerceThreadConversationState } from "./thread-state-0UfRMWYd.js";
31
+ import { o as unlinkProvider } from "./connections-BtnvpBEV.js";
32
+ import { a as GET$5, i as publishAppHomeView, r as GET$6, t as receiveLocalOAuthCredential } from "./credential-sync-B4XFVcjM.js";
33
33
  import { t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
34
- import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-BBos68l0.js";
35
- import { t as processConversationWork } from "./worker-CoVKgJ-O.js";
36
- import { t as bindMessageAgent } from "./message-LR8z5jXJ.js";
37
- import { t as bindSpawnAgent } from "./spawn-Cl8WS7zi.js";
38
- import { t as processPluginTask } from "./task-runner-BSF9zO-H.js";
34
+ import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-BE70Pb9p.js";
35
+ import { t as processConversationWork } from "./worker-s1fCvj1z.js";
36
+ import { t as bindMessageAgent } from "./message-BG1v1lXX.js";
37
+ import { t as bindSpawnAgent } from "./spawn-CNIQGgAS.js";
38
+ import { t as processPluginTask } from "./task-runner-CmmfddSZ.js";
39
39
  import { createRequire } from "node:module";
40
40
  import { Hono } from "hono";
41
41
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { Wt as extractAssistantText } from "./projection-Bhz1tp0G.js";
1
+ import { Wt as extractAssistantText } from "./projection-BfKkpOGQ.js";
2
2
  // src/chat/no-reply.ts
3
3
  const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { a as resolveLocalScheduleAtMs, i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
2
- import { r as actorIdentitySchema } from "./conversation-DNtcULyX.js";
2
+ import { r as actorIdentitySchema } from "./conversation-DdT7SNar.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/scheduled-automations/schedule-intent.ts
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-3AZ11aSM.js";
2
- import { E as withSpan, m as logInfo, p as logException } from "./logging-DHzrobea.js";
1
+ import { i as getChatConfig } from "./config-DFVlYCeY.js";
2
+ import { E as withSpan, m as logInfo, p as logException } from "./logging-2BXvW7Mp.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
5
5
  import * as z from "zod";
@@ -1,6 +1,6 @@
1
- import { i as completeObject } from "./client-DkG0Tj53.js";
2
- import { U as parseBriefInput, c as conversationDetailReportSchema, u as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-DNtcULyX.js";
3
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DI6KCtwb.js";
1
+ import { i as completeObject } from "./client-a3Ib6wxr.js";
2
+ import { U as parseBriefInput, c as conversationDetailReportSchema, u as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-DdT7SNar.js";
3
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CCtaGgbI.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import path from "node:path";
6
6
  import * as z from "zod";
@@ -263,7 +263,7 @@ async function parseRunOptions(argv) {
263
263
  * token.
264
264
  */
265
265
  async function configuredBriefModelId() {
266
- const { botConfig } = await import("./config-3AZ11aSM.js").then((n) => n.r);
266
+ const { botConfig } = await import("./config-DFVlYCeY.js").then((n) => n.r);
267
267
  return botConfig.fastModelId;
268
268
  }
269
269
  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-EjhulgQW.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-CLooHPAz.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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-B229gXUY.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-Bj7GhysW.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-Bhz1tp0G.js").then((n) => n.kn),
103
- import("../catalog-runtime-ClKzLvbN.js").then((n) => n.t),
104
- import("../validation-DrR0leBT.js").then((n) => n.r),
105
- import("../viewer-DWlpSFdj.js").then((n) => n.v)
102
+ import("../projection-BfKkpOGQ.js").then((n) => n.kn),
103
+ import("../catalog-runtime-B7NRB7eH.js").then((n) => n.t),
104
+ import("../validation-Cs_knhR8.js").then((n) => n.r),
105
+ import("../viewer-CYB9T4rm.js").then((n) => n.v)
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-Bhz1tp0G.js").then((n) => n.Vn);
155
+ const { setBriefsConfig } = await import("../projection-BfKkpOGQ.js").then((n) => n.Vn);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-D22bsBDS.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-EWdpj0_y.js");
157
+ const { runLocalAgentTurn } = await import("../runner-Ds31u3rB.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CXNZJymo.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-D6xxVywK.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BG5GYacQ.js");
161
- const { bindSpawnAgent } = await import("../spawn-Cl8WS7zi.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-LR8z5jXJ.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-BoD0jevy.js").then((n) => n.i);
164
- const { skipInputBeforeConversationStop } = await import("../session-stop-CHSYB2uw.js").then((n) => n.r);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CLd5RPUw.js");
161
+ const { bindSpawnAgent } = await import("../spawn-CNIQGgAS.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-BG1v1lXX.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-BPCjUefO.js").then((n) => n.i);
164
+ const { skipInputBeforeConversationStop } = await import("../session-stop-D8LGC3H6.js").then((n) => n.r);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-CoVKgJ-O.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-s1fCvj1z.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 { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, L as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, M as JUNIOR_HEARTBEAT_ROUTE } from "../logging-DHzrobea.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-EjhulgQW.js";
3
- import { i as parseSkillFile } from "../skills-BGJr6xtW.js";
1
+ import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, L as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, M as JUNIOR_HEARTBEAT_ROUTE } from "../logging-2BXvW7Mp.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-CLooHPAz.js";
3
+ import { i as parseSkillFile } from "../skills-DuOKByQH.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/main.js CHANGED
@@ -25,13 +25,13 @@ async function runChat(argv, pluginSet) {
25
25
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
26
26
  }
27
27
  async function runAdmin(argv) {
28
- return await (await import("../admin-DQpHx6Og.js")).runAdmin(argv);
28
+ return await (await import("../admin-Dnw5SCXp.js")).runAdmin(argv);
29
29
  }
30
30
  async function runServiceAccount(argv) {
31
- return await (await import("../service-account-xo-CeMqI.js")).runServiceAccount(argv);
31
+ return await (await import("../service-account-CWpTsoIM.js")).runServiceAccount(argv);
32
32
  }
33
33
  async function runBriefs(argv) {
34
- return await (await import("../briefs-BwzGWJgR.js")).runBriefs(argv);
34
+ return await (await import("../briefs-C4qBY-jb.js")).runBriefs(argv);
35
35
  }
36
36
  function topLevelCommand(argv) {
37
37
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,7 +1,7 @@
1
- import { Aa as createPluginLogger, Rn as setPlugins, zn as validatePlugins } from "../projection-Bhz1tp0G.js";
2
- import { S as getDb } from "../viewer-DWlpSFdj.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-ClKzLvbN.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DrR0leBT.js";
1
+ import { Aa as createPluginLogger, Rn as setPlugins, zn as validatePlugins } from "../projection-BfKkpOGQ.js";
2
+ import { S as getDb } from "../viewer-CYB9T4rm.js";
3
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-B7NRB7eH.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Cs_knhR8.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 { ai as create } from "../projection-Bhz1tp0G.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-ClKzLvbN.js";
3
- import { t as disconnectStateAdapter } from "../adapter-RVQGEa98.js";
4
- import { n as resolve } from "../resolve-Cw6OW4Fj.js";
1
+ import { ai as create } from "../projection-BfKkpOGQ.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-B7NRB7eH.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-D8-lqOBF.js";
4
+ import { n as resolve } from "../resolve-D3MK9oRJ.js";
5
5
  // src/cli/snapshot-create.ts
6
6
  const DEFAULT_RUNTIME = "node22";
7
7
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,4 +1,4 @@
1
- import "../db-BCFM0CUX.js";
1
+ import "../db-A_WrTY-s.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-3AZ11aSM.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-DLKnzP6S.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-EjhulgQW.js";
1
+ import { i as getChatConfig } from "../config-DFVlYCeY.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-HPgHGAWK.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-CLooHPAz.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,6 +8,69 @@ import { createHash } from "node:crypto";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { createJiti } from "jiti";
10
10
  import { readMigrationFiles } from "drizzle-orm/migrator";
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
+ }
11
74
  // src/db/postgres-error.ts
12
75
  /** Return whether an unknown PostgreSQL failure has the requested SQLSTATE. */
13
76
  function isPostgresErrorCode(error, code) {
@@ -79,6 +142,7 @@ async function migrateSchema(executor) {
79
142
  const lockedState = await loadCoreMigrationState(executor);
80
143
  if (isCurrentMigrationState(lockedState, latestMigration.folderMillis)) return migrationResult(migrations, lockedState);
81
144
  assertSupportedMigrationState(lockedState);
145
+ await buildPendingConcurrentIndexes(executor, migrations, lockedState.appliedAt);
82
146
  await executor.migrate({
83
147
  migrationsFolder,
84
148
  migrationsTable: MIGRATIONS_TABLE
@@ -172,10 +236,13 @@ async function migratePluginSchemas(executor, roots, options = {}) {
172
236
  table
173
237
  });
174
238
  const existing = appliedCount(migrations, currentTime);
175
- if (existing < migrations.length) await executor.migrate({
176
- migrationsFolder: root.dir,
177
- migrationsTable: table
178
- });
239
+ if (existing < migrations.length) {
240
+ await buildPendingConcurrentIndexes(executor, migrations, currentTime);
241
+ await executor.migrate({
242
+ migrationsFolder: root.dir,
243
+ migrationsTable: table
244
+ });
245
+ }
179
246
  return {
180
247
  existing,
181
248
  migrated: migrations.length - existing,
@@ -1,5 +1,5 @@
1
- import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DHzrobea.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DAgeBGLN.js";
1
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-2BXvW7Mp.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DLq-abjU.js";
3
3
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
4
4
  import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
5
5
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -1,7 +1,96 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { c as resolveGatewayModel, w as toOptionalTrimmed } from "./client-DkG0Tj53.js";
2
+ import { c as resolveGatewayModel, w as toOptionalTrimmed } from "./client-a3Ib6wxr.js";
3
3
  import { AwsClient } from "aws4fetch";
4
+ import { del, get, put } from "@vercel/blob";
4
5
  import * as z from "zod";
6
+ // src/chat/attachments/memory.ts
7
+ /**
8
+ * Store attachments in process memory, for tests.
9
+ *
10
+ * Objects are lost when the process stops, and each process has its own
11
+ * copy. Do not use this provider for deployed apps.
12
+ */
13
+ function createMemoryAttachmentStorage() {
14
+ const objects = /* @__PURE__ */ new Map();
15
+ return {
16
+ objects,
17
+ provider: "memory",
18
+ async put(input) {
19
+ objects.set(input.key, Buffer.from(input.body));
20
+ },
21
+ async get(key, range) {
22
+ const body = objects.get(key);
23
+ if (!body) return null;
24
+ const bytes = range ? body.subarray(range.start, range.end + 1) : body;
25
+ return new ReadableStream({ start(controller) {
26
+ controller.enqueue(new Uint8Array(bytes));
27
+ controller.close();
28
+ } });
29
+ },
30
+ async delete(keys) {
31
+ for (const key of keys) objects.delete(key);
32
+ }
33
+ };
34
+ }
35
+ // src/chat/attachments/vercel.ts
36
+ /** Store private conversation attachments in Vercel Blob. */
37
+ function createVercelAttachmentStorage() {
38
+ return {
39
+ provider: "vercel-blob",
40
+ async put(input) {
41
+ await put(input.key, input.body, {
42
+ access: "private",
43
+ addRandomSuffix: false,
44
+ allowOverwrite: true,
45
+ contentType: input.contentType
46
+ });
47
+ },
48
+ async get(key, range) {
49
+ const result = await get(key, {
50
+ access: "private",
51
+ useCache: false,
52
+ ...range ? { headers: { range: rangeHeader(range) } } : void 0
53
+ });
54
+ if (result?.statusCode !== 200) return null;
55
+ if (range && !result.headers.get("content-range")) {
56
+ await result.stream.cancel();
57
+ throw new Error("Vercel Blob get ignored the byte range");
58
+ }
59
+ return result.stream;
60
+ },
61
+ async delete(keys) {
62
+ if (keys.length === 0) return;
63
+ await del(keys);
64
+ }
65
+ };
66
+ }
67
+ // src/chat/attachments/storage.ts
68
+ /** Build the HTTP `Range` request header value for one byte range. */
69
+ function rangeHeader(range) {
70
+ return `bytes=${range.start}-${range.end}`;
71
+ }
72
+ /**
73
+ * Return attachment storage for the configured provider.
74
+ *
75
+ * Callers do not choose a provider. Chat config decides it.
76
+ */
77
+ function getAttachmentStorage() {
78
+ return createAttachmentStorage(getChatConfig().attachmentStorage);
79
+ }
80
+ /**
81
+ * Create attachment storage for one provider config.
82
+ *
83
+ * Runtime code uses `getAttachmentStorage()`. Call this only to test a
84
+ * provider adapter with its own config.
85
+ */
86
+ function createAttachmentStorage(config) {
87
+ switch (config.provider) {
88
+ case "vercel-blob": return createVercelAttachmentStorage();
89
+ case "s3": return createS3AttachmentStorage(config.s3);
90
+ case "memory": return createMemoryAttachmentStorage();
91
+ default: throw new Error(`Unsupported attachment storage provider: ${String(config.provider)}`);
92
+ }
93
+ }
5
94
  // src/chat/attachments/s3.ts
6
95
  function readRequiredSetting(env, name) {
7
96
  const value = toOptionalTrimmed(env[name]);
@@ -62,13 +151,17 @@ function createS3AttachmentStorage(config) {
62
151
  method: "PUT"
63
152
  }), "put");
64
153
  },
65
- async get(key) {
66
- const response = await client.fetch(objectUrl(config, key));
154
+ async get(key, range) {
155
+ const response = await client.fetch(objectUrl(config, key), range ? { headers: { range: rangeHeader(range) } } : void 0);
67
156
  if (response.status === 404) {
68
157
  await drain(response);
69
158
  return null;
70
159
  }
71
160
  if (!response.ok) await expectOk(response, "get");
161
+ if (range && response.status !== 206) {
162
+ await drain(response);
163
+ throw new Error(`S3 get ignored the byte range with status ${response.status}`);
164
+ }
72
165
  return response.body;
73
166
  },
74
167
  async delete(keys) {
@@ -483,4 +576,4 @@ function setSlackReactionConfig(overrides) {
483
576
  if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
484
577
  if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
485
578
  }
486
- export { toPiReasoningLevel as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, TURN_REASONING_LEVELS as g, snapshotRuntimeConfig as h, getChatConfig as i, getSlackSigningSecret as l, setSlackReactionConfig as m, botConfig as n, getSlackBotToken as o, setRuntimeLimits as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v, createS3AttachmentStorage as y };
579
+ export { toPiReasoningLevel as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, TURN_REASONING_LEVELS as g, snapshotRuntimeConfig as h, getChatConfig as i, getSlackSigningSecret as l, setSlackReactionConfig as m, botConfig as n, getSlackBotToken as o, setRuntimeLimits as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v, getAttachmentStorage as y };
@@ -1,13 +1,13 @@
1
- import { X as loadTurnCheckpoint, et as failTurnRecord, gi as startOAuthFlow, tt as getTurnRecord } from "./projection-Bhz1tp0G.js";
2
- import { n as botConfig } from "./config-3AZ11aSM.js";
3
- import { C as getSqlExecutor, R as deleteProviderIdentityForSlackUser, y as getConversationEventStore, z as deleteProviderIdentityForUser } from "./viewer-DWlpSFdj.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-EjhulgQW.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-ClKzLvbN.js";
6
- import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-B229gXUY.js";
7
- import { r as getStateAdapter } from "./adapter-RVQGEa98.js";
8
- import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-oegyrxSe.js";
9
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-C4z8gOgZ.js";
10
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-RBtUe-3y.js";
1
+ import { X as loadTurnCheckpoint, et as failTurnRecord, gi as startOAuthFlow, tt as getTurnRecord } from "./projection-BfKkpOGQ.js";
2
+ import { n as botConfig } from "./config-DFVlYCeY.js";
3
+ import { C as getSqlExecutor, R as deleteProviderIdentityForSlackUser, y as getConversationEventStore, z as deleteProviderIdentityForUser } from "./viewer-CYB9T4rm.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-CLooHPAz.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B7NRB7eH.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-Bj7GhysW.js";
7
+ import { r as getStateAdapter } from "./adapter-D8-lqOBF.js";
8
+ import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-Bbsqx8Vm.js";
9
+ import { m as ensureConversationWake, w as requestConversationWork } from "./store-DAJntSEv.js";
10
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-CzCnNAUO.js";
11
11
  import { randomBytes, randomUUID } from "node:crypto";
12
12
  import * as z from "zod";
13
13
  // src/chat/task-execution/authorized-turn.ts
@@ -1,4 +1,4 @@
1
- import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-Dq9_svfQ.js";
1
+ import { c as conversationTurnFailureCodeSchema, l as conversationTurnFailureReasonSchema, n as INPUT_IMAGE_TYPES, y as usageSchema } from "./media-Bu9C6lz0.js";
2
2
  import * as z from "zod";
3
3
  import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
4
4
  // src/chat/briefs/schema.ts
@@ -422,6 +422,8 @@ const conversationSummaryReportSchema = z.object({
422
422
  participants: z.array(actorIdentitySchema).optional(),
423
423
  archivedAt: z.string().datetime().nullable().optional(),
424
424
  pinnedAt: z.string().datetime().nullable().optional(),
425
+ /** The viewer's place in Pinned. Unset until they reorder their pins. */
426
+ pinPosition: z.number().int().optional(),
425
427
  channel: z.string().optional(),
426
428
  channelName: z.string().optional(),
427
429
  channelNameRedacted: z.boolean().optional(),
@@ -1,4 +1,4 @@
1
- import { L as messageAttachmentSchema, O as reviewItemChangeRecordSchema, c as conversationDetailReportSchema, r as actorIdentitySchema } from "./conversation-DNtcULyX.js";
1
+ import { L as messageAttachmentSchema, O as reviewItemChangeRecordSchema, c as conversationDetailReportSchema, r as actorIdentitySchema } from "./conversation-DdT7SNar.js";
2
2
  import * as z from "zod";
3
3
  // src/reporting-schema.ts
4
4
  const healthReportSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-DHzrobea.js";
1
+ import { h as logWarn } from "./logging-2BXvW7Mp.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;