@sentry/junior 0.222.0 → 0.223.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/{agent-7kKtDe-6.js → agent-Bzbf92vv.js} +87 -52
  2. package/dist/{agent-hooks-DkriF84n.js → agent-hooks-DZU5nsd1.js} +60 -16
  3. package/dist/{agent-runner-D0ImXS7U.js → agent-runner-2VQ9WhkG.js} +5 -5
  4. package/dist/api/schema.d.ts +160 -11
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +16 -16
  7. package/dist/{app-C0zbsnr7.d.ts → app-BbSD6EtD.d.ts} +1 -1
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +120 -39
  10. package/dist/{auth-pause-state-3OT67TA8.js → auth-pause-state-Bn2vX4PA.js} +14 -25
  11. package/dist/{briefs-CNH1ztn5.js → briefs-BJPfCrlT.js} +6 -6
  12. package/dist/{catalog-runtime-XH_LFA_7.js → catalog-runtime-BthunUDD.js} +1 -1
  13. package/dist/{checkpoint-CRod8es5.js → checkpoint-Deu-OVb3.js} +11 -8
  14. package/dist/cli/chat.js +13 -13
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +1 -1
  17. package/dist/cli/plugins.js +3 -3
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.js +3 -3
  20. package/dist/{client-CcSboWx_.js → client-DjC6-6iU.js} +56 -6
  21. package/dist/{config-CGYv-YPE.js → config-CtoUVs72.js} +6 -7
  22. package/dist/{conversation-BBDt88di.js → conversation-1HUoZr2l.js} +33 -5
  23. package/dist/{conversation-privacy-BGjdDVWD.js → conversation-privacy-xS1t92xa.js} +1 -1
  24. package/dist/{credential-sync-BfzGNruT.js → credential-sync-CKdXEUDO.js} +77 -23
  25. package/dist/{execution-stats-D97ePWuM.js → execution-stats-CrXs9vSH.js} +3 -3
  26. package/dist/{executor-BLBZ-UB8.js → executor-AOhG9X1t.js} +1 -1
  27. package/dist/{history-CaV8Ww7M.d.ts → history-yaSjGMD_.d.ts} +18 -0
  28. package/dist/instrumentation.js +2 -2
  29. package/dist/{job-queue-_8gxwDzt.js → job-queue-CNd9cpIy.js} +1 -1
  30. package/dist/{logging-qmsMdU0y.js → logging-DiN3o3nB.js} +1 -1
  31. package/dist/nitro.d.ts +1 -1
  32. package/dist/nitro.js +3 -3
  33. package/dist/{oauth-callback-server-Mjfm46A5.js → oauth-callback-server-Ca0VLUEw.js} +2 -2
  34. package/dist/{pending-auth-_1Ry-_Bw.js → pending-auth-D7vmttn_.js} +2 -2
  35. package/dist/{profile-DbG8AlNd.js → profile-BsNrw8lj.js} +4 -4
  36. package/dist/{prompt-B8rCQI7K.js → prompt-90miy8VV.js} +1 -1
  37. package/dist/{registry-DGyQCsiy.js → registry-Dankt-Pl.js} +1 -1
  38. package/dist/{resolve-D5SqDbCA.js → resolve-B38CpJe2.js} +2 -2
  39. package/dist/{runner-BRAFjJhe.js → runner-Ck5rEjCm.js} +10 -10
  40. package/dist/{sandbox-egress-signals-CdI1aVHT.js → sandbox-egress-signals-BOfFkvly.js} +1 -1
  41. package/dist/{schema-CTOODa3L.js → schema-RpbW5Od2.js} +1 -1
  42. package/dist/{short-title-CB2fxEyx.js → short-title-BHd_jUFX.js} +2 -2
  43. package/dist/{skills-BoS3b8cg.js → skills-DbP4TDft.js} +2 -2
  44. package/dist/{spawn-BXCU1udr.js → spawn-DzXc_PKO.js} +2 -2
  45. package/dist/{stats-qUXQZq-w.js → stats-pNGp3G5q.js} +19 -17
  46. package/dist/{task-queue-Di_q8922.js → task-queue-Cy9y1foT.js} +3 -3
  47. package/dist/{task-runner-4rCppQMo.js → task-runner-DI1FBJFJ.js} +8 -8
  48. package/dist/{thread-state-2Paza8DV.js → thread-state-DXgxOYpZ.js} +5 -5
  49. package/dist/{turn-execution--F7a9kEU.js → turn-execution-BNOXrZ-M.js} +3 -3
  50. package/dist/{turn-lifecycle-f-y0Irpi.js → turn-lifecycle-Bjf6y2GO.js} +1 -1
  51. package/dist/{validation-Be9lSORU.js → validation-D5CIslEu.js} +1 -1
  52. package/dist/{version-BydrOZMQ.js → version-_ZQFlslB.js} +1 -1
  53. package/dist/version.js +1 -1
  54. package/dist/{web-authorization-BdfOkTuG.js → web-authorization-6mmfS_o-.js} +1 -1
  55. package/dist/{web-input-DegYUyKU.js → web-input-BJpWm6go.js} +7 -7
  56. package/dist/{work-Citqpnfc.js → work-DvIlJR3C.js} +9 -9
  57. package/dist/{worker-Bn_HFyvM.js → worker-D1qidg-Y.js} +5 -5
  58. package/package.json +4 -4
@@ -1,28 +1,28 @@
1
- import { C as resolveGatewayCredential, S as getGatewayApiKey, _ as findProviderError, b as isProviderRetryError, c as COMPACTION_SUMMARY_PREFIX, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeText, l as MODEL_HANDOFF_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as unwrapCurrentInstruction, r as completeObject, s as ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-CcSboWx_.js";
2
- import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, S as withLogContext, _ as setSpanAttributes, a as extractGenAiUsageSummary, b as summarizeMessageText, c as getTracePropagationHeaders, d as logInfo, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as logError, p as normalizeGenAiFinishReason, s as getLogContextAttributesForSpan, u as logException, v as setSpanStatus, y as setTags } from "./logging-qmsMdU0y.js";
1
+ import { C as resolveGatewayCredential, S as getGatewayApiKey, _ as findProviderError, b as isProviderRetryError, c as COMPACTION_SUMMARY_PREFIX, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeText, l as MODEL_HANDOFF_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as unwrapCurrentInstruction, r as completeObject, s as ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-DjC6-6iU.js";
2
+ import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, S as withLogContext, _ as setSpanAttributes, a as extractGenAiUsageSummary, b as summarizeMessageText, c as getTracePropagationHeaders, d as logInfo, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as logError, p as normalizeGenAiFinishReason, s as getLogContextAttributesForSpan, u as logException, v as setSpanStatus, y as setTags } from "./logging-DiN3o3nB.js";
3
3
  import { m as startInactiveSpan, v as withActiveSpan } from "./sentry-CgWZM_kV.js";
4
- import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-BGjdDVWD.js";
5
- import { h as normalizeSlackEmojiName, n as botConfig } from "./config-CGYv-YPE.js";
4
+ import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-xS1t92xa.js";
5
+ import { h as normalizeSlackEmojiName, n as botConfig } from "./config-CtoUVs72.js";
6
6
  import { a as modelIdForProfile, c as TURN_REASONING_LEVELS, i as formatModelProfiles, o as modelProfileSchema, r as formatModelProfile, s as profileConfig, t as ModelProfileNotConfiguredError } from "./model-profile-CZmVoGdX.js";
7
7
  import { _ as parseSlackMessageTs, g as parseSlackUserId, h as parseSlackTeamId, i as credentialUserSubjectId, l as isUserActor, m as parseSlackChannelReferenceId, n as credentialContextSchema, p as parseSlackChannelId, t as credentialContextForActor } from "./context-Bplcgypl.js";
8
- import { A as tryWorkspaceRepoCheckoutPath, B as downloadPrivateSlackFile, C as invalidateReadySnapshot, D as SANDBOX_RUNTIME, E as setWorkspaceSnapshotBuild, Gt as getDb, Ht as getConversationEventStore, J as withSlackRetries, K as normalizeSlackConversationId, Kt as getSqlExecutor, M as resolveChannelCapabilities, O as deleteWorkspaceSnapshotBuilders, Q as readActorIdentity, S as WorkspaceValidationError, T as setWorkspaceSnapshot, U as getSlackClient, Ut as getConversationMessageSearchStore, V as getFilePermalink, W as isConversationScopedChannel, Wt as getConversationStore, _ as deleteWorkspace, at as STOP_WATCHING_TOOL_NAME, b as listWorkspaces, bt as createPluginLogger, c as getPluginTools, dt as findMatchingWatches, en as addAgentTurnUsage, ft as listWatches, g as createWorkspace, ht as getDashboardTaskLink, in as hasAgentTurnUsage, it as RESOURCE_WATCH_TOOL_SOURCE, j as workspaceRepoCheckoutPath, k as getWorkspaceSnapshotBuilder, l as getPluginUserPromptContributions, lt as createWatch, mt as getDashboardConversationLink, nt as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, ot as cancelSubscriptions, pt as JUNIOR_THREAD_STATE_TTL_MS, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as cancelWatch, tt as getSlackToolContext, u as getPlugins, un as parseDestination, ut as deliverWatch, v as getWorkspace, w as loadSnapshotsForProfile, x as updateWorkspace, y as getWorkspaceByName, z as SlackActionError } from "./agent-hooks-DkriF84n.js";
8
+ import { A as tryWorkspaceRepoCheckoutPath, B as downloadPrivateSlackFile, C as invalidateReadySnapshot, D as SANDBOX_RUNTIME, E as setWorkspaceSnapshotBuild, Ft as saveObjectAnnotations, Gt as getConversationMessageSearchStore, It as createPluginAnnotations, J as withSlackRetries, Jt as getSqlExecutor, K as normalizeSlackConversationId, Kt as getConversationStore, M as resolveChannelCapabilities, O as deleteWorkspaceSnapshotBuilders, Q as readActorIdentity, S as WorkspaceValidationError, T as setWorkspaceSnapshot, U as getSlackClient, V as getFilePermalink, W as isConversationScopedChannel, Wt as getConversationEventStore, _ as deleteWorkspace, at as STOP_WATCHING_TOOL_NAME, b as listWorkspaces, bt as createPluginLogger, c as getPluginTools, dt as findMatchingWatches, fn as parseDestination, ft as listWatches, g as createWorkspace, ht as getDashboardTaskLink, it as RESOURCE_WATCH_TOOL_SOURCE, j as workspaceRepoCheckoutPath, k as getWorkspaceSnapshotBuilder, l as getPluginUserPromptContributions, lt as createWatch, mt as getDashboardConversationLink, nn as addAgentTurnUsage, nt as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, on as hasAgentTurnUsage, ot as cancelSubscriptions, pt as JUNIOR_THREAD_STATE_TTL_MS, qt as getDb, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as cancelWatch, tt as getSlackToolContext, u as getPlugins, ut as deliverWatch, v as getWorkspace, w as loadSnapshotsForProfile, x as updateWorkspace, y as getWorkspaceByName, z as SlackActionError } from "./agent-hooks-DZU5nsd1.js";
9
9
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
10
- import { D as juniorIdentities, E as juniorConversations, a as juniorSchedulerRuns, d as AGENT_INVOCATION_MAILBOX_STATUSES, g as juniorConversationBriefs, k as juniorArtifacts, w as juniorAttachments, x as juniorConversationAnnotations } from "./executor-BLBZ-UB8.js";
11
- import { F as conversationBriefSchema, G as contextProvenance, J as sameActorIdentity, K as instructionActors, L as KNOWN_CONVERSATION_EVENT_TYPES, N as briefLinkSchema, P as briefOutcomeStatusSchema, j as automationCardSchema, q as instructionProvenanceFor } from "./conversation-BBDt88di.js";
10
+ import { D as juniorIdentities, E as juniorConversations, a as juniorSchedulerRuns, d as AGENT_INVOCATION_MAILBOX_STATUSES, g as juniorConversationBriefs, k as juniorArtifacts, w as juniorAttachments, x as juniorConversationAnnotations } from "./executor-AOhG9X1t.js";
11
+ import { F as briefLinkSchema, I as briefOutcomeStatusSchema, J as instructionActors, L as conversationBriefSchema, X as sameActorIdentity, Y as instructionProvenanceFor, j as messageCardRefSchema, q as contextProvenance, z as KNOWN_CONVERSATION_EVENT_TYPES } from "./conversation-1HUoZr2l.js";
12
12
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-7a9YqLhE.js";
13
- import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, o as resolvePluginCommandEnv, s as OAuthProviderError } from "./registry-DGyQCsiy.js";
14
- import { n as pluginCatalogRuntime } from "./catalog-runtime-XH_LFA_7.js";
15
- import { a as parseSkillInvocation, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-BoS3b8cg.js";
16
- import { A as TURN_CONTEXT_TAG, C as isContinuablePiBoundary, D as retainRuntimeTurnContext, E as normalizeToolNameFromResult, H as recordAuthorizationRequested, I as loadTurnRoute, K as recordToolExecutionStarted, L as openConversationProjection, N as loadConnectedMcpProviders, O as stripRuntimeTurnContext, P as loadConversationProjection, R as recordAgentsInstructionsUpdated, S as isAssistantMessage, T as isToolResultMessage, U as recordGuardianActionReviewed, W as recordMcpProviderConnected, _ as getPiMessageRole, b as hasRuntimeTurnContext, dt as estimateTextTokens, f as TurnSliceLimitExceededError, ft as getAgentContextCompactionTriggerTokens, g as extractAssistantText, h as isTurnExecutionLimitExceededError, ht as piMessageFromHistoryItem, k as trimTrailingAssistantMessages, mt as historyItemFromPiMessage, n as loadTurnCheckpoint, p as assertTurnToolCallLimit, pt as getAgentContextInputLimitTokens, q as recordTurnRoute, r as saveTurnCheckpoint, t as continuableMessages, v as getTerminalAssistantMessages, w as isToolResultError, y as getUserMessageInstructionText, z as recordAttachmentsDelivered } from "./checkpoint-CRod8es5.js";
17
- import { n as generateShortTitle, r as resolveTaskTitle, t as fallbackShortTitle } from "./short-title-CB2fxEyx.js";
18
- import { A as sleep$1, D as fenceLock, E as acquireActiveLock, F as sandboxSkillDir, I as sandboxSkillFile, L as sandboxSkillPathResolution, M as SANDBOX_REPOS_ROOT, N as SANDBOX_SKILLS_ROOT, P as SANDBOX_WORKSPACE_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildNonInteractiveShellScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, j as SANDBOX_DATA_ROOT, k as withLock, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand, y as buildCommandScript } from "./profile-DbG8AlNd.js";
19
- import { $ as workspaceSnapshotFinishedEvent, B as createEventAutomation, C as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as eventAutomationMatchesDestination, E as eventAutomationListToolResultSchema, F as effectiveTaskOutcomes, Gt as makeStructuredToolOutput, I as moveTaskOutcomes, Jt as ToolInputError, L as resolveTaskOutcomes, M as requireEventAutomationSlackContext, N as requireSupportedEventAutomationTrigger, O as eventAutomationToolResult, P as writableEventAutomation, Q as WORKSPACE_SNAPSHOT_READY_EVENT, R as taskOutcomeInputSchema, T as compactEventAutomation, Ut as injectContinuationToolName, V as deleteEventAutomation, W as getEventAutomation, Wt as juniorToolOutputSchema, X as getEventCatalog, Y as saveEventAutomation, Z as WORKSPACE_SNAPSHOT_FAILED_EVENT, at as normalizeCatalogEventIdentifier, c as parseSlackThreadId, ct as registeredEventTypeSchema, et as workspaceSnapshotWatch, f as createScheduledAutomation, g as listScheduledAutomationsForTeam, i as readLiveAttachment, it as hasPluginEventCatalogEntries, j as registeredEventAutomationTriggerSchema, k as eventAutomationToolResultSchema, lt as registeredResourceTypeSchema, nt as eventNamespaceSchema, ot as pluginSupportsEvent, pt as appendAndEnqueueInboundMessage, q as listEventAutomationsForTeam, rt as hasEventCatalogEntries, s as storeAttachments, st as registeredEventMatchSchema, t as incrementStat, tt as eventGuidance, ut as requireSupportedEventMatch, v as readScheduledAutomation, y as saveScheduledAutomation } from "./stats-qUXQZq-w.js";
20
- import { _ as isTurnInputCommitLostError, c as sanitizeAssistantText, f as CooperativeTurnYieldError, l as NO_REPLY_MARKER, n as canReusePendingAuthLink, o as decideReply, p as TurnInputCommitLostError, s as getAssistantReplyText, t as abandonReplacedPendingAuth, u as isNoReplyMarker } from "./pending-auth-_1Ry-_Bw.js";
21
- import { C as toolInvocationDestination, S as surfaceFromRun, _ as uploadFilesToConversation, b as assertRunConsistency, h as postSlackMessage, i as formatProviderLabel, m as getSlackMessagePermalink, o as resolveBaseUrl, p as addReactionToMessage, r as deliverOAuthAuthorization, s as startOAuthFlow, v as RetryableDeliveryError, x as isAgentRunFeatureDisabled, y as actorFromRun } from "./agent-runner-D0ImXS7U.js";
22
- import { r as EVENT_AUTHOR_ID } from "./prompt-B8rCQI7K.js";
23
- import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-D5SqDbCA.js";
13
+ import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, o as resolvePluginCommandEnv, s as OAuthProviderError } from "./registry-Dankt-Pl.js";
14
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
15
+ import { a as parseSkillInvocation, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-DbP4TDft.js";
16
+ import { A as TURN_CONTEXT_TAG, C as isContinuablePiBoundary, D as retainRuntimeTurnContext, E as normalizeToolNameFromResult, H as recordAuthorizationRequested, I as loadTurnRoute, K as recordToolExecutionStarted, L as openConversationProjection, N as loadConnectedMcpProviders, O as stripRuntimeTurnContext, P as loadConversationProjection, R as recordAgentsInstructionsUpdated, S as isAssistantMessage, T as isToolResultMessage, U as recordGuardianActionReviewed, W as recordMcpProviderConnected, _ as getPiMessageRole, b as hasRuntimeTurnContext, dt as estimateTextTokens, f as TurnSliceLimitExceededError, ft as getAgentContextCompactionTriggerTokens, g as extractAssistantText, h as isTurnExecutionLimitExceededError, ht as piMessageFromHistoryItem, k as trimTrailingAssistantMessages, mt as historyItemFromPiMessage, n as loadTurnCheckpoint, p as assertTurnToolCallLimit, pt as getAgentContextInputLimitTokens, q as recordTurnRoute, r as saveTurnCheckpoint, t as continuableMessages, v as getTerminalAssistantMessages, w as isToolResultError, y as getUserMessageInstructionText, z as recordAttachmentsDelivered } from "./checkpoint-Deu-OVb3.js";
17
+ import { n as generateShortTitle, r as resolveTaskTitle, t as fallbackShortTitle } from "./short-title-BHd_jUFX.js";
18
+ import { A as sleep$1, D as fenceLock, E as acquireActiveLock, F as sandboxSkillDir, I as sandboxSkillFile, L as sandboxSkillPathResolution, M as SANDBOX_REPOS_ROOT, N as SANDBOX_SKILLS_ROOT, P as SANDBOX_WORKSPACE_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildNonInteractiveShellScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, j as SANDBOX_DATA_ROOT, k as withLock, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand, y as buildCommandScript } from "./profile-BsNrw8lj.js";
19
+ import { $ as workspaceSnapshotFinishedEvent, B as createEventAutomation, C as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as eventAutomationMatchesDestination, E as eventAutomationListToolResultSchema, F as effectiveTaskOutcomes, Gt as makeStructuredToolOutput, I as moveTaskOutcomes, Jt as ToolInputError, L as resolveTaskOutcomes, M as requireEventAutomationSlackContext, N as requireSupportedEventAutomationTrigger, O as eventAutomationToolResult, P as writableEventAutomation, Q as WORKSPACE_SNAPSHOT_READY_EVENT, R as taskOutcomeInputSchema, T as compactEventAutomation, Ut as injectContinuationToolName, V as deleteEventAutomation, W as getEventAutomation, Wt as juniorToolOutputSchema, X as getEventCatalog, Y as saveEventAutomation, Z as WORKSPACE_SNAPSHOT_FAILED_EVENT, at as normalizeCatalogEventIdentifier, c as parseSlackThreadId, ct as registeredEventTypeSchema, et as workspaceSnapshotWatch, f as createScheduledAutomation, g as listScheduledAutomationsForTeam, i as readLiveAttachment, it as hasPluginEventCatalogEntries, j as registeredEventAutomationTriggerSchema, k as eventAutomationToolResultSchema, lt as registeredResourceTypeSchema, nt as eventNamespaceSchema, ot as pluginSupportsEvent, pt as appendAndEnqueueInboundMessage, q as listEventAutomationsForTeam, rt as hasEventCatalogEntries, s as storeAttachments, st as registeredEventMatchSchema, t as incrementStat, tt as eventGuidance, ut as requireSupportedEventMatch, v as readScheduledAutomation, y as saveScheduledAutomation } from "./stats-pNGp3G5q.js";
20
+ import { _ as isTurnInputCommitLostError, c as sanitizeAssistantText, f as CooperativeTurnYieldError, l as NO_REPLY_MARKER, n as canReusePendingAuthLink, o as decideReply, p as TurnInputCommitLostError, s as getAssistantReplyText, t as abandonReplacedPendingAuth, u as isNoReplyMarker } from "./pending-auth-D7vmttn_.js";
21
+ import { C as toolInvocationDestination, S as surfaceFromRun, _ as uploadFilesToConversation, b as assertRunConsistency, h as postSlackMessage, i as formatProviderLabel, m as getSlackMessagePermalink, o as resolveBaseUrl, p as addReactionToMessage, r as deliverOAuthAuthorization, s as startOAuthFlow, v as RetryableDeliveryError, x as isAgentRunFeatureDisabled, y as actorFromRun } from "./agent-runner-2VQ9WhkG.js";
22
+ import { r as EVENT_AUTHOR_ID } from "./prompt-90miy8VV.js";
23
+ import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-B38CpJe2.js";
24
24
  import { t as getVercelConversationWorkQueue } from "./vercel-queue-DIkVcfK4.js";
25
- import { a as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-_8gxwDzt.js";
25
+ import { a as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-CNd9cpIy.js";
26
26
  import { n as privateTraceResultAttributes } from "./private-trace-result-BLvBjy_e.js";
27
27
  import { streamSimple } from "@earendil-works/pi-ai/compat";
28
28
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -33,7 +33,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
33
33
  import { z } from "zod";
34
34
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
35
35
  import { and, desc, eq, gt, gte, inArray, isNull, lt, ne, notExists, or, sql } from "drizzle-orm";
36
- import { EgressAuthRequired, EgressPolicyDenied, PluginToolInputError, actorSchema, destinationSchema, eventSchema, missingToolAnnotationKeys, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema, sourceSchema, stableEventMatchKey, watchResultSchema } from "@sentry/junior-plugin-api";
36
+ import { EgressAuthRequired, EgressPolicyDenied, PluginToolInputError, actorSchema, destinationSchema, eventSchema, missingToolAnnotationKeys, ownedObjectAnnotationSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema, sourceSchema, stableEventMatchKey, watchResultSchema } from "@sentry/junior-plugin-api";
37
37
  import { alias } from "drizzle-orm/pg-core";
38
38
  import { Agent, estimateContextTokens } from "@earendil-works/pi-agent-core";
39
39
  import fs from "node:fs/promises";
@@ -1483,7 +1483,7 @@ const TOOL_POLICY_RULES = [
1483
1483
  "- For user-provided URLs, use `webFetch`; for discovery, use `webSearch` then fetch/read promising sources; for current time/date context, use `systemTime`.",
1484
1484
  "- When searchEventTypes is exposed, use it only when the user asks what events are supported or the required resource type or event name is unclear. It discovers options but does not watch a resource or create an automation. When explaining how results can be used, distinguish temporary current-thread watches from durable event automations.",
1485
1485
  "- When a tool result includes a subscription, those events are already watched; do not call watchEvents for them. When a tool result includes a subscribable resource with suggestedEvents, use watchEvents only for those remaining events that serve the current intent. If suggestedEvents is empty or omitted, do not invent a watch. Do not create scheduled polling tasks for events a watch can deliver. Write a concise intent summary, and tell the user when the temporary watch expires. Stop only the requested watch by id unless the user explicitly asks to stop every watch in the thread.",
1486
- "- Successful automation changes include cards that the runtime attaches to your next visible reply. Explain what changed; do not repeat the card fields or draw a card in text.",
1486
+ "- Cards returned by tools attach to your next visible reply automatically. Explain the outcome; do not repeat the card fields or draw a card in text.",
1487
1487
  "- Use createEventAutomation only when the user explicitly asks for an event automation or durable whenever-this-happens-do-X automation. Ordinary watch, notify, and tell-me-when requests use watchEvents. When an event automation's resource and events are known, create it without redundant confirmation.",
1488
1488
  "- Event automations make the automation creator's connected credentials available by default when the requested work needs user-bound authorization. Do not ask for separate confirmation merely to use credentials needed for the requested work. On creation, omit credentialMode for the creator default and set system only when the creator explicitly requires it. For later changes, creator always means the automation's original createdBy actor, never the current requester. If the requester is not that creator, do not attempt to enable creator credential use or suggest that confirmation could authorize it.",
1489
1489
  "- Event automations list for the current destination, not one thread. Public automations can also be updated or deleted by automation id from another destination in the same workspace. When listing them, use createdBy to explain creator-only credential changes and warn when trigger.available is false; an unavailable automation remains stored but cannot receive events until its plugin event is enabled again.",
@@ -6824,13 +6824,16 @@ var McpToolManager = class {
6824
6824
  providerContent,
6825
6825
  ...result.structuredContent !== void 0 ? { structuredContent: result.structuredContent } : void 0
6826
6826
  };
6827
- await this.options.onToolSuccess?.({
6827
+ const cards = await this.options.onToolSuccess?.({
6828
6828
  arguments: resolvedArgs,
6829
6829
  provider: plugin.manifest.name,
6830
6830
  ...result.structuredContent !== void 0 ? { structuredContent: result.structuredContent } : void 0,
6831
6831
  toolName: tool.name
6832
6832
  });
6833
- return successResult;
6833
+ return cards?.length ? {
6834
+ ...successResult,
6835
+ cards
6836
+ } : successResult;
6834
6837
  } catch (error) {
6835
6838
  if (error instanceof McpAuthorizationRequiredError && await this.handleAuthorizationRequired(plugin.manifest.name, error)) {
6836
6839
  const parkedContent = [{
@@ -7148,6 +7151,7 @@ function createCallMcpToolTool(mcpToolManager) {
7148
7151
  }
7149
7152
  };
7150
7153
  },
7154
+ outputSchema: z.object({ objectCards: z.array(ownedObjectAnnotationSchema) }),
7151
7155
  execute: async (input, options) => {
7152
7156
  const { tool_name } = input;
7153
7157
  const provider = parseMcpProviderFromToolName(tool_name);
@@ -7167,10 +7171,14 @@ function createCallMcpToolTool(mcpToolManager) {
7167
7171
  });
7168
7172
  throw new McpToolError(missingToolMessage(tool_name, provider));
7169
7173
  }
7170
- return { content: (await mcpTool.execute(resolveMcpArguments(input), {
7174
+ const result = await mcpTool.execute(resolveMcpArguments(input), {
7171
7175
  conversationPrivacy: options?.conversationPrivacy ?? "private",
7172
7176
  ...options?.toolCallId ? { toolCallId: options.toolCallId } : void 0
7173
- })).content };
7177
+ });
7178
+ return {
7179
+ content: result.content,
7180
+ details: { objectCards: result.cards ?? [] }
7181
+ };
7174
7182
  }
7175
7183
  });
7176
7184
  }
@@ -7928,7 +7936,7 @@ function createEventAutomationTool(context, catalog) {
7928
7936
  const existing = await getEventAutomation(db, id);
7929
7937
  if (existing) {
7930
7938
  if (!eventAutomationMatchesDestination(existing, destination) || existing.createdBy.slackUserId !== actor.userId) throw new ToolInputError("Event automation operation identity is invalid.");
7931
- if (existing.status !== "deleted") return eventAutomationToolResult(existing, catalog, actor.userId);
7939
+ if (existing.status !== "deleted") return eventAutomationToolResult(context.conversationId, existing, catalog, actor.userId);
7932
7940
  }
7933
7941
  const title = await resolveTaskTitle({
7934
7942
  completeText,
@@ -7958,7 +7966,7 @@ function createEventAutomationTool(context, catalog) {
7958
7966
  ...match ? { match } : void 0
7959
7967
  }
7960
7968
  };
7961
- return eventAutomationToolResult(await createEventAutomation(db, task), catalog, actor.userId);
7969
+ return eventAutomationToolResult(context.conversationId, await createEventAutomation(db, task), catalog, actor.userId);
7962
7970
  }
7963
7971
  });
7964
7972
  }
@@ -7977,13 +7985,24 @@ function createDeleteEventAutomationTool(context, catalog) {
7977
7985
  executionMode: "sequential",
7978
7986
  description: "Delete an event automation.",
7979
7987
  inputSchema: z.object({ automationId: z.string().min(1) }).strict(),
7980
- outputSchema: eventAutomationToolResultSchema.omit({ cards: true }),
7988
+ outputSchema: eventAutomationToolResultSchema.omit({ objectCards: true }).extend({ removedCards: z.array(messageCardRefSchema) }),
7981
7989
  async execute({ automationId }) {
7982
7990
  const { actor } = requireEventAutomationSlackContext(context);
7983
7991
  const current = await writableEventAutomation(context, automationId);
7984
7992
  const deleted = await deleteEventAutomation(getDb(), current.id);
7985
7993
  if (!deleted) throw new ToolInputError("Event automation was not found.");
7986
- return { automation: compactEventAutomation(deleted, catalog, actor.userId) };
7994
+ await createPluginAnnotations({
7995
+ conversationId: context.conversationId,
7996
+ db: getDb(),
7997
+ plugin: "junior"
7998
+ }).remove("object", automationId);
7999
+ return {
8000
+ automation: compactEventAutomation(deleted, catalog, actor.userId),
8001
+ removedCards: [{
8002
+ plugin: "junior",
8003
+ key: automationId
8004
+ }]
8005
+ };
7987
8006
  }
7988
8007
  });
7989
8008
  }
@@ -8088,7 +8107,7 @@ function createUpdateEventAutomationTool(context, catalog) {
8088
8107
  }
8089
8108
  const saved = await saveEventAutomation(getDb(), next);
8090
8109
  if (!saved) throw new ToolInputError("Event automation was not found.");
8091
- return eventAutomationToolResult(saved, catalog, actor.userId);
8110
+ return eventAutomationToolResult(context.conversationId, saved, catalog, actor.userId);
8092
8111
  }
8093
8112
  });
8094
8113
  }
@@ -8674,7 +8693,7 @@ const compactTaskResultSchema = z.object({
8674
8693
  }).strict();
8675
8694
  const scheduleAutomationToolResultSchema = juniorToolOutputSchema.extend({
8676
8695
  automation: compactTaskResultSchema,
8677
- cards: z.array(automationCardSchema).optional()
8696
+ objectCards: z.array(ownedObjectAnnotationSchema).optional()
8678
8697
  }).strict();
8679
8698
  const scheduleListToolResultSchema = juniorToolOutputSchema.extend({
8680
8699
  automations: z.array(compactTaskResultSchema),
@@ -8792,23 +8811,27 @@ function compactTask(task, requesterSlackUserId) {
8792
8811
  });
8793
8812
  }
8794
8813
  /** Build the structured result shared by single-task scheduler tools. */
8795
- function scheduleAutomationToolResult(task, requesterSlackUserId) {
8814
+ async function scheduleAutomationToolResult(conversationId, task, requesterSlackUserId) {
8796
8815
  const automation = compactTask(task, requesterSlackUserId);
8816
+ const title = automation.title ?? fallbackShortTitle(automation.instruction, "Scheduled automation");
8817
+ const annotation = {
8818
+ kind: "object",
8819
+ objectType: "automation",
8820
+ label: title,
8821
+ key: task.id,
8822
+ title,
8823
+ url: automation.dashboardUrl,
8824
+ description: automation.instruction,
8825
+ trigger: task.schedule.kind === "one_off" && task.nextRunAtMs !== void 0 ? `${new Intl.DateTimeFormat("en-US", {
8826
+ dateStyle: "medium",
8827
+ timeStyle: "short",
8828
+ timeZone: task.schedule.timezone
8829
+ }).format(task.nextRunAtMs)} · ${task.schedule.timezone}` : automation.schedule,
8830
+ warning: automation.status === "blocked" ? automation.statusReason ?? "This automation is blocked." : automation.status === "completed" ? "This automation has completed." : void 0
8831
+ };
8797
8832
  return {
8798
8833
  automation,
8799
- cards: [{
8800
- kind: "automation",
8801
- id: task.id,
8802
- title: automation.title ?? fallbackShortTitle(automation.instruction, "Scheduled automation"),
8803
- url: automation.dashboardUrl,
8804
- instruction: automation.instruction,
8805
- trigger: task.schedule.kind === "one_off" && task.nextRunAtMs !== void 0 ? `${new Intl.DateTimeFormat("en-US", {
8806
- dateStyle: "medium",
8807
- timeStyle: "short",
8808
- timeZone: task.schedule.timezone
8809
- }).format(task.nextRunAtMs)} · ${task.schedule.timezone}` : automation.schedule,
8810
- warning: automation.status === "blocked" ? automation.statusReason ?? "This automation is blocked." : automation.status === "completed" ? "This automation has completed." : null
8811
- }]
8834
+ objectCards: await saveObjectAnnotations(conversationId, "junior", [annotation])
8812
8835
  };
8813
8836
  }
8814
8837
  /** Build the structured result for listing scheduler tools. */
@@ -8879,7 +8902,7 @@ function createSlackScheduleCreateAutomationTool(context) {
8879
8902
  const existing = await readScheduledAutomation(db, id);
8880
8903
  if (existing) {
8881
8904
  if (!sameDestination(existing, destination) || existing.createdBy.slackUserId !== actor.slackUserId) throwToolInputError("Scheduled automation operation identity is invalid.");
8882
- return scheduleAutomationToolResult(existing, actor.slackUserId);
8905
+ return scheduleAutomationToolResult(context.conversationId, existing, actor.slackUserId);
8883
8906
  }
8884
8907
  const identity = (await context.users.resolveActor())?.identity;
8885
8908
  if (!identity || identity.provider !== "slack" || identity.providerTenantId !== destination.teamId || identity.providerSubjectId !== actor.slackUserId) throwToolInputError("Scheduled automation creator identity is unavailable.");
@@ -8922,7 +8945,7 @@ function createSlackScheduleCreateAutomationTool(context) {
8922
8945
  const committed = await createScheduledAutomation(db, task);
8923
8946
  if (!sameDestination(committed, destination) || committed.createdBy.slackUserId !== actor.slackUserId) throwToolInputError("Scheduled automation operation identity is invalid.");
8924
8947
  logInfo("scheduled_automation.create.completed", scheduledAutomationAttributes(committed));
8925
- return scheduleAutomationToolResult(committed, actor.slackUserId);
8948
+ return scheduleAutomationToolResult(context.conversationId, committed, actor.slackUserId);
8926
8949
  }
8927
8950
  });
8928
8951
  }
@@ -8941,7 +8964,7 @@ function createSlackScheduleDeleteAutomationTool(context) {
8941
8964
  description: "Delete one scheduled Junior task from the active Slack conversation. Use only task IDs returned for this conversation. Do not delete schedules from threads, other channels, or another user's DM.",
8942
8965
  executionMode: "sequential",
8943
8966
  inputSchema: z.object({ automationId: z.string().min(1).describe("ID of the task to delete. Must be from this active Slack conversation.") }),
8944
- outputSchema: scheduleAutomationToolResultSchema,
8967
+ outputSchema: scheduleAutomationToolResultSchema.extend({ removedCards: z.array(messageCardRefSchema) }),
8945
8968
  execute: async ({ automationId }) => {
8946
8969
  const next = {
8947
8970
  ...await getWritableTask({
@@ -8954,7 +8977,18 @@ function createSlackScheduleDeleteAutomationTool(context) {
8954
8977
  runNowAtMs: void 0
8955
8978
  };
8956
8979
  await saveScheduledAutomation(getDb(), next);
8957
- return { automation: compactTask(next, context.actor?.userId) };
8980
+ await createPluginAnnotations({
8981
+ conversationId: context.conversationId,
8982
+ db: getDb(),
8983
+ plugin: "junior"
8984
+ }).remove("object", automationId);
8985
+ return {
8986
+ automation: compactTask(next, context.actor?.userId),
8987
+ removedCards: [{
8988
+ plugin: "junior",
8989
+ key: automationId
8990
+ }]
8991
+ };
8958
8992
  }
8959
8993
  });
8960
8994
  }
@@ -9170,10 +9204,10 @@ function createSlackScheduleUpdateAutomationTool(context) {
9170
9204
  if (title) next.title = title;
9171
9205
  else delete next.title;
9172
9206
  }
9173
- if (!changingDestination && !instructionChanged && !compiled && status === void 0 && (input.credentialMode === void 0 || input.credentialMode === null || input.credentialMode === lookup.credentialMode) && input.outcomes === void 0 && moveDestination) return scheduleAutomationToolResult(lookup, actor.slackUserId);
9207
+ if (!changingDestination && !instructionChanged && !compiled && status === void 0 && (input.credentialMode === void 0 || input.credentialMode === null || input.credentialMode === lookup.credentialMode) && input.outcomes === void 0 && moveDestination) return scheduleAutomationToolResult(context.conversationId, lookup, actor.slackUserId);
9174
9208
  const committed = await saveScheduledAutomation(db, next);
9175
9209
  if (changingDestination) logInfo("scheduled_automation.move.completed", scheduledAutomationAttributes(committed));
9176
- return scheduleAutomationToolResult(committed, actor.slackUserId);
9210
+ return scheduleAutomationToolResult(context.conversationId, committed, actor.slackUserId);
9177
9211
  }
9178
9212
  });
9179
9213
  }
@@ -9182,6 +9216,7 @@ function createSlackScheduleUpdateAutomationTool(context) {
9182
9216
  function scheduledAutomationToolContext(context) {
9183
9217
  if (context.source.kind !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack" || !context.resolveActorIdentity) return;
9184
9218
  return {
9219
+ conversationId: context.conversationId,
9185
9220
  actor: context.actor,
9186
9221
  source: context.source,
9187
9222
  users: { resolveActor: context.resolveActorIdentity },
@@ -16395,7 +16430,7 @@ async function wireAgentTools(args) {
16395
16430
  authProviderFactory: mcpAuth.authProviderFactory,
16396
16431
  onAuthorizationRequired: mcpAuth.onAuthorizationRequired,
16397
16432
  onToolSuccess: async (input) => {
16398
- await pluginHooks.afterMcpTool({
16433
+ return await pluginHooks.afterMcpTool({
16399
16434
  ...input,
16400
16435
  conversationId: args.run.conversationId
16401
16436
  });
@@ -1,21 +1,21 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { a as embedTexts, r as completeObject } from "./client-CcSboWx_.js";
3
- import { C as withSpan, P as normalizeIdentityEmail, _ as setSpanAttributes, d as logInfo, f as logWarn, u as logException, v as setSpanStatus } from "./logging-qmsMdU0y.js";
2
+ import { a as embedTexts, r as completeObject } from "./client-DjC6-6iU.js";
3
+ import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, _ as setSpanAttributes, d as logInfo, f as logWarn, u as logException, v as setSpanStatus } from "./logging-DiN3o3nB.js";
4
4
  import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-BGjdDVWD.js";
6
- import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-CGYv-YPE.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-xS1t92xa.js";
6
+ import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-CtoUVs72.js";
7
7
  import { n as defaultModelId } from "./model-profile-CZmVoGdX.js";
8
8
  import { _ as parseSlackMessageTs, c as isActorUserId, h as parseSlackTeamId, m as parseSlackChannelReferenceId, u as parseActorUserId } from "./context-Bplcgypl.js";
9
9
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
10
- import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-BLBZ-UB8.js";
11
- import { A as readMessageCards, C as conversationReportEventSchema, F as conversationBriefSchema, H as decodeStoredConversationEvent, I as parseBriefInput, U as historyReplacementSchema, W as newConversationEventSchema, Y as usageSchema, z as conversationEventDataSchema } from "./conversation-BBDt88di.js";
12
- import { A as sleep$1, P as SANDBOX_WORKSPACE_ROOT, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-DbG8AlNd.js";
13
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-B8rCQI7K.js";
10
+ import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-AOhG9X1t.js";
11
+ import { C as conversationReportEventSchema, G as historyReplacementSchema, K as newConversationEventSchema, L as conversationBriefSchema, N as readMessageCards, R as parseBriefInput, V as conversationEventDataSchema, W as decodeStoredConversationEvent, Z as usageSchema } from "./conversation-1HUoZr2l.js";
12
+ import { A as sleep$1, P as SANDBOX_WORKSPACE_ROOT, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BsNrw8lj.js";
13
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-90miy8VV.js";
14
14
  import { AsyncLocalStorage } from "node:async_hooks";
15
15
  import { z } from "zod";
16
16
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
17
17
  import { and, arrayContains, asc, desc, eq, exists, getTableColumns, gt, gte, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
18
- import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, identitySchema, locationSchema, missingToolAnnotationKeys, normalizeEventIdentifier, pluginEventsSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey, userSchema } from "@sentry/junior-plugin-api";
18
+ import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, identitySchema, locationSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, pluginEventsSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey, userSchema } from "@sentry/junior-plugin-api";
19
19
  import { alias } from "drizzle-orm/pg-core";
20
20
  import { WebClient } from "@slack/web-api";
21
21
  import { Sandbox } from "@vercel/sandbox";
@@ -1707,6 +1707,43 @@ async function listConversationAnnotationsById(db, conversationIds) {
1707
1707
  return byConversation;
1708
1708
  }
1709
1709
  //#endregion
1710
+ //#region src/chat/conversations/annotation-results.ts
1711
+ /** Save object annotations and return their Message card snapshots. */
1712
+ async function saveObjectAnnotations(conversationId, plugin, value) {
1713
+ const annotations = objectAnnotationSchema.array().parse(value);
1714
+ await getDb().transaction(async (db) => {
1715
+ const store = createPluginAnnotations({
1716
+ conversationId,
1717
+ plugin,
1718
+ db
1719
+ });
1720
+ for (const annotation of annotations) {
1721
+ await store.upsert(annotation);
1722
+ await store.remove("resource_link", annotation.key);
1723
+ }
1724
+ });
1725
+ return annotations.map((annotation) => ({
1726
+ ...annotation,
1727
+ plugin
1728
+ }));
1729
+ }
1730
+ /** Save annotations from a successful plugin tool result and attach their cards. */
1731
+ async function annotateToolResult(conversationId, plugin, result) {
1732
+ if (!isRecord$2(result) || result.isError === true) return result;
1733
+ const details = isRecord$2(result.details) ? result.details : result;
1734
+ if (details.timed_out === true || details.isError === true || !Array.isArray(details.objectAnnotations)) return result;
1735
+ const cards = await saveObjectAnnotations(conversationId, plugin, details.objectAnnotations);
1736
+ const annotated = {
1737
+ ...details,
1738
+ objectCards: cards
1739
+ };
1740
+ if (isRecord$2(result.details)) return {
1741
+ ...result,
1742
+ details: annotated
1743
+ };
1744
+ return annotated;
1745
+ }
1746
+ //#endregion
1710
1747
  //#region src/chat/conversations/sql/privacy.ts
1711
1748
  const privacyRoot = alias(juniorConversations, "privacy_root");
1712
1749
  /** Accept only a structurally valid persisted root as privacy authority. */
@@ -2018,7 +2055,7 @@ function reportEventData(args) {
2018
2055
  ...typeof data.meta?.eventType === "string" ? { eventType: data.meta.eventType } : void 0,
2019
2056
  ...typeof data.meta?.explicitMention === "boolean" ? { explicitMention: data.meta.explicitMention } : void 0,
2020
2057
  ...args.canExposePayload && typeof data.meta?.trustedSummary === "string" ? { trustedSummary: data.meta.trustedSummary } : void 0,
2021
- ...args.canExposePayload && data.meta?.cards ? { cards: readMessageCards(data.meta.cards) } : void 0,
2058
+ ...args.canExposePayload && (data.meta?.cards || data.meta?.objectCards) ? { cards: readMessageCards(data.meta) } : void 0,
2022
2059
  ...args.canExposePayload ? { text: data.text } : { redacted: true }
2023
2060
  };
2024
2061
  }
@@ -4467,7 +4504,7 @@ var PluginHookDeniedError = class extends Error {
4467
4504
  };
4468
4505
  let registeredPlugins = [];
4469
4506
  const PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
4470
- const PLUGIN_TOOL_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
4507
+ const PLUGIN_TASK_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
4471
4508
  const OPERATIONAL_REPORT_MAX_METRICS = 8;
4472
4509
  const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
4473
4510
  const OPERATIONAL_REPORT_MAX_CHART_SERIES = 8;
@@ -4646,7 +4683,7 @@ function validatePlugins(plugins) {
4646
4683
  if (seen.has(name)) throw new Error(`Duplicate plugin name "${name}"`);
4647
4684
  if (plugin.events !== void 0 && !pluginEventsSchema.safeParse(plugin.events).success) throw new Error(`Plugin "${name}" events is invalid`);
4648
4685
  for (const [taskName, task] of Object.entries(plugin.tasks ?? {})) {
4649
- if (!PLUGIN_TOOL_NAME_RE.test(taskName)) throw new Error(`Plugin task "${taskName}" from plugin "${name}" must be a camelCase identifier`);
4686
+ if (!PLUGIN_TASK_NAME_RE.test(taskName)) throw new Error(`Plugin task "${taskName}" from plugin "${name}" must be a camelCase identifier`);
4650
4687
  if (typeof task.run !== "function") throw new Error(`Plugin task "${taskName}" from plugin "${name}" must define a run function`);
4651
4688
  }
4652
4689
  seen.add(name);
@@ -4885,7 +4922,6 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
4885
4922
  const pluginTools = hook(pluginContext);
4886
4923
  const namespace = pluginToolNamespace(pluginName);
4887
4924
  for (const [localName, tool] of Object.entries(pluginTools)) {
4888
- if (!PLUGIN_TOOL_NAME_RE.test(localName)) throw new Error(`Plugin tool "${localName}" from plugin "${pluginName}" must be a camelCase identifier`);
4889
4925
  const name = `${namespace}_${localName}`;
4890
4926
  if (tools[name]) throw new Error(`Duplicate plugin tool "${name}" from plugin "${pluginName}"`);
4891
4927
  const definition = tool;
@@ -4906,7 +4942,12 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
4906
4942
  description: plugin.manifest.description
4907
4943
  };
4908
4944
  definition.exposure ??= "deferred";
4909
- tools[name] = definition;
4945
+ const execute = definition.execute;
4946
+ if (execute) {
4947
+ const wrapped = Object.create(definition);
4948
+ wrapped.execute = async (input, options) => annotateToolResult(context.conversationId, pluginName, await execute.call(definition, input, options));
4949
+ tools[name] = wrapped;
4950
+ } else tools[name] = definition;
4910
4951
  }
4911
4952
  }
4912
4953
  return tools;
@@ -5264,6 +5305,7 @@ function createPluginHookRunner(input = {}) {
5264
5305
  const loaded = getPlugins();
5265
5306
  return {
5266
5307
  async afterMcpTool(tool) {
5308
+ const cards = [];
5267
5309
  for (const plugin of loaded) {
5268
5310
  if (plugin.manifest.name !== tool.provider) continue;
5269
5311
  const hook = plugin.hooks?.afterMcpTool;
@@ -5274,7 +5316,7 @@ function createPluginHookRunner(input = {}) {
5274
5316
  plugin: plugin.manifest.name
5275
5317
  }) : void 0;
5276
5318
  try {
5277
- await hook({
5319
+ const result = await hook({
5278
5320
  ...basePluginContext(plugin),
5279
5321
  ...tool.conversationId ? { conversationId: tool.conversationId } : void 0,
5280
5322
  ...annotations ? { annotations } : void 0,
@@ -5284,6 +5326,7 @@ function createPluginHookRunner(input = {}) {
5284
5326
  name: tool.toolName
5285
5327
  }
5286
5328
  });
5329
+ if (result && tool.conversationId) cards.push(...await saveObjectAnnotations(tool.conversationId, plugin.manifest.name, result.objectAnnotations));
5287
5330
  } catch (error) {
5288
5331
  logWarn("agent.plugin.after_mcp_tool.failed", {
5289
5332
  "app.plugin.name": plugin.manifest.name,
@@ -5292,6 +5335,7 @@ function createPluginHookRunner(input = {}) {
5292
5335
  });
5293
5336
  }
5294
5337
  }
5338
+ return cards;
5295
5339
  },
5296
5340
  async prepareWorkspace(sandbox, repos, signal) {
5297
5341
  const preparers = new Set(loaded.filter((plugin) => plugin.hooks?.workspacePrepare).map((plugin) => plugin.manifest.name));
@@ -5393,4 +5437,4 @@ function createPluginHookRunner(input = {}) {
5393
5437
  };
5394
5438
  }
5395
5439
  //#endregion
5396
- export { resolveViewerUser as $, parseSessionSource as $t, tryWorkspaceRepoCheckoutPath as A, createPluginConversationEvents as At, downloadPrivateSlackFile as B, authenticationUnlinkedEvent as Bt, invalidateReadySnapshot as C, conversationArchivedForEmail as Ct, SANDBOX_RUNTIME as D, conversationNotArchivedForEmail as Dt, setWorkspaceSnapshotBuild as E, conversationHasParticipantUser as Et, bindSlackDirectCredentialSubject as F, listConversationAnnotations as Ft, isDmChannel as G, getDb as Gt, getHeaderString as H, getConversationEventStore as Ht, verifyEventAutomationCredentialSubject as I, listConversationAnnotationsById as It, withSlackRetries as J, withConversationEventLock as Jt, normalizeSlackConversationId as K, getSqlExecutor as Kt, verifyScheduledAutomationCredentialSubject as L, JUNIOR_NATIVE_EVENT_NAMESPACE as Lt, resolveChannelCapabilities as M, readConversationEventPage as Mt, bindEventAutomationCredentialSubject as N, buildSentryConversationUrl as Nt, deleteWorkspaceSnapshotBuilders as O, conversationNotArchivedForUser as Ot, bindScheduledAutomationCredentialSubject as P, resolveRootVisibility as Pt, readActorIdentity as Q, bindProviderConversation as Qt, verifySlackDirectCredentialSubject as R, agentsInstructionsUpdatedEvent as Rt, WorkspaceValidationError as S, conversationArchiveTimes as St, setWorkspaceSnapshot as T, conversationHasParticipantEmail as Tt, getSlackClient as U, getConversationMessageSearchStore as Ut, getFilePermalink as V, db_exports as Vt, isConversationScopedChannel as W, getConversationStore as Wt, runWithWorkspaceTeamId as X, withConversationMutationLock as Xt, getWorkspaceTeamId as Y, sanitizePostgresJson as Yt, findUserByEmail as Z, locationFromRow as Zt, deleteWorkspace as _, createPluginState as _t, getPluginRoutes as a, resolveRootConversationId as an, STOP_WATCHING_TOOL_NAME as at, listWorkspaces as b, createPluginLogger as bt, getPluginTools as c, upsertLinkedIdentity as cn, collectEventMatchKeys as ct, setPlugins as d, requireSlackDestination as dn, findMatchingWatches as dt, addAgentTurnUsage as en, updateViewerDisplayName as et, validatePlugins as f, sameDestination as fn, listWatches as ft, createWorkspace as g, setDashboardConversationLinkOptions as gt, setBriefsConfig as h, getDashboardTaskLink as ht, getPluginApiRoutes as i, hasAgentTurnUsage as in, RESOURCE_WATCH_TOOL_SOURCE as it, workspaceRepoCheckoutPath as j, readLatestConversationBrief as jt, getWorkspaceSnapshotBuilder as k, viewerConversationMembership as kt, getPluginUserPromptContributions as l, createSlackDestination as ln, createWatch as lt, registration_exports as m, getDashboardConversationLink as mt, applyPluginFormatMarkdown as n, agentTurnTotalTokens as nn, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as nt, getPluginSlackConversationLink as o, deleteProviderIdentityForSlackUser as on, cancelSubscriptions as ot, coreTaskRegistrations as p, JUNIOR_THREAD_STATE_TTL_MS as pt, runWithSlackInstallationToken as q, createSqlConversationEventStore as qt, createPluginHookRunner as r, agentTurnUsageSchema as rn, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as rt, getPluginSystemPromptContributions as s, upsertIdentity as sn, cancelWatch as st, agent_hooks_exports as t, agentTurnCostUsd as tn, getSlackToolContext as tt, getPlugins as u, parseDestination as un, deliverWatch as ut, getWorkspace as v, createPluginEmbedder as vt, loadSnapshotsForProfile as w, conversationArchivedForUser as wt, updateWorkspace as x, readConversationAccessFromSql as xt, getWorkspaceByName as y, createPluginModel as yt, SlackActionError as z, authenticationLinkedEvent as zt };
5440
+ export { resolveViewerUser as $, locationFromRow as $t, tryWorkspaceRepoCheckoutPath as A, createPluginConversationEvents as At, downloadPrivateSlackFile as B, agentsInstructionsUpdatedEvent as Bt, invalidateReadySnapshot as C, conversationArchivedForEmail as Ct, SANDBOX_RUNTIME as D, conversationNotArchivedForEmail as Dt, setWorkspaceSnapshotBuild as E, conversationHasParticipantUser as Et, bindSlackDirectCredentialSubject as F, saveObjectAnnotations as Ft, isDmChannel as G, getConversationMessageSearchStore as Gt, getHeaderString as H, authenticationUnlinkedEvent as Ht, verifyEventAutomationCredentialSubject as I, createPluginAnnotations as It, withSlackRetries as J, getSqlExecutor as Jt, normalizeSlackConversationId as K, getConversationStore as Kt, verifyScheduledAutomationCredentialSubject as L, listConversationAnnotations as Lt, resolveChannelCapabilities as M, readConversationEventPage as Mt, bindEventAutomationCredentialSubject as N, buildSentryConversationUrl as Nt, deleteWorkspaceSnapshotBuilders as O, conversationNotArchivedForUser as Ot, bindScheduledAutomationCredentialSubject as P, resolveRootVisibility as Pt, readActorIdentity as Q, withConversationMutationLock as Qt, verifySlackDirectCredentialSubject as R, listConversationAnnotationsById as Rt, WorkspaceValidationError as S, conversationArchiveTimes as St, setWorkspaceSnapshot as T, conversationHasParticipantEmail as Tt, getSlackClient as U, db_exports as Ut, getFilePermalink as V, authenticationLinkedEvent as Vt, isConversationScopedChannel as W, getConversationEventStore as Wt, runWithWorkspaceTeamId as X, withConversationEventLock as Xt, getWorkspaceTeamId as Y, createSqlConversationEventStore as Yt, findUserByEmail as Z, sanitizePostgresJson as Zt, deleteWorkspace as _, createPluginState as _t, getPluginRoutes as a, agentTurnUsageSchema as an, STOP_WATCHING_TOOL_NAME as at, listWorkspaces as b, createPluginLogger as bt, getPluginTools as c, deleteProviderIdentityForSlackUser as cn, collectEventMatchKeys as ct, setPlugins as d, createSlackDestination as dn, findMatchingWatches as dt, bindProviderConversation as en, updateViewerDisplayName as et, validatePlugins as f, parseDestination as fn, listWatches as ft, createWorkspace as g, setDashboardConversationLinkOptions as gt, setBriefsConfig as h, getDashboardTaskLink as ht, getPluginApiRoutes as i, agentTurnTotalTokens as in, RESOURCE_WATCH_TOOL_SOURCE as it, workspaceRepoCheckoutPath as j, readLatestConversationBrief as jt, getWorkspaceSnapshotBuilder as k, viewerConversationMembership as kt, getPluginUserPromptContributions as l, upsertIdentity as ln, createWatch as lt, registration_exports as m, sameDestination as mn, getDashboardConversationLink as mt, applyPluginFormatMarkdown as n, addAgentTurnUsage as nn, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as nt, getPluginSlackConversationLink as o, hasAgentTurnUsage as on, cancelSubscriptions as ot, coreTaskRegistrations as p, requireSlackDestination as pn, JUNIOR_THREAD_STATE_TTL_MS as pt, runWithSlackInstallationToken as q, getDb as qt, createPluginHookRunner as r, agentTurnCostUsd as rn, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as rt, getPluginSystemPromptContributions as s, resolveRootConversationId as sn, cancelWatch as st, agent_hooks_exports as t, parseSessionSource as tn, getSlackToolContext as tt, getPlugins as u, upsertLinkedIdentity as un, deliverWatch as ut, getWorkspace as v, createPluginEmbedder as vt, loadSnapshotsForProfile as w, conversationArchivedForUser as wt, updateWorkspace as x, readConversationAccessFromSql as xt, getWorkspaceByName as y, createPluginModel as yt, SlackActionError as z, JUNIOR_NATIVE_EVENT_NAMESPACE as zt };
@@ -1,9 +1,9 @@
1
- import { F as isRecord, d as logInfo, f as logWarn } from "./logging-qmsMdU0y.js";
2
- import { h as normalizeSlackEmojiName } from "./config-CGYv-YPE.js";
1
+ import { F as isRecord, d as logInfo, f as logWarn } from "./logging-DiN3o3nB.js";
2
+ import { h as normalizeSlackEmojiName } from "./config-CtoUVs72.js";
3
3
  import { _ as parseSlackMessageTs, g as parseSlackUserId } from "./context-Bplcgypl.js";
4
- import { G as isDmChannel, J as withSlackRetries, K as normalizeSlackConversationId, U as getSlackClient, n as applyPluginFormatMarkdown, un as parseDestination, z as SlackActionError } from "./agent-hooks-DkriF84n.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-XH_LFA_7.js";
6
- import { w as getStateAdapter } from "./profile-DbG8AlNd.js";
4
+ import { G as isDmChannel, J as withSlackRetries, K as normalizeSlackConversationId, U as getSlackClient, fn as parseDestination, n as applyPluginFormatMarkdown, z as SlackActionError } from "./agent-hooks-DZU5nsd1.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
6
+ import { w as getStateAdapter } from "./profile-BsNrw8lj.js";
7
7
  import { r as isExperimentalFeatureEnabled } from "./experimental-CIXf7Uye.js";
8
8
  import { randomBytes } from "node:crypto";
9
9
  import { actorSchema, sourceSchema } from "@sentry/junior-plugin-api";