@sentry/junior 0.244.0 → 0.246.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 (58) hide show
  1. package/dist/{admin-CF9lQg0M.js → admin-Bh-MYw-j.js} +1 -1
  2. package/dist/{agent-hooks-Cj_rSeWd.js → agent-hooks-DpklSWZg.js} +10 -10
  3. package/dist/{agent-runner-DtEtbaOb.js → agent-runner-DSKpHjHW.js} +568 -191
  4. package/dist/api/schema.d.ts +86 -3
  5. package/dist/api/schema.js +3 -3
  6. package/dist/api.js +372 -245
  7. package/dist/{app-DRLh-8zs.d.ts → app-BYB7szGb.d.ts} +2 -0
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +179 -146
  10. package/dist/{briefs-BMzTiGJO.js → briefs-cZ5vWqP_.js} +4 -4
  11. package/dist/{catalog-runtime-CpxhLwZG.js → catalog-runtime-CTaQXYqS.js} +1 -1
  12. package/dist/cli/chat.js +17 -13
  13. package/dist/cli/check.js +3 -3
  14. package/dist/cli/main.js +2 -2
  15. package/dist/cli/plugins.js +4 -4
  16. package/dist/cli/snapshot-create.js +3 -3
  17. package/dist/cli/upgrade.js +3 -3
  18. package/dist/{client-BVaGEb1-.js → client--xtsAxKP.js} +2 -2
  19. package/dist/{config-q9xXVN_5.js → config-BK53Ip5C.js} +11 -2
  20. package/dist/{conversation-BxvgH64Q.js → conversation-CvBG57Io.js} +11 -1
  21. package/dist/{conversation-privacy-Dyh_63Ee.js → conversation-privacy-BDBFw6Ws.js} +1 -1
  22. package/dist/{credential-sync-Bsn-6m16.js → credential-sync-BiuhC9Ds.js} +14 -14
  23. package/dist/{executor-DA7eHhmC.js → executor-bmmuRY-w.js} +2 -2
  24. package/dist/{images-CvMreau5.js → images-DZliDtSH.js} +3 -3
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-mVyF9jgv.js → job-queue-Cz3M7gg4.js} +1 -1
  27. package/dist/{logging-z7_w-KN_.js → logging-DVtMYOdD.js} +1 -1
  28. package/dist/message-BSN-Ma5f.js +317 -0
  29. package/dist/nitro.d.ts +1 -1
  30. package/dist/nitro.js +3 -3
  31. package/dist/{oauth-authorization-Db1yGVvG.js → oauth-authorization-By_MVRDC.js} +1 -1
  32. package/dist/{oauth-callback-server-_MfOtSxS.js → oauth-callback-server-BrUo6w1e.js} +2 -2
  33. package/dist/{pending-auth-OndKPW4M.js → pending-auth-BuQLZ6dK.js} +2 -2
  34. package/dist/{profile-yeKVNECl.js → profile-BevMNSlr.js} +4 -4
  35. package/dist/{prompt-CX36ZlbV.js → prompt-C9Q9cjD3.js} +1 -1
  36. package/dist/{registry-DvzzL8-v.js → registry-C2rSEio1.js} +1 -1
  37. package/dist/{resolve-4u5gEU04.js → resolve-qPhrznTf.js} +2 -2
  38. package/dist/{runner-Y6A6pww4.js → runner-CNh5eMWx.js} +10 -10
  39. package/dist/{sandbox-egress-signals-D7AOkuoe.js → sandbox-egress-signals-BnDEKu8d.js} +1 -1
  40. package/dist/{schema-Dyyi9oRc.js → schema-BWMRg8JS.js} +28 -4
  41. package/dist/{skills-DFduSvuO.js → skills-C6zJbudq.js} +2 -2
  42. package/dist/{spawn-DYg7jhhR.js → spawn-C3efZSx3.js} +2 -2
  43. package/dist/{task-queue-BQ0vnumm.js → task-queue-BX4vG6uA.js} +3 -3
  44. package/dist/{task-runner-D4jvUpFV.js → task-runner-T51kll0U.js} +10 -10
  45. package/dist/{tasks-DBZAgTx7.js → tasks-B9OIjl2K.js} +82 -11
  46. package/dist/{thread-state-hj70P2Cp.js → thread-state-AGZtVyXp.js} +6 -6
  47. package/dist/{turn-failure-response-S2pwtR8b.js → turn-failure-response-DJ8KU2bo.js} +9 -9
  48. package/dist/{turn-lifecycle-CNFOMAJq.js → turn-lifecycle-DZJkJ95q.js} +1 -1
  49. package/dist/{turn-session-routing-1eTgv6ns.js → turn-session-routing-mRqLbMZW.js} +1 -1
  50. package/dist/{validation-DcsBjzdi.js → validation-Dg0Ihxzo.js} +1 -1
  51. package/dist/{version-DVCHJYcY.js → version-Deub4try.js} +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/{viewer-BBnCMR1g.js → viewer-D5hbx6TE.js} +3 -3
  54. package/dist/{web-authorization-CTltRLsB.js → web-authorization-DCxixz5S.js} +6 -6
  55. package/dist/{web-input-CIsRGF07.js → web-input-0sorYVLh.js} +74 -187
  56. package/dist/{work-fje9VXgQ.js → work-rm2X7jj4.js} +13 -6
  57. package/dist/{worker-Byd2Et9r.js → worker-bnGsAOP3.js} +5 -5
  58. package/package.json +4 -4
@@ -1,34 +1,35 @@
1
- import { $ as getLatestAgentInvocationForConversation, A as resolveSlackChannelIdFromMessage, B as effectiveTaskOutcomes, C as renderBlockText, D as storeAttachment, M as getConversationInfo, N as listThreadReplies, Nt as getConversationWorkState, O as parseSlackThreadId, Qt as recordFinishedTurnForAutomatedLimit, S as renderAttachmentText, Xt as renderTaskInput, Y as getAgentInvocation, Z as getAgentInvocationResultMessageId, Zt as maybePostAutomatedTurnLimitNotice, _n as AuthorizationFlowDisabledError, _t as pluginEventCatalog, a as buildAuthPauseResponse, at as markAgentInvocationParentMailboxAppended, bn as runDispatchOutcome, bt as appendAndEnqueueInboundMessage, et as isTerminalAgentInvocation, fn as createUserTokenStore, ft as EVENT_WAIT_MS, h as latestProgressStatus, ht as getEventCatalog, j as resolveSlackChannelIdFromThreadId, k as readSlackRawMessageContext, m as PluginCredentialFailureError, mn as RetryableDeliveryError, mt as timerWatchCredentialSubject, n as executeAgentRun, pn as buildSteeringPiMessage, pt as isEventMailboxMetadata, q as createAgentInvocationForResult, r as createContextCompactor, t as createAgentRunner, vn as deliversFinalText, xn as shouldEmitDevAgentTrace, yn as finishedRunReply, yt as appendAndEnqueueExclusiveInboundMessage, z as eventAutomationTriggerAvailable } from "./agent-runner-DtEtbaOb.js";
2
- import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-BVaGEb1-.js";
3
- import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-z7_w-KN_.js";
4
- import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-q9xXVN_5.js";
1
+ import { $t as stopConversationWork, A as resolveSlackChannelIdFromMessage, An as finishedRunReply, At as appendAndEnqueueInboundMessage, B as effectiveTaskOutcomes, C as renderBlockText, Cn as buildSteeringPiMessage, D as storeAttachment, Dn as AuthorizationFlowDisabledError, Et as automationEventCatalog, Ht as getConversation, M as getConversationInfo, Mn as shouldEmitDevAgentTrace, N as listThreadReplies, O as parseSlackThreadId, S as renderAttachmentText, Sn as createUserTokenStore, St as getEventCatalog, Ut as getConversationWorkState, Vt as ensureConversationWake, Zt as requestConversationWork, a as buildAuthPauseResponse, bt as isEventMailboxMetadata, cn as recordFinishedTurnForAutomatedLimit, h as latestProgressStatus, j as resolveSlackChannelIdFromThreadId, jn as runDispatchOutcome, k as readSlackRawMessageContext, kn as deliversFinalText, kt as appendAndEnqueueExclusiveInboundMessage, m as PluginCredentialFailureError, n as executeAgentRun, r as createContextCompactor, sn as maybePostAutomatedTurnLimitNotice, t as createAgentRunner, wn as RetryableDeliveryError, xt as timerWatchCredentialSubject, yt as EVENT_WAIT_MS, z as eventAutomationTriggerAvailable } from "./agent-runner-DSKpHjHW.js";
2
+ import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client--xtsAxKP.js";
3
+ import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-DVtMYOdD.js";
4
+ import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-BK53Ip5C.js";
5
5
  import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-BwU8mqwD.js";
6
6
  import { a as isUserActor, g as parseSlackMessageTs, i as isActorUserId, l as parseSlackChannelId, n as createSlackActor, o as parseActorUserId, r as createSlackResumeActor, t as createActor } from "./actor-BTtLaeWy.js";
7
- import { M as createSlackDestination, P as requireSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore } from "./viewer-BBnCMR1g.js";
7
+ import { M as createSlackDestination, P as requireSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore } from "./viewer-D5hbx6TE.js";
8
8
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-BO6ddZax.js";
9
- import { c as juniorAutomationExecutions, o as juniorSchedulerTasks, u as juniorEventAutomations } from "./executor-DA7eHhmC.js";
9
+ import { c as juniorAutomationExecutions, o as juniorSchedulerTasks, u as juniorEventAutomations } from "./executor-bmmuRY-w.js";
10
10
  import { f as instructionProvenanceFor } from "./history-Nte1oVed.js";
11
- import { d as credentialContextForActor } from "./registry-DvzzL8-v.js";
12
- import { $ as persistWithRetry, $t as isHumanConversationMessage, A as formatSlackLink, B as removeReactionFromMessage, Bt as hydrateConversationMessages, C as listAutomationVersions, Ct as loadConversationProjection, F as addReactionToMessage, G as loadTurnCheckpoint, It as recordSubscribedReplyRoute, J as completeTurnRecord, Jt as appendThreadContextMessages, K as saveTurnCheckpoint, Kt as fallbackShortTitle, M as normalizeSlackStatusText, Mt as recordAuthorizationCompleted, P as truncateStatusText, Q as recordTurnSummary, Qt as getConversationMessageSlackTs, S as automationDefinition, T as sameDefinitionValue, Tt as loadProjection, Ut as persistConversationMessageSummaries, Vt as persistConversationMessages, Wt as resolveConversationTitle, X as getTurnRecord, Xt as createConversationMemoryService, Y as failTurnRecord, Yt as buildConversationContext, Z as listTurnSummaries, Zt as estimateConversationContextTokens, _ as listDeletedEventAutomationsCreatedBy, _t as trimTrailingAssistantMessages, a as readScheduledAutomation, bt as commitAcceptedReply, en as markConversationMessage, g as getEventAutomation, i as parseScheduledAutomationRow, in as upsertConversationMessage, j as normalizeSlackReplyMarkdown, k as escapeSlackMrkdwnText, l as withScheduledAutomationLock, m as eventAutomationBelongsToUser, nn as recordDeliveredAssistantMessage, nt as buildTurnErrorResponse, p as deleteEventAutomation, q as abandonTurnRecord, rn as turnHasReply, s as saveScheduledAutomationInLock, tn as normalizeConversationText, xt as commitMessages, y as parseEventAutomationRow, z as postSlackMessage } from "./tasks-DBZAgTx7.js";
13
- import { Ct as getSlackFileId, Et as recordSlackAttachment, Ft as SlackActionError, Ht as normalizeSlackConversationId, It as downloadPrivateSlackFile, Pt as lookupSlackUser, Rt as getHeaderString, St as buildSentryConversationUrl, Tt as readAttachmentVisionSummary, Ut as runWithSlackInstallationToken, Vt as isDmChannel, et as verifyTimerWatchCredentialSubject, nt as getDashboardConversationLink, o as getPluginSlackConversationLink, rt as getDashboardObjectIconLink, tt as JUNIOR_THREAD_STATE_TTL_MS, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-Cj_rSeWd.js";
14
- import { F as isVisionImageMediaType, N as readMessageAttachments } from "./conversation-BxvgH64Q.js";
15
- import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-yeKVNECl.js";
16
- import { a as wasPendingAuthStopped, c as getThreadStopDecision, l as buildDeterministicAssistantMessageId, o as decideSubscribedThreadReply, r as clearPendingAuth, s as getSubscribedReplyPreflightDecision, u as buildDeterministicTurnId } from "./pending-auth-OndKPW4M.js";
17
- import { _ as markTurnFailed, c as CooperativeTurnYieldError, d as getConversationTurnBoundaryError, f as isCooperativeTurnYieldError, g as markTurnCompleted, h as markTurnClosed, l as TurnInputCommitLostError, m as isTurnInputDeferredError, p as isTurnInputCommitLostError, r as getAssistantReplyText, s as ConversationTurnBoundaryError, u as TurnInputDeferredError, v as startActiveTurn } from "./oauth-authorization-Db1yGVvG.js";
18
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-CX36ZlbV.js";
19
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-mVyF9jgv.js";
11
+ import { d as credentialContextForActor } from "./registry-C2rSEio1.js";
12
+ import { $ as listTurnSummaries, $t as estimateConversationContextTokens, Ct as commitMessages, D as sameDefinitionValue, Dt as loadProjection, Gt as persistConversationMessageSummaries, H as removeReactionFromMessage, Ht as hydrateConversationMessages, I as truncateStatusText, J as saveTurnCheckpoint, Jt as fallbackShortTitle, Kt as resolveConversationTitle, L as addReactionToMessage, M as formatSlackLink, N as normalizeSlackReplyMarkdown, P as normalizeSlackStatusText, Pt as recordAuthorizationCompleted, Q as getTurnRecord, Qt as createConversationMemoryService, Rt as recordSubscribedReplyRoute, St as commitAcceptedReply, T as listAutomationVersions, Tt as loadConversationProjection, Ut as persistConversationMessages, V as postSlackMessage, X as completeTurnRecord, Xt as appendThreadContextMessages, Y as abandonTurnRecord, Z as failTurnRecord, Zt as buildConversationContext, _ as listDeletedEventAutomationsCreatedBy, a as readScheduledAutomation, an as turnHasReply, en as getConversationMessageSlackTs, et as recordTurnSummary, g as getEventAutomation, i as parseScheduledAutomationRow, in as recordDeliveredAssistantMessage, it as buildTurnErrorResponse, j as escapeSlackMrkdwnText, l as withScheduledAutomationLock, m as eventAutomationBelongsToUser, nn as markConversationMessage, on as upsertConversationMessage, p as deleteEventAutomation, q as loadTurnCheckpoint, rn as normalizeConversationText, s as saveScheduledAutomationInLock, tn as isHumanConversationMessage, tt as persistWithRetry, w as automationDefinition, y as parseEventAutomationRow, yt as trimTrailingAssistantMessages } from "./tasks-B9OIjl2K.js";
13
+ import { Ct as getSlackFileId, Et as recordSlackAttachment, Ft as SlackActionError, Ht as normalizeSlackConversationId, It as downloadPrivateSlackFile, Pt as lookupSlackUser, Rt as getHeaderString, St as buildSentryConversationUrl, Tt as readAttachmentVisionSummary, Ut as runWithSlackInstallationToken, Vt as isDmChannel, et as verifyTimerWatchCredentialSubject, nt as getDashboardConversationLink, o as getPluginSlackConversationLink, rt as getDashboardObjectIconLink, tt as JUNIOR_THREAD_STATE_TTL_MS, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-DpklSWZg.js";
14
+ import { I as isVisionImageMediaType, P as readMessageAttachments } from "./conversation-CvBG57Io.js";
15
+ import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-BevMNSlr.js";
16
+ import { a as wasPendingAuthStopped, c as getThreadStopDecision, l as buildDeterministicAssistantMessageId, o as decideSubscribedThreadReply, r as clearPendingAuth, s as getSubscribedReplyPreflightDecision, u as buildDeterministicTurnId } from "./pending-auth-BuQLZ6dK.js";
17
+ import { _ as markTurnFailed, c as CooperativeTurnYieldError, d as getConversationTurnBoundaryError, f as isCooperativeTurnYieldError, g as markTurnCompleted, h as markTurnClosed, l as TurnInputCommitLostError, m as isTurnInputDeferredError, p as isTurnInputCommitLostError, r as getAssistantReplyText, s as ConversationTurnBoundaryError, u as TurnInputDeferredError, v as startActiveTurn } from "./oauth-authorization-By_MVRDC.js";
18
+ import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-C9Q9cjD3.js";
19
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-Cz3M7gg4.js";
20
20
  import { l as automationListQuerySchema } from "./automation-gznOMaQ2.js";
21
21
  import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
22
22
  import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-xPI_EFSC.js";
23
- import { C as readAutomationExecutionHours, D as readAutomationExecutions, E as readAutomationExecutionSummaries, O as readAutomationRuns, S as readAutomationExecutionDays, T as readAutomationExecutionStatusHours, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, b as emptyAutomationRunWindows, c as getDispatchInputMessageId, f as isTerminalDispatchStatus, g as markDispatchCompleted, h as markDispatchBlocked, i as claimDispatchMailboxAppend, l as getDispatchRecord, m as markDispatchAwaitingResume, n as scheduleSessionCompletedPluginTasks, s as getDispatchConversationId, t as processPluginTask, u as getDispatchTurnId, v as markDispatchRunning, w as readAutomationExecutionStatusDays, x as readAutomationExecutionByConversationId } from "./task-runner-D4jvUpFV.js";
24
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-CNFOMAJq.js";
25
- import { i as resolveAgentInvocationId, o as AgentRunError, r as enqueueAgentInvocation, s as executeTurn, t as createAgentInvocationWorker } from "./work-fje9VXgQ.js";
26
- import { a as persistThreadState, c as configValueSchema, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-hj70P2Cp.js";
27
- import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-CTltRLsB.js";
28
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-1eTgv6ns.js";
29
- import { t as bindSpawnAgent } from "./spawn-DYg7jhhR.js";
30
- import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-S2pwtR8b.js";
31
- import { r as storeInputImages } from "./images-CvMreau5.js";
23
+ import { C as readAutomationExecutionHours, D as readAutomationExecutions, E as readAutomationExecutionSummaries, O as readAutomationRuns, S as readAutomationExecutionDays, T as readAutomationExecutionStatusHours, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, b as emptyAutomationRunWindows, c as getDispatchInputMessageId, f as isTerminalDispatchStatus, g as markDispatchCompleted, h as markDispatchBlocked, i as claimDispatchMailboxAppend, l as getDispatchRecord, m as markDispatchAwaitingResume, n as scheduleSessionCompletedPluginTasks, s as getDispatchConversationId, t as processPluginTask, u as getDispatchTurnId, v as markDispatchRunning, w as readAutomationExecutionStatusDays, x as readAutomationExecutionByConversationId } from "./task-runner-T51kll0U.js";
24
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-DZJkJ95q.js";
25
+ import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-rm2X7jj4.js";
26
+ import { a as persistThreadState, c as configValueSchema, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-AGZtVyXp.js";
27
+ import { a as withAgentInvocationResultActors, i as startAgentInvocationsForChildResults, r as enqueueAgentInvocationResult, t as bindMessageAgent } from "./message-BSN-Ma5f.js";
28
+ import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-DCxixz5S.js";
29
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-mRqLbMZW.js";
30
+ import { t as bindSpawnAgent } from "./spawn-C3efZSx3.js";
31
+ import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-DJ8KU2bo.js";
32
+ import { r as storeInputImages } from "./images-DZliDtSH.js";
32
33
  import { z } from "zod";
33
34
  import { createHash } from "node:crypto";
34
35
  import { and, asc, count, desc, eq, exists, inArray, ne, or, sql } from "drizzle-orm";
@@ -303,167 +304,6 @@ function createAgentDispatchConversationWorker(options) {
303
304
  };
304
305
  }
305
306
  //#endregion
306
- //#region src/chat/agent-invocations/result.ts
307
- const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
308
- const AGENT_INVOCATION_EVENT_TYPE_PREFIX = "agent_invocation.";
309
- const AGENT_INVOCATION_RESULT_MAX_LENGTH = 12e3;
310
- /**
311
- * Return the Inbound message author id for results sent by one Actor.
312
- * `selectContiguousTurnBatch` in `task-execution/worker.ts` puts messages in
313
- * one attempt only when their author ids and sources match. Mid-Turn drains
314
- * take only `interrupt` messages, and results are `defer`. So results never
315
- * share a Turn and its credentials with another Actor or with watch Events.
316
- * Keep this id unique per Actor if either rule changes.
317
- */
318
- function resultAuthorId(actor) {
319
- switch (actor.platform) {
320
- case "system": return `agent-invocation:system:${actor.name}`;
321
- case "slack": return `agent-invocation:slack:${actor.teamId}:${actor.userId}`;
322
- default: return `agent-invocation:${actor.platform}:${actor.userId}`;
323
- }
324
- }
325
- /**
326
- * Error messages can contain text from tools or providers, so only the status
327
- * is trusted. The result or error goes in external text.
328
- */
329
- function trustedSummary(invocation, agent) {
330
- switch (invocation.status) {
331
- case "completed": return `${agent} finished its task.`;
332
- case "blocked": return `${agent} is blocked.`;
333
- case "failed": return `${agent} failed.`;
334
- case "stopped": return `${agent} was stopped.`;
335
- }
336
- }
337
- /**
338
- * Build the parent Inbound message for one terminal agent invocation. The
339
- * child result is model output, so the parent gets it as information, not
340
- * instructions. Verified details leave out the task. The input of an agent
341
- * invocation that receives a result holds another child's output, and the
342
- * parent's own `spawnAgent` call already has the task.
343
- */
344
- function buildResultInboundMessage(invocation, nowMs) {
345
- const agent = invocation.agentName ? `Child agent "${invocation.agentName}"` : "Child agent";
346
- const summary = trustedSummary(invocation, agent);
347
- const metadata = {
348
- kind: "event",
349
- event: {
350
- eventKey: invocation.invocationId,
351
- eventType: `${AGENT_INVOCATION_EVENT_TYPE_PREFIX}${invocation.status}`,
352
- identifier: invocation.invocationId,
353
- namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
354
- trustedSummary: summary
355
- }
356
- };
357
- return {
358
- conversationId: invocation.parentConversationId,
359
- createdAtMs: invocation.terminalAtMs,
360
- delivery: "defer",
361
- inboundMessageId: getAgentInvocationResultMessageId(invocation.invocationId),
362
- input: {
363
- authorId: resultAuthorId(invocation.actor),
364
- metadata,
365
- text: renderTaskInput({
366
- about: agent,
367
- instructions: "A child agent that you started has ended. Its status tells how it ended. Use its result to continue the work in this conversation. Do not repeat work that the child agent already did.",
368
- trustedSummary: summary,
369
- verifiedDetails: {
370
- conversation_id: invocation.childConversationId,
371
- ...invocation.agentName ? { agent_name: invocation.agentName } : void 0,
372
- status: invocation.status
373
- },
374
- externalText: invocation.status === "completed" ? invocation.result : invocation.errorMessage,
375
- externalTextMaxLength: AGENT_INVOCATION_RESULT_MAX_LENGTH
376
- })
377
- },
378
- receivedAtMs: nowMs,
379
- source: "event"
380
- };
381
- }
382
- /**
383
- * Append one terminal agent invocation result to the parent mailbox and wake
384
- * the parent. Repeat calls are safe.
385
- *
386
- * Results do not go through `admitAutomatedTurn`, so the automated-turn limit
387
- * never drops them. Result Turns still count toward that limit.
388
- * TODO(dcramer): Add a per-parent total invocation limit as the loop guard
389
- * for spawn -> result -> spawn chains (#881).
390
- */
391
- async function enqueueAgentInvocationResult(invocation, options) {
392
- if (invocation.parentMailboxStatus !== "pending") return;
393
- const nowMs = options.nowMs ?? Date.now();
394
- await appendAndEnqueueInboundMessage({
395
- message: buildResultInboundMessage(invocation, nowMs),
396
- queue: options.queue,
397
- queueDelayMs: EVENT_WAIT_MS,
398
- state: options.state
399
- });
400
- await markAgentInvocationParentMailboxAppended(invocation.invocationId, nowMs);
401
- }
402
- function resultInvocationId(message) {
403
- const metadata = message.input.metadata;
404
- return isEventMailboxMetadata(metadata) && metadata.event.namespace === AGENT_INVOCATION_EVENT_NAMESPACE && metadata.event.eventType.startsWith(AGENT_INVOCATION_EVENT_TYPE_PREFIX) ? metadata.event.identifier : void 0;
405
- }
406
- /** Read one result message's agent invocation and check its parent. */
407
- async function getResultInvocation(message, invocationId) {
408
- const invocation = await getAgentInvocation(invocationId);
409
- if (!invocation || !isTerminalAgentInvocation(invocation) || invocation.parentConversationId !== message.conversationId) throw new Error(`Agent invocation result ${invocationId} does not belong to ${message.conversationId}`);
410
- return invocation;
411
- }
412
- /**
413
- * Give agent invocation results that reach a child Conversation to that
414
- * child. A child Conversation has no Location, so it cannot run an Event
415
- * Turn. Each result starts a new agent invocation on the child instead, and
416
- * that invocation reports to the child's parent. Returns undefined for work
417
- * that is not a result for a child Conversation.
418
- */
419
- async function startAgentInvocationsForChildResults(context, options) {
420
- const messages = context.attempt.messages;
421
- const invocationIds = messages.map(resultInvocationId);
422
- if (messages.length === 0 || invocationIds.some((id) => !id)) return;
423
- const latest = await getLatestAgentInvocationForConversation(context.conversationId);
424
- if (!latest) return;
425
- if (latest.status === "stopped") {
426
- await context.attempt.ack();
427
- return { status: "completed" };
428
- }
429
- for (const [index, message] of messages.entries()) {
430
- const result = await getResultInvocation(message, invocationIds[index]);
431
- if (result.parentMailboxStatus === "skipped") continue;
432
- const invocation = await createAgentInvocationForResult({
433
- input: message.input.text.trim(),
434
- latest,
435
- resultInvocationId: result.invocationId
436
- });
437
- await enqueueAgentInvocation(invocation, options);
438
- }
439
- await context.attempt.ack();
440
- return { status: "completed" };
441
- }
442
- /**
443
- * Run each agent invocation result as the Actor that triggered the child, user
444
- * or system. This is on purpose: the result continues that Actor's work. The
445
- * Actor comes from SQL, not from mailbox metadata, so the parent Turn has the
446
- * same authority it had at spawn time.
447
- *
448
- * TODO(dcramer): Pass the delegated credential subject of a system Actor, such
449
- * as a timer watch Turn, when system Turns can spawn children that need it.
450
- */
451
- async function withAgentInvocationResultActors(work) {
452
- if (work.kind !== "mailbox") return work;
453
- return {
454
- kind: "mailbox",
455
- batch: await Promise.all(work.batch.map(async (entry) => {
456
- const invocationId = resultInvocationId(entry.message);
457
- if (!invocationId) return entry;
458
- const invocation = await getResultInvocation(entry.message, invocationId);
459
- return {
460
- ...entry,
461
- actor: invocation.actor
462
- };
463
- }))
464
- };
465
- }
466
- //#endregion
467
307
  //#region src/chat/attachments/vercel.ts
468
308
  /** Store private conversation attachments in Vercel Blob. */
469
309
  function createVercelAttachmentStorage() {
@@ -1867,6 +1707,43 @@ async function resolveMailboxTurnWork(context) {
1867
1707
  } : void 0;
1868
1708
  }
1869
1709
  //#endregion
1710
+ //#region src/chat/conversations/stop.ts
1711
+ /** Stop the current Conversation Turn and wake an idle resume when needed. */
1712
+ async function stopConversationTurn(args) {
1713
+ const nowMs = args.nowMs ?? Date.now();
1714
+ const stop = async () => await stopConversationWork({
1715
+ conversationId: args.conversationId,
1716
+ conversationStore: args.conversationStore,
1717
+ nowMs,
1718
+ state: args.state
1719
+ });
1720
+ let result = await stop();
1721
+ if (result.status === "no_work" && await getAuthPausedConversationTurnId(args.conversationId)) {
1722
+ const conversation = await getConversation({
1723
+ conversationId: args.conversationId,
1724
+ state: args.state
1725
+ });
1726
+ await requestConversationWork({
1727
+ conversationId: args.conversationId,
1728
+ conversationStore: args.conversationStore,
1729
+ destination: conversation?.destination,
1730
+ nowMs,
1731
+ state: args.state
1732
+ });
1733
+ result = await stop();
1734
+ }
1735
+ if (result.status === "requested") await ensureConversationWake({
1736
+ conversationId: args.conversationId,
1737
+ conversationStore: args.conversationStore,
1738
+ idempotencyKey: `conversation-stop:${args.conversationId}:${result.runId}`,
1739
+ nowMs,
1740
+ queue: args.queue,
1741
+ replaceExistingWake: true,
1742
+ state: args.state
1743
+ });
1744
+ return result;
1745
+ }
1746
+ //#endregion
1870
1747
  //#region src/chat/ingress/message-router.ts
1871
1748
  /** Derive canonical Slack thread IDs from the raw event payload. */
1872
1749
  /** Rebuild a Message onto a normalized Slack thread id. */
@@ -3019,7 +2896,7 @@ function viewerAutomationCollection(user) {
3019
2896
  function destinationJoin(record, teamId) {
3020
2897
  return and(eq(destination.provider, "slack"), sql`${destination.providerTenantId} = ${teamId}`, sql`${destination.providerDestinationId} = ${record}->'destination'->>'channelId'`);
3021
2898
  }
3022
- const available = or(...Object.entries(pluginEventCatalog(getEventCatalog())).map(([namespace, registration]) => {
2899
+ const available = or(...Object.entries(automationEventCatalog(getEventCatalog())).map(([namespace, registration]) => {
3023
2900
  const events = registration.resourceTypes.flatMap((resource) => resource.supportedEvents);
3024
2901
  return and(eq(event.namespace, namespace), sql`${event.task}->'trigger'->'events' <@ ${JSON.stringify(events)}::jsonb`);
3025
2902
  })) ?? sql`false`;
@@ -3676,6 +3553,7 @@ function createJuniorRuntimeServices(overrides = {}) {
3676
3553
  downloadFile: overrides.visionContext?.downloadFile ?? downloadPrivateSlackFile
3677
3554
  });
3678
3555
  const agentRunner = overrides.agentRunner ?? createAgentRunner(executeAgentRun, {
3556
+ bindMessageAgent: (request) => bindMessageAgent(request, { queue: getVercelConversationWorkQueue }),
3679
3557
  bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: getVercelConversationWorkQueue }),
3680
3558
  tracePropagation: overrides.sandbox?.tracePropagation
3681
3559
  });
@@ -5051,6 +4929,15 @@ function createSlackTurn(deps) {
5051
4929
  let acceptedMessages;
5052
4930
  const drained = await options.drainSteeringMessages(async (queuedMessages) => {
5053
4931
  acceptedMessages = await resolveSteeringMessages(queuedMessages);
4932
+ for (const queued of queuedMessages) upsertConversationMessage(preparedState.conversation, toConversationMessage({
4933
+ entry: queued.message,
4934
+ explicitMention: queued.explicitMention,
4935
+ text: queued.userText
4936
+ }));
4937
+ await persistConversationMessages({
4938
+ conversation: preparedState.conversation,
4939
+ conversationId
4940
+ });
5054
4941
  await accept(acceptedMessages);
5055
4942
  }, { conversationContext: preparedState.conversationContext });
5056
4943
  return acceptedMessages ?? await resolveSteeringMessages(drained);
@@ -7662,4 +7549,4 @@ async function appendAndEnqueueWebMessage(input, options) {
7662
7549
  };
7663
7550
  }
7664
7551
  //#endregion
7665
- export { withNormalizedThreadId as A, enqueueAgentDispatch as B, buildSlackInboundMessage as C, isSlackMessageStopped as D, verifySlackSignature as E, parseContent as F, readHealthReport as H, renderSlackObjectCard as I, createVercelAttachmentStorage as L, legacyWebMailboxMetadataSchema as M, THREAD_OPTOUT_ACK as N, stopSlackThread as O, startProcessingReaction as P, enqueueAgentInvocationResult as R, recordSkippedConversationMessage as S, runWithSlackInstallation as T, GET as V, readViewerAutomationRuns as _, recordWebConversationActivity as a, readViewerAutomations as b, createProductionSlackWebhookServices as c, resolveSlackConversationContextFromThreadId as d, createSlackWebApiStatusSender as f, readViewerAutomationExecutions as g, readConversationSourceTask as h, createConversationId as i, getAuthPausedConversationTurnId as j, normalizeIncomingSlackThreadId as k, getProductionSlackAdapter as l, deleteViewerTask as m, conversationTurnIdForMessage as n, webActorFromEmail as o, ViewerTaskNotFoundError as p, createAndEnqueueConversation as r, createProductionConversationWorkOptions as s, appendAndEnqueueWebMessage as t, formatSlackConversationRedactedLabel as u, readViewerAutomationSummary as v, clearSlackPendingReactions as w, resolveViewerTaskCandidate as x, readViewerAutomationVersions as y, AGENT_DISPATCH_MAX_AGE_MS as z };
7552
+ export { withNormalizedThreadId as A, enqueueAgentDispatch as B, buildSlackInboundMessage as C, isSlackMessageStopped as D, verifySlackSignature as E, startProcessingReaction as F, readHealthReport as H, parseContent as I, renderSlackObjectCard as L, getAuthPausedConversationTurnId as M, legacyWebMailboxMetadataSchema as N, stopSlackThread as O, THREAD_OPTOUT_ACK as P, createVercelAttachmentStorage as R, recordSkippedConversationMessage as S, runWithSlackInstallation as T, GET as V, readViewerAutomationRuns as _, recordWebConversationActivity as a, readViewerAutomations as b, createProductionSlackWebhookServices as c, resolveSlackConversationContextFromThreadId as d, createSlackWebApiStatusSender as f, readViewerAutomationExecutions as g, readConversationSourceTask as h, createConversationId as i, stopConversationTurn as j, normalizeIncomingSlackThreadId as k, getProductionSlackAdapter as l, deleteViewerTask as m, conversationTurnIdForMessage as n, webActorFromEmail as o, ViewerTaskNotFoundError as p, createAndEnqueueConversation as r, createProductionConversationWorkOptions as s, appendAndEnqueueWebMessage as t, formatSlackConversationRedactedLabel as u, readViewerAutomationSummary as v, clearSlackPendingReactions as w, resolveViewerTaskCandidate as x, readViewerAutomationVersions as y, AGENT_DISPATCH_MAX_AGE_MS as z };
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { $ as getLatestAgentInvocationForConversation, G as completeAgentInvocation, H as stopChildAgentsOf, J as getActiveAgentInvocationForConversation, K as createAgentInvocation, Q as getAgentInvocationTurnId, U as recordSubagentEnded, W as recordSubagentStarted, X as getAgentInvocationMessageId, Y as getAgentInvocation, _n as AuthorizationFlowDisabledError, bt as appendAndEnqueueInboundMessage, ct as reportReplacedAgentInvocation, et as isTerminalAgentInvocation, it as markAgentInvocationMailboxAppended, m as PluginCredentialFailureError, ot as markAgentInvocationPaused, st as markAgentInvocationRunning } from "./agent-runner-DtEtbaOb.js";
3
- import { c as getConversationEventStore, u as getConversationStore } from "./viewer-BBnCMR1g.js";
4
- import { K as saveTurnCheckpoint, Ot as openConversationProjection, X as getTurnRecord, Y as failTurnRecord, ot as getTerminalAssistantMessages, q as abandonTurnRecord } from "./tasks-DBZAgTx7.js";
5
- import { d as getConversationTurnBoundaryError, l as TurnInputCommitLostError, p as isTurnInputCommitLostError, r as getAssistantReplyText } from "./oauth-authorization-Db1yGVvG.js";
6
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CNFOMAJq.js";
7
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-hj70P2Cp.js";
2
+ import { At as appendAndEnqueueInboundMessage, Dn as AuthorizationFlowDisabledError, H as stopChildAgentsOf, K as completeAgentInvocation, On as readBlockedReport, Q as getAgentInvocation, U as recordSubagentEnded, W as recordSubagentStarted, Z as getActiveAgentInvocationForConversation, at as getLatestAgentInvocationForConversation, dt as markAgentInvocationPaused, ft as markAgentInvocationRunning, lt as markAgentInvocationMailboxAppended, m as PluginCredentialFailureError, ot as isTerminalAgentInvocation, pt as reportReplacedAgentInvocation, q as createAgentInvocation, rt as getAgentInvocationTurnId, tt as getAgentInvocationMessageId } from "./agent-runner-DSKpHjHW.js";
3
+ import { c as getConversationEventStore, u as getConversationStore } from "./viewer-D5hbx6TE.js";
4
+ import { At as openConversationProjection, J as saveTurnCheckpoint, Q as getTurnRecord, Y as abandonTurnRecord, Z as failTurnRecord, ct as getTerminalAssistantMessages } from "./tasks-B9OIjl2K.js";
5
+ import { d as getConversationTurnBoundaryError, l as TurnInputCommitLostError, p as isTurnInputCommitLostError, r as getAssistantReplyText } from "./oauth-authorization-By_MVRDC.js";
6
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DZJkJ95q.js";
7
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-AGZtVyXp.js";
8
8
  import { z } from "zod";
9
9
  //#region src/chat/runtime/turn-execution.ts
10
10
  /** An error thrown while the agent advances a Run. */
@@ -166,11 +166,15 @@ async function projectTerminalTurn(invocation) {
166
166
  if (turn.state === "paused") return;
167
167
  const result = getTerminalAssistantMessages(turn.piMessages).map(getAssistantReplyText).filter((text) => text !== void 0).join("\n\n");
168
168
  const failed = turn.state !== "completed" || Boolean(turn.errorMessage);
169
+ const blocked = turn.turnStartMessageIndex === void 0 ? void 0 : readBlockedReport(turn.piMessages.slice(turn.turnStartMessageIndex));
169
170
  return await completeAgentInvocation({
170
171
  invocationId: invocation.invocationId,
171
172
  ...failed ? {
172
173
  errorMessage: turn.errorMessage ?? "Agent invocation failed",
173
174
  status: "failed"
175
+ } : blocked ? {
176
+ errorMessage: blocked.missing,
177
+ status: "blocked"
174
178
  } : {
175
179
  result,
176
180
  status: "completed"
@@ -208,6 +212,9 @@ async function saveAgentInvocationResult(args) {
208
212
  ...failed ? {
209
213
  errorMessage: args.result.diagnostics.errorMessage ?? "Agent invocation failed",
210
214
  status: "failed"
215
+ } : args.result.blocked ? {
216
+ errorMessage: args.result.blocked.missing,
217
+ status: "blocked"
211
218
  } : {
212
219
  result: args.result.text,
213
220
  status: "completed"
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { At as drainConversationMailbox, Bt as requestAnotherSlice, Ct as checkInConversationWork, Dt as completeConversationWork, Et as completeConversationStop, Ht as startConversationWork, It as recordAttemptFailure, Jt as isFinalAttempt, Kt as hasConversationStop, Lt as recordConversationRetry, Nt as getConversationWorkState, Ot as countPendingConversationMessages, Rt as releaseConversationWork, Yt as isInvalidConversationRecordError, jt as ensureConversationWake, kt as deadLetterAttempt, vt as ackMessages, wt as clearConsumedConversationWake, xt as beginConversationResume } from "./agent-runner-DtEtbaOb.js";
3
- import { v as isProviderRetryError } from "./client-BVaGEb1-.js";
4
- import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-z7_w-KN_.js";
5
- import { i as getChatConfig } from "./config-q9xXVN_5.js";
6
- import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-mVyF9jgv.js";
2
+ import { Bt as drainConversationMailbox, It as completeConversationStop, Jt as releaseConversationWork, Kt as recordAttemptFailure, Lt as completeConversationWork, Nt as checkInConversationWork, Ot as ackMessages, Pt as clearConsumedConversationWake, Qt as startConversationWork, Rt as countPendingConversationMessages, Ut as getConversationWorkState, Vt as ensureConversationWake, Xt as requestAnotherSlice, an as isInvalidConversationRecordError, in as isFinalAttempt, jt as beginConversationResume, nn as hasConversationStop, qt as recordConversationRetry, zt as deadLetterAttempt } from "./agent-runner-DSKpHjHW.js";
3
+ import { v as isProviderRetryError } from "./client--xtsAxKP.js";
4
+ import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-DVtMYOdD.js";
5
+ import { i as getChatConfig } from "./config-BK53Ip5C.js";
6
+ import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-Cz3M7gg4.js";
7
7
  //#region src/chat/task-execution/worker.ts
8
8
  var worker_exports = /* @__PURE__ */ __exportAll({
9
9
  CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.244.0",
3
+ "version": "0.246.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -87,7 +87,7 @@
87
87
  "pg": "^8.16.3",
88
88
  "yaml": "^2.9.0",
89
89
  "zod": "^4.5.4",
90
- "@sentry/junior-plugin-api": "0.244.0"
90
+ "@sentry/junior-plugin-api": "0.246.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@emnapi/core": "^1.10.0",
@@ -106,9 +106,9 @@
106
106
  "typescript": "^6.0.3",
107
107
  "vercel": "^54.4.0",
108
108
  "vitest": "^4.1.7",
109
+ "@sentry/junior-github": "0.246.0",
109
110
  "@sentry/junior-testing": "0.0.0",
110
- "@sentry/junior-memory": "0.244.0",
111
- "@sentry/junior-github": "0.244.0"
111
+ "@sentry/junior-memory": "0.246.0"
112
112
  },
113
113
  "scripts": {
114
114
  "build": "tsdown",