@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
package/dist/app.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { $ as AuthorizationFlowDisabledError, B as recordFinishedTurnForAutomatedLimit, C as renderBlockText, D as getNextRunAtMs, E as scheduledAutomationRunAttributes, F as ingestEvent, G as clearSandboxEgressSignals, H as normalizeSandboxEgressTracePropagationDomains, I as EVENT_WAIT_MS, J as parseSandboxEgressCredentialToken, K as consumeSandboxEgressAuthRequiredSignal, L as isEventMailboxMetadata, P as processWorkspaceSnapshotJob, Q as isVisionImageMediaType, R as renderTaskInput, S as renderAttachmentText, T as logScheduledAutomationRunSkipped, U as shouldPropagateSandboxEgressTrace, V as resolveSandboxEgressProviderForHost, W as SANDBOX_EGRESS_PROXY_PATH, X as createUserTokenStore, Z as buildSteeringPiMessage, _ as readPublicArtifact, b as readAttachmentVisionSummary, c as deleteMcpStoredOAuthCredentials, et as shouldEmitDevAgentTrace, f as PluginCredentialFailureError, g as publicArtifactHeaders, m as latestProgressStatus, n as createContextCompactor, nt as setConfigDefaults, o as deleteMcpAuthSessionsForUserProvider, q as consumeSandboxEgressPermissionDeniedSignal, r as executeCredentialedEgressRequest, s as deleteMcpServerSessionId, t as executeAgentRun, tt as getConfigDefaults, v as unpublishedArtifactHeaders, w as listThreadReplies, x as recordSlackAttachment, z as maybePostAutomatedTurnLimitNotice } from "./agent-
|
|
2
|
-
import { b as isProviderRetryError, i as completeText, m as escapeXml, r as completeObject } from "./client-
|
|
3
|
-
import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, C as withSpan, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, F as isRecord$1, I as toOptionalNumber, L as toOptionalString, S as withLogContext, _ as setSpanAttributes, d as logInfo, f as logWarn, g as setSentryUser, l as logError, n as createChatSdkLogger, o as getActiveTraceId, r as createRequestContext, t as buildTurnFailureResponse, u as logException, v as setSpanStatus, x as withContext, y as setTags } from "./logging-
|
|
1
|
+
import { $ as AuthorizationFlowDisabledError, B as recordFinishedTurnForAutomatedLimit, C as renderBlockText, D as getNextRunAtMs, E as scheduledAutomationRunAttributes, F as ingestEvent, G as clearSandboxEgressSignals, H as normalizeSandboxEgressTracePropagationDomains, I as EVENT_WAIT_MS, J as parseSandboxEgressCredentialToken, K as consumeSandboxEgressAuthRequiredSignal, L as isEventMailboxMetadata, P as processWorkspaceSnapshotJob, Q as isVisionImageMediaType, R as renderTaskInput, S as renderAttachmentText, T as logScheduledAutomationRunSkipped, U as shouldPropagateSandboxEgressTrace, V as resolveSandboxEgressProviderForHost, W as SANDBOX_EGRESS_PROXY_PATH, X as createUserTokenStore, Z as buildSteeringPiMessage, _ as readPublicArtifact, b as readAttachmentVisionSummary, c as deleteMcpStoredOAuthCredentials, et as shouldEmitDevAgentTrace, f as PluginCredentialFailureError, g as publicArtifactHeaders, m as latestProgressStatus, n as createContextCompactor, nt as setConfigDefaults, o as deleteMcpAuthSessionsForUserProvider, q as consumeSandboxEgressPermissionDeniedSignal, r as executeCredentialedEgressRequest, s as deleteMcpServerSessionId, t as executeAgentRun, tt as getConfigDefaults, v as unpublishedArtifactHeaders, w as listThreadReplies, x as recordSlackAttachment, z as maybePostAutomatedTurnLimitNotice } from "./agent-Bzbf92vv.js";
|
|
2
|
+
import { b as isProviderRetryError, i as completeText, m as escapeXml, r as completeObject } from "./client-DjC6-6iU.js";
|
|
3
|
+
import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, C as withSpan, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, F as isRecord$1, I as toOptionalNumber, L as toOptionalString, S as withLogContext, _ as setSpanAttributes, d as logInfo, f as logWarn, g as setSentryUser, l as logError, n as createChatSdkLogger, o as getActiveTraceId, r as createRequestContext, t as buildTurnFailureResponse, u as logException, v as setSpanStatus, x as withContext, y as setTags } from "./logging-DiN3o3nB.js";
|
|
4
4
|
import { r as continueTrace } from "./sentry-CgWZM_kV.js";
|
|
5
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
6
|
-
import { a as getChatConfig, c as getSlackClientId, d as getSlackSigningSecret, f as setBotModelConfig, i as configureFunctionMaxDurationSeconds, l as getSlackClientSecret, m as setSlackReactionConfig, n as botConfig, p as setProfiles, s as getSlackBotToken, u as getSlackReactionConfig } from "./config-
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-_ZQFlslB.js";
|
|
6
|
+
import { a as getChatConfig, c as getSlackClientId, d as getSlackSigningSecret, f as setBotModelConfig, i as configureFunctionMaxDurationSeconds, l as getSlackClientSecret, m as setSlackReactionConfig, n as botConfig, p as setProfiles, s as getSlackBotToken, u as getSlackReactionConfig } from "./config-CtoUVs72.js";
|
|
7
7
|
import { a as modelIdForProfile, n as defaultModelId } from "./model-profile-CZmVoGdX.js";
|
|
8
8
|
import { _ as parseSlackMessageTs, a as createActor, c as isActorUserId, o as createSlackActor, p as parseSlackChannelId, s as createSlackResumeActor, t as credentialContextForActor, u as parseActorUserId } from "./context-Bplcgypl.js";
|
|
9
|
-
import { B as downloadPrivateSlackFile, F as bindSlackDirectCredentialSubject, G as isDmChannel,
|
|
9
|
+
import { B as downloadPrivateSlackFile, F as bindSlackDirectCredentialSubject, G as isDmChannel, I as verifyEventAutomationCredentialSubject, Jt as getSqlExecutor, K as normalizeSlackConversationId, Kt as getConversationStore, L as verifyScheduledAutomationCredentialSubject, Lt as listConversationAnnotations, N as bindEventAutomationCredentialSubject, P as bindScheduledAutomationCredentialSubject, Pt as resolveRootVisibility, Q as readActorIdentity, Qt as withConversationMutationLock, R as verifySlackDirectCredentialSubject, U as getSlackClient, Wt as getConversationEventStore, X as runWithWorkspaceTeamId, Xt as withConversationEventLock, Y as getWorkspaceTeamId, _t as createPluginState, a as getPluginRoutes, bt as createPluginLogger, cn as deleteProviderIdentityForSlackUser, ct as collectEventMatchKeys, d as setPlugins, dn as createSlackDestination, dt as findMatchingWatches, f as validatePlugins, gt as setDashboardConversationLinkOptions, h as setBriefsConfig, ht as getDashboardTaskLink, i as getPluginApiRoutes, mt as getDashboardConversationLink, ot as cancelSubscriptions, pn as requireSlackDestination, pt as JUNIOR_THREAD_STATE_TTL_MS, q as runWithSlackInstallationToken, qt as getDb, u as getPlugins, xt as readConversationAccessFromSql, z as SlackActionError } from "./agent-hooks-DZU5nsd1.js";
|
|
10
10
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
11
|
-
import { E as juniorConversations, a as juniorSchedulerRuns, f as juniorAgentBindings, g as juniorConversationBriefs, o as juniorSchedulerTasks, p as juniorAgentInvocations, y as juniorConversationEvents } from "./executor-
|
|
12
|
-
import {
|
|
13
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
14
|
-
import { $ as resolveConversationTitle, F as loadProjection, G as recordSubscribedReplyRoute, J as appendConversationMessages, M as commitMessages, P as loadConversationProjection, Q as persistConversationMessageSummaries, X as persistConversationMessages, Y as hydrateConversationMessages, Z as projectConversationMessages, a as completeTurnRecord, at as isHumanConversationMessage, c as getTurnRecordForResume, ct as recordDeliveredAssistantMessage, d as persistWithRetry, dt as estimateTextTokens, et as appendThreadContextMessages, i as abandonTurnRecord, it as getConversationMessageSlackTs, j as commitAcceptedReply, k as trimTrailingAssistantMessages, l as listTurnSummaries, lt as turnHasReply, m as buildTurnErrorResponse, n as loadTurnCheckpoint, nt as createConversationMemoryService, o as failTurnRecord, ot as markConversationMessage, r as saveTurnCheckpoint, rt as estimateConversationContextTokens, s as getTurnRecord, st as normalizeConversationText, tt as buildConversationContext, u as recordTurnSummary, ut as upsertConversationMessage } from "./checkpoint-
|
|
15
|
-
import { E as acquireActiveLock, O as withActiveLock, T as MUTATION_LOCK_TTL_MS$1, k as withLock$1, w as getStateAdapter } from "./profile-
|
|
16
|
-
import { Bt as hasRunnableConversationWork$1, Dt as hasRunnableConversationWork, Et as getConversationWorkState, F as effectiveTaskOutcomes, Ht as isInvalidConversationRecordError, It as stopConversationWork, Kt as buildDeterministicAssistantMessageId, Mt as removeActiveConversation, Ot as listActiveConversationIds, Pt as requestConversationWork, Rt as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as withScheduledAutomationLock, Tt as getConversation, U as findMatchingEventAutomations, X as getEventCatalog, a as requestAttachmentDeletion, b as saveScheduledAutomationInLock, c as parseSlackThreadId, g as listScheduledAutomationsForTeam, h as listScheduledAutomations, o as storeAttachment, pt as appendAndEnqueueInboundMessage, qt as buildDeterministicTurnId, r as collectAttachmentGarbage, tt as eventGuidance, v as readScheduledAutomation, vt as clearExpiredConversationLease, w as scheduledRunSchema, wt as ensureConversationWake, x as scheduledRunId, z as collectEventAutomationMatchKeys } from "./stats-
|
|
17
|
-
import { S as startActiveTurn, _ as isTurnInputCommitLostError, b as markTurnCompleted, d as ConversationTurnBoundaryError, f as CooperativeTurnYieldError, g as isCooperativeTurnYieldError, h as getConversationTurnBoundaryError, m as TurnInputDeferredError, p as TurnInputCommitLostError, r as clearPendingAuth, s as getAssistantReplyText, v as isTurnInputDeferredError, x as markTurnFailed, y as markTurnClosed } from "./pending-auth-
|
|
18
|
-
import { h as postSlackMessage, i as formatProviderLabel, s as startOAuthFlow, t as createAgentRunner, v as RetryableDeliveryError } from "./agent-runner-
|
|
19
|
-
import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-
|
|
20
|
-
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-
|
|
11
|
+
import { E as juniorConversations, a as juniorSchedulerRuns, f as juniorAgentBindings, g as juniorConversationBriefs, o as juniorSchedulerTasks, p as juniorAgentInvocations, y as juniorConversationEvents } from "./executor-AOhG9X1t.js";
|
|
12
|
+
import { Y as instructionProvenanceFor, k as annotationCard } from "./conversation-1HUoZr2l.js";
|
|
13
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
|
|
14
|
+
import { $ as resolveConversationTitle, F as loadProjection, G as recordSubscribedReplyRoute, J as appendConversationMessages, M as commitMessages, P as loadConversationProjection, Q as persistConversationMessageSummaries, X as persistConversationMessages, Y as hydrateConversationMessages, Z as projectConversationMessages, a as completeTurnRecord, at as isHumanConversationMessage, c as getTurnRecordForResume, ct as recordDeliveredAssistantMessage, d as persistWithRetry, dt as estimateTextTokens, et as appendThreadContextMessages, i as abandonTurnRecord, it as getConversationMessageSlackTs, j as commitAcceptedReply, k as trimTrailingAssistantMessages, l as listTurnSummaries, lt as turnHasReply, m as buildTurnErrorResponse, n as loadTurnCheckpoint, nt as createConversationMemoryService, o as failTurnRecord, ot as markConversationMessage, r as saveTurnCheckpoint, rt as estimateConversationContextTokens, s as getTurnRecord, st as normalizeConversationText, tt as buildConversationContext, u as recordTurnSummary, ut as upsertConversationMessage } from "./checkpoint-Deu-OVb3.js";
|
|
15
|
+
import { E as acquireActiveLock, O as withActiveLock, T as MUTATION_LOCK_TTL_MS$1, k as withLock$1, w as getStateAdapter } from "./profile-BsNrw8lj.js";
|
|
16
|
+
import { Bt as hasRunnableConversationWork$1, Dt as hasRunnableConversationWork, Et as getConversationWorkState, F as effectiveTaskOutcomes, Ht as isInvalidConversationRecordError, It as stopConversationWork, Kt as buildDeterministicAssistantMessageId, Mt as removeActiveConversation, Ot as listActiveConversationIds, Pt as requestConversationWork, Rt as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as withScheduledAutomationLock, Tt as getConversation, U as findMatchingEventAutomations, X as getEventCatalog, a as requestAttachmentDeletion, b as saveScheduledAutomationInLock, c as parseSlackThreadId, g as listScheduledAutomationsForTeam, h as listScheduledAutomations, o as storeAttachment, pt as appendAndEnqueueInboundMessage, qt as buildDeterministicTurnId, r as collectAttachmentGarbage, tt as eventGuidance, v as readScheduledAutomation, vt as clearExpiredConversationLease, w as scheduledRunSchema, wt as ensureConversationWake, x as scheduledRunId, z as collectEventAutomationMatchKeys } from "./stats-pNGp3G5q.js";
|
|
17
|
+
import { S as startActiveTurn, _ as isTurnInputCommitLostError, b as markTurnCompleted, d as ConversationTurnBoundaryError, f as CooperativeTurnYieldError, g as isCooperativeTurnYieldError, h as getConversationTurnBoundaryError, m as TurnInputDeferredError, p as TurnInputCommitLostError, r as clearPendingAuth, s as getAssistantReplyText, v as isTurnInputDeferredError, x as markTurnFailed, y as markTurnClosed } from "./pending-auth-D7vmttn_.js";
|
|
18
|
+
import { h as postSlackMessage, i as formatProviderLabel, s as startOAuthFlow, t as createAgentRunner, v as RetryableDeliveryError } from "./agent-runner-2VQ9WhkG.js";
|
|
19
|
+
import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-90miy8VV.js";
|
|
20
|
+
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-B38CpJe2.js";
|
|
21
21
|
import { l as conversationQueueMessageSchema, n as resolveConversationWorkQueueTopic, r as verifyConversationQueueMessage, t as getVercelConversationWorkQueue, u as isConversationQueueMessageRejectedError } from "./vercel-queue-DIkVcfK4.js";
|
|
22
|
-
import { a as getTurnRequestDeadline, i as verifyWorkspaceSnapshotJobMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
22
|
+
import { a as getTurnRequestDeadline, i as verifyWorkspaceSnapshotJobMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CNd9cpIy.js";
|
|
23
23
|
import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-CIXf7Uye.js";
|
|
24
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
24
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-D5CIslEu.js";
|
|
25
25
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
|
|
26
|
-
import {
|
|
27
|
-
import { u as recordAutomationExecution } from "./execution-stats-
|
|
28
|
-
import { _ as markDispatchCompleted, a as claimDispatchMailboxAppend, c as getDispatchConversationId, d as getDispatchTurnId, f as getPluginDispatchProjection, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as resolveTurnSessionRouting, l as getDispatchInputMessageId, m as listPendingDispatchMailboxAppends, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, p as isTerminalDispatchStatus, s as createOrGetDispatch, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./task-runner-
|
|
29
|
-
import { i as resolveAgentInvocationId, o as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-
|
|
30
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
31
|
-
import { n as executeTurn, t as AgentRunError } from "./turn-execution-
|
|
32
|
-
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-
|
|
33
|
-
import { a as requireTurnFailureEventId, d as
|
|
34
|
-
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-
|
|
35
|
-
import { C as isSlackTitlePermissionError, D as createSlackAdapterAssistantStatusSession, E as
|
|
36
|
-
import { n as deleteWebAuthorization, t as createWebAuthorization } from "./web-authorization-
|
|
37
|
-
import { t as processConversationWork } from "./worker-
|
|
38
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
26
|
+
import { S as GET$3, _ as readViewerAutomationSummary, a as webActorFromEmail, b as legacyWebMailboxMetadataSchema, i as recordWebConversationActivity, l as resolveSlackChannelTypeFromMessage, n as conversationTurnIdForMessage, o as resolveConversationDestination, s as conversationVisibilityFromSlackChannelType, t as appendAndEnqueueWebMessage, u as resolveSlackConversationContext, x as createVercelAttachmentStorage, y as lookupSlackUser } from "./web-input-BJpWm6go.js";
|
|
27
|
+
import { u as recordAutomationExecution } from "./execution-stats-CrXs9vSH.js";
|
|
28
|
+
import { _ as markDispatchCompleted, a as claimDispatchMailboxAppend, c as getDispatchConversationId, d as getDispatchTurnId, f as getPluginDispatchProjection, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as resolveTurnSessionRouting, l as getDispatchInputMessageId, m as listPendingDispatchMailboxAppends, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, p as isTerminalDispatchStatus, s as createOrGetDispatch, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./task-runner-DI1FBJFJ.js";
|
|
29
|
+
import { i as resolveAgentInvocationId, o as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation, t as createAgentInvocationWorker } from "./work-DvIlJR3C.js";
|
|
30
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-Bjf6y2GO.js";
|
|
31
|
+
import { n as executeTurn, t as AgentRunError } from "./turn-execution-BNOXrZ-M.js";
|
|
32
|
+
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-DXgxOYpZ.js";
|
|
33
|
+
import { a as requireTurnFailureEventId, c as getTurnUserMessage, d as getTurnUserSlackMessageTs, f as buildDeliveredTurnStatePatch, i as getAgentTurnDiagnosticsAttributes, n as persistAuthPauseTurnState, r as finalizeFailedTurnReplyWithEvent, s as loadPendingMessageCards, t as completeAuthPauseTurn, u as getTurnUserReplyAttachmentContext } from "./auth-pause-state-Bn2vX4PA.js";
|
|
34
|
+
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-Cy9y1foT.js";
|
|
35
|
+
import { C as isSlackTitlePermissionError, D as createSlackAdapterAssistantStatusSession, E as renderSlackObjectCard, S as isRetryableSlackPostError, T as buildSlackOutputMessage, _ as getThreadId, a as GET$4, b as getSlackApiErrorCode, c as wakePausedTurn, d as shouldKeepProcessingReactionForToolInvocation, f as startProcessingReaction, g as getRunId, h as getMessageTs, i as publishAppHomeView, l as resumeSlackTurn, m as getChannelId, o as createPausedTurns, p as getAssistantThreadContext, r as GET$5, s as getPausedTurnRequest, t as receiveLocalOAuthCredential, u as buildAuthPauseResponse, v as getThreadTs, w as sendSlackReply, x as getSlackErrorObservabilityAttributes, y as stripLeadingBotMention } from "./credential-sync-CKdXEUDO.js";
|
|
36
|
+
import { n as deleteWebAuthorization, t as createWebAuthorization } from "./web-authorization-6mmfS_o-.js";
|
|
37
|
+
import { t as processConversationWork } from "./worker-D1qidg-Y.js";
|
|
38
|
+
import { t as bindSpawnAgent } from "./spawn-DzXc_PKO.js";
|
|
39
39
|
import { createRequire } from "node:module";
|
|
40
40
|
import { pathToFileURL } from "node:url";
|
|
41
41
|
import { Hono } from "hono";
|
|
@@ -1920,6 +1920,85 @@ async function GET(request) {
|
|
|
1920
1920
|
});
|
|
1921
1921
|
}
|
|
1922
1922
|
//#endregion
|
|
1923
|
+
//#region src/chat/slack/annotation-details.ts
|
|
1924
|
+
const eventSchema$1 = z.object({
|
|
1925
|
+
trigger_id: z.string().min(1),
|
|
1926
|
+
user: z.string().min(1),
|
|
1927
|
+
external_ref: z.object({
|
|
1928
|
+
type: z.literal("annotation"),
|
|
1929
|
+
id: z.string().max(4096)
|
|
1930
|
+
})
|
|
1931
|
+
});
|
|
1932
|
+
const refSchema = z.tuple([
|
|
1933
|
+
z.string().min(1),
|
|
1934
|
+
z.string().min(1),
|
|
1935
|
+
z.string().min(1)
|
|
1936
|
+
]);
|
|
1937
|
+
/** Show saved annotation facts only to a viewer who can read their Conversation. */
|
|
1938
|
+
async function presentSlackAnnotationDetails(event, teamId) {
|
|
1939
|
+
const triggerId = event.trigger_id;
|
|
1940
|
+
if (typeof triggerId !== "string" || !triggerId) return;
|
|
1941
|
+
const client = getSlackClient();
|
|
1942
|
+
const missing = () => client.entity.presentDetails({
|
|
1943
|
+
trigger_id: triggerId,
|
|
1944
|
+
error: { status: "not_found" }
|
|
1945
|
+
});
|
|
1946
|
+
const parsed = eventSchema$1.safeParse(event);
|
|
1947
|
+
if (!parsed.success || !teamId) {
|
|
1948
|
+
await missing();
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
let value;
|
|
1952
|
+
try {
|
|
1953
|
+
value = JSON.parse(parsed.data.external_ref.id);
|
|
1954
|
+
} catch {
|
|
1955
|
+
await missing();
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
const ref = refSchema.safeParse(value);
|
|
1959
|
+
if (!ref.success) {
|
|
1960
|
+
await missing();
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
const [conversationId, plugin, key] = ref.data;
|
|
1964
|
+
const db = getDb();
|
|
1965
|
+
const identity = await readActorIdentity({
|
|
1966
|
+
platform: "slack",
|
|
1967
|
+
teamId,
|
|
1968
|
+
userId: parsed.data.user
|
|
1969
|
+
});
|
|
1970
|
+
if (!identity?.user) {
|
|
1971
|
+
await missing();
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
const [location] = await db.select({
|
|
1975
|
+
teamId: juniorDestinations.providerTenantId,
|
|
1976
|
+
provider: juniorDestinations.provider
|
|
1977
|
+
}).from(juniorConversations).innerJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).where(eq(juniorConversations.conversationId, conversationId));
|
|
1978
|
+
if (location?.provider !== "slack" || location.teamId !== teamId) {
|
|
1979
|
+
await missing();
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
if (!(await readConversationAccessFromSql(db, [conversationId], identity.user)).get(conversationId)?.canViewPrivateContent) {
|
|
1983
|
+
await missing();
|
|
1984
|
+
return;
|
|
1985
|
+
}
|
|
1986
|
+
const annotation = (await listConversationAnnotations(db, conversationId)).find((item) => item.plugin === plugin && item.key === key);
|
|
1987
|
+
if (!annotation) {
|
|
1988
|
+
await missing();
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
const entity = renderSlackObjectCard(annotationCard(annotation), conversationId).entity;
|
|
1992
|
+
if (!entity) {
|
|
1993
|
+
await missing();
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
await client.entity.presentDetails({
|
|
1997
|
+
trigger_id: parsed.data.trigger_id,
|
|
1998
|
+
metadata: entity
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
//#endregion
|
|
1923
2002
|
//#region src/chat/services/subscribed-reply-router-policy.ts
|
|
1924
2003
|
/**
|
|
1925
2004
|
* Passive subscribed-thread reply router policy.
|
|
@@ -2314,8 +2393,11 @@ function readRawBlocks(raw) {
|
|
|
2314
2393
|
return raw.blocks;
|
|
2315
2394
|
}
|
|
2316
2395
|
function renderTopLevelText(message) {
|
|
2396
|
+
const blocks = readRawBlocks(message.raw);
|
|
2397
|
+
const blockText = renderBlockText(blocks);
|
|
2398
|
+
if (Array.isArray(blocks) && blocks.some((block) => block?.type === "section") && blockText) return blockText;
|
|
2317
2399
|
if (message.formatted.children.length > 0) return stringifyMarkdown(message.formatted).trim();
|
|
2318
|
-
return message.text.trim() ||
|
|
2400
|
+
return message.text.trim() || blockText;
|
|
2319
2401
|
}
|
|
2320
2402
|
/** Parse the agent-visible content and attachment state of a Slack message. */
|
|
2321
2403
|
function parseContent(message) {
|
|
@@ -4567,6 +4649,108 @@ async function handleSlashCommand(event) {
|
|
|
4567
4649
|
else await handleUnlink(event, actorId, normalized);
|
|
4568
4650
|
}
|
|
4569
4651
|
//#endregion
|
|
4652
|
+
//#region src/chat/slack/automation-details.ts
|
|
4653
|
+
function textField(key, label, value) {
|
|
4654
|
+
return {
|
|
4655
|
+
key,
|
|
4656
|
+
label,
|
|
4657
|
+
type: "string",
|
|
4658
|
+
value
|
|
4659
|
+
};
|
|
4660
|
+
}
|
|
4661
|
+
function dateField(key, label, value, empty) {
|
|
4662
|
+
return value ? {
|
|
4663
|
+
key,
|
|
4664
|
+
label,
|
|
4665
|
+
type: "slack#/types/timestamp",
|
|
4666
|
+
value: Math.floor(Date.parse(value) / 1e3)
|
|
4667
|
+
} : textField(key, label, empty);
|
|
4668
|
+
}
|
|
4669
|
+
function renderAutomationDetails(automation) {
|
|
4670
|
+
const url = getDashboardTaskLink(automation.id);
|
|
4671
|
+
if (!url) return void 0;
|
|
4672
|
+
const fields = [textField("status", "Status", automation.kind === "scheduled" ? automation.status : automation.triggerAvailable ? "ready" : "unavailable"), {
|
|
4673
|
+
...textField("description", "Instruction", automation.instruction),
|
|
4674
|
+
format: "markdown",
|
|
4675
|
+
long: true
|
|
4676
|
+
}];
|
|
4677
|
+
if (automation.kind === "scheduled") fields.push({
|
|
4678
|
+
...textField("trigger", "Schedule", automation.schedule),
|
|
4679
|
+
long: true
|
|
4680
|
+
}, dateField("next_run", "Next run", automation.nextRunAt, "None"));
|
|
4681
|
+
else {
|
|
4682
|
+
fields.push(textField("source", "Source", automation.source), {
|
|
4683
|
+
...textField("resource", "Resource", automation.resource),
|
|
4684
|
+
long: true
|
|
4685
|
+
}, {
|
|
4686
|
+
...textField("events", "Events", automation.events.join(", ")),
|
|
4687
|
+
long: true
|
|
4688
|
+
});
|
|
4689
|
+
if (!automation.triggerAvailable) fields.push({
|
|
4690
|
+
...textField("warning", "Needs attention", "Trigger unavailable. This automation cannot receive events."),
|
|
4691
|
+
long: true
|
|
4692
|
+
});
|
|
4693
|
+
}
|
|
4694
|
+
const lastRun = dateField("last_run", "Last execution", automation.lastRunAt, "Never run");
|
|
4695
|
+
if (automation.lastRunAt && automation.lastConversationId) lastRun.link = getDashboardConversationLink(automation.lastConversationId);
|
|
4696
|
+
fields.push(textField("outcomes", "Outcomes", automation.outcomes.length === 0 ? "None (silent)" : `${automation.outcomes.length} message${automation.outcomes.length === 1 ? "" : "s"}`), textField("destination", "Destination", `${automation.destination.label} · ${automation.destination.visibility}`), textField("created_by", "Created by", automation.createdBy), dateField("date_created", "Created", automation.createdAt, "Unknown"), textField("executions", "Executions", `${automation.totalRuns} total · ${automation.runs[30]} in the last 30 days`), lastRun);
|
|
4697
|
+
return {
|
|
4698
|
+
entity_type: "slack#/entities/item",
|
|
4699
|
+
external_ref: {
|
|
4700
|
+
id: automation.id,
|
|
4701
|
+
type: "automation"
|
|
4702
|
+
},
|
|
4703
|
+
url,
|
|
4704
|
+
entity_payload: {
|
|
4705
|
+
attributes: {
|
|
4706
|
+
title: { text: automation.title },
|
|
4707
|
+
display_type: automation.kind === "scheduled" ? "Scheduled automation" : "Event automation"
|
|
4708
|
+
},
|
|
4709
|
+
custom_fields: fields
|
|
4710
|
+
}
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
const detailsEventSchema = z.object({
|
|
4714
|
+
trigger_id: z.string().min(1),
|
|
4715
|
+
user: z.string().min(1),
|
|
4716
|
+
external_ref: z.object({
|
|
4717
|
+
id: z.string().min(1),
|
|
4718
|
+
type: z.literal("automation")
|
|
4719
|
+
})
|
|
4720
|
+
});
|
|
4721
|
+
/** Answer a Work Object open or refresh with current, viewer-visible facts. */
|
|
4722
|
+
async function presentSlackAutomationDetails(event, teamId) {
|
|
4723
|
+
const parsed = detailsEventSchema.safeParse(event);
|
|
4724
|
+
const client = getSlackClient();
|
|
4725
|
+
const triggerId = event.trigger_id;
|
|
4726
|
+
if (typeof triggerId !== "string" || !triggerId) return;
|
|
4727
|
+
if (!parsed.success || !teamId) {
|
|
4728
|
+
await client.entity.presentDetails({
|
|
4729
|
+
trigger_id: triggerId,
|
|
4730
|
+
error: { status: "not_found" }
|
|
4731
|
+
});
|
|
4732
|
+
return;
|
|
4733
|
+
}
|
|
4734
|
+
const identity = await readActorIdentity({
|
|
4735
|
+
platform: "slack",
|
|
4736
|
+
teamId,
|
|
4737
|
+
userId: parsed.data.user
|
|
4738
|
+
});
|
|
4739
|
+
const automation = identity?.user ? await readViewerAutomationSummary(identity.user, parsed.data.external_ref.id) : void 0;
|
|
4740
|
+
const entity = automation ? renderAutomationDetails(automation) : void 0;
|
|
4741
|
+
if (!entity) {
|
|
4742
|
+
await client.entity.presentDetails({
|
|
4743
|
+
trigger_id: triggerId,
|
|
4744
|
+
error: { status: "not_found" }
|
|
4745
|
+
});
|
|
4746
|
+
return;
|
|
4747
|
+
}
|
|
4748
|
+
await client.entity.presentDetails({
|
|
4749
|
+
trigger_id: triggerId,
|
|
4750
|
+
metadata: entity
|
|
4751
|
+
});
|
|
4752
|
+
}
|
|
4753
|
+
//#endregion
|
|
4570
4754
|
//#region src/chat/ingress/slack-webhook.ts
|
|
4571
4755
|
function slackEventLogContext(event) {
|
|
4572
4756
|
const channelId = event?.channel?.trim() || void 0;
|
|
@@ -4749,7 +4933,7 @@ async function routeParsedMessage(args) {
|
|
|
4749
4933
|
const message = normalized.message;
|
|
4750
4934
|
const canonicalThreadId = normalized.threadId;
|
|
4751
4935
|
const botUserId = args.adapter.botUserId;
|
|
4752
|
-
const isMention = Boolean(botUserId && textMentionsBot(args.event.text ?? "", botUserId));
|
|
4936
|
+
const isMention = Boolean(botUserId && (textMentionsBot(args.event.text ?? "", botUserId) || args.event.blocks?.some((block) => block.type === "section" && block.text?.type === "mrkdwn" && textMentionsBot(block.text.text, botUserId))));
|
|
4753
4937
|
if (isMention) message.isMention = true;
|
|
4754
4938
|
const isDirectMessage = isDmEvent(args.event);
|
|
4755
4939
|
const isSubscribed = !isDirectMessage && !isMention && await args.state.isSubscribed(canonicalThreadId);
|
|
@@ -4858,6 +5042,12 @@ async function handleSlackEvent(args) {
|
|
|
4858
5042
|
});
|
|
4859
5043
|
return;
|
|
4860
5044
|
}
|
|
5045
|
+
if (event.type === "entity_details_requested") {
|
|
5046
|
+
const ref = event.external_ref;
|
|
5047
|
+
if (ref && typeof ref === "object" && "type" in ref && ref.type === "annotation") await presentSlackAnnotationDetails(event, installation.teamId);
|
|
5048
|
+
else await presentSlackAutomationDetails(event, installation.teamId);
|
|
5049
|
+
return;
|
|
5050
|
+
}
|
|
4861
5051
|
if (event.type === "app_home_opened" && event.user) {
|
|
4862
5052
|
await publishAppHomeViewBestEffort(event.user);
|
|
4863
5053
|
return;
|
|
@@ -5424,6 +5614,12 @@ async function saveSteeringMessages(args) {
|
|
|
5424
5614
|
//#endregion
|
|
5425
5615
|
//#region src/chat/providers/slack/turn.ts
|
|
5426
5616
|
/**
|
|
5617
|
+
* Add Slack behavior around one Turn.
|
|
5618
|
+
*
|
|
5619
|
+
* This module owns Slack status, delivery, and state.
|
|
5620
|
+
* It calls `executeTurn` to run and finish the Turn.
|
|
5621
|
+
*/
|
|
5622
|
+
/**
|
|
5427
5623
|
* Persist post-delivery Redis scratch with a short retry after durable SQL
|
|
5428
5624
|
* completion has succeeded.
|
|
5429
5625
|
*/
|
|
@@ -5804,6 +6000,7 @@ function createSlackTurn(deps) {
|
|
|
5804
6000
|
const text = typeof reply === "string" ? reply : getAssistantReplyText(reply);
|
|
5805
6001
|
if (!text?.trim()) return;
|
|
5806
6002
|
boundaryFailureCode = "delivery_failed";
|
|
6003
|
+
const cards = await loadPendingMessageCards(conversationId);
|
|
5807
6004
|
let slackMessageTs = [];
|
|
5808
6005
|
const messageDestinations = [];
|
|
5809
6006
|
await beforeFirstResponsePost();
|
|
@@ -5811,6 +6008,7 @@ function createSlackTurn(deps) {
|
|
|
5811
6008
|
const outcomes = options.execution?.dispatch?.outcomes;
|
|
5812
6009
|
if (outcomes) for (const outcome of outcomes) {
|
|
5813
6010
|
const messageIds = await sendSlackReply({
|
|
6011
|
+
cards,
|
|
5814
6012
|
channelId: outcome.destination.channelId,
|
|
5815
6013
|
conversationId,
|
|
5816
6014
|
replyAttribution: options.execution?.dispatch?.replyAttribution,
|
|
@@ -5823,9 +6021,10 @@ function createSlackTurn(deps) {
|
|
|
5823
6021
|
messageId
|
|
5824
6022
|
})));
|
|
5825
6023
|
}
|
|
5826
|
-
else
|
|
6024
|
+
else {
|
|
5827
6025
|
slackMessageTs = await sendSlackReply({
|
|
5828
|
-
|
|
6026
|
+
cards,
|
|
6027
|
+
channelId: destination.channelId,
|
|
5829
6028
|
conversationId,
|
|
5830
6029
|
replyAttribution: options.execution?.dispatch?.replyAttribution,
|
|
5831
6030
|
text,
|
|
@@ -5835,9 +6034,6 @@ function createSlackTurn(deps) {
|
|
|
5835
6034
|
destination,
|
|
5836
6035
|
messageId: threadTs ?? messageId
|
|
5837
6036
|
})));
|
|
5838
|
-
} else for (const part of splitSlackReplyText(text)) {
|
|
5839
|
-
const postedMessageTs = (await thread.post(buildSlackOutputMessage(part))).id;
|
|
5840
|
-
if (postedMessageTs) slackMessageTs.push(postedMessageTs);
|
|
5841
6037
|
}
|
|
5842
6038
|
} catch (error) {
|
|
5843
6039
|
if (isRetryableSlackPostError(error)) throw new RetryableDeliveryError(error);
|
|
@@ -5857,6 +6053,7 @@ function createSlackTurn(deps) {
|
|
|
5857
6053
|
acceptedDeliveryId = slackTs;
|
|
5858
6054
|
options.onTurnDeliveryAccepted?.(slackTs);
|
|
5859
6055
|
const recordedMessageId = recordDeliveredAssistantMessage({
|
|
6056
|
+
cards,
|
|
5860
6057
|
conversation: preparedState.conversation,
|
|
5861
6058
|
sessionId: turnId,
|
|
5862
6059
|
source: "slack",
|
|
@@ -7204,6 +7401,7 @@ async function runNextPausedTurnInContext(conversationId, options, runOptions) {
|
|
|
7204
7401
|
/** Store one assistant Message and its Agent history. */
|
|
7205
7402
|
async function commitAssistantMessage(args) {
|
|
7206
7403
|
const conversationMessageId = recordDeliveredAssistantMessage({
|
|
7404
|
+
cards: args.cards,
|
|
7207
7405
|
conversation: args.conversation,
|
|
7208
7406
|
sessionId: args.sessionId,
|
|
7209
7407
|
source: args.source,
|
|
@@ -7444,16 +7642,19 @@ function createConversationTurnWorker(agentRunner, deliverMessage) {
|
|
|
7444
7642
|
const replyText = typeof value === "string" ? value : getAssistantReplyText(value);
|
|
7445
7643
|
if (!replyText?.trim()) return;
|
|
7446
7644
|
failureCode = "delivery_failed";
|
|
7645
|
+
const cards = await loadPendingMessageCards(context.conversationId);
|
|
7447
7646
|
let deliveryResult;
|
|
7448
7647
|
if (deliverToProvider) {
|
|
7449
7648
|
if (!conversationLocation || !deliverMessage) throw new Error(`Conversation ${context.conversationId} cannot deliver to its Location`);
|
|
7450
7649
|
deliveryResult = await deliverMessage({
|
|
7650
|
+
cards,
|
|
7451
7651
|
conversationId: context.conversationId,
|
|
7452
7652
|
location: conversationLocation,
|
|
7453
7653
|
text: replyText
|
|
7454
7654
|
});
|
|
7455
7655
|
}
|
|
7456
7656
|
await commitAssistantMessage({
|
|
7657
|
+
cards,
|
|
7457
7658
|
...agentMessage ? { agentMessage } : void 0,
|
|
7458
7659
|
conversation,
|
|
7459
7660
|
conversationId: context.conversationId,
|
|
@@ -7687,7 +7888,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage) {
|
|
|
7687
7888
|
* Location after Event work supplies Delivery before the Run.
|
|
7688
7889
|
*/
|
|
7689
7890
|
function createSlackSystemTurnDelivery(args) {
|
|
7690
|
-
return async ({ conversationId, location, text }) => {
|
|
7891
|
+
return async ({ conversationId, location, text, cards }) => {
|
|
7691
7892
|
if (location.provider !== "slack") throw new Error(`Slack system Turn cannot deliver to ${location.provider} Location`);
|
|
7692
7893
|
let messageIds;
|
|
7693
7894
|
try {
|
|
@@ -7696,6 +7897,7 @@ function createSlackSystemTurnDelivery(args) {
|
|
|
7696
7897
|
installation: { teamId: location.teamId },
|
|
7697
7898
|
state: args.state,
|
|
7698
7899
|
task: async () => await sendSlackReply({
|
|
7900
|
+
cards,
|
|
7699
7901
|
channelId: location.channelId,
|
|
7700
7902
|
conversationId,
|
|
7701
7903
|
text,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-
|
|
2
|
-
import { t as buildTurnFailureResponse } from "./logging-
|
|
1
|
+
import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-DjC6-6iU.js";
|
|
2
|
+
import { F as isRecord, t as buildTurnFailureResponse } from "./logging-DiN3o3nB.js";
|
|
3
3
|
import { _ as parseSlackMessageTs } from "./context-Bplcgypl.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { Wt as getConversationEventStore } from "./agent-hooks-DZU5nsd1.js";
|
|
5
|
+
import { A as messageCardKey, N as readMessageCards, j as messageCardRefSchema } from "./conversation-1HUoZr2l.js";
|
|
6
|
+
import { Y as hydrateConversationMessages, ot as markConversationMessage } from "./checkpoint-Deu-OVb3.js";
|
|
7
|
+
import { qt as buildDeterministicTurnId } from "./stats-pNGp3G5q.js";
|
|
8
|
+
import { b as markTurnCompleted, r as clearPendingAuth, y as markTurnClosed } from "./pending-auth-D7vmttn_.js";
|
|
9
|
+
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DXgxOYpZ.js";
|
|
8
10
|
//#region src/chat/runtime/delivered-turn-state.ts
|
|
9
11
|
/** Build state after destination delivery or intentional no-reply completion. */
|
|
10
12
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -53,6 +55,38 @@ function getTurnUserReplyAttachmentContext(message) {
|
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
//#endregion
|
|
58
|
+
//#region src/chat/conversations/pending-cards.ts
|
|
59
|
+
/** Read undelivered card snapshots across resume and history replacement. */
|
|
60
|
+
async function loadPendingMessageCards(conversationId) {
|
|
61
|
+
const cards = /* @__PURE__ */ new Map();
|
|
62
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
63
|
+
let beforeSeq;
|
|
64
|
+
while (true) {
|
|
65
|
+
const page = await getConversationEventStore().query(conversationId, {
|
|
66
|
+
beforeSeq,
|
|
67
|
+
limit: 100,
|
|
68
|
+
types: [
|
|
69
|
+
"tool_result",
|
|
70
|
+
"message",
|
|
71
|
+
"turn_started"
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
for (const event of [...page.events].reverse()) {
|
|
75
|
+
const data = event.data;
|
|
76
|
+
if (data.type === "turn_started" || data.type === "message" && data.role === "assistant") return [...cards.values()].reverse();
|
|
77
|
+
if (data.type !== "tool_result" || data.isError || typeof data.toolName !== "string" || !isRecord(data.details)) continue;
|
|
78
|
+
if (data.details.timed_out === true) continue;
|
|
79
|
+
if (Array.isArray(data.details.removedCards)) for (const ref of messageCardRefSchema.array().parse(data.details.removedCards)) deleted.add(JSON.stringify([ref.plugin, ref.key]));
|
|
80
|
+
for (const card of readMessageCards(data.details)) {
|
|
81
|
+
const key = messageCardKey(card);
|
|
82
|
+
if (!deleted.has(key) && !cards.has(key)) cards.set(key, card);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!page.hasOlder || page.events.length === 0) return [...cards.values()].reverse();
|
|
86
|
+
beforeSeq = page.events[0].seq;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
56
90
|
//#region src/chat/interruption-marker.ts
|
|
57
91
|
const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
|
|
58
92
|
/** Return the marker added when a visible reply ended mid-execution. */
|
|
@@ -165,4 +199,4 @@ async function persistAuthPauseTurnState(args) {
|
|
|
165
199
|
await persistThreadStateById(args.threadStateId, { conversation });
|
|
166
200
|
}
|
|
167
201
|
//#endregion
|
|
168
|
-
export { requireTurnFailureEventId as a,
|
|
202
|
+
export { requireTurnFailureEventId as a, getTurnUserMessage as c, getTurnUserSlackMessageTs as d, buildDeliveredTurnStatePatch as f, getAgentTurnDiagnosticsAttributes as i, getTurnUserMessageId as l, persistAuthPauseTurnState as n, getInterruptionMarker as o, finalizeFailedTurnReplyWithEvent as r, loadPendingMessageCards as s, completeAuthPauseTurn as t, getTurnUserReplyAttachmentContext as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as completeObject } from "./client-
|
|
1
|
+
import { r as completeObject } from "./client-DjC6-6iU.js";
|
|
2
2
|
import { n as defaultModelId } from "./model-profile-CZmVoGdX.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
3
|
+
import { P as briefCodeChangeSchema, R as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-1HUoZr2l.js";
|
|
4
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-90miy8VV.js";
|
|
5
5
|
import { CLI_USAGE } from "./cli/run.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -179,11 +179,11 @@ function briefInputFromSnapshot(snapshot, throughIndex) {
|
|
|
179
179
|
const bounded = codeChangeAt(change, boundaryMs);
|
|
180
180
|
return bounded ? [bounded] : [];
|
|
181
181
|
}),
|
|
182
|
-
resources: (detail.annotations ?? []).
|
|
182
|
+
resources: (detail.annotations ?? []).flatMap((annotation) => annotation.url !== null && Date.parse(annotation.createdAt) <= boundaryMs ? [{
|
|
183
183
|
label: annotation.label,
|
|
184
184
|
url: annotation.url,
|
|
185
185
|
...annotation.status ? { status: annotation.status } : void 0
|
|
186
|
-
})
|
|
186
|
+
}] : [])
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
/** Return the last event index included in a conversation snapshot. */
|
|
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
|
|
|
269
269
|
* `DATABASE_URL` at import, and `briefs pull` must work with only a token.
|
|
270
270
|
*/
|
|
271
271
|
async function configuredDefaultModelId() {
|
|
272
|
-
const { botConfig } = await import("./config-
|
|
272
|
+
const { botConfig } = await import("./config-CtoUVs72.js").then((n) => n.r);
|
|
273
273
|
return defaultModelId(botConfig);
|
|
274
274
|
}
|
|
275
275
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-Dankt-Pl.js";
|
|
3
3
|
//#region src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { i as completeText, m as escapeXml, o as resolveGatewayModel, p as unwrapCurrentInstruction } from "./client-
|
|
2
|
-
import { _ as setSpanAttributes, f as logWarn, o as getActiveTraceId, t as buildTurnFailureResponse, u as logException } from "./logging-
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
1
|
+
import { i as completeText, m as escapeXml, o as resolveGatewayModel, p as unwrapCurrentInstruction } from "./client-DjC6-6iU.js";
|
|
2
|
+
import { _ as setSpanAttributes, f as logWarn, o as getActiveTraceId, t as buildTurnFailureResponse, u as logException } from "./logging-DiN3o3nB.js";
|
|
3
|
+
import { n as botConfig } from "./config-CtoUVs72.js";
|
|
4
4
|
import { _ as parseSlackMessageTs, f as toStoredSlackActor } from "./context-Bplcgypl.js";
|
|
5
|
-
import { Bt as
|
|
6
|
-
import {
|
|
7
|
-
import { n as generateShortTitle, t as fallbackShortTitle } from "./short-title-
|
|
8
|
-
import { A as sleep, D as fenceLock, T as MUTATION_LOCK_TTL_MS, k as withLock, w as getStateAdapter } from "./profile-
|
|
5
|
+
import { Bt as agentsInstructionsUpdatedEvent, Ht as authenticationUnlinkedEvent, Jt as getSqlExecutor, Kt as getConversationStore, Vt as authenticationLinkedEvent, Wt as getConversationEventStore, Xt as withConversationEventLock, Yt as createSqlConversationEventStore, Zt as sanitizePostgresJson, en as bindProviderConversation, nn as addAgentTurnUsage, zt as JUNIOR_NATIVE_EVENT_NAMESPACE } from "./agent-hooks-DZU5nsd1.js";
|
|
6
|
+
import { B as agentHistoryItemSchema, J as instructionActors, Y as instructionProvenanceFor, q as contextProvenance } from "./conversation-1HUoZr2l.js";
|
|
7
|
+
import { n as generateShortTitle, t as fallbackShortTitle } from "./short-title-BHd_jUFX.js";
|
|
8
|
+
import { A as sleep, D as fenceLock, T as MUTATION_LOCK_TTL_MS, k as withLock, w as getStateAdapter } from "./profile-BsNrw8lj.js";
|
|
9
9
|
import { isDeepStrictEqual } from "node:util";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
@@ -237,6 +237,8 @@ function recordDeliveredAssistantMessage(args) {
|
|
|
237
237
|
replied: true,
|
|
238
238
|
skippedReason: void 0
|
|
239
239
|
});
|
|
240
|
+
const cards = args.cards?.filter((card) => card.kind === "automation");
|
|
241
|
+
const objectCards = args.cards?.filter((card) => card.kind === "object");
|
|
240
242
|
upsertConversationMessage(args.conversation, {
|
|
241
243
|
id: messageId,
|
|
242
244
|
role: "assistant",
|
|
@@ -247,6 +249,8 @@ function recordDeliveredAssistantMessage(args) {
|
|
|
247
249
|
isBot: true
|
|
248
250
|
},
|
|
249
251
|
meta: {
|
|
252
|
+
...cards?.length ? { cards } : void 0,
|
|
253
|
+
...objectCards?.length ? { objectCards } : void 0,
|
|
250
254
|
replied: true,
|
|
251
255
|
...args.source ? { source: args.source } : void 0
|
|
252
256
|
}
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as executeAgentRun } from "../agent-
|
|
2
|
-
import { t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { t as executeAgentRun } from "../agent-Bzbf92vv.js";
|
|
2
|
+
import { t as createAgentRunner } from "../agent-runner-2VQ9WhkG.js";
|
|
3
3
|
import { t as loadAppPluginSet } from "../plugin-module-BKGOXca2.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -101,10 +101,10 @@ async function loadLocalPluginSet() {
|
|
|
101
101
|
async function configureLocalChatPlugins(pluginSet) {
|
|
102
102
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
103
103
|
import("../plugins-egKWjgue.js").then((n) => n.o),
|
|
104
|
-
import("../agent-hooks-
|
|
105
|
-
import("../catalog-runtime-
|
|
106
|
-
import("../validation-
|
|
107
|
-
import("../agent-hooks-
|
|
104
|
+
import("../agent-hooks-DZU5nsd1.js").then((n) => n.t),
|
|
105
|
+
import("../catalog-runtime-BthunUDD.js").then((n) => n.t),
|
|
106
|
+
import("../validation-D5CIslEu.js").then((n) => n.r),
|
|
107
|
+
import("../agent-hooks-DZU5nsd1.js").then((n) => n.Ut)
|
|
108
108
|
]);
|
|
109
109
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
110
110
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -156,16 +156,16 @@ async function prepareLocalChatRun(io, pluginSet) {
|
|
|
156
156
|
await configureLocalChatPlugins(pluginSet);
|
|
157
157
|
const { setExperimentalFeatures } = await import("../experimental-CIXf7Uye.js").then((n) => n.t);
|
|
158
158
|
setExperimentalFeatures({ subagents: true });
|
|
159
|
-
const { setBriefsConfig } = await import("../agent-hooks-
|
|
159
|
+
const { setBriefsConfig } = await import("../agent-hooks-DZU5nsd1.js").then((n) => n.m);
|
|
160
160
|
setBriefsConfig({ enabled: true });
|
|
161
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
162
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
161
|
+
const { runLocalAgentTurn } = await import("../runner-Ck5rEjCm.js");
|
|
162
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-Ca0VLUEw.js");
|
|
163
163
|
const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
|
|
164
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
165
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
166
|
-
const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-
|
|
164
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BOfFkvly.js");
|
|
165
|
+
const { bindSpawnAgent } = await import("../spawn-DzXc_PKO.js").then((n) => n.n);
|
|
166
|
+
const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-DvIlJR3C.js").then((n) => n.a);
|
|
167
167
|
const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
|
|
168
|
-
const { processConversationWork } = await import("../worker-
|
|
168
|
+
const { processConversationWork } = await import("../worker-D1qidg-Y.js").then((n) => n.n);
|
|
169
169
|
let agentRunner;
|
|
170
170
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
171
171
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as JUNIOR_HEARTBEAT_ROUTE, j as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
2
|
-
import { f as parseInlinePluginManifest, p as parsePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { E as JUNIOR_HEARTBEAT_ROUTE, j as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DiN3o3nB.js";
|
|
2
|
+
import { f as parseInlinePluginManifest, p as parsePluginManifest } from "../registry-Dankt-Pl.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-DbP4TDft.js";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs/promises";
|