@sentry/junior 0.270.0 → 0.271.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 (69) hide show
  1. package/dist/{actor-CP9K2Idu.js → actor-B4DYygOB.js} +1 -1
  2. package/dist/{adapter-BQNTKVTF.js → adapter-Bqbtr1RV.js} +1 -1
  3. package/dist/{admin-CKVEoXa4.js → admin-CWBjzyN0.js} +1 -1
  4. package/dist/{agent-runner-MSQSMFkq.js → agent-runner-BiHsH8O_.js} +36 -29
  5. package/dist/api/schema.d.ts +1 -1
  6. package/dist/api/schema.js +2 -2
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +34 -32
  9. package/dist/{app-Bz8t4P8p.d.ts → app-C81xfpNa.d.ts} +8 -2
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +72 -31
  12. package/dist/{interruption-marker-CdblrIQK.js → assistant-reply-DgtX9DaJ.js} +2 -8
  13. package/dist/{briefs-DNFzFFVx.js → briefs-0FeSJHQ3.js} +2 -2
  14. package/dist/{catalog-runtime-Bdym_wKy.js → catalog-runtime-Bw9kjGVu.js} +1 -1
  15. package/dist/cli/chat.js +14 -14
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{client-B2MjENki.js → client-B0jlQSgO.js} +2 -2
  23. package/dist/{config-Dm3pWRqY.js → config-DrAeD8sr.js} +2 -2
  24. package/dist/{connections-0BBhiD-p.js → connections-BzN2K0G9.js} +10 -10
  25. package/dist/{conversation-privacy-C1pJ89rs.js → conversation-privacy-D1NhUxyo.js} +1 -1
  26. package/dist/{credential-sync-BRiWYs6_.js → credential-sync-DpNWl4yy.js} +15 -15
  27. package/dist/{credentialed-BeBaJMZ_.js → credentialed-mh7HBqey.js} +31 -24
  28. package/dist/{db-BYOuu6v2.d.ts → db-DSabI7jJ.d.ts} +1 -1
  29. package/dist/{executor-BB6eJkD4.js → executor-C2cRw0hZ.js} +7 -2
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-DiaXoSDg.js → job-queue-CEeLYkSj.js} +2 -2
  32. package/dist/{list-BTDRxkOg.js → list-DjJJ5K0x.js} +26 -26
  33. package/dist/{logging-C6EdT6PP.js → logging-DuwXUuIY.js} +1 -1
  34. package/dist/{message-DsjiWRVg.js → message-CRe3WBKc.js} +4 -4
  35. package/dist/nitro.d.ts +1 -1
  36. package/dist/nitro.js +3 -3
  37. package/dist/{oauth-callback-server-CjFFVGqa.js → oauth-callback-server-oM5TJt34.js} +2 -2
  38. package/dist/{registry-CndmkP2P.js → registry-BPtbAVFo.js} +2 -2
  39. package/dist/{reporting-window-DRCi1Ls_.js → reporting-window-DgHgwQB3.js} +6 -1
  40. package/dist/{resolve-BkAA1wH7.js → resolve-D44G1jJm.js} +3 -3
  41. package/dist/{result-9TJTpuYP.js → result-CvP8c5bb.js} +9 -9
  42. package/dist/{runner-BmKLSyJm.js → runner-FIGIKvk2.js} +10 -10
  43. package/dist/{sandbox-egress-signals-CjLaogMo.js → sandbox-egress-signals-C_JzucwP.js} +1 -1
  44. package/dist/{schema-DNLJ_MzW.js → schema-DKZgO-xf.js} +10 -5
  45. package/dist/{schema-WayPSHFu.d.ts → schema-DPCvePop.d.ts} +13 -2
  46. package/dist/{service-account-DlhYl-Mu.js → service-account-1mJGRAvx.js} +3 -3
  47. package/dist/{service-account-D6e9cVmH.js → service-account-CHO3YXpt.js} +3 -3
  48. package/dist/{session-stop-MZRgYqYH.js → session-stop-DuUB1rwQ.js} +41 -139
  49. package/dist/{skills-BggTR_ue.js → skills-DHK7L9Eo.js} +2 -2
  50. package/dist/{spawn-DmtlcAT_.js → spawn-CKl_ySIq.js} +2 -2
  51. package/dist/{store-BeWGgaMA.js → store-BF2XEeQz.js} +3 -3
  52. package/dist/{store-Byarin7b.js → store-Di0E4EvU.js} +3 -3
  53. package/dist/{task-queue-Dt1_ZoI_.js → task-queue-CC7IFtbT.js} +3 -3
  54. package/dist/{task-runner-DyKqAPpm.js → task-runner-DKZtMFwa.js} +7 -7
  55. package/dist/{thread-state-BHBLMvgb.js → thread-state-BQ1T3eeF.js} +5 -5
  56. package/dist/{turn-failure-response-DWXy_0oJ.js → turn-failure-response-B5eSFoHn.js} +14 -9
  57. package/dist/{turn-lifecycle-AiXkVqCB.js → turn-lifecycle-CTLEIEOn.js} +1 -1
  58. package/dist/{turn-session-routing-B9KLBhaT.js → turn-session-routing-BFVp8TbU.js} +11 -11
  59. package/dist/{validation-BW60Vtx_.js → validation-Cjo-3yt3.js} +1 -1
  60. package/dist/{version-CivPYmkH.js → version-D30MBLLw.js} +1 -1
  61. package/dist/version.js +1 -1
  62. package/dist/{viewer-BTgAfdUg.js → viewer-D3jhuP66.js} +4 -4
  63. package/dist/{work-Bjm52fHo.js → work-CL9QwQcl.js} +10 -10
  64. package/dist/{worker-CMbgtHLu.js → worker-S2P7IJDI.js} +6 -6
  65. package/migrations/0071_review_item_turn.sql +1 -0
  66. package/migrations/AGENTS.md +3 -12
  67. package/migrations/meta/0071_snapshot.json +4003 -0
  68. package/migrations/meta/_journal.json +7 -0
  69. package/package.json +4 -4
package/dist/app.js CHANGED
@@ -1,39 +1,39 @@
1
- import { B as readScheduledAutomation, G as blockEventAutomation, Gr as setExperimentalFeatures, H as saveScheduledAutomationInLock, Ir as SubscribedReplyReason, Jn as hasRunnableConversationWork, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, Mn as CONVERSATION_WORK_STALE_ENQUEUE_MS, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, Ur as getExperimentalFeatures, W as withScheduledAutomationLock, Wr as isExperimentalFeatureEnabled, Wt as appendConversationMessages, Xn as isInvalidConversationRecordError, Xr as getConfigDefaults, Xt as settleConversationTitleWork, Y as findMatchingEventAutomations, Zr as setConfigDefaults, 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, qt as projectConversationMessages, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed, zr as getThreadStopDecision } from "./turn-session-routing-B9KLBhaT.js";
2
- import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-Dm3pWRqY.js";
3
- import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as withSpan, L as GOOGLE_IDENTITY_PROVIDER, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException, r as createRequestContext, w as withContext, z as normalizeIdentityEmail } from "./logging-C6EdT6PP.js";
1
+ import { B as readScheduledAutomation, G as blockEventAutomation, Gr as setExperimentalFeatures, H as saveScheduledAutomationInLock, Ir as SubscribedReplyReason, Jn as hasRunnableConversationWork, K as collectEventAutomationMatchKeys, M as recordAutomationExecution, Mn as CONVERSATION_WORK_STALE_ENQUEUE_MS, R as listScheduledAutomationsForTeam, S as existingConversationId, U as scheduledRunId, Ur as getExperimentalFeatures, W as withScheduledAutomationLock, Wr as isExperimentalFeatureEnabled, Wt as appendConversationMessages, Xn as isInvalidConversationRecordError, Xr as getConfigDefaults, Xt as settleConversationTitleWork, Y as findMatchingEventAutomations, Zr as setConfigDefaults, 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, qt as projectConversationMessages, r as buildDispatchId, s as getDispatchConversationId, tt as admitEventAutomationRun, u as getDispatchRecord, v as markDispatchFailed, zr as getThreadStopDecision } from "./turn-session-routing-BFVp8TbU.js";
2
+ import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-DrAeD8sr.js";
3
+ import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as withSpan, L as GOOGLE_IDENTITY_PROVIDER, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException, r as createRequestContext, w as withContext, z as normalizeIdentityEmail } from "./logging-DuwXUuIY.js";
4
4
  import { n as captureMessage } from "./sentry-MDkYAVPV.js";
5
- import { t as JUNIOR_VERSION } from "./version-CivPYmkH.js";
6
- import { f as parseSlackTeamId, g as slackMessageTsSchema, h as slackMessageTsFromMs, m as parseSlackMessageTs, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-CP9K2Idu.js";
7
- import { C as getSqlExecutor, M as resolveActorIdentityId, O as withConversationMutationLock, R as recordGoogleSignIn, S as getDb, T as withConversationEventLock, _ as closeDb, g as createCache, i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore } from "./viewer-BTgAfdUg.js";
5
+ import { t as JUNIOR_VERSION } from "./version-D30MBLLw.js";
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-B4DYygOB.js";
7
+ import { C as getSqlExecutor, M as resolveActorIdentityId, O as withConversationMutationLock, R as recordGoogleSignIn, S as getDb, T as withConversationEventLock, _ as closeDb, g as createCache, i as readActorIdentity, l as resolveViewerUser, p as parseAvatarUrl, x as getConversationStore, y as getConversationEventStore } from "./viewer-D3jhuP66.js";
8
8
  import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
9
- import { c as juniorReviewItems, d as juniorAutomations, g as juniorConversationBriefs, l as juniorAutomationRuns, y as juniorConversationEvents } from "./executor-BB6eJkD4.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
11
- import { A as verifySlackSignature, C as syncReviewItemSlackCards, Ct as processWorkspaceSnapshotJob, D as parseSlackReviewItemFormTarget, E as parseSlackReviewItemClick, J as readViewerAutomationSummary, L as logScheduledAutomationRunSkipped, O as parseSlackUserInputSubmission, Q as effectiveTaskOutcomes, R as scheduledAutomationRunAttributes, S as readSlackReviewItemCardConversationId, T as buildSlackReviewItemModal, _ as unpublishedArtifactHeaders, _t as recordSubagentEnded, ct as webActorFromEmail, dt as collectAttachmentGarbage, et as deliverReviewItemChange, g as readPublicArtifact, gt as stopConversationSession, h as publicArtifactHeaders, it as conversationTurnIdForMessage, j as parseSlackThreadId, k as runWithSlackInstallation, n as executeAgentRun, pt as requestAttachmentDeletion, rt as appendAndEnqueueWebMessage, st as recordWebConversationActivity, t as createAgentRunner, tt as renderReviewItemMessage, v as lookupSlackUserProfile, wt as ingestEvent, x as createSlackReviewItemShow } from "./agent-runner-MSQSMFkq.js";
12
- import { At as slackEntitySchema, Bn as getDashboardTaskLink, Bt as clearSandboxEgressSignals, Cr as resolveRootVisibility, Dn as getSlackClient, Er as listConversationAnnotations, Fn as runWithWorkspaceTeamId, Ht as consumeSandboxEgressPermissionDeniedSignal, Ln as getDashboardConversationLink, M as canActOnReviewItem, Pn as getWorkspaceTeamId, S as dismissOpenReviewItems, Tt as postSlackEphemeralMessage, Vn as setDashboardConversationLinkOptions, Vt as consumeSandboxEgressAuthRequiredSignal, Wt as parseSandboxEgressCredentialToken, Xt as normalizeSandboxEgressTracePropagationDomains, _n as bindScheduledAutomationCredentialSubject, ar as createPluginLogger, bn as verifyScheduledAutomationCredentialSubject, c as getPluginRoutes, cn as collectEventMatchKeys, ct as proxyVercelSandboxEgressRequest, fn as findMatchingWatches, ft as resolveBaseUrl, gn as bindEventAutomationCredentialSubject, h as validatePlugins, hn as takeDueTimerWatches, jr as createPluginCache, jt as slackExternalRefIdSchema, kn as isDmChannel, m as setPlugins, n as createUserTokenStore, nr as createPluginState, or as readConversationAccessFromSql, p as getPlugins, rr as createPluginEmbedder, s as getPluginApiRoutes, st as isVercelSandboxEgressRequest, v as setBriefsConfig, vn as bindSlackDirectCredentialSubject, vt as slackMention, wt as openSlackModal, xn as verifySlackDirectCredentialSubject, yn as verifyEventAutomationCredentialSubject } from "./credentialed-BeBaJMZ_.js";
9
+ import { c as juniorReviewItems, d as juniorAutomations, g as juniorConversationBriefs, l as juniorAutomationRuns, y as juniorConversationEvents } from "./executor-C2cRw0hZ.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
11
+ import { $ as effectiveTaskOutcomes, A as verifySlackSignature, C as syncReviewItemSlackCards, D as parseSlackReviewItemFormTarget, E as parseSlackReviewItemClick, I as joinPublicChannel, O as parseSlackUserInputSubmission, R as logScheduledAutomationRunSkipped, S as readSlackReviewItemCardConversationId, T as buildSlackReviewItemModal, Tt as ingestEvent, Y as readViewerAutomationSummary, _ as unpublishedArtifactHeaders, _t as stopConversationSession, at as conversationTurnIdForMessage, ct as recordWebConversationActivity, ft as collectAttachmentGarbage, g as readPublicArtifact, h as publicArtifactHeaders, it as appendAndEnqueueWebMessage, j as parseSlackThreadId, k as runWithSlackInstallation, lt as webActorFromEmail, mt as requestAttachmentDeletion, n as executeAgentRun, nt as renderReviewItemMessage, t as createAgentRunner, tt as deliverReviewItemChange, v as lookupSlackUserProfile, vt as recordSubagentEnded, wt as processWorkspaceSnapshotJob, x as createSlackReviewItemShow, z as scheduledAutomationRunAttributes } from "./agent-runner-BiHsH8O_.js";
12
+ import { At as slackEntitySchema, Bn as getDashboardTaskLink, Bt as clearSandboxEgressSignals, Cr as resolveRootVisibility, Dn as getSlackClient, Er as listConversationAnnotations, Fn as runWithWorkspaceTeamId, Ht as consumeSandboxEgressPermissionDeniedSignal, Ln as getDashboardConversationLink, M as canActOnReviewItem, Pn as getWorkspaceTeamId, S as dismissOpenReviewItems, Tt as postSlackEphemeralMessage, Vn as setDashboardConversationLinkOptions, Vt as consumeSandboxEgressAuthRequiredSignal, Wt as parseSandboxEgressCredentialToken, Xt as normalizeSandboxEgressTracePropagationDomains, _n as bindScheduledAutomationCredentialSubject, ar as createPluginLogger, bn as verifyScheduledAutomationCredentialSubject, c as getPluginRoutes, cn as collectEventMatchKeys, ct as proxyVercelSandboxEgressRequest, fn as findMatchingWatches, ft as resolveBaseUrl, gn as bindEventAutomationCredentialSubject, h as validatePlugins, hn as takeDueTimerWatches, jr as createPluginCache, jt as slackExternalRefIdSchema, kn as isDmChannel, m as setPlugins, n as createUserTokenStore, nr as createPluginState, or as readConversationAccessFromSql, p as getPlugins, rr as createPluginEmbedder, s as getPluginApiRoutes, st as isVercelSandboxEgressRequest, v as setBriefsConfig, vn as bindSlackDirectCredentialSubject, vt as slackMention, wt as openSlackModal, xn as verifySlackDirectCredentialSubject, yn as verifyEventAutomationCredentialSubject } from "./credentialed-mh7HBqey.js";
13
13
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
14
- import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-BQNTKVTF.js";
14
+ import { r as getStateAdapter, t as disconnectStateAdapter } from "./adapter-Bqbtr1RV.js";
15
15
  import { n as getNextRunAtMs } from "./cadence-R7Em4RjE.js";
16
16
  import { D as conversationSurfaceSchema, I as annotationCard, T as conversationReportStatusSchema, h as conversationFeedQuerySchema } from "./conversation-AhOVzN_k.js";
17
- import { b as listPendingAgentInvocationMailboxAppends, x as listPendingAgentInvocationResults } from "./store-Byarin7b.js";
18
- import { E as renderSlackObjectCard, S as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-MZRgYqYH.js";
19
- import { h as buttonUserInputField } from "./reporting-window-DRCi1Ls_.js";
20
- import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-BkAA1wH7.js";
21
- import { a as getVercelConversationWorkQueue, d as getQueueProvider, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DiaXoSDg.js";
22
- 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-BeWGgaMA.js";
17
+ import { b as listPendingAgentInvocationMailboxAppends, x as listPendingAgentInvocationResults } from "./store-Di0E4EvU.js";
18
+ import { E as renderSlackObjectCard, S as renderTaskInput, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-DuUB1rwQ.js";
19
+ import { h as buttonUserInputField } from "./reporting-window-DgHgwQB3.js";
20
+ import { c as setSandboxResourceConfig, o as getSandboxResourceConfig } from "./resolve-D44G1jJm.js";
21
+ import { a as getVercelConversationWorkQueue, d as getQueueProvider, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CEeLYkSj.js";
22
+ 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-BF2XEeQz.js";
23
23
  import { M as scheduledRunSchema } from "./automation-Dwh_xcqM.js";
24
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BW60Vtx_.js";
24
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Cjo-3yt3.js";
25
25
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-DOm9Y6qI.js";
26
- import { A as stopSlackThread, B as actOnReviewItem, C as isAllowedSignInEmail, D as buildSlackInboundMessage, E as recordSkippedConversationMessage, F as bindMessageAuthorIdentityId, H as readReviewItemForUser, I as startProcessingReaction, K as enqueueAgentDispatch, L as stripLeadingBotMention, M as withNormalizedThreadId, N as stopConversationTurn, O as clearSlackPendingReactions, P as THREAD_OPTOUT_ACK, R as parseContent, S as isAllowedDomain, T as resolveAllowedDomains, U as reviewItemChange, V as closeReviewItemsAnsweredByReply, W as getAttachmentStorage, _ as createProductionConversationWorkOptions, b as createSlackWebApiStatusSender, j as normalizeIncomingSlackThreadId, k as isSlackMessageStopped, q as GET$3, t as readConversationFeed, v as createProductionSlackWebhookServices, w as readEnvList, x as assertNoLegacyAllowedDomains, y as getProductionSlackAdapter, z as ReviewItemActionError } from "./list-BTDRxkOg.js";
27
- import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-9TJTpuYP.js";
28
- import { r as enqueueAgentInvocation } from "./work-Bjm52fHo.js";
29
- import { o as coerceThreadConversationState } from "./thread-state-BHBLMvgb.js";
30
- import { o as unlinkProvider } from "./connections-0BBhiD-p.js";
31
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BRiWYs6_.js";
32
- import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-Dt1_ZoI_.js";
33
- import { t as processConversationWork } from "./worker-CMbgtHLu.js";
34
- import { t as bindMessageAgent } from "./message-DsjiWRVg.js";
35
- import { t as bindSpawnAgent } from "./spawn-DmtlcAT_.js";
36
- import { t as processPluginTask } from "./task-runner-DyKqAPpm.js";
26
+ import { A as stopSlackThread, B as actOnReviewItem, C as isAllowedSignInEmail, D as buildSlackInboundMessage, E as recordSkippedConversationMessage, F as bindMessageAuthorIdentityId, H as readReviewItemForUser, I as startProcessingReaction, K as enqueueAgentDispatch, L as stripLeadingBotMention, M as withNormalizedThreadId, N as stopConversationTurn, O as clearSlackPendingReactions, P as THREAD_OPTOUT_ACK, R as parseContent, S as isAllowedDomain, T as resolveAllowedDomains, U as reviewItemChange, V as closeReviewItemsAnsweredByReply, W as getAttachmentStorage, _ as createProductionConversationWorkOptions, b as createSlackWebApiStatusSender, j as normalizeIncomingSlackThreadId, k as isSlackMessageStopped, q as GET$3, t as readConversationFeed, v as createProductionSlackWebhookServices, w as readEnvList, x as assertNoLegacyAllowedDomains, y as getProductionSlackAdapter, z as ReviewItemActionError } from "./list-DjJJ5K0x.js";
27
+ import { n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId } from "./result-CvP8c5bb.js";
28
+ import { r as enqueueAgentInvocation } from "./work-CL9QwQcl.js";
29
+ import { o as coerceThreadConversationState } from "./thread-state-BQ1T3eeF.js";
30
+ import { o as unlinkProvider } from "./connections-BzN2K0G9.js";
31
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-DpNWl4yy.js";
32
+ import { a as pluginTaskQueueConsumer, c as queueCallback, n as createVercelPluginTaskCallback, o as registerVercelPluginTaskDevConsumer } from "./task-queue-CC7IFtbT.js";
33
+ import { t as processConversationWork } from "./worker-S2P7IJDI.js";
34
+ import { t as bindMessageAgent } from "./message-CRe3WBKc.js";
35
+ import { t as bindSpawnAgent } from "./spawn-CKl_ySIq.js";
36
+ import { t as processPluginTask } from "./task-runner-DKZtMFwa.js";
37
37
  import { createRequire } from "node:module";
38
38
  import { Hono } from "hono";
39
39
  import { z } from "zod";
@@ -2079,6 +2079,27 @@ async function handleSlackForm(args) {
2079
2079
  })));
2080
2080
  return new Response("", { status: 200 });
2081
2081
  }
2082
+ // src/chat/ingress/slack-channel-created.ts
2083
+ const slackChannelCreatedEnvelopeSchema = z.object({
2084
+ type: z.literal("event_callback"),
2085
+ team_id: z.string().optional(),
2086
+ enterprise_id: z.string().optional(),
2087
+ is_enterprise_install: z.boolean().optional(),
2088
+ event: z.object({
2089
+ type: z.literal("channel_created"),
2090
+ channel: z.looseObject({ id: slackChannelIdSchema })
2091
+ })
2092
+ });
2093
+ /** Join a newly created public channel for the installation that sent it. */
2094
+ async function joinCreatedSlackChannel(args) {
2095
+ await args.state.connect();
2096
+ await runWithWorkspaceTeamId(args.installation.teamId, () => runWithSlackInstallation({
2097
+ adapter: args.adapter,
2098
+ installation: args.installation,
2099
+ state: args.state,
2100
+ task: () => joinPublicChannel(args.channelId)
2101
+ }));
2102
+ }
2082
2103
  // src/chat/ingress/bot-mention.ts
2083
2104
  /**
2084
2105
  * Detect Slack bot @mentions that should activate Junior.
@@ -2975,7 +2996,26 @@ async function handleSlackWebhook(args) {
2975
2996
  waitUntil: args.waitUntil
2976
2997
  });
2977
2998
  }
2978
- const result = slackEventEnvelopeSchema.safeParse(parseJson(body));
2999
+ const json = parseJson(body);
3000
+ const channelCreated = slackChannelCreatedEnvelopeSchema.safeParse(json);
3001
+ if (channelCreated.success) {
3002
+ if (args.services.autoJoinNewChannels) {
3003
+ const channelId = channelCreated.data.event.channel.id;
3004
+ enqueue(args.waitUntil, withLogContext({
3005
+ platform: "slack",
3006
+ destinationName: channelId
3007
+ }, () => joinCreatedSlackChannel({
3008
+ adapter,
3009
+ channelId,
3010
+ installation: installationFromEnvelope(channelCreated.data),
3011
+ state: args.services.state ?? getStateAdapter()
3012
+ }).catch((error) => {
3013
+ logException(error, "slack.channel.auto_join.failed");
3014
+ })));
3015
+ }
3016
+ return new Response("ok", { status: 200 });
3017
+ }
3018
+ const result = slackEventEnvelopeSchema.safeParse(json);
2979
3019
  if (!result.success) return new Response("Invalid JSON", { status: 400 });
2980
3020
  const parsed = result.data;
2981
3021
  if (parsed.type === "url_verification") return Response.json({ challenge: parsed.challenge });
@@ -6691,7 +6731,8 @@ async function createApp(options) {
6691
6731
  services: runtimeServiceOverrides
6692
6732
  }),
6693
6733
  allowedBotUserIds: options?.slack?.allowedBotUserIds ?? [],
6694
- allowedDomains
6734
+ allowedDomains,
6735
+ autoJoinNewChannels: options?.slack?.autoJoinNewChannels === true
6695
6736
  };
6696
6737
  const app = new Hono();
6697
6738
  app.onError((err, c) => {
@@ -1,4 +1,4 @@
1
- import { _r as extractAssistantText } from "./turn-session-routing-B9KLBhaT.js";
1
+ import { _r as extractAssistantText } from "./turn-session-routing-BFVp8TbU.js";
2
2
  // src/chat/no-reply.ts
3
3
  const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
4
  /**
@@ -40,10 +40,4 @@ function getAssistantReplyText(message) {
40
40
  const decision = decideReply(message);
41
41
  return decision.kind === "deliver" ? decision.text : void 0;
42
42
  }
43
- // src/chat/interruption-marker.ts
44
- const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
45
- /** Return the marker added when a visible reply ended mid-execution. */
46
- function getInterruptionMarker() {
47
- return INTERRUPTED_MARKER;
48
- }
49
- export { NO_REPLY_MARKER as a, sanitizeAssistantText as i, decideReply as n, isNoReplyMarker as o, getAssistantReplyText as r, getInterruptionMarker as t };
43
+ export { isNoReplyMarker as a, NO_REPLY_MARKER as i, getAssistantReplyText as n, sanitizeAssistantText as r, decideReply as t };
@@ -1,4 +1,4 @@
1
- import { i as completeObject } from "./client-B2MjENki.js";
1
+ import { i as completeObject } from "./client-B0jlQSgO.js";
2
2
  import { i as defaultModelId } from "./model-profile-B998sjVd.js";
3
3
  import { G as briefCodeChangeSchema, Y as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-AhOVzN_k.js";
4
4
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BPSdXYXV.js";
@@ -267,7 +267,7 @@ async function parseRunOptions(argv) {
267
267
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
268
268
  */
269
269
  async function configuredDefaultModelId() {
270
- const { botConfig } = await import("./config-Dm3pWRqY.js").then((n) => n.r);
270
+ const { botConfig } = await import("./config-DrAeD8sr.js").then((n) => n.r);
271
271
  return defaultModelId(botConfig);
272
272
  }
273
273
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-CndmkP2P.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-BPtbAVFo.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-MSQSMFkq.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-BiHsH8O_.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-DOm9Y6qI.js").then((n) => n.o),
102
- import("../credentialed-BeBaJMZ_.js").then((n) => n.a),
103
- import("../catalog-runtime-Bdym_wKy.js").then((n) => n.t),
104
- import("../validation-BW60Vtx_.js").then((n) => n.r),
105
- import("../viewer-BTgAfdUg.js").then((n) => n.v)
102
+ import("../credentialed-mh7HBqey.js").then((n) => n.a),
103
+ import("../catalog-runtime-Bw9kjGVu.js").then((n) => n.t),
104
+ import("../validation-Cjo-3yt3.js").then((n) => n.r),
105
+ import("../viewer-D3jhuP66.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("../credentialed-BeBaJMZ_.js").then((n) => n._);
155
+ const { setBriefsConfig } = await import("../credentialed-mh7HBqey.js").then((n) => n._);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-BmKLSyJm.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CjFFVGqa.js");
157
+ const { runLocalAgentTurn } = await import("../runner-FIGIKvk2.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-oM5TJt34.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-CTygMkNx.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CjLaogMo.js");
161
- const { bindSpawnAgent } = await import("../spawn-DmtlcAT_.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-DsjiWRVg.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-9TJTpuYP.js").then((n) => n.i);
164
- const { skipInputBeforeConversationStop } = await import("../session-stop-MZRgYqYH.js").then((n) => n.r);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-C_JzucwP.js");
161
+ const { bindSpawnAgent } = await import("../spawn-CKl_ySIq.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-CRe3WBKc.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-CvP8c5bb.js").then((n) => n.i);
164
+ const { skipInputBeforeConversationStop } = await import("../session-stop-DuUB1rwQ.js").then((n) => n.r);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-CMbgtHLu.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-S2P7IJDI.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 { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-C6EdT6PP.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-CndmkP2P.js";
3
- import { i as parseSkillFile } from "../skills-BggTR_ue.js";
1
+ import { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-DuwXUuIY.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-BPtbAVFo.js";
3
+ import { i as parseSkillFile } from "../skills-DHK7L9Eo.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-CKVEoXa4.js")).runAdmin(argv);
28
+ return await (await import("../admin-CWBjzyN0.js")).runAdmin(argv);
29
29
  }
30
30
  async function runServiceAccount(argv) {
31
- return await (await import("../service-account-DlhYl-Mu.js")).runServiceAccount(argv);
31
+ return await (await import("../service-account-1mJGRAvx.js")).runServiceAccount(argv);
32
32
  }
33
33
  async function runBriefs(argv) {
34
- return await (await import("../briefs-DNFzFFVx.js")).runBriefs(argv);
34
+ return await (await import("../briefs-0FeSJHQ3.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 { S as getDb } from "../viewer-BTgAfdUg.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Bdym_wKy.js";
3
- import { ar as createPluginLogger, h as validatePlugins, m as setPlugins } from "../credentialed-BeBaJMZ_.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BW60Vtx_.js";
1
+ import { S as getDb } from "../viewer-D3jhuP66.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-Bw9kjGVu.js";
3
+ import { ar as createPluginLogger, h as validatePlugins, m as setPlugins } from "../credentialed-mh7HBqey.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Cjo-3yt3.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-DOm9Y6qI.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 { n as pluginCatalogRuntime } from "../catalog-runtime-Bdym_wKy.js";
2
- import { nt as create } from "../credentialed-BeBaJMZ_.js";
3
- import { t as disconnectStateAdapter } from "../adapter-BQNTKVTF.js";
4
- import { n as resolve } from "../resolve-BkAA1wH7.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-Bw9kjGVu.js";
2
+ import { nt as create } from "../credentialed-mh7HBqey.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-Bqbtr1RV.js";
4
+ import { n as resolve } from "../resolve-D44G1jJm.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-BYOuu6v2.js";
1
+ import "../db-DSabI7jJ.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-B_0Cr0MO.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-Dm3pWRqY.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-BB6eJkD4.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-CndmkP2P.js";
1
+ import { i as getChatConfig } from "../config-DrAeD8sr.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-C2cRw0hZ.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-BPtbAVFo.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-DOm9Y6qI.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -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-C6EdT6PP.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-C1pJ89rs.js";
1
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DuwXUuIY.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-D1NhUxyo.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,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { S as toOptionalTrimmed, s as resolveGatewayModel } from "./client-B2MjENki.js";
3
- import { h as logWarn } from "./logging-C6EdT6PP.js";
2
+ import { S as toOptionalTrimmed, s as resolveGatewayModel } from "./client-B0jlQSgO.js";
3
+ import { h as logWarn } from "./logging-DuwXUuIY.js";
4
4
  import { c as modelProfileSchema, d as parseTurnReasoningLevel, t as DEFAULT_MODEL_PROFILES, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
5
5
  import { AwsClient } from "aws4fetch";
6
6
  // src/chat/attachments/s3.ts
@@ -1,13 +1,13 @@
1
- import { Cn as loadTurnCheckpoint, Dn as failTurnRecord, On as getTurnRecord, n as resolveTurnSessionRouting } from "./turn-session-routing-B9KLBhaT.js";
2
- import { n as botConfig } from "./config-Dm3pWRqY.js";
3
- import { C as getSqlExecutor, F as deleteProviderIdentityForUser, P as deleteProviderIdentityForSlackUser, y as getConversationEventStore } from "./viewer-BTgAfdUg.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-CndmkP2P.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
6
- import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-MSQSMFkq.js";
7
- import { pt as startOAuthFlow } from "./credentialed-BeBaJMZ_.js";
8
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
9
- import { a as getVercelConversationWorkQueue } from "./job-queue-DiaXoSDg.js";
10
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-BeWGgaMA.js";
1
+ import { Cn as loadTurnCheckpoint, Dn as failTurnRecord, On as getTurnRecord, n as resolveTurnSessionRouting } from "./turn-session-routing-BFVp8TbU.js";
2
+ import { n as botConfig } from "./config-DrAeD8sr.js";
3
+ import { C as getSqlExecutor, F as deleteProviderIdentityForUser, P as deleteProviderIdentityForSlackUser, y as getConversationEventStore } from "./viewer-D3jhuP66.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-BPtbAVFo.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
6
+ import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-BiHsH8O_.js";
7
+ import { pt as startOAuthFlow } from "./credentialed-mh7HBqey.js";
8
+ import { r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
9
+ import { a as getVercelConversationWorkQueue } from "./job-queue-CEeLYkSj.js";
10
+ import { m as ensureConversationWake, w as requestConversationWork } from "./store-BF2XEeQz.js";
11
11
  import { z } from "zod";
12
12
  import { randomBytes, randomUUID } from "node:crypto";
13
13
  // src/chat/task-execution/authorized-turn.ts
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-C6EdT6PP.js";
1
+ import { h as logWarn } from "./logging-DuwXUuIY.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,20 +1,20 @@
1
- import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, On as getTurnRecord, bn as getConversationPendingAuth } from "./turn-session-routing-B9KLBhaT.js";
2
- import { p as escapeXml } from "./client-B2MjENki.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-Dm3pWRqY.js";
4
- import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-C6EdT6PP.js";
5
- import { p as parseSlackUserId } from "./actor-CP9K2Idu.js";
6
- import { B as upsertLinkedIdentity, C as getSqlExecutor, I as findUserByVerifiedEmails, M as resolveActorIdentityId, o as readIdentityById } from "./viewer-BTgAfdUg.js";
1
+ import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, On as getTurnRecord, bn as getConversationPendingAuth } from "./turn-session-routing-BFVp8TbU.js";
2
+ import { p as escapeXml } from "./client-B0jlQSgO.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-DrAeD8sr.js";
4
+ import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-DuwXUuIY.js";
5
+ import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
6
+ import { B as upsertLinkedIdentity, C as getSqlExecutor, I as findUserByVerifiedEmails, M as resolveActorIdentityId, o as readIdentityById } from "./viewer-D3jhuP66.js";
7
7
  import { i as homeDir } from "./package-discovery-DJBompdd.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CndmkP2P.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
10
- import { t as discoverSkills } from "./skills-BggTR_ue.js";
11
- import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-MSQSMFkq.js";
12
- import { Dn as getSlackClient, Et as postSlackMessage, dt as parseOAuthStatePayload, ft as resolveBaseUrl, i as resolvePluginOAuthAccount, n as createUserTokenStore, ut as formatProviderLabel } from "./credentialed-BeBaJMZ_.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BPtbAVFo.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
10
+ import { t as discoverSkills } from "./skills-DHK7L9Eo.js";
11
+ import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-BiHsH8O_.js";
12
+ import { Dn as getSlackClient, Et as postSlackMessage, dt as parseOAuthStatePayload, ft as resolveBaseUrl, i as resolvePluginOAuthAccount, n as createUserTokenStore, ut as formatProviderLabel } from "./credentialed-mh7HBqey.js";
13
13
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
14
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
15
- import { _ as getMcpProviderErrorAttributes } from "./service-account-D6e9cVmH.js";
16
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BHBLMvgb.js";
17
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-0BBhiD-p.js";
14
+ import { r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
15
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-CHO3YXpt.js";
16
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BQ1T3eeF.js";
17
+ import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-BzN2K0G9.js";
18
18
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CTygMkNx.js";
19
19
  import path from "node:path";
20
20
  import { z } from "zod";
@@ -1,19 +1,19 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { S as toOptionalTrimmed, i as completeObject, o as embedTexts, t as GEN_AI_PROVIDER_NAME } from "./client-B2MjENki.js";
3
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-Dm3pWRqY.js";
4
- import { B as isRecord$2, E as withSpan, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-C6EdT6PP.js";
2
+ import { S as toOptionalTrimmed, i as completeObject, o as embedTexts, t as GEN_AI_PROVIDER_NAME } from "./client-B0jlQSgO.js";
3
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-DrAeD8sr.js";
4
+ import { B as isRecord$2, E as withSpan, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-DuwXUuIY.js";
5
5
  import { a as getClient$1, n as captureMessage, r as continueTrace } from "./sentry-MDkYAVPV.js";
6
- import { t as canExposeConversationPayload } from "./conversation-privacy-C1pJ89rs.js";
6
+ import { t as canExposeConversationPayload } from "./conversation-privacy-D1NhUxyo.js";
7
7
  import { i as defaultModelId } from "./model-profile-B998sjVd.js";
8
- import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, i as isActorUserId, m as parseSlackMessageTs, p as parseSlackUserId, s as parseActorUserId } from "./actor-CP9K2Idu.js";
9
- import { C as getSqlExecutor, D as createSqlStore, L as readUserTimezone, S as getDb, X as parseDestination, g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, q as hasAgentTurnUsage, s as readIdentityByIdFromSql, y as getConversationEventStore, z as saveUserTimezone } from "./viewer-BTgAfdUg.js";
8
+ import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, p as parseSlackUserId, s as parseActorUserId } from "./actor-B4DYygOB.js";
9
+ import { C as getSqlExecutor, D as createSqlStore, L as readUserTimezone, S as getDb, X as parseDestination, g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, q as hasAgentTurnUsage, s as readIdentityByIdFromSql, y as getConversationEventStore, z as saveUserTimezone } from "./viewer-D3jhuP66.js";
10
10
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
11
- import { C as juniorCodeRepositories, S as juniorCodeChanges, a as juniorReviewItemAssignees, c as juniorReviewItems, d as juniorAutomations, g as juniorConversationBriefs, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, o as juniorReviewItemConversations, r as juniorWorkspaceRepos, w as juniorAttachments, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-BB6eJkD4.js";
11
+ import { C as juniorCodeRepositories, S as juniorCodeChanges, a as juniorReviewItemAssignees, c as juniorReviewItems, d as juniorAutomations, g as juniorConversationBriefs, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, o as juniorReviewItemConversations, r as juniorWorkspaceRepos, w as juniorAttachments, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-C2cRw0hZ.js";
12
12
  import { l as decodeStoredConversationEvent } from "./media-U6Tuz6Mi.js";
13
- import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-CndmkP2P.js";
14
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
13
+ import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-BPtbAVFo.js";
14
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bw9kjGVu.js";
15
15
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
16
- import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-BQNTKVTF.js";
16
+ import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-Bqbtr1RV.js";
17
17
  import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
18
18
  import { C as conversationReportEventSchema, J as conversationBriefSchema, W as readMessageAttachments, Y as parseBriefInput, w as conversationReportMessageEventSchema, z as readMessageCardRefs } from "./conversation-AhOVzN_k.js";
19
19
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BPSdXYXV.js";
@@ -21,7 +21,7 @@ import path from "node:path";
21
21
  import { AsyncLocalStorage } from "node:async_hooks";
22
22
  import { z } from "zod";
23
23
  import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
24
- import { and, arrayContains, asc, count, desc, eq, exists, getTableColumns, gte, ilike, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
24
+ import { and, arrayContains, asc, count, desc, eq, exists, getTableColumns, gt, gte, ilike, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
25
25
  import { EgressAuthRequired, EgressPolicyDenied, actorSchema, codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, eventDataSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginEventsSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
26
26
  import { alias, union } from "drizzle-orm/pg-core";
27
27
  import fs from "node:fs/promises";
@@ -7757,6 +7757,7 @@ async function hydrate(db, rows) {
7757
7757
  updatedAt: row.updatedAt,
7758
7758
  visibility: row.visibility,
7759
7759
  ...row.answer ? { answer: row.answer } : void 0,
7760
+ ...row.addedByTurnId ? { addedByTurnId: row.addedByTurnId } : void 0,
7760
7761
  ...row.automationId ? { automationId: row.automationId } : void 0,
7761
7762
  ...row.closeReason ? { closeReason: row.closeReason } : void 0,
7762
7763
  ...row.closedAt ? { closedAt: row.closedAt } : void 0,
@@ -7829,6 +7830,7 @@ async function insertReviewItem(db, input) {
7829
7830
  const inserted = await tx.insert(juniorReviewItems).values({
7830
7831
  ...contentColumns(input),
7831
7832
  addedByConversationId: input.addedByConversationId,
7833
+ addedByTurnId: input.addedByTurnId ?? null,
7832
7834
  automationId: input.automationId ?? null,
7833
7835
  createdAt: now,
7834
7836
  dedupeKey: input.dedupeKey,
@@ -7847,12 +7849,17 @@ async function insertReviewItem(db, input) {
7847
7849
  if (!item) throw new Error(`Review item ${id} is missing after insert`);
7848
7850
  return item;
7849
7851
  }
7850
- /** Replace the content of one open Review item. Return false when closed. */
7852
+ /**
7853
+ * Replace the content of one open Review item. Return false when closed.
7854
+ * `addedByTurnId` moves the Turn pointer to the Turn that added the item
7855
+ * again; omit it to keep the stored Turn.
7856
+ */
7851
7857
  async function updateReviewItemContent(db, input) {
7852
7858
  return await db.transaction(async (tx) => {
7853
7859
  if (!(await tx.update(juniorReviewItems).set({
7854
7860
  ...contentColumns(input),
7855
- updatedAt: new Date(input.nowMs)
7861
+ updatedAt: new Date(input.nowMs),
7862
+ ...input.addedByTurnId ? { addedByTurnId: input.addedByTurnId } : void 0
7856
7863
  }).where(and(eq(juniorReviewItems.id, input.id), eq(juniorReviewItems.status, "open"))).returning({ id: juniorReviewItems.id }))[0]) return false;
7857
7864
  await replaceLinks(tx, input.id, input);
7858
7865
  return true;
@@ -7911,7 +7918,7 @@ async function takeReviewItem(db, input) {
7911
7918
  }
7912
7919
  function searchConditions(reader, filters) {
7913
7920
  const conditions = [reviewItemVisibleTo(reader), inArray(juniorReviewItems.status, [...filters.statuses])];
7914
- if (filters.after) conditions.push(or(lt(juniorReviewItems.updatedAt, filters.after.updatedAt), and(eq(juniorReviewItems.updatedAt, filters.after.updatedAt), lt(juniorReviewItems.id, filters.after.id))));
7921
+ if (filters.after) conditions.push(or(gt(juniorReviewItems.createdAt, filters.after.createdAt), and(eq(juniorReviewItems.createdAt, filters.after.createdAt), gt(juniorReviewItems.id, filters.after.id))));
7915
7922
  if (filters.subjectId) conditions.push(eq(juniorReviewItems.subjectId, filters.subjectId));
7916
7923
  if (filters.automationId) conditions.push(eq(juniorReviewItems.automationId, filters.automationId));
7917
7924
  if (filters.conversationId) conditions.push(reviewItemLinkedTo(filters.conversationId));
@@ -7929,11 +7936,12 @@ async function countReviewItemsNeedingUser(db, userId) {
7929
7936
  /**
7930
7937
  * Find the Review items that a reader can see. Open items come first, so
7931
7938
  * the limit never drops an open item for a closed one. Then the newest
7932
- * change comes first: `updated_at`, then `id`, both descending. `after`
7933
- * pages through that order.
7939
+ * change comes first: `updated_at`, then `id`, both descending. With
7940
+ * `order: "oldest"`, the oldest item comes first: `created_at`, then `id`,
7941
+ * both ascending. `after` pages through that order.
7934
7942
  */
7935
7943
  async function searchReviewItems(db, reader, filters) {
7936
- return await hydrate(db, await db.select().from(juniorReviewItems).where(and(...searchConditions(reader, filters))).orderBy(desc(eq(juniorReviewItems.status, "open")), desc(juniorReviewItems.updatedAt), desc(juniorReviewItems.id)).limit(filters.limit));
7944
+ return await hydrate(db, await db.select().from(juniorReviewItems).where(and(...searchConditions(reader, filters))).orderBy(desc(eq(juniorReviewItems.status, "open")), ...filters.order === "oldest" ? [asc(juniorReviewItems.createdAt), asc(juniorReviewItems.id)] : [desc(juniorReviewItems.updatedAt), desc(juniorReviewItems.id)]).limit(filters.limit));
7937
7945
  }
7938
7946
  /**
7939
7947
  * List the Conversations that wait on a User: each is linked to an open item
@@ -7944,17 +7952,16 @@ async function listWaitingConversationIds(db, userId) {
7944
7952
  }
7945
7953
  // src/chat/review-items/plugin.ts
7946
7954
  /**
7947
- * Resolve the Users to assign. An Identity without a User has no one to
7948
- * assign. A private item goes only to people in its Conversation, the same
7949
- * rule that `requireReviewItemAssignees` applies to agents.
7955
+ * Resolve the Users to assign. A plugin notice goes only to people in its
7956
+ * Conversation, public or private. Junior leaves out an Identity without a
7957
+ * User and a User who is not in the Conversation.
7950
7958
  */
7951
- async function assigneeUserIds(db, identityIds, conversationId, isPrivate) {
7959
+ async function assigneeUserIds(db, identityIds, conversationId) {
7952
7960
  const userIds = [];
7953
7961
  for (const identityId of new Set(identityIds)) {
7954
7962
  const user = (await readIdentityByIdFromSql(db, identityId))?.user;
7955
7963
  if (!user) continue;
7956
- if (isPrivate && !(await readConversationAccessFromSql(db, [conversationId], user)).get(conversationId)?.isParticipant) throw new Error("A private review item can be assigned only to people in its Conversation");
7957
- userIds.push(user.id);
7964
+ if ((await readConversationAccessFromSql(db, [conversationId], user)).get(conversationId)?.isParticipant) userIds.push(user.id);
7958
7965
  }
7959
7966
  return userIds;
7960
7967
  }
@@ -7982,7 +7989,7 @@ function createPluginReviewItems(args) {
7982
7989
  if (existing && isPrivate && existing.addedByConversationId !== conversationId) throw new Error("A private review item links only to the Conversation that added it");
7983
7990
  const content = {
7984
7991
  assignedToEveryone: false,
7985
- assigneeUserIds: await assigneeUserIds(db, notice.assigneeIdentityIds, conversationId, isPrivate),
7992
+ assigneeUserIds: await assigneeUserIds(db, notice.assigneeIdentityIds, conversationId),
7986
7993
  body: notice.body,
7987
7994
  conversationIds: [.../* @__PURE__ */ new Set([conversationId, ...existing?.conversationIds ?? []])],
7988
7995
  kind: "notice",
@@ -1,4 +1,4 @@
1
- import "./schema-WayPSHFu.js";
1
+ import "./schema-DPCvePop.js";
2
2
  import { z } from "zod";
3
3
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
4
4
  import "drizzle-orm/pg-core";
@@ -1,5 +1,5 @@
1
- import "./config-Dm3pWRqY.js";
2
- import { p as logException } from "./logging-C6EdT6PP.js";
1
+ import "./config-DrAeD8sr.js";
2
+ import { p as logException } from "./logging-DuwXUuIY.js";
3
3
  import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
@@ -410,6 +410,11 @@ const juniorReviewItems = pgTable("junior_review_items", {
410
410
  /** Conversation of the agent that added the item. */
411
411
  addedByConversationId: text("added_by_conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
412
412
  /**
413
+ * Turn of the agent that added the item, or that last added it again with
414
+ * its dedupe key. Null for a plugin item, which has no Turn.
415
+ */
416
+ addedByTurnId: text("added_by_turn_id"),
417
+ /**
413
418
  * Provider tenant, such as a Slack workspace, of the Conversation that
414
419
  * added the item. A public item is visible only inside it.
415
420
  */
@@ -1,6 +1,6 @@
1
- import { F as getDeploymentServiceVersion, I as getDeploymentTelemetryAttributes } from "./logging-C6EdT6PP.js";
1
+ import { F as getDeploymentServiceVersion, I as getDeploymentTelemetryAttributes } from "./logging-DuwXUuIY.js";
2
2
  import { a as getClient, c as init, o as getGlobalScope } from "./sentry-MDkYAVPV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C1pJ89rs.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D1NhUxyo.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
5
5
  // src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([