@sentry/junior 0.221.1 → 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.
- package/dist/{agent-CY49A4pN.js → agent-Bzbf92vv.js} +97 -42
- package/dist/{agent-hooks-BnZBgDPe.js → agent-hooks-DZU5nsd1.js} +60 -15
- package/dist/{agent-runner-BC8iSAfE.js → agent-runner-2VQ9WhkG.js} +6 -5
- package/dist/api/schema.d.ts +209 -11
- package/dist/api/schema.js +4 -4
- package/dist/api.js +18 -515
- package/dist/{app-BYD2Nyji.d.ts → app-BbSD6EtD.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +241 -39
- package/dist/{auth-pause-state-CJwPs1cT.js → auth-pause-state-Bn2vX4PA.js} +41 -7
- package/dist/{briefs-BSOhy23c.js → briefs-BJPfCrlT.js} +6 -6
- package/dist/{catalog-runtime-0oMD2jas.js → catalog-runtime-BthunUDD.js} +1 -1
- package/dist/{checkpoint-Bl47qAIY.js → checkpoint-Deu-OVb3.js} +11 -7
- package/dist/cli/chat.js +13 -13
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-BrThxuRI.js → client-DjC6-6iU.js} +56 -6
- package/dist/{config-CEuC6CFj.js → config-CtoUVs72.js} +6 -7
- package/dist/{conversation-BSRGzJmY.js → conversation-1HUoZr2l.js} +75 -4
- package/dist/{conversation-privacy-aHn1OwXL.js → conversation-privacy-xS1t92xa.js} +1 -1
- package/dist/{credential-sync-Dht95TJQ.js → credential-sync-CKdXEUDO.js} +180 -31
- package/dist/{execution-stats-D9m2kmmg.js → execution-stats-CrXs9vSH.js} +3 -3
- package/dist/{executor-3IasVOqK.js → executor-AOhG9X1t.js} +1 -1
- package/dist/history-yaSjGMD_.d.ts +65 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-36liupTq.js → job-queue-CNd9cpIy.js} +1 -1
- package/dist/{logging-gR24QCo_.js → logging-DiN3o3nB.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-BvNIWVA3.js → oauth-callback-server-Ca0VLUEw.js} +2 -2
- package/dist/{pending-auth-Cl4BsopG.js → pending-auth-D7vmttn_.js} +2 -2
- package/dist/{profile-VmUpQuOm.js → profile-BsNrw8lj.js} +4 -4
- package/dist/{prompt-BkaHwBW0.js → prompt-90miy8VV.js} +1 -1
- package/dist/{registry-BATk1X_v.js → registry-Dankt-Pl.js} +1 -1
- package/dist/reporting-window-DbUqng0P.js +229 -0
- package/dist/{resolve-Cf79l1H8.js → resolve-B38CpJe2.js} +2 -2
- package/dist/{runner-DNN4EPj_.js → runner-Ck5rEjCm.js} +21 -10
- package/dist/{sandbox-egress-signals-C-HUJW1G.js → sandbox-egress-signals-BOfFkvly.js} +1 -1
- package/dist/{schema-YPJXVcOW.js → schema-RpbW5Od2.js} +5 -128
- package/dist/{short-title-Cy3D8vg1.js → short-title-BHd_jUFX.js} +2 -2
- package/dist/{skills-DMQkR1Yu.js → skills-DbP4TDft.js} +2 -2
- package/dist/{spawn-BHk7RpYw.js → spawn-DzXc_PKO.js} +2 -2
- package/dist/{stats-8Bzht8zO.js → stats-pNGp3G5q.js} +56 -15
- package/dist/{task-queue-Cm4FhC0n.js → task-queue-Cy9y1foT.js} +3 -3
- package/dist/{task-runner-dQwOhCYs.js → task-runner-DI1FBJFJ.js} +8 -8
- package/dist/{thread-state-D0Ktlch_.js → thread-state-DXgxOYpZ.js} +5 -5
- package/dist/{turn-execution-BfLZfabf.js → turn-execution-BNOXrZ-M.js} +3 -3
- package/dist/{turn-lifecycle-D75pWL8e.js → turn-lifecycle-Bjf6y2GO.js} +1 -1
- package/dist/{validation-D5fdtuzG.js → validation-D5CIslEu.js} +1 -1
- package/dist/{version-DErORHQC.js → version-_ZQFlslB.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-IHMPbDay.js → web-authorization-6mmfS_o-.js} +1 -1
- package/dist/web-input-BJpWm6go.js +899 -0
- package/dist/{work-CaaSjlNk.js → work-DvIlJR3C.js} +9 -9
- package/dist/{worker-Eom9CfBl.js → worker-D1qidg-Y.js} +5 -5
- package/migrations/0044_event_automation_channel_destinations.sql +36 -0
- package/migrations/meta/0044_snapshot.json +3473 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/history-ClE4toxe.d.ts +0 -32
- package/dist/reporting-schema-DosTN__Q.js +0 -105
- package/dist/web-input-DskRJhrK.js +0 -392
|
@@ -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-
|
|
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-
|
|
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-
|
|
5
|
-
import { h as normalizeSlackEmojiName, n as botConfig } from "./config-
|
|
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
|
|
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-
|
|
11
|
-
import {
|
|
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-
|
|
14
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
15
|
-
import { a as parseSkillInvocation, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-
|
|
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-
|
|
17
|
-
import { n as generateShortTitle, r as resolveTaskTitle } from "./short-title-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
22
|
-
import { r as EVENT_AUTHOR_ID } from "./prompt-
|
|
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-
|
|
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-
|
|
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,6 +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
|
+
"- 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.",
|
|
1486
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.",
|
|
1487
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.",
|
|
1488
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.",
|
|
@@ -5188,7 +5189,7 @@ async function grepFilesWithRipgrep(params) {
|
|
|
5188
5189
|
if (result.exitCode !== 0 && result.exitCode !== 1) {
|
|
5189
5190
|
const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
|
|
5190
5191
|
if (/error parsing glob/i.test(detail)) throw new ToolInputError(`Invalid glob: ${params.glob ?? ""}`, { cause: new Error(detail) });
|
|
5191
|
-
if (/regex parse error|error parsing regex/i.test(detail)) throw new ToolInputError(`Invalid regex pattern: ${params.pattern}`, { cause: new Error(detail) });
|
|
5192
|
+
if (/regex parse error|error parsing regex|is not allowed in a regex/i.test(detail)) throw new ToolInputError(`Invalid regex pattern: ${params.pattern}`, { cause: new Error(detail) });
|
|
5192
5193
|
throw new Error(`ripgrep search failed: ${detail}`);
|
|
5193
5194
|
}
|
|
5194
5195
|
const recordsByPath = /* @__PURE__ */ new Map();
|
|
@@ -6823,13 +6824,16 @@ var McpToolManager = class {
|
|
|
6823
6824
|
providerContent,
|
|
6824
6825
|
...result.structuredContent !== void 0 ? { structuredContent: result.structuredContent } : void 0
|
|
6825
6826
|
};
|
|
6826
|
-
await this.options.onToolSuccess?.({
|
|
6827
|
+
const cards = await this.options.onToolSuccess?.({
|
|
6827
6828
|
arguments: resolvedArgs,
|
|
6828
6829
|
provider: plugin.manifest.name,
|
|
6829
6830
|
...result.structuredContent !== void 0 ? { structuredContent: result.structuredContent } : void 0,
|
|
6830
6831
|
toolName: tool.name
|
|
6831
6832
|
});
|
|
6832
|
-
return
|
|
6833
|
+
return cards?.length ? {
|
|
6834
|
+
...successResult,
|
|
6835
|
+
cards
|
|
6836
|
+
} : successResult;
|
|
6833
6837
|
} catch (error) {
|
|
6834
6838
|
if (error instanceof McpAuthorizationRequiredError && await this.handleAuthorizationRequired(plugin.manifest.name, error)) {
|
|
6835
6839
|
const parkedContent = [{
|
|
@@ -7147,6 +7151,7 @@ function createCallMcpToolTool(mcpToolManager) {
|
|
|
7147
7151
|
}
|
|
7148
7152
|
};
|
|
7149
7153
|
},
|
|
7154
|
+
outputSchema: z.object({ objectCards: z.array(ownedObjectAnnotationSchema) }),
|
|
7150
7155
|
execute: async (input, options) => {
|
|
7151
7156
|
const { tool_name } = input;
|
|
7152
7157
|
const provider = parseMcpProviderFromToolName(tool_name);
|
|
@@ -7166,10 +7171,14 @@ function createCallMcpToolTool(mcpToolManager) {
|
|
|
7166
7171
|
});
|
|
7167
7172
|
throw new McpToolError(missingToolMessage(tool_name, provider));
|
|
7168
7173
|
}
|
|
7169
|
-
|
|
7174
|
+
const result = await mcpTool.execute(resolveMcpArguments(input), {
|
|
7170
7175
|
conversationPrivacy: options?.conversationPrivacy ?? "private",
|
|
7171
7176
|
...options?.toolCallId ? { toolCallId: options.toolCallId } : void 0
|
|
7172
|
-
})
|
|
7177
|
+
});
|
|
7178
|
+
return {
|
|
7179
|
+
content: result.content,
|
|
7180
|
+
details: { objectCards: result.cards ?? [] }
|
|
7181
|
+
};
|
|
7173
7182
|
}
|
|
7174
7183
|
});
|
|
7175
7184
|
}
|
|
@@ -7899,7 +7908,7 @@ function createEventAutomationTool(context, catalog) {
|
|
|
7899
7908
|
readOnlyHint: false
|
|
7900
7909
|
},
|
|
7901
7910
|
executionMode: "sequential",
|
|
7902
|
-
description: "Create a durable event automation
|
|
7911
|
+
description: "Create a durable event automation in the active Slack channel or DM, never a thread. It executes the supplied instruction for every matching event. Use for whenever-this-happens-do-X automation; ordinary watch, notify, or tell-me-when requests use watchEvents instead. The automation may use the creator's connected credentials. Prefer a subscribable tool result when available.",
|
|
7903
7912
|
inputSchema: z.object({
|
|
7904
7913
|
instruction: z.string().trim().min(1).max(4e3),
|
|
7905
7914
|
title: z.string().trim().min(1).max(60).nullable().describe("Optional short display title. Omit or use null to generate one from the task instruction.").optional(),
|
|
@@ -7927,7 +7936,7 @@ function createEventAutomationTool(context, catalog) {
|
|
|
7927
7936
|
const existing = await getEventAutomation(db, id);
|
|
7928
7937
|
if (existing) {
|
|
7929
7938
|
if (!eventAutomationMatchesDestination(existing, destination) || existing.createdBy.slackUserId !== actor.userId) throw new ToolInputError("Event automation operation identity is invalid.");
|
|
7930
|
-
if (existing.status !== "deleted") return eventAutomationToolResult(existing, catalog, actor.userId);
|
|
7939
|
+
if (existing.status !== "deleted") return eventAutomationToolResult(context.conversationId, existing, catalog, actor.userId);
|
|
7931
7940
|
}
|
|
7932
7941
|
const title = await resolveTaskTitle({
|
|
7933
7942
|
completeText,
|
|
@@ -7957,7 +7966,7 @@ function createEventAutomationTool(context, catalog) {
|
|
|
7957
7966
|
...match ? { match } : void 0
|
|
7958
7967
|
}
|
|
7959
7968
|
};
|
|
7960
|
-
return eventAutomationToolResult(await createEventAutomation(db, task), catalog, actor.userId);
|
|
7969
|
+
return eventAutomationToolResult(context.conversationId, await createEventAutomation(db, task), catalog, actor.userId);
|
|
7961
7970
|
}
|
|
7962
7971
|
});
|
|
7963
7972
|
}
|
|
@@ -7976,13 +7985,24 @@ function createDeleteEventAutomationTool(context, catalog) {
|
|
|
7976
7985
|
executionMode: "sequential",
|
|
7977
7986
|
description: "Delete an event automation.",
|
|
7978
7987
|
inputSchema: z.object({ automationId: z.string().min(1) }).strict(),
|
|
7979
|
-
outputSchema: eventAutomationToolResultSchema,
|
|
7988
|
+
outputSchema: eventAutomationToolResultSchema.omit({ objectCards: true }).extend({ removedCards: z.array(messageCardRefSchema) }),
|
|
7980
7989
|
async execute({ automationId }) {
|
|
7981
7990
|
const { actor } = requireEventAutomationSlackContext(context);
|
|
7982
7991
|
const current = await writableEventAutomation(context, automationId);
|
|
7983
7992
|
const deleted = await deleteEventAutomation(getDb(), current.id);
|
|
7984
7993
|
if (!deleted) throw new ToolInputError("Event automation was not found.");
|
|
7985
|
-
|
|
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
|
+
};
|
|
7986
8006
|
}
|
|
7987
8007
|
});
|
|
7988
8008
|
}
|
|
@@ -8087,7 +8107,7 @@ function createUpdateEventAutomationTool(context, catalog) {
|
|
|
8087
8107
|
}
|
|
8088
8108
|
const saved = await saveEventAutomation(getDb(), next);
|
|
8089
8109
|
if (!saved) throw new ToolInputError("Event automation was not found.");
|
|
8090
|
-
return eventAutomationToolResult(saved, catalog, actor.userId);
|
|
8110
|
+
return eventAutomationToolResult(context.conversationId, saved, catalog, actor.userId);
|
|
8091
8111
|
}
|
|
8092
8112
|
});
|
|
8093
8113
|
}
|
|
@@ -8671,7 +8691,10 @@ const compactTaskResultSchema = z.object({
|
|
|
8671
8691
|
lastRunAt: z.string().nullable(),
|
|
8672
8692
|
runNowAt: z.string().nullable()
|
|
8673
8693
|
}).strict();
|
|
8674
|
-
const scheduleAutomationToolResultSchema = juniorToolOutputSchema.extend({
|
|
8694
|
+
const scheduleAutomationToolResultSchema = juniorToolOutputSchema.extend({
|
|
8695
|
+
automation: compactTaskResultSchema,
|
|
8696
|
+
objectCards: z.array(ownedObjectAnnotationSchema).optional()
|
|
8697
|
+
}).strict();
|
|
8675
8698
|
const scheduleListToolResultSchema = juniorToolOutputSchema.extend({
|
|
8676
8699
|
automations: z.array(compactTaskResultSchema),
|
|
8677
8700
|
truncated: z.boolean()
|
|
@@ -8788,8 +8811,28 @@ function compactTask(task, requesterSlackUserId) {
|
|
|
8788
8811
|
});
|
|
8789
8812
|
}
|
|
8790
8813
|
/** Build the structured result shared by single-task scheduler tools. */
|
|
8791
|
-
function scheduleAutomationToolResult(task, requesterSlackUserId) {
|
|
8792
|
-
|
|
8814
|
+
async function scheduleAutomationToolResult(conversationId, task, requesterSlackUserId) {
|
|
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
|
+
};
|
|
8832
|
+
return {
|
|
8833
|
+
automation,
|
|
8834
|
+
objectCards: await saveObjectAnnotations(conversationId, "junior", [annotation])
|
|
8835
|
+
};
|
|
8793
8836
|
}
|
|
8794
8837
|
/** Build the structured result for listing scheduler tools. */
|
|
8795
8838
|
function scheduleListToolResult(args) {
|
|
@@ -8859,7 +8902,7 @@ function createSlackScheduleCreateAutomationTool(context) {
|
|
|
8859
8902
|
const existing = await readScheduledAutomation(db, id);
|
|
8860
8903
|
if (existing) {
|
|
8861
8904
|
if (!sameDestination(existing, destination) || existing.createdBy.slackUserId !== actor.slackUserId) throwToolInputError("Scheduled automation operation identity is invalid.");
|
|
8862
|
-
return scheduleAutomationToolResult(existing, actor.slackUserId);
|
|
8905
|
+
return scheduleAutomationToolResult(context.conversationId, existing, actor.slackUserId);
|
|
8863
8906
|
}
|
|
8864
8907
|
const identity = (await context.users.resolveActor())?.identity;
|
|
8865
8908
|
if (!identity || identity.provider !== "slack" || identity.providerTenantId !== destination.teamId || identity.providerSubjectId !== actor.slackUserId) throwToolInputError("Scheduled automation creator identity is unavailable.");
|
|
@@ -8902,7 +8945,7 @@ function createSlackScheduleCreateAutomationTool(context) {
|
|
|
8902
8945
|
const committed = await createScheduledAutomation(db, task);
|
|
8903
8946
|
if (!sameDestination(committed, destination) || committed.createdBy.slackUserId !== actor.slackUserId) throwToolInputError("Scheduled automation operation identity is invalid.");
|
|
8904
8947
|
logInfo("scheduled_automation.create.completed", scheduledAutomationAttributes(committed));
|
|
8905
|
-
return scheduleAutomationToolResult(committed, actor.slackUserId);
|
|
8948
|
+
return scheduleAutomationToolResult(context.conversationId, committed, actor.slackUserId);
|
|
8906
8949
|
}
|
|
8907
8950
|
});
|
|
8908
8951
|
}
|
|
@@ -8921,7 +8964,7 @@ function createSlackScheduleDeleteAutomationTool(context) {
|
|
|
8921
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.",
|
|
8922
8965
|
executionMode: "sequential",
|
|
8923
8966
|
inputSchema: z.object({ automationId: z.string().min(1).describe("ID of the task to delete. Must be from this active Slack conversation.") }),
|
|
8924
|
-
outputSchema: scheduleAutomationToolResultSchema,
|
|
8967
|
+
outputSchema: scheduleAutomationToolResultSchema.extend({ removedCards: z.array(messageCardRefSchema) }),
|
|
8925
8968
|
execute: async ({ automationId }) => {
|
|
8926
8969
|
const next = {
|
|
8927
8970
|
...await getWritableTask({
|
|
@@ -8934,7 +8977,18 @@ function createSlackScheduleDeleteAutomationTool(context) {
|
|
|
8934
8977
|
runNowAtMs: void 0
|
|
8935
8978
|
};
|
|
8936
8979
|
await saveScheduledAutomation(getDb(), next);
|
|
8937
|
-
|
|
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
|
+
};
|
|
8938
8992
|
}
|
|
8939
8993
|
});
|
|
8940
8994
|
}
|
|
@@ -9057,7 +9111,7 @@ function createSlackScheduleRunAutomationNowTool(context) {
|
|
|
9057
9111
|
runNowAtMs: nowMs
|
|
9058
9112
|
};
|
|
9059
9113
|
await saveScheduledAutomation(getDb(), next);
|
|
9060
|
-
return
|
|
9114
|
+
return { automation: compactTask(next, context.actor?.userId) };
|
|
9061
9115
|
}
|
|
9062
9116
|
});
|
|
9063
9117
|
}
|
|
@@ -9150,10 +9204,10 @@ function createSlackScheduleUpdateAutomationTool(context) {
|
|
|
9150
9204
|
if (title) next.title = title;
|
|
9151
9205
|
else delete next.title;
|
|
9152
9206
|
}
|
|
9153
|
-
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);
|
|
9154
9208
|
const committed = await saveScheduledAutomation(db, next);
|
|
9155
9209
|
if (changingDestination) logInfo("scheduled_automation.move.completed", scheduledAutomationAttributes(committed));
|
|
9156
|
-
return scheduleAutomationToolResult(committed, actor.slackUserId);
|
|
9210
|
+
return scheduleAutomationToolResult(context.conversationId, committed, actor.slackUserId);
|
|
9157
9211
|
}
|
|
9158
9212
|
});
|
|
9159
9213
|
}
|
|
@@ -9162,6 +9216,7 @@ function createSlackScheduleUpdateAutomationTool(context) {
|
|
|
9162
9216
|
function scheduledAutomationToolContext(context) {
|
|
9163
9217
|
if (context.source.kind !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack" || !context.resolveActorIdentity) return;
|
|
9164
9218
|
return {
|
|
9219
|
+
conversationId: context.conversationId,
|
|
9165
9220
|
actor: context.actor,
|
|
9166
9221
|
source: context.source,
|
|
9167
9222
|
users: { resolveActor: context.resolveActorIdentity },
|
|
@@ -16375,7 +16430,7 @@ async function wireAgentTools(args) {
|
|
|
16375
16430
|
authProviderFactory: mcpAuth.authProviderFactory,
|
|
16376
16431
|
onAuthorizationRequired: mcpAuth.onAuthorizationRequired,
|
|
16377
16432
|
onToolSuccess: async (input) => {
|
|
16378
|
-
await pluginHooks.afterMcpTool({
|
|
16433
|
+
return await pluginHooks.afterMcpTool({
|
|
16379
16434
|
...input,
|
|
16380
16435
|
conversationId: args.run.conversationId
|
|
16381
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-
|
|
3
|
-
import { C as withSpan, P as normalizeIdentityEmail, _ as setSpanAttributes, d as logInfo, f as logWarn, u as logException, v as setSpanStatus } from "./logging-
|
|
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-
|
|
6
|
-
import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-
|
|
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-
|
|
11
|
-
import {
|
|
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-
|
|
13
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
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,6 +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,
|
|
2058
|
+
...args.canExposePayload && (data.meta?.cards || data.meta?.objectCards) ? { cards: readMessageCards(data.meta) } : void 0,
|
|
2021
2059
|
...args.canExposePayload ? { text: data.text } : { redacted: true }
|
|
2022
2060
|
};
|
|
2023
2061
|
}
|
|
@@ -4466,7 +4504,7 @@ var PluginHookDeniedError = class extends Error {
|
|
|
4466
4504
|
};
|
|
4467
4505
|
let registeredPlugins = [];
|
|
4468
4506
|
const PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
4469
|
-
const
|
|
4507
|
+
const PLUGIN_TASK_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
|
|
4470
4508
|
const OPERATIONAL_REPORT_MAX_METRICS = 8;
|
|
4471
4509
|
const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
|
|
4472
4510
|
const OPERATIONAL_REPORT_MAX_CHART_SERIES = 8;
|
|
@@ -4645,7 +4683,7 @@ function validatePlugins(plugins) {
|
|
|
4645
4683
|
if (seen.has(name)) throw new Error(`Duplicate plugin name "${name}"`);
|
|
4646
4684
|
if (plugin.events !== void 0 && !pluginEventsSchema.safeParse(plugin.events).success) throw new Error(`Plugin "${name}" events is invalid`);
|
|
4647
4685
|
for (const [taskName, task] of Object.entries(plugin.tasks ?? {})) {
|
|
4648
|
-
if (!
|
|
4686
|
+
if (!PLUGIN_TASK_NAME_RE.test(taskName)) throw new Error(`Plugin task "${taskName}" from plugin "${name}" must be a camelCase identifier`);
|
|
4649
4687
|
if (typeof task.run !== "function") throw new Error(`Plugin task "${taskName}" from plugin "${name}" must define a run function`);
|
|
4650
4688
|
}
|
|
4651
4689
|
seen.add(name);
|
|
@@ -4884,7 +4922,6 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
4884
4922
|
const pluginTools = hook(pluginContext);
|
|
4885
4923
|
const namespace = pluginToolNamespace(pluginName);
|
|
4886
4924
|
for (const [localName, tool] of Object.entries(pluginTools)) {
|
|
4887
|
-
if (!PLUGIN_TOOL_NAME_RE.test(localName)) throw new Error(`Plugin tool "${localName}" from plugin "${pluginName}" must be a camelCase identifier`);
|
|
4888
4925
|
const name = `${namespace}_${localName}`;
|
|
4889
4926
|
if (tools[name]) throw new Error(`Duplicate plugin tool "${name}" from plugin "${pluginName}"`);
|
|
4890
4927
|
const definition = tool;
|
|
@@ -4905,7 +4942,12 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
4905
4942
|
description: plugin.manifest.description
|
|
4906
4943
|
};
|
|
4907
4944
|
definition.exposure ??= "deferred";
|
|
4908
|
-
|
|
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;
|
|
4909
4951
|
}
|
|
4910
4952
|
}
|
|
4911
4953
|
return tools;
|
|
@@ -5263,6 +5305,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5263
5305
|
const loaded = getPlugins();
|
|
5264
5306
|
return {
|
|
5265
5307
|
async afterMcpTool(tool) {
|
|
5308
|
+
const cards = [];
|
|
5266
5309
|
for (const plugin of loaded) {
|
|
5267
5310
|
if (plugin.manifest.name !== tool.provider) continue;
|
|
5268
5311
|
const hook = plugin.hooks?.afterMcpTool;
|
|
@@ -5273,7 +5316,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5273
5316
|
plugin: plugin.manifest.name
|
|
5274
5317
|
}) : void 0;
|
|
5275
5318
|
try {
|
|
5276
|
-
await hook({
|
|
5319
|
+
const result = await hook({
|
|
5277
5320
|
...basePluginContext(plugin),
|
|
5278
5321
|
...tool.conversationId ? { conversationId: tool.conversationId } : void 0,
|
|
5279
5322
|
...annotations ? { annotations } : void 0,
|
|
@@ -5283,6 +5326,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5283
5326
|
name: tool.toolName
|
|
5284
5327
|
}
|
|
5285
5328
|
});
|
|
5329
|
+
if (result && tool.conversationId) cards.push(...await saveObjectAnnotations(tool.conversationId, plugin.manifest.name, result.objectAnnotations));
|
|
5286
5330
|
} catch (error) {
|
|
5287
5331
|
logWarn("agent.plugin.after_mcp_tool.failed", {
|
|
5288
5332
|
"app.plugin.name": plugin.manifest.name,
|
|
@@ -5291,6 +5335,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5291
5335
|
});
|
|
5292
5336
|
}
|
|
5293
5337
|
}
|
|
5338
|
+
return cards;
|
|
5294
5339
|
},
|
|
5295
5340
|
async prepareWorkspace(sandbox, repos, signal) {
|
|
5296
5341
|
const preparers = new Set(loaded.filter((plugin) => plugin.hooks?.workspacePrepare).map((plugin) => plugin.manifest.name));
|
|
@@ -5392,4 +5437,4 @@ function createPluginHookRunner(input = {}) {
|
|
|
5392
5437
|
};
|
|
5393
5438
|
}
|
|
5394
5439
|
//#endregion
|
|
5395
|
-
export { resolveViewerUser as $,
|
|
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-
|
|
2
|
-
import { h as normalizeSlackEmojiName } from "./config-
|
|
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,
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
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";
|
|
@@ -125,6 +125,7 @@ async function postSlackMessage(input) {
|
|
|
125
125
|
unfurl_links: false,
|
|
126
126
|
unfurl_media: false,
|
|
127
127
|
...input.blocks?.length ? { blocks: input.blocks } : void 0,
|
|
128
|
+
...input.entities?.length ? { metadata: { entities: input.entities } } : void 0,
|
|
128
129
|
...threadTs ? { thread_ts: threadTs } : void 0
|
|
129
130
|
}), 3, {
|
|
130
131
|
action: "chat.postMessage",
|