@sentry/junior 0.270.0 → 0.272.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 (75) hide show
  1. package/dist/{actor-CP9K2Idu.js → actor-B4DYygOB.js} +1 -1
  2. package/dist/{adapter-BQNTKVTF.js → adapter-BDYDi1F9.js} +1 -1
  3. package/dist/{admin-CKVEoXa4.js → admin-Dj7EFycG.js} +1 -1
  4. package/dist/{agent-runner-MSQSMFkq.js → agent-runner-Cl6Usx2Y.js} +336 -280
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +81 -37
  9. package/dist/{app-Bz8t4P8p.d.ts → app-DjZblE2J.d.ts} +8 -2
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +74 -40
  12. package/dist/{interruption-marker-CdblrIQK.js → assistant-reply-DN2w6JL_.js} +2 -8
  13. package/dist/{automation-Dwh_xcqM.js → automation-CV7g5h3A.js} +1 -1
  14. package/dist/{briefs-DNFzFFVx.js → briefs-PysAqnjV.js} +4 -4
  15. package/dist/{catalog-runtime-Bdym_wKy.js → catalog-runtime-BNeCWIaF.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 +3 -3
  23. package/dist/{client-B2MjENki.js → client-FRphcDWW.js} +2 -2
  24. package/dist/{config-Dm3pWRqY.js → config-BUP9wjiR.js} +3 -3
  25. package/dist/{connections-0BBhiD-p.js → connections-CesHau9u.js} +10 -10
  26. package/dist/{conversation-AhOVzN_k.js → conversation-BtQzLoK8.js} +12 -1
  27. package/dist/{conversation-privacy-C1pJ89rs.js → conversation-privacy-DiGvA9a3.js} +1 -1
  28. package/dist/{credential-sync-BRiWYs6_.js → credential-sync-D2odJC30.js} +15 -15
  29. package/dist/{credentialed-BeBaJMZ_.js → credentialed-CgTulRDH.js} +33 -26
  30. package/dist/{db-BYOuu6v2.d.ts → db-BPLmOwXf.d.ts} +11 -1
  31. package/dist/{executor-BB6eJkD4.js → executor-DGDpyegI.js} +30 -7
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{job-queue-DiaXoSDg.js → job-queue-CjB97sii.js} +2 -2
  34. package/dist/{list-BTDRxkOg.js → list-JZUP1yog.js} +37 -53
  35. package/dist/{logging-C6EdT6PP.js → logging-CjkDr-jP.js} +1 -1
  36. package/dist/message-D9y8PKA1.js +186 -0
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +3 -3
  39. package/dist/{oauth-callback-server-CjFFVGqa.js → oauth-callback-server-02Pej6hj.js} +2 -2
  40. package/dist/{prompt-BPSdXYXV.js → prompt-vfceH0c-.js} +1 -1
  41. package/dist/{registry-CndmkP2P.js → registry-7XgwNgQe.js} +2 -2
  42. package/dist/{reporting-window-DRCi1Ls_.js → reporting-window-DgHgwQB3.js} +6 -1
  43. package/dist/{resolve-BkAA1wH7.js → resolve-CuuxNfWG.js} +3 -3
  44. package/dist/{result-9TJTpuYP.js → result-BRhb6iN1.js} +17 -13
  45. package/dist/{runner-BmKLSyJm.js → runner-DaWCofuS.js} +11 -11
  46. package/dist/{sandbox-egress-signals-CjLaogMo.js → sandbox-egress-signals-Bn6FA1UC.js} +1 -1
  47. package/dist/{schema-WayPSHFu.d.ts → schema-CNjAzYOw.d.ts} +28 -5
  48. package/dist/{schema-DNLJ_MzW.js → schema-D5VLF4NT.js} +13 -9
  49. package/dist/{service-account-DlhYl-Mu.js → service-account-D9vrsi8d.js} +3 -3
  50. package/dist/{service-account-D6e9cVmH.js → service-account-H45LIAG2.js} +3 -3
  51. package/dist/{session-stop-MZRgYqYH.js → session-stop-HKl0ECX0.js} +81 -153
  52. package/dist/{skills-BggTR_ue.js → skills-CsiKu3-g.js} +2 -2
  53. package/dist/{spawn-DmtlcAT_.js → spawn-DqjBxqWh.js} +2 -2
  54. package/dist/{store-BeWGgaMA.js → store-CPF2kzbu.js} +3 -3
  55. package/dist/{store-Byarin7b.js → store-DyVKH0QB.js} +47 -30
  56. package/dist/{task-queue-Dt1_ZoI_.js → task-queue-BbQXCcNX.js} +3 -3
  57. package/dist/{task-runner-DyKqAPpm.js → task-runner-ChzW5E7R.js} +7 -7
  58. package/dist/{thread-state-BHBLMvgb.js → thread-state-Ds8JTsX6.js} +5 -5
  59. package/dist/{turn-failure-response-DWXy_0oJ.js → turn-failure-response-DCMvjsA0.js} +15 -10
  60. package/dist/{turn-lifecycle-AiXkVqCB.js → turn-lifecycle-DM_77q33.js} +1 -1
  61. package/dist/{turn-session-routing-B9KLBhaT.js → turn-session-routing-BV_gX7n3.js} +13 -13
  62. package/dist/{validation-BW60Vtx_.js → validation-DcGelbBi.js} +1 -1
  63. package/dist/{version-CivPYmkH.js → version-C48azPKq.js} +1 -1
  64. package/dist/version.js +1 -1
  65. package/dist/{viewer-BTgAfdUg.js → viewer-BCRuO8Wg.js} +26 -10
  66. package/dist/{work-Bjm52fHo.js → work-zxkmbJAp.js} +27 -11
  67. package/dist/{worker-CMbgtHLu.js → worker-CNNxHF1V.js} +6 -6
  68. package/migrations/0071_review_item_turn.sql +1 -0
  69. package/migrations/0072_conversation_read_positions.sql +10 -0
  70. package/migrations/meta/0071_snapshot.json +4003 -0
  71. package/migrations/meta/0072_snapshot.json +4064 -0
  72. package/migrations/meta/_journal.json +14 -0
  73. package/package.json +4 -4
  74. package/dist/message-DsjiWRVg.js +0 -59
  75. package/migrations/AGENTS.md +0 -17
@@ -1,40 +1,40 @@
1
- import { $t as appendThreadContextMessages, An as recordTurnSummary, Ar as trimTrailingAssistantMessages, At as loadProjection, Cn as loadTurnCheckpoint, Dn as failTurnRecord, En as completeTurnRecord, Et as commitMessages, Fr as buildDeterministicTurnId, Gt as hydrateConversationMessages, Jt as persistConversationMessageSummaries, Kt as persistConversationMessages, Lr as decideSubscribedThreadReply, Lt as recordAuthorizationCompleted, On as getTurnRecord, Ot as loadConversationProjection, Pr as buildDeterministicAssistantMessageId, Rr as getSubscribedReplyPreflightDecision, Tn as abandonTurnRecord, Tt as commitAcceptedReply, Vt as recordSubscribedReplyRoute, Wr as isExperimentalFeatureEnabled, Yr as piMessageFromHistoryItem, Yt as resolveConversationTitle, Zt as fallbackShortTitle, _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, an as markConversationMessage, cn as turnHasReply, d as getDispatchTurnId, dn as PluginCredentialFailureError, en as buildConversationContext, fr as buildTurnErrorResponse, g as markDispatchBlocked, gr as persistWithRetry, h as markDispatchAwaitingResume, hn as AuthorizationFlowDisabledError, i as claimDispatchMailboxAppend, in as isHumanConversationMessage, j as readAutomationTitlesByConversationId, jt as loadTurnProjection, kn as listTurnSummaries, l as getDispatchInputMessageId, ln as upsertConversationMessage, n as resolveTurnSessionRouting, nn as estimateConversationContextTokens, on as normalizeConversationText, p as isTerminalDispatchStatus, qr as configValueSchema, rn as getConversationMessageSlackTs, s as getDispatchConversationId, sn as recordDeliveredAssistantMessage, t as resolveConversationRouting, tn as createConversationMemoryService, u as getDispatchRecord, v as markDispatchFailed, wn as saveTurnCheckpoint, xn as wasPendingAuthStopped, y as markDispatchRunning, yn as clearPendingAuth, zr as getThreadStopDecision } from "./turn-session-routing-B9KLBhaT.js";
2
- import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-B2MjENki.js";
3
- import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName, y as createS3AttachmentStorage } from "./config-Dm3pWRqY.js";
4
- import { B as isRecord, E as withSpan, H as toOptionalString, S as setTags, T as withLogContext, V as toOptionalNumber, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-C6EdT6PP.js";
1
+ import { $t as appendThreadContextMessages, An as recordTurnSummary, Ar as trimTrailingAssistantMessages, At as loadProjection, Cn as loadTurnCheckpoint, Dn as failTurnRecord, En as completeTurnRecord, Et as commitMessages, Fr as buildDeterministicTurnId, Gt as hydrateConversationMessages, Jt as persistConversationMessageSummaries, Kt as persistConversationMessages, Lr as decideSubscribedThreadReply, Lt as recordAuthorizationCompleted, On as getTurnRecord, Ot as loadConversationProjection, Pr as buildDeterministicAssistantMessageId, Rr as getSubscribedReplyPreflightDecision, Tn as abandonTurnRecord, Tt as commitAcceptedReply, Vt as recordSubscribedReplyRoute, Wr as isExperimentalFeatureEnabled, Yr as piMessageFromHistoryItem, Yt as resolveConversationTitle, Zt as fallbackShortTitle, _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, an as markConversationMessage, cn as turnHasReply, d as getDispatchTurnId, dn as PluginCredentialFailureError, en as buildConversationContext, fr as buildTurnErrorResponse, g as markDispatchBlocked, gr as persistWithRetry, h as markDispatchAwaitingResume, hn as AuthorizationFlowDisabledError, i as claimDispatchMailboxAppend, in as isHumanConversationMessage, j as readAutomationTitlesByConversationId, jt as loadTurnProjection, kn as listTurnSummaries, l as getDispatchInputMessageId, ln as upsertConversationMessage, n as resolveTurnSessionRouting, nn as estimateConversationContextTokens, on as normalizeConversationText, p as isTerminalDispatchStatus, qr as configValueSchema, rn as getConversationMessageSlackTs, s as getDispatchConversationId, sn as recordDeliveredAssistantMessage, t as resolveConversationRouting, tn as createConversationMemoryService, u as getDispatchRecord, v as markDispatchFailed, wn as saveTurnCheckpoint, xn as wasPendingAuthStopped, y as markDispatchRunning, yn as clearPendingAuth, zr as getThreadStopDecision } from "./turn-session-routing-BV_gX7n3.js";
2
+ import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-FRphcDWW.js";
3
+ import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName, y as createS3AttachmentStorage } from "./config-BUP9wjiR.js";
4
+ import { B as isRecord, E as withSpan, H as toOptionalString, S as setTags, T as withLogContext, V as toOptionalNumber, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-CjkDr-jP.js";
5
5
  import { i as getActiveSpan, r as continueTrace } from "./sentry-MDkYAVPV.js";
6
6
  import { i as defaultModelId, r as boundProfile, s as modelIdForProfile } from "./model-profile-B998sjVd.js";
7
- import { f as parseSlackTeamId, i as isActorUserId, m as parseSlackMessageTs, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-CP9K2Idu.js";
8
- import { C as getSqlExecutor, E as loadConversationSlackTenantIds, H as parseSessionSource, M as resolveActorIdentityId, N as saveActorAvatar, S as getDb, T as withConversationEventLock, U as addAgentTurnUsage, Y as createSlackDestination, Z as requireSlackDestination, f as identityAvatarUrl, h as readUserAvatarUrls, k as locationFromRow, q as hasAgentTurnUsage, x as getConversationStore, y as getConversationEventStore } from "./viewer-BTgAfdUg.js";
7
+ import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-B4DYygOB.js";
8
+ import { C as getSqlExecutor, E as loadConversationSlackTenantIds, H as parseSessionSource, M as resolveActorIdentityId, N as saveActorAvatar, S as getDb, T as withConversationEventLock, U as addAgentTurnUsage, Y as createSlackDestination, Z as requireSlackDestination, f as identityAvatarUrl, h as readUserAvatarUrls, k as locationFromRow, q as hasAgentTurnUsage, x as getConversationStore, y as getConversationEventStore } from "./viewer-BCRuO8Wg.js";
9
9
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
10
- import { S as juniorCodeChanges, g as juniorConversationBriefs, y as juniorConversationEvents } from "./executor-BB6eJkD4.js";
10
+ import { C as juniorCodeChanges, _ as juniorConversationBriefs, b as juniorConversationEvents, h as juniorConversationParticipants } from "./executor-DGDpyegI.js";
11
11
  import { g as instructionProvenanceFor, m as contextProvenance, r as isVisionImageMediaType } from "./media-U6Tuz6Mi.js";
12
- import { d as actorLogContext, f as credentialContextForActor } from "./registry-CndmkP2P.js";
13
- import { Et as withoutSavedSteeringMessages, F as getConversationInfo, I as listThreadReplies, M as readSlackRawMessageContext, N as resolveSlackChannelIdFromMessage, Nt as shouldEmitDevAgentTrace, P as resolveSlackChannelIdFromThreadId, St as conversationSubtreeColumns, Tt as buildSteeringPiMessage, b as renderBlockText, ct as webActorFromEmail, et as deliverReviewItemChange, i as buildAuthPauseResponse, j as parseSlackThreadId, k as runWithSlackInstallation, kt as RetryableDeliveryError, lt as resolveConversationDestination, mt as storeAttachment, n as executeAgentRun, ot as createConversationId, p as latestProgressStatus, r as createContextCompactor, st as recordWebConversationActivity, t as createAgentRunner, xt as conversationSubtree, y as renderAttachmentText } from "./agent-runner-MSQSMFkq.js";
14
- import { An as normalizeSlackConversationId, Ar as lookupSlackUser, Cn as SlackActionError, Dn as getSlackClient, Dr as listConversationAnnotationsById, Dt as removeReactionFromMessage, E as listReplyActionItems, En as getHeaderString, F as isOnlyAssignee, In as JUNIOR_THREAD_STATE_TTL_MS, M as canActOnReviewItem, Mn as withSlackRetries, P as canReadReviewItem, Sn as verifyTimerWatchCredentialSubject, Sr as recordSlackAttachment, _t as normalizeSlackStatusText, ar as createPluginLogger, b as closeReviewItem, bt as addReactionToMessage, cr as conversationArchivedForEmail, dr as conversationIsMemberRoot, fr as conversationNotArchivedForEmail, jr as createPluginCache, k as takeReviewItem, kn as isDmChannel, lr as conversationArchivedForUser, mr as viewerConversationMembership, n as createUserTokenStore, on as cancelSubscriptions, or as readConversationAccessFromSql, p as getPlugins, pr as conversationNotArchivedForUser, sr as conversationArchiveTimes, ur as conversationHasParticipantUser, w as getReviewItem, wn as downloadPrivateSlackFile, xr as readAttachmentVisionSummary, yr as getSlackFileId, yt as truncateStatusText, z as reviewItemReaderForUser } from "./credentialed-BeBaJMZ_.js";
12
+ import { d as actorLogContext, f as credentialContextForActor } from "./registry-7XgwNgQe.js";
13
+ import { Ct as conversationSubtree, Dt as buildSteeringPiMessage, F as getConversationInfo, Ft as shouldEmitDevAgentTrace, L as listThreadReplies, M as readSlackRawMessageContext, N as resolveSlackChannelIdFromMessage, Ot as withoutSavedSteeringMessages, P as resolveSlackChannelIdFromThreadId, R as resolveDestinationVisibility, b as renderBlockText, ct as createConversationId, dt as resolveConversationDestination, gt as storeAttachment, i as buildAuthPauseResponse, j as parseSlackThreadId, jt as RetryableDeliveryError, k as runWithSlackInstallation, lt as recordWebConversationActivity, n as executeAgentRun, nt as deliverReviewItemChange, p as latestProgressStatus, r as createContextCompactor, t as createAgentRunner, ut as webActorFromEmail, wt as conversationSubtreeColumns, y as renderAttachmentText } from "./agent-runner-Cl6Usx2Y.js";
14
+ import { An as normalizeSlackConversationId, Ar as lookupSlackUser, Cn as SlackActionError, Dn as getSlackClient, Dr as listConversationAnnotationsById, Dt as removeReactionFromMessage, E as listReplyActionItems, En as getHeaderString, F as isOnlyAssignee, In as JUNIOR_THREAD_STATE_TTL_MS, M as canActOnReviewItem, Mn as withSlackRetries, P as canReadReviewItem, Sn as verifyTimerWatchCredentialSubject, Sr as recordSlackAttachment, _t as normalizeSlackStatusText, ar as createPluginLogger, b as closeReviewItem, bt as addReactionToMessage, cr as conversationArchivedForEmail, dr as conversationIsMemberRoot, fr as conversationNotArchivedForEmail, jr as createPluginCache, k as takeReviewItem, kn as isDmChannel, lr as conversationArchivedForUser, mr as viewerConversationMembership, n as createUserTokenStore, on as cancelSubscriptions, or as readConversationAccessFromSql, p as getPlugins, pr as conversationNotArchivedForUser, sr as conversationArchiveTimes, ur as conversationHasParticipantUser, w as getReviewItem, wn as downloadPrivateSlackFile, xr as readAttachmentVisionSummary, yr as getSlackFileId, yt as truncateStatusText, z as reviewItemReaderForUser } from "./credentialed-CgTulRDH.js";
15
15
  import { a as withLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
16
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
17
- import { W as readMessageAttachments, g as conversationFeedSchema } from "./conversation-AhOVzN_k.js";
18
- import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-BPSdXYXV.js";
19
- import { B as ConversationTurnBoundaryError, G as isCooperativeTurnYieldError, H as TurnInputCommitLostError, J as markTurnClosed, K as isTurnInputCommitLostError, U as TurnInputDeferredError, V as CooperativeTurnYieldError, W as getConversationTurnBoundaryError, X as markTurnFailed, Y as markTurnCompleted, Z as startActiveTurn, q as isTurnInputDeferredError } from "./store-Byarin7b.js";
20
- import { r as getAssistantReplyText } from "./interruption-marker-CdblrIQK.js";
21
- import { C as maybePostAutomatedTurnLimitNotice, D as recordFinishedTurnForAutomatedLimit, I as runDispatchOutcome, M as finishedRunReply, N as postsRunNotices, T as sendSlackReply, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, j as deliversFinalText, l as renderEventBatchText, s as eventBatchMessageEvents, u as timerWatchCredentialSubject, w as resolveSlackReplyTarget, x as joinMailboxText } from "./session-stop-MZRgYqYH.js";
22
- import { _ as isEmptyUserInputAnswer, v as normalizeUserInputAnswer } from "./reporting-window-DRCi1Ls_.js";
23
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-DiaXoSDg.js";
24
- import { D as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-BeWGgaMA.js";
16
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
17
+ import { G as readMessageAttachments, g as conversationFeedSchema } from "./conversation-BtQzLoK8.js";
18
+ import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-vfceH0c-.js";
19
+ import { $ as startActiveTurn, G as TurnInputDeferredError, H as ConversationTurnBoundaryError, J as isTurnInputCommitLostError, K as getConversationTurnBoundaryError, Q as markTurnFailed, U as CooperativeTurnYieldError, W as TurnInputCommitLostError, X as markTurnClosed, Y as isTurnInputDeferredError, Z as markTurnCompleted, q as isCooperativeTurnYieldError } from "./store-DyVKH0QB.js";
20
+ import { n as getAssistantReplyText } from "./assistant-reply-DN2w6JL_.js";
21
+ import { A as recordFinishedTurnForAutomatedLimit, D as sendSlackReply, E as resolveSlackReplyTarget, F as finishedRunReply, I as postsRunNotices, P as deliversFinalText, S as joinMailboxText, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, l as renderEventBatchText, s as eventBatchMessageEvents, u as timerWatchCredentialSubject, w as maybePostAutomatedTurnLimitNotice, z as runDispatchOutcome } from "./session-stop-HKl0ECX0.js";
22
+ import { _ as isEmptyUserInputAnswer, v as normalizeUserInputAnswer } from "./reporting-window-DgHgwQB3.js";
23
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-CjB97sii.js";
24
+ import { D as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-CPF2kzbu.js";
25
25
  import { t as healthReportSchema } from "./reporting-schema-CZREhYc-.js";
26
- import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, d as legacyWebMailboxMetadataSchema, l as sourceFromTurnInput, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as turnInputFactsFromConversationMessage } from "./result-9TJTpuYP.js";
27
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-AiXkVqCB.js";
28
- import { a as AgentRunError, o as executeTurn } from "./work-Bjm52fHo.js";
29
- import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-BHBLMvgb.js";
30
- import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-0BBhiD-p.js";
31
- import { t as bindMessageAgent } from "./message-DsjiWRVg.js";
32
- import { t as bindSpawnAgent } from "./spawn-DmtlcAT_.js";
33
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DyKqAPpm.js";
34
- import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DWXy_0oJ.js";
26
+ import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-BRhb6iN1.js";
27
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-DM_77q33.js";
28
+ import { a as AgentRunError, o as executeTurn } from "./work-zxkmbJAp.js";
29
+ import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-Ds8JTsX6.js";
30
+ import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-CesHau9u.js";
31
+ import { t as bindMessageAgent } from "./message-D9y8PKA1.js";
32
+ import { t as bindSpawnAgent } from "./spawn-DqjBxqWh.js";
33
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-ChzW5E7R.js";
34
+ import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DCMvjsA0.js";
35
35
  import { z } from "zod";
36
36
  import { createHash } from "node:crypto";
37
- import { and, asc, desc, eq, inArray, isNotNull, isNull, ne, or, sql } from "drizzle-orm";
37
+ import { and, asc, desc, eq, inArray, isNotNull, isNull, or, sql } from "drizzle-orm";
38
38
  import { conversationSidebarAnnotationSchema, createSlackSource, objectTypeSchema } from "@sentry/junior-plugin-api";
39
39
  import { alias } from "drizzle-orm/pg-core";
40
40
  import { del, get, put } from "@vercel/blob";
@@ -471,10 +471,6 @@ function reviewItemChange(action, user) {
471
471
  kind: "submitted",
472
472
  user
473
473
  };
474
- if (action === "complete") return {
475
- kind: "completed",
476
- user
477
- };
478
474
  return {
479
475
  kind: "dismissed",
480
476
  user
@@ -499,7 +495,7 @@ function submittedAnswer(item, answer) {
499
495
  }
500
496
  /**
501
497
  * Do one person action on a Review item and tell its linked Conversations.
502
- * The first submit, complete, or dismiss closes the item for every
498
+ * The first submit or dismiss closes the item for every
503
499
  * assignee. A retry of the same close sends any missing messages again and
504
500
  * succeeds, so a client can retry after a failure. With `firstCloseOnly`,
505
501
  * only the call that closes the item succeeds, and every other call gets a
@@ -537,7 +533,6 @@ async function actOnReviewItem(args) {
537
533
  let closedNow = false;
538
534
  if (item.status === "open") {
539
535
  if (!canActOnReviewItem(item, user.id)) throw new ReviewItemActionError("forbidden", "Only an assignee can act on this item.");
540
- if (action === "complete" && item.kind === "action") throw new ReviewItemActionError("invalid", "An action item needs an answer. Submit it or dismiss it.");
541
536
  const answer = action === "submit" ? submittedAnswer(item, args.answer) : void 0;
542
537
  closedNow = await closeReviewItem(db, {
543
538
  closedByUserId: user.id,
@@ -3518,17 +3513,6 @@ async function maybeApplyProviderDefaultConfigRequest(args) {
3518
3513
  });
3519
3514
  return { text: `Default GitHub repo set to \`${repo}\`.` };
3520
3515
  }
3521
- // src/chat/conversations/destination-visibility.ts
3522
- /** Read confirmed visibility from the current signal or persisted destination. */
3523
- async function resolveDestinationVisibility(args) {
3524
- if (args.visibility) return args.visibility;
3525
- if (args.destination.platform === "local") return "private";
3526
- return await getConversationStore().getDestinationVisibility({
3527
- provider: "slack",
3528
- providerDestinationId: args.destination.channelId,
3529
- providerTenantId: args.destination.teamId
3530
- });
3531
- }
3532
3516
  // src/chat/providers/slack/input.ts
3533
3517
  function renderRecentThreadMessageLines(conversationContext, messages) {
3534
3518
  const messagesForContext = messages.filter((queued) => {
@@ -6393,21 +6377,21 @@ function createConversationTurnWorker(agentRunner, deliverMessage) {
6393
6377
  if (stopSignal?.aborted) return await completeCancelledTurn();
6394
6378
  if (!isResume) {
6395
6379
  const pendingAuthorizationActorId = conversation.processing.pendingAuth?.actorId;
6396
- const authParked = (await listTurnSummaries(context.conversationId)).filter((summary) => summary.surface === "api" && !summary.dispatchId && summary.state === "paused" && summary.resumeReason === "auth");
6397
- for (const parked of authParked) {
6380
+ const superseded = (await listActiveMailboxTurns(context.conversationId)).filter((record) => record.turnId !== turnId);
6381
+ for (const stale of superseded) {
6398
6382
  if (stopSignal?.aborted) return await completeCancelledTurn();
6399
6383
  await abandonTurnRecord({
6400
6384
  conversationId: context.conversationId,
6401
- turnId: parked.turnId,
6402
- errorMessage: "Auth-paused Turn superseded by new input"
6385
+ turnId: stale.turnId,
6386
+ errorMessage: "Turn superseded by new input"
6403
6387
  });
6404
6388
  markTurnClosed({
6405
6389
  conversation,
6406
6390
  nowMs: Date.now(),
6407
- sessionId: parked.turnId
6391
+ sessionId: stale.turnId
6408
6392
  });
6409
6393
  }
6410
- if (authParked.length > 0 && pendingAuthorizationActorId) await deleteWebAuthorization({
6394
+ if (superseded.some((record) => record.state === "paused" && record.resumeReason === "auth") && pendingAuthorizationActorId) await deleteWebAuthorization({
6411
6395
  actorId: pendingAuthorizationActorId,
6412
6396
  conversationId: context.conversationId
6413
6397
  });
@@ -7710,7 +7694,7 @@ async function readConversationParticipants(db, conversationIds) {
7710
7694
  conversationId: juniorConversationEvents.conversationId,
7711
7695
  seq: juniorConversationEvents.seq,
7712
7696
  ...identityColumns
7713
- }).from(juniorConversationEvents).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationEvents.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(inArray(juniorConversationEvents.conversationId, [...conversationIds]), ne(juniorIdentities.kind, "system"))).orderBy(asc(juniorConversationEvents.conversationId), asc(juniorConversationEvents.actorIdentityId), asc(juniorConversationEvents.seq))]);
7697
+ }).from(juniorConversationEvents).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversationEvents.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).innerJoin(juniorConversations, eq(juniorConversations.conversationId, juniorConversationEvents.conversationId)).innerJoin(juniorConversationParticipants, and(eq(juniorConversationParticipants.userId, juniorIdentities.userId), eq(juniorConversationParticipants.rootConversationId, sql`coalesce(${juniorConversations.rootConversationId}, ${juniorConversations.conversationId})`))).where(inArray(juniorConversationEvents.conversationId, [...conversationIds])).orderBy(asc(juniorConversationEvents.conversationId), asc(juniorConversationEvents.actorIdentityId), asc(juniorConversationEvents.seq))]);
7714
7698
  const userAvatarUrls = await readUserAvatarUrls(db, [...rootRows, ...eventRows].flatMap((row) => row.userId ? [row.userId] : []));
7715
7699
  const ordered = /* @__PURE__ */ new Map();
7716
7700
  const add = (conversationId, row) => {
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-MDkYAVPV.js";
2
- import { t as JUNIOR_VERSION } from "./version-CivPYmkH.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C48azPKq.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -0,0 +1,186 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { n as botConfig } from "./config-BUP9wjiR.js";
3
+ import { S as getDb, i as readActorIdentity, j as SYSTEM_IDENTITY_ID, x as getConversationStore } from "./viewer-BCRuO8Wg.js";
4
+ import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Cl6Usx2Y.js";
5
+ import { or as readConversationAccessFromSql } from "./credentialed-CgTulRDH.js";
6
+ import { A as AgentMessagePausedError, I as PARENT_AGENT_TARGET, M as AgentMessageTargetError, P as findChildAgentConversationId, i as createAgentInvocationForMessage, o as getActiveAgentInvocationForConversation } from "./store-DyVKH0QB.js";
7
+ import { T as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, k as admitAutomatedTurn } from "./session-stop-HKl0ECX0.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
9
+ import { r as enqueueAgentMessageToParent } from "./result-BRhb6iN1.js";
10
+ import { r as enqueueAgentInvocation } from "./work-zxkmbJAp.js";
11
+ // src/chat/agent-invocations/top-level-message.ts
12
+ const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
+ /** Event type of a message from another top-level agent. */
14
+ const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
15
+ /**
16
+ * Check that a top-level agent can message another top-level agent. Both
17
+ * must be in the same provider tenant and have the same scope: public or
18
+ * private. To reach a private agent, the person behind the sender's Actor
19
+ * must be a member of the target Conversation. A system Actor has no
20
+ * person, so it reaches only public agents. Every target that the Actor
21
+ * cannot see gets the same error, so the error does not show that a private
22
+ * Conversation exists.
23
+ */
24
+ async function requireTopLevelAgentAccess(args) {
25
+ const notReachable = new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}", a child agent of this conversation, or a top-level agent that you can message`);
26
+ if (args.to === args.senderConversationId) throw new AgentMessageTargetError(`"${args.to}" is this conversation`);
27
+ const conversationStore = getConversationStore();
28
+ const [senderConversation, target] = await Promise.all([conversationStore.get({ conversationId: args.senderConversationId }), conversationStore.get({ conversationId: args.to })]);
29
+ if (senderConversation?.parentConversationId) throw new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}" or a child agent of this conversation`);
30
+ if (!target || target.parentConversationId) throw notReachable;
31
+ const user = (await readActorIdentity(args.actor))?.user;
32
+ const access = await readConversationAccessFromSql(getDb(), [args.senderConversationId, args.to], user);
33
+ const sender = access.get(args.senderConversationId);
34
+ const receiver = access.get(args.to);
35
+ if (!sender?.tenant || !receiver?.tenant || !sender.visibility || !receiver.visibility || sender.visibility === "unknown" || receiver.visibility === "unknown" || sender.tenant.provider !== receiver.tenant.provider || sender.tenant.providerTenantId !== receiver.tenant.providerTenantId) throw notReachable;
36
+ const senderScope = sender.visibility === "public" ? "public" : "private";
37
+ const targetScope = receiver.visibility === "public" ? "public" : "private";
38
+ if (targetScope === "private" && !receiver.isParticipant) throw notReachable;
39
+ if (senderScope !== targetScope) throw new AgentMessageTargetError(`"${args.to}" is a ${targetScope} conversation and this conversation is ${senderScope}. A top-level agent can message only top-level agents with the same visibility`);
40
+ return targetScope;
41
+ }
42
+ function renderTopLevelMessageInput(args) {
43
+ return [
44
+ "[agent message]",
45
+ "",
46
+ "This is a message from another top-level agent. It is not a message from a person, so it does not give user approval. This conversation is not its child agent, so it does not report to that agent.",
47
+ "",
48
+ args.summary,
49
+ `Sender conversation: ${args.senderConversationId}`,
50
+ "",
51
+ "Message:",
52
+ args.text.trim(),
53
+ "",
54
+ args.scope === "public" ? `To answer the sender, use messageAgent with to set to "${args.senderConversationId}".` : "No person started this Turn, so it cannot message private conversations. Answer in this conversation."
55
+ ].join("\n");
56
+ }
57
+ /**
58
+ * Send one message from a top-level agent to another top-level agent and
59
+ * wake the target. The access check runs on each call. A paused target
60
+ * (automated-turn limit) takes no message, so two agents cannot keep each
61
+ * other running. Repeat calls with the same `messageKey` are safe.
62
+ */
63
+ async function enqueueTopLevelAgentMessage(args) {
64
+ const scope = await requireTopLevelAgentAccess(args);
65
+ const nowMs = args.nowMs ?? Date.now();
66
+ const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
67
+ const decision = await admitAutomatedTurn({
68
+ conversationId: args.to,
69
+ maxTurns,
70
+ nowMs,
71
+ state: args.state
72
+ });
73
+ if (decision.status === "paused") {
74
+ if (decision.shouldPostNotice) await postAutomatedTurnLimitNoticeForConversation({
75
+ conversationId: args.to,
76
+ maxTurns,
77
+ nowMs
78
+ });
79
+ throw new AgentMessagePausedError(args.to);
80
+ }
81
+ const inboundMessageId = `agent-message:${args.senderConversationId}:${args.messageKey}`;
82
+ const summary = `Top-level agent ${args.senderConversationId} sent a message.`;
83
+ const metadata = {
84
+ kind: "event",
85
+ event: {
86
+ eventKey: inboundMessageId,
87
+ eventType: TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE,
88
+ identifier: args.senderConversationId,
89
+ namespace: AGENT_MESSAGE_EVENT_NAMESPACE,
90
+ trustedSummary: summary
91
+ }
92
+ };
93
+ await appendAndEnqueueInboundMessage({
94
+ message: {
95
+ conversationId: args.to,
96
+ createdAtMs: nowMs,
97
+ delivery: "defer",
98
+ inboundMessageId,
99
+ input: {
100
+ authorId: `agent-message:${args.senderConversationId}`,
101
+ authorIdentityId: SYSTEM_IDENTITY_ID,
102
+ metadata,
103
+ text: renderTopLevelMessageInput({
104
+ scope,
105
+ senderConversationId: args.senderConversationId,
106
+ summary,
107
+ text: args.text
108
+ })
109
+ },
110
+ receivedAtMs: nowMs,
111
+ source: "event"
112
+ },
113
+ queue: args.queue,
114
+ queueDelayMs: EVENT_WAIT_MS,
115
+ state: args.state
116
+ });
117
+ }
118
+ // src/chat/agent-invocations/message.ts
119
+ var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
120
+ /**
121
+ * Bind a Run's Actor and credentials to messages for its parent and child
122
+ * agents, and for other top-level agents. A message to a child continues that
123
+ * child. A message to the parent wakes the parent like a result. A top-level
124
+ * agent can also message another top-level agent that it has access to.
125
+ */
126
+ function bindMessageAgent(run, options) {
127
+ const actor = actorFromRun(run);
128
+ if (!actor) return;
129
+ return async (input, call) => {
130
+ call.signal?.throwIfAborted();
131
+ const queue = typeof options.queue === "function" ? options.queue() : options.queue;
132
+ if (input.to === "parent") {
133
+ const sender = await getActiveAgentInvocationForConversation(run.conversationId);
134
+ if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
135
+ await enqueueAgentMessageToParent({
136
+ messageKey: `${run.turnId}:${call.toolCallId}`,
137
+ queue,
138
+ sender,
139
+ state: options.state,
140
+ text: input.text
141
+ });
142
+ return {
143
+ conversationId: sender.parentConversationId,
144
+ delivery: "queued"
145
+ };
146
+ }
147
+ const childConversationId = await findChildAgentConversationId({
148
+ parentConversationId: run.conversationId,
149
+ target: input.to
150
+ });
151
+ if (!childConversationId) {
152
+ await enqueueTopLevelAgentMessage({
153
+ actor,
154
+ messageKey: `${run.turnId}:${call.toolCallId}`,
155
+ queue,
156
+ senderConversationId: run.conversationId,
157
+ state: options.state,
158
+ text: input.text,
159
+ to: input.to
160
+ });
161
+ return {
162
+ conversationId: input.to,
163
+ delivery: "queued"
164
+ };
165
+ }
166
+ const { invocation, queued } = await createAgentInvocationForMessage({
167
+ actor,
168
+ childConversationId,
169
+ ...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
170
+ destination: toolInvocationDestination(run),
171
+ idempotencyKey: `${run.turnId}:${call.toolCallId}`,
172
+ input: input.text,
173
+ parentConversationId: run.conversationId,
174
+ parentToolCallId: call.toolCallId
175
+ });
176
+ await enqueueAgentInvocation(invocation, {
177
+ ...options,
178
+ queue
179
+ });
180
+ return {
181
+ conversationId: childConversationId,
182
+ delivery: queued ? "queued" : "started"
183
+ };
184
+ };
185
+ }
186
+ export { message_exports as n, bindMessageAgent as t };
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-Bz8t4P8p.js";
1
+ import { i as JuniorDashboardOptions } from "./app-DjZblE2J.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, F as getDeploymentServiceVersion, M as JUNIOR_RETENTION_ROUTE, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_HEARTBEAT_CRON_SCHEDULE, j as JUNIOR_RETENTION_CRON_SCHEDULE, k as JUNIOR_HEARTBEAT_ROUTE } from "./logging-C6EdT6PP.js";
1
+ import { A as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, F as getDeploymentServiceVersion, M as JUNIOR_RETENTION_ROUTE, N as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_HEARTBEAT_CRON_SCHEDULE, j as JUNIOR_RETENTION_CRON_SCHEDULE, k as JUNIOR_HEARTBEAT_ROUTE } from "./logging-CjkDr-jP.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJBompdd.js";
3
- import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DiaXoSDg.js";
3
+ import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CjB97sii.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-DOm9Y6qI.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Dt1_ZoI_.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BbQXCcNX.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { n as createUserTokenStore } from "./credentialed-BeBaJMZ_.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BRiWYs6_.js";
1
+ import { n as createUserTokenStore } from "./credentialed-CgTulRDH.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-D2odJC30.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,4 +1,4 @@
1
- import { J as conversationBriefSchema, Y as parseBriefInput, q as briefOutcomeStatusSchema } from "./conversation-AhOVzN_k.js";
1
+ import { J as briefOutcomeStatusSchema, X as parseBriefInput, Y as conversationBriefSchema } from "./conversation-BtQzLoK8.js";
2
2
  import { z } from "zod";
3
3
  // src/chat/briefs/generate.ts
4
4
  const MAX_INPUT_CHARS = 6e4;
@@ -1,5 +1,5 @@
1
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-C6EdT6PP.js";
2
- import { o as isUserActor, s as parseActorUserId } from "./actor-CP9K2Idu.js";
1
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-CjkDr-jP.js";
2
+ import { o as isUserActor, s as parseActorUserId } from "./actor-B4DYygOB.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJBompdd.js";
4
4
  import path from "node:path";
5
5
  import { z } from "zod";
@@ -30,7 +30,8 @@ const labelSchema = z.string().trim().min(1).max(USER_INPUT_LIMITS.maxLabelChars
30
30
  const descriptionSchema = z.string().trim().min(1).max(USER_INPUT_LIMITS.maxDescriptionChars).optional();
31
31
  const optionSchema = z.object({
32
32
  label: labelSchema.describe("Short choice text, such as `Accept` or `Decline`. The answer uses this exact text."),
33
- description: descriptionSchema.describe("Optional short note about what this choice does.")
33
+ description: descriptionSchema.describe("Optional short note about what this choice does."),
34
+ recommended: z.boolean().optional().describe("Set true on the choice that you recommend, and say why in its description. A `choice` field can recommend one option.")
34
35
  });
35
36
  const fieldBase = {
36
37
  id: z.string().regex(/^[a-z][a-z0-9_]{0,31}$/).describe("Stable key for this field, such as `approach`."),
@@ -71,6 +72,10 @@ const userInputRequestSchema = z.object({
71
72
  code: "custom",
72
73
  message: "Each choice of a field needs a different label."
73
74
  });
75
+ if (field.kind === "choice" && field.options.filter((option) => option.recommended).length > 1) context.addIssue({
76
+ code: "custom",
77
+ message: "A `choice` field can recommend only one option."
78
+ });
74
79
  }
75
80
  });
76
81
  /**
@@ -1,6 +1,6 @@
1
- import { E as withSpan, b as setSpanAttributes } from "./logging-C6EdT6PP.js";
2
- import { Kn as runNonInteractiveCommand, Nn as sleep, Qn as SANDBOX_WORKSPACE_ROOT, it as isStale, nt as create, ot as getSandboxProvider, qn as SANDBOX_COMMAND_PATH } from "./credentialed-BeBaJMZ_.js";
3
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
1
+ import { E as withSpan, b as setSpanAttributes } from "./logging-CjkDr-jP.js";
2
+ import { Kn as runNonInteractiveCommand, Nn as sleep, Qn as SANDBOX_WORKSPACE_ROOT, it as isStale, nt as create, ot as getSandboxProvider, qn as SANDBOX_COMMAND_PATH } from "./credentialed-CgTulRDH.js";
3
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
4
4
  import { z } from "zod";
5
5
  // src/chat/sandbox/resources.ts
6
6
  let configuredResources;
@@ -1,14 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { On as getTurnRecord, kn as listTurnSummaries } from "./turn-session-routing-B9KLBhaT.js";
3
- import { t as createActor } from "./actor-CP9K2Idu.js";
4
- import { j as SYSTEM_IDENTITY_ID } from "./viewer-BTgAfdUg.js";
5
- import { f as credentialContextForActor } from "./registry-CndmkP2P.js";
6
- import { bt as listUnreportedSiblingAgents } from "./agent-runner-MSQSMFkq.js";
7
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-BPSdXYXV.js";
8
- import { C as markAgentInvocationParentMailboxAppended, _ as getLatestAgentInvocationForConversation, a as createAgentInvocationFromLatest, c as getAgentInvocation, d as getAgentInvocationIdForResult, l as getAgentInvocationIdForEvents, p as getAgentInvocationResultMessageId, u as getAgentInvocationIdForMessage, y as isTerminalAgentInvocation } from "./store-Byarin7b.js";
9
- import { a as EVENT_WAIT_MS, c as isEventMailboxMetadata, l as renderEventBatchText, u as timerWatchCredentialSubject } from "./session-stop-MZRgYqYH.js";
10
- import { r as appendAndEnqueueInboundMessage } from "./store-BeWGgaMA.js";
11
- import { i as resolveAgentInvocationId, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-Bjm52fHo.js";
2
+ import { On as getTurnRecord, kn as listTurnSummaries } from "./turn-session-routing-BV_gX7n3.js";
3
+ import { t as createActor } from "./actor-B4DYygOB.js";
4
+ import { j as SYSTEM_IDENTITY_ID } from "./viewer-BCRuO8Wg.js";
5
+ import { f as credentialContextForActor } from "./registry-7XgwNgQe.js";
6
+ import { St as listUnreportedSiblingAgents } from "./agent-runner-Cl6Usx2Y.js";
7
+ import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-vfceH0c-.js";
8
+ import { C as markAgentInvocationParentMailboxAppended, a as createAgentInvocationFromLatest, c as getAgentInvocationIdForEvents, f as getAgentInvocationResultMessageId, g as getLatestAgentInvocationForConversation, l as getAgentInvocationIdForMessage, s as getAgentInvocation, u as getAgentInvocationIdForResult, v as isTerminalAgentInvocation } from "./store-DyVKH0QB.js";
9
+ import { a as EVENT_WAIT_MS, c as isEventMailboxMetadata, l as renderEventBatchText, u as timerWatchCredentialSubject } from "./session-stop-HKl0ECX0.js";
10
+ import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
11
+ import { i as resolveAgentInvocationId, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-zxkmbJAp.js";
12
12
  import { z } from "zod";
13
13
  import { createEventSource, createLocalSource, createWebSource } from "@sentry/junior-plugin-api";
14
14
  // src/chat/conversations/web-mailbox.ts
@@ -62,10 +62,14 @@ async function getActiveConversationTurnId(conversationId) {
62
62
  const record = await getTurnRecord(conversationId, turnId);
63
63
  return record && (record.source?.kind === "web" || !record.source && record.surface === "api") && !record.dispatchId && (record.state === "paused" || record.state === "running") ? turnId : void 0;
64
64
  }
65
+ /** Return the web and event mailbox Turns that are paused or running. */
66
+ async function listActiveMailboxTurns(conversationId) {
67
+ const summaries = await listTurnSummaries(conversationId);
68
+ return (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record !== void 0 && !record.dispatchId && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
69
+ }
65
70
  /** Return the active web or event mailbox Turn. */
66
71
  async function getActiveMailboxTurnId(conversationId) {
67
- const summaries = await listTurnSummaries(conversationId);
68
- const active = (await Promise.all(summaries.filter((summary) => !summary.dispatchId && (summary.state === "paused" || summary.state === "running")).map((summary) => getTurnRecord(conversationId, summary.turnId)))).filter((record) => record && !record.dispatchId && (record.source?.kind === "web" || record.source?.kind === "event" || !record.source && (record.surface === "api" || hasEventActor(record.actors))) && (record.state === "paused" || record.state === "running"));
72
+ const active = await listActiveMailboxTurns(conversationId);
69
73
  if (active.length > 1) throw new Error(`Conversation ${conversationId} has multiple active mailbox Turns`);
70
74
  return active[0]?.turnId;
71
75
  }
@@ -476,4 +480,4 @@ async function withAgentInvocationResultActors(work) {
476
480
  }))
477
481
  };
478
482
  }
479
- export { withAgentInvocationResultActors as a, resolveMailboxTurnWork as c, legacyWebMailboxMetadataSchema as d, result_exports as i, sourceFromTurnInput as l, enqueueAgentInvocationResult as n, getAuthPausedConversationTurnId as o, enqueueAgentMessageToParent as r, getEventBatchDelayMs as s, createChildConversationWorker as t, turnInputFactsFromConversationMessage as u };
483
+ export { withAgentInvocationResultActors as a, listActiveMailboxTurns as c, turnInputFactsFromConversationMessage as d, legacyWebMailboxMetadataSchema as f, result_exports as i, resolveMailboxTurnWork as l, enqueueAgentInvocationResult as n, getAuthPausedConversationTurnId as o, enqueueAgentMessageToParent as r, getEventBatchDelayMs as s, createChildConversationWorker as t, sourceFromTurnInput as u };
@@ -1,14 +1,14 @@
1
- import { At as loadProjection, Gt as hydrateConversationMessages, Kt as persistConversationMessages, Lt as recordAuthorizationCompleted, Tt as commitAcceptedReply, an as markConversationMessage, en as buildConversationContext, gr as persistWithRetry, ln as upsertConversationMessage, on as normalizeConversationText, pn as authorizationId, sn as recordDeliveredAssistantMessage, wn as saveTurnCheckpoint } from "./turn-session-routing-B9KLBhaT.js";
2
- import { S as setTags, T as withLogContext, p as logException } from "./logging-C6EdT6PP.js";
3
- import { j as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BTgAfdUg.js";
4
- import { f as credentialContextForActor } from "./registry-CndmkP2P.js";
5
- import { R as messageCardText } from "./conversation-AhOVzN_k.js";
6
- import { X as markTurnFailed, Z as startActiveTurn } from "./store-Byarin7b.js";
7
- import { r as getAssistantReplyText } from "./interruption-marker-CdblrIQK.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-AiXkVqCB.js";
9
- import { a as persistThreadStateById, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BHBLMvgb.js";
10
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DyKqAPpm.js";
11
- import { i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DWXy_0oJ.js";
1
+ import { At as loadProjection, Gt as hydrateConversationMessages, Kt as persistConversationMessages, Lt as recordAuthorizationCompleted, Tt as commitAcceptedReply, an as markConversationMessage, en as buildConversationContext, gr as persistWithRetry, ln as upsertConversationMessage, on as normalizeConversationText, pn as authorizationId, sn as recordDeliveredAssistantMessage, wn as saveTurnCheckpoint } from "./turn-session-routing-BV_gX7n3.js";
2
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-CjkDr-jP.js";
3
+ import { j as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BCRuO8Wg.js";
4
+ import { f as credentialContextForActor } from "./registry-7XgwNgQe.js";
5
+ import { z as messageCardText } from "./conversation-BtQzLoK8.js";
6
+ import { $ as startActiveTurn, Q as markTurnFailed } from "./store-DyVKH0QB.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-DN2w6JL_.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DM_77q33.js";
9
+ import { a as persistThreadStateById, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Ds8JTsX6.js";
10
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-ChzW5E7R.js";
11
+ import { i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-DCMvjsA0.js";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
14
14
  // src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Kt as sandboxEgressSignalsResponseSchema } from "./credentialed-BeBaJMZ_.js";
1
+ import { Kt as sandboxEgressSignalsResponseSchema } from "./credentialed-CgTulRDH.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;