@sentry/junior 0.252.0 → 0.253.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/{admin-C_-XEdym.js → admin-CZnlnlg9.js} +1 -1
  2. package/dist/{agent-hooks-DcoKnnxn.js → agent-hooks-CvcbAtJH.js} +8 -8
  3. package/dist/{agent-runner-B-7S_DCS.js → agent-runner-B4FMVbCs.js} +20 -20
  4. package/dist/api.js +21 -21
  5. package/dist/app.js +111 -82
  6. package/dist/{assistant-reply-DbPLvsnL.js → assistant-reply-BU05IECs.js} +1 -1
  7. package/dist/{briefs-D4SMqc-r.js → briefs-DyspoG90.js} +2 -2
  8. package/dist/{catalog-runtime-BQQiwwA7.js → catalog-runtime-Br8s-TYx.js} +1 -1
  9. package/dist/cli/chat.js +15 -15
  10. package/dist/cli/check.js +3 -3
  11. package/dist/cli/main.js +2 -2
  12. package/dist/cli/plugins.js +4 -4
  13. package/dist/cli/snapshot-create.js +3 -3
  14. package/dist/cli/upgrade.js +3 -3
  15. package/dist/{client-ROZeVjq0.js → client-CRVXpEWi.js} +2 -2
  16. package/dist/{config-DNNkxfGS.js → config-B7joRWt7.js} +2 -2
  17. package/dist/{connections-DJV6mLrH.js → connections-CGPYNw2B.js} +9 -9
  18. package/dist/{conversation-privacy-B19umzIL.js → conversation-privacy-0JuTT_OJ.js} +1 -1
  19. package/dist/{credential-sync-CEd2F5PS.js → credential-sync-C-k3fnY5.js} +14 -14
  20. package/dist/{executor-_4bdoCxe.js → executor-YL577nNt.js} +32 -4
  21. package/dist/{images-BAN7DHuO.js → images-DopOctPc.js} +2 -2
  22. package/dist/instrumentation.js +2 -2
  23. package/dist/{job-queue-DSQx1qFY.js → job-queue-CIhKXUE3.js} +1 -1
  24. package/dist/{logging-COUsTFIL.js → logging-B0QxCh3D.js} +1 -1
  25. package/dist/{message-CtDDEwwV.js → message-DQvor8lM.js} +3 -3
  26. package/dist/nitro.js +3 -3
  27. package/dist/{oauth-callback-server-CCiKrS0s.js → oauth-callback-server-BT7cSxBm.js} +2 -2
  28. package/dist/{pending-auth-DDx3EU4M.js → pending-auth-CwA1uLA9.js} +2 -2
  29. package/dist/{profile-DP4LKL6V.js → profile-p1oiViVs.js} +4 -4
  30. package/dist/{registry-CeEpPna6.js → registry-BO2LM2oW.js} +1 -1
  31. package/dist/{resolve-B5ma3igH.js → resolve-CtWKGuKE.js} +2 -2
  32. package/dist/{result-Da0RVuWG.js → result-DR5JTBcb.js} +6 -6
  33. package/dist/{runner-se1W_jGZ.js → runner-BIxTJF9a.js} +9 -9
  34. package/dist/{sandbox-egress-signals-CS959-wm.js → sandbox-egress-signals-DF3Pu813.js} +1 -1
  35. package/dist/{session-stop-DlRDisF5.js → session-stop-BRq8Vxrr.js} +10 -10
  36. package/dist/{skills-CSzgs0EC.js → skills-DitcC3Vw.js} +2 -2
  37. package/dist/{spawn-DT9fMjtd.js → spawn-CHQ42PAo.js} +2 -2
  38. package/dist/{store-Dx1U69mm.js → store-DIFp9K52.js} +6 -6
  39. package/dist/{task-queue-BX9YrIsw.js → task-queue-UAeJGLYM.js} +3 -3
  40. package/dist/{task-runner-CO55Olal.js → task-runner-DwD-i2ta.js} +144 -126
  41. package/dist/{tasks-DwGlFX9i.js → tasks-DThIG7F-.js} +15 -26
  42. package/dist/{thread-state-Ces6tXmB.js → thread-state-BQxkL7Xm.js} +6 -6
  43. package/dist/{turn-failure-response-B4VCvEQf.js → turn-failure-response-OAIxgzNh.js} +7 -7
  44. package/dist/{turn-lifecycle-B1VV58Yo.js → turn-lifecycle-BAEJpjDI.js} +1 -1
  45. package/dist/{turn-session-routing-Dw2Kamg9.js → turn-session-routing-F5s728f0.js} +1 -1
  46. package/dist/{validation-yJF9LKOv.js → validation-DFM4-vDr.js} +1 -1
  47. package/dist/{version-CZYqvIFh.js → version-B80CD9sN.js} +1 -1
  48. package/dist/version.js +1 -1
  49. package/dist/{viewer-D96vo_42.js → viewer-CPxNfHWa.js} +3 -3
  50. package/dist/{web-input-5mls-41-.js → web-input-DIO177R0.js} +43 -51
  51. package/dist/{work-D2M2-zCO.js → work-Dl5KPKjW.js} +9 -9
  52. package/dist/{worker-BwCpf8tB.js → worker-CJkE86Co.js} +5 -5
  53. package/migrations/0056_automation_runs.sql +69 -0
  54. package/migrations/meta/0056_snapshot.json +4280 -0
  55. package/migrations/meta/_journal.json +8 -1
  56. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-D96vo_42.js";
1
+ import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-CPxNfHWa.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
3
  //#region src/cli/admin.ts
4
4
  /**
@@ -1,18 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { a as embedTexts, r as completeObject } from "./client-ROZeVjq0.js";
3
- import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-COUsTFIL.js";
2
+ import { a as embedTexts, r as completeObject } from "./client-CRVXpEWi.js";
3
+ import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-B0QxCh3D.js";
4
4
  import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-B19umzIL.js";
6
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-DNNkxfGS.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-0JuTT_OJ.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-B7joRWt7.js";
7
7
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
8
8
  import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
9
- import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-D96vo_42.js";
9
+ import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-CPxNfHWa.js";
10
10
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
11
- import { b as juniorCodeRepositories, d as juniorConversationParticipants, g as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, p as juniorConversationBriefs, r as juniorWorkspaceRepos, v as juniorConversationAnnotations, x as juniorAttachments, y as juniorCodeChanges } from "./executor-_4bdoCxe.js";
11
+ import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-YL577nNt.js";
12
12
  import { o as decodeStoredConversationEvent } from "./history-9pO1Zd4Y.js";
13
- import { p as credentialSubjectSchema } from "./registry-CeEpPna6.js";
13
+ import { p as credentialSubjectSchema } from "./registry-BO2LM2oW.js";
14
14
  import { C as conversationReportEventSchema, F as readMessageAttachments, H as conversationBriefSchema, U as parseBriefInput, q as readMessageCardRefs } from "./conversation-T18Xlkx9.js";
15
- import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-DP4LKL6V.js";
15
+ import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-p1oiViVs.js";
16
16
  import { i as isValidTimeZone } from "./cadence-D00SCzT1.js";
17
17
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C04mP1hu.js";
18
18
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -1,30 +1,30 @@
1
- import { b as getGatewayApiKey, c as hasCompactedConversationContext, d as unwrapCurrentInstruction, f as escapeXml, g as getProviderErrorAttributes, h as findProviderError, i as completeText, l as isCompactionSummaryText, m as createProviderError, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as ProviderError, r as completeObject, s as COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as renderCurrentInstruction, v as isProviderRetryError, x as resolveGatewayCredential, y as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-ROZeVjq0.js";
2
- import { C as withLogContext, F as normalizeIdentityEmail, I as isRecord$4, R as toOptionalString, a as extractGenAiUsageSummary, b as setTags, c as getLogContextAttributesForSpan, d as logException, f as logInfo, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as normalizeGenAiFinishReason, p as logWarn, u as logError, v as setSpanAttributes, w as withSpan, x as summarizeMessageText, y as setSpanStatus } from "./logging-COUsTFIL.js";
1
+ import { b as getGatewayApiKey, c as hasCompactedConversationContext, d as unwrapCurrentInstruction, f as escapeXml, g as getProviderErrorAttributes, h as findProviderError, i as completeText, l as isCompactionSummaryText, m as createProviderError, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as ProviderError, r as completeObject, s as COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as renderCurrentInstruction, v as isProviderRetryError, x as resolveGatewayCredential, y as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-CRVXpEWi.js";
2
+ import { C as withLogContext, F as normalizeIdentityEmail, I as isRecord$4, R as toOptionalString, a as extractGenAiUsageSummary, b as setTags, c as getLogContextAttributesForSpan, d as logException, f as logInfo, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as normalizeGenAiFinishReason, p as logWarn, u as logError, v as setSpanAttributes, w as withSpan, x as summarizeMessageText, y as setSpanStatus } from "./logging-B0QxCh3D.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-B19umzIL.js";
5
- import { n as botConfig, v as normalizeSlackEmojiName } from "./config-DNNkxfGS.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-0JuTT_OJ.js";
5
+ import { n as botConfig, v as normalizeSlackEmojiName } from "./config-B7joRWt7.js";
6
6
  import { a as formatModelProfiles, c as profileConfig, i as formatModelProfile, l as TURN_REASONING_LEVELS, n as ModelProfileNotConfiguredError, o as modelIdForProfile, s as modelProfileSchema } from "./model-profile-BwU8mqwD.js";
7
7
  import { a as isUserActor, d as parseSlackTeamId, f as parseSlackUserId, g as parseSlackMessageTs, l as parseSlackChannelId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
8
- import { N as parseDestination, S as agentTurnCostUsd, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, x as addAgentTurnUsage } from "./viewer-D96vo_42.js";
8
+ import { N as parseDestination, S as agentTurnCostUsd, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, x as addAgentTurnUsage } from "./viewer-CPxNfHWa.js";
9
9
  import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-D_YoNnAn.js";
10
- import { S as juniorArtifacts, a as juniorSchedulerRuns, l as juniorStats, p as juniorConversationBriefs, v as juniorConversationAnnotations, x as juniorAttachments } from "./executor-_4bdoCxe.js";
10
+ import { _ as juniorConversationAnnotations, b as juniorAttachments, c as juniorStats, f as juniorConversationBriefs, o as juniorAutomationRuns, x as juniorArtifacts } from "./executor-YL577nNt.js";
11
11
  import { d as contextProvenance, f as instructionActors, m as sameActorIdentity, p as instructionProvenanceFor, t as KNOWN_CONVERSATION_EVENT_TYPES, u as agentInstructionProvenance } from "./history-9pO1Zd4Y.js";
12
12
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-BVvSnQBB.js";
13
- import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as credentialContextForActor, f as credentialContextSchema, h as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, m as credentialUserSubjectId, o as resolvePluginCommandEnv, s as OAuthProviderError } from "./registry-CeEpPna6.js";
14
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BQQiwwA7.js";
15
- import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-CSzgs0EC.js";
16
- import { B as postSlackEphemeralMessage, Bt as recordMcpProviderConnected, Ct as TURN_CONTEXT_TAG, Dt as loadConnectedMcpProviders, F as slackMention, Ft as recordAttachmentsDelivered, Ht as recordToolExecutionStarted, J as saveTurnCheckpoint, K as continuableMessages, L as addReactionToMessage, M as formatSlackLink, Mt as loadTurnRoute, Nt as openConversationProjection, Ot as loadConversationProjection, Pt as recordAgentsInstructionsUpdated, Qt as resolveTaskTitle, R as getSlackMessagePermalink, Rt as recordAuthorizationRequested, St as trimTrailingAssistantMessages, U as uploadFilesToConversation, Ut as recordTurnRoute, V as postSlackMessage, Zt as fallbackShortTitle, _t as isToolResultError, a as readScheduledAutomation, at as TurnToolCallLimitExceededError, b as saveEventAutomation, bt as retainRuntimeTurnContext, ct as isTurnExecutionLimitExceededError, dn as getAgentContextCompactionTriggerTokens, dt as getTerminalAssistantMessages, f as createEventAutomation, fn as getAgentContextInputLimitTokens, ft as getUserMessageInstructionText, g as getEventAutomation, gt as isContinuablePiBoundary, ht as isAssistantMessage, it as TurnSliceLimitExceededError, j as escapeSlackMrkdwnText, k as automationRevision, kt as loadLastModelProfile, lt as extractAssistantText, mn as piMessageFromHistoryItem, nt as TURN_LIMIT_DISABLED_REASON, o as saveScheduledAutomation, p as deleteEventAutomation, pn as historyItemFromPiMessage, pt as hasRuntimeTurnContext, q as loadTurnCheckpoint, r as listScheduledAutomationsForTeam, rt as TurnBudgetExceededError, st as createTurnLimitGate, t as createScheduledAutomation, un as estimateTextTokens, ut as getPiMessageRole, v as listEventAutomationsForTeam, vt as isToolResultMessage, wt as ToolInputError, x as setEventAutomationStatus, xt as stripRuntimeTurnContext, yt as normalizeToolNameFromResult, z as openSlackDirectMessage, zt as recordGuardianActionReviewed } from "./tasks-DwGlFX9i.js";
17
- import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, Bt as getFilePermalink, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, Dt as matchSlackAttachments, E as setWorkspaceSnapshot, F as isSlackMessageTurn, Ft as defaultTimezone, G as createWatch, Gt as normalizeSlackConversationId, H as cancelWatch, Ht as getSlackClient, I as slackMessageTurnDisabledReason, It as resolveUserTimezone, J as getWatch, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, Mt as createPluginAnnotations, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, Rt as SlackActionError, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as isConversationScopedChannel, V as cancelSubscriptions, W as createTimerWatch, Wt as isDmChannel$1, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Y as listWatches, _ as deleteWorkspace, at as getDashboardConversationLink, b as listWorkspaces, c as getPluginTools, en as conversationNoteEvent, ft as createPluginLogger, g as createWorkspace, j as tryWorkspaceRepoCheckoutPath, jt as saveObjectAnnotations, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, q as findMatchingWatches, qt as withSlackRetries, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as getDashboardTaskLink, u as getPlugins, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, z as RESOURCE_WATCH_TOOL_SOURCE, zt as downloadPrivateSlackFile } from "./agent-hooks-DcoKnnxn.js";
13
+ import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as credentialContextForActor, f as credentialContextSchema, h as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, m as credentialUserSubjectId, o as resolvePluginCommandEnv, s as OAuthProviderError } from "./registry-BO2LM2oW.js";
14
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Br8s-TYx.js";
15
+ import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-DitcC3Vw.js";
16
+ import { B as postSlackEphemeralMessage, Bt as recordMcpProviderConnected, Ct as TURN_CONTEXT_TAG, Dt as loadConnectedMcpProviders, F as slackMention, Ft as recordAttachmentsDelivered, Ht as recordToolExecutionStarted, J as saveTurnCheckpoint, K as continuableMessages, L as addReactionToMessage, M as formatSlackLink, Mt as loadTurnRoute, Nt as openConversationProjection, Ot as loadConversationProjection, Pt as recordAgentsInstructionsUpdated, Qt as resolveTaskTitle, R as getSlackMessagePermalink, Rt as recordAuthorizationRequested, St as trimTrailingAssistantMessages, U as uploadFilesToConversation, Ut as recordTurnRoute, V as postSlackMessage, Zt as fallbackShortTitle, _t as isToolResultError, a as readScheduledAutomation, at as TurnToolCallLimitExceededError, b as saveEventAutomation, bt as retainRuntimeTurnContext, ct as isTurnExecutionLimitExceededError, dn as getAgentContextCompactionTriggerTokens, dt as getTerminalAssistantMessages, f as createEventAutomation, fn as getAgentContextInputLimitTokens, ft as getUserMessageInstructionText, g as getEventAutomation, gt as isContinuablePiBoundary, ht as isAssistantMessage, it as TurnSliceLimitExceededError, j as escapeSlackMrkdwnText, k as automationRevision, kt as loadLastModelProfile, lt as extractAssistantText, mn as piMessageFromHistoryItem, nt as TURN_LIMIT_DISABLED_REASON, o as saveScheduledAutomation, p as deleteEventAutomation, pn as historyItemFromPiMessage, pt as hasRuntimeTurnContext, q as loadTurnCheckpoint, r as listScheduledAutomationsForTeam, rt as TurnBudgetExceededError, st as createTurnLimitGate, t as createScheduledAutomation, un as estimateTextTokens, ut as getPiMessageRole, v as listEventAutomationsForTeam, vt as isToolResultMessage, wt as ToolInputError, x as setEventAutomationStatus, xt as stripRuntimeTurnContext, yt as normalizeToolNameFromResult, z as openSlackDirectMessage, zt as recordGuardianActionReviewed } from "./tasks-DThIG7F-.js";
17
+ import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, Bt as getFilePermalink, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, Dt as matchSlackAttachments, E as setWorkspaceSnapshot, F as isSlackMessageTurn, Ft as defaultTimezone, G as createWatch, Gt as normalizeSlackConversationId, H as cancelWatch, Ht as getSlackClient, I as slackMessageTurnDisabledReason, It as resolveUserTimezone, J as getWatch, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, Mt as createPluginAnnotations, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, Rt as SlackActionError, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as isConversationScopedChannel, V as cancelSubscriptions, W as createTimerWatch, Wt as isDmChannel$1, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Y as listWatches, _ as deleteWorkspace, at as getDashboardConversationLink, b as listWorkspaces, c as getPluginTools, en as conversationNoteEvent, ft as createPluginLogger, g as createWorkspace, j as tryWorkspaceRepoCheckoutPath, jt as saveObjectAnnotations, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, q as findMatchingWatches, qt as withSlackRetries, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as getDashboardTaskLink, u as getPlugins, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, z as RESOURCE_WATCH_TOOL_SOURCE, zt as downloadPrivateSlackFile } from "./agent-hooks-CvcbAtJH.js";
18
18
  import { B as briefLinkSchema, H as conversationBriefSchema, J as removedCardSchema, L as detectImageMediaType, R as isVisionImageMediaType, V as briefOutcomeStatusSchema } from "./conversation-T18Xlkx9.js";
19
- import { A as SANDBOX_DATA_ROOT, D as fenceLock, E as acquireActiveLock, F as sandboxSkillFile, I as sandboxSkillPathResolution, M as SANDBOX_SKILLS_ROOT, N as SANDBOX_WORKSPACE_ROOT, O as withLock, P as sandboxSkillDir, _ 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_REPOS_ROOT, k as sleep, 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-DP4LKL6V.js";
20
- import { n as canReusePendingAuthLink, t as abandonReplacedPendingAuth } from "./pending-auth-DDx3EU4M.js";
19
+ import { A as SANDBOX_DATA_ROOT, D as fenceLock, E as acquireActiveLock, F as sandboxSkillFile, I as sandboxSkillPathResolution, M as SANDBOX_SKILLS_ROOT, N as SANDBOX_WORKSPACE_ROOT, O as withLock, P as sandboxSkillDir, _ 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_REPOS_ROOT, k as sleep, 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-p1oiViVs.js";
20
+ import { n as canReusePendingAuthLink, t as abandonReplacedPendingAuth } from "./pending-auth-CwA1uLA9.js";
21
21
  import { c as isTurnInputCommitLostError, i as TurnInputCommitLostError, r as CooperativeTurnYieldError, t as authorizationId } from "./oauth-authorization-BA4Dt6a7.js";
22
- import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-DbPLvsnL.js";
23
- import { C as registeredEventMatchSchema, D as requireSupportedEventMatch, E as requireEventIdentifier, I as readAutomationResult, L as remindMissingAutomationResult, M as FINISH_AUTOMATION_RUN_TOOL_NAME, N as automationResultSchema, S as pluginSupportsEvent, T as registeredResourceTypeSchema, _ as workspaceSnapshotWatch, b as eventNamespaceSchema, d as requireSlackChannelMessageScope, g as workspaceSnapshotFinishedEvent, h as WORKSPACE_SNAPSHOT_READY_EVENT, l as getEventCatalog, m as WORKSPACE_SNAPSHOT_FAILED_EVENT, n as markConversationsStopped, o as enqueueEventNotification, t as getConversationStoppedAtMs, v as automationEventCatalog, w as registeredEventTypeSchema, x as hasEventCatalogEntries } from "./session-stop-DlRDisF5.js";
22
+ import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-BU05IECs.js";
23
+ import { C as registeredEventMatchSchema, D as requireSupportedEventMatch, E as requireEventIdentifier, I as readAutomationResult, L as remindMissingAutomationResult, M as FINISH_AUTOMATION_RUN_TOOL_NAME, N as automationResultSchema, S as pluginSupportsEvent, T as registeredResourceTypeSchema, _ as workspaceSnapshotWatch, b as eventNamespaceSchema, d as requireSlackChannelMessageScope, g as workspaceSnapshotFinishedEvent, h as WORKSPACE_SNAPSHOT_READY_EVENT, l as getEventCatalog, m as WORKSPACE_SNAPSHOT_FAILED_EVENT, n as markConversationsStopped, o as enqueueEventNotification, t as getConversationStoppedAtMs, v as automationEventCatalog, w as registeredEventTypeSchema, x as hasEventCatalogEntries } from "./session-stop-BRq8Vxrr.js";
24
24
  import { i as isValidTimeZone, r as getZonedDateTimeParts } from "./cadence-D00SCzT1.js";
25
- 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-B5ma3igH.js";
26
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-DSQx1qFY.js";
27
- import { E as stopConversationWork } from "./store-Dx1U69mm.js";
25
+ 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-CtWKGuKE.js";
26
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-CIhKXUE3.js";
27
+ import { E as stopConversationWork } from "./store-DIFp9K52.js";
28
28
  import { F as taskOutcomeInputSchema, M as compileScheduleIntent, N as scheduleIntentSchema, O as automationInstructionToolSchema, T as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, j as ScheduleIntentError, k as automationTitleSchema } from "./automation-gznOMaQ2.js";
29
29
  import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
30
30
  import { n as privateTraceResultAttributes } from "./private-trace-result-BLvBjy_e.js";
@@ -10843,7 +10843,7 @@ function createSlackScheduleUpdateAutomationTool(context) {
10843
10843
  if (input.outcomes !== void 0 && !isCreator) throwToolInputError("Only the scheduled automation creator can change message destinations.");
10844
10844
  const changingDestination = moveDestination && !alreadyHere;
10845
10845
  if (changingDestination) {
10846
- if ((await db.select({ id: juniorSchedulerRuns.id }).from(juniorSchedulerRuns).where(and(eq(juniorSchedulerRuns.taskId, lookup.id), inArray(juniorSchedulerRuns.status, ["pending", "running"]))).limit(1)).length > 0) throwToolInputError("Scheduled automation cannot be moved while an occurrence is already running. Try again after the current run finishes.");
10846
+ if ((await db.select({ id: juniorAutomationRuns.id }).from(juniorAutomationRuns).where(and(eq(juniorAutomationRuns.automationId, lookup.id), inArray(juniorAutomationRuns.status, ["pending", "running"]))).limit(1)).length > 0) throwToolInputError("Scheduled automation cannot be moved while an occurrence is already running. Try again after the current run finishes.");
10847
10847
  }
10848
10848
  const nowMs = context.now?.() ?? Date.now();
10849
10849
  const status = normalizeStatus(input.status);
@@ -20736,7 +20736,7 @@ function createAgentRunner(execute, options) {
20736
20736
  } } : void 0
20737
20737
  };
20738
20738
  if (run.instruction.storedAttachments?.length) {
20739
- const { loadInputImages } = await import("./images-BAN7DHuO.js").then((n) => n.n);
20739
+ const { loadInputImages } = await import("./images-DopOctPc.js").then((n) => n.n);
20740
20740
  const storage = nextRun.environment?.attachmentStorage;
20741
20741
  if (!storage) throw new Error("Attachment storage is unavailable.");
20742
20742
  nextRun.instruction = {
package/dist/api.js CHANGED
@@ -1,26 +1,26 @@
1
- import { K as listChildAgents, L as editEventAutomation, Lt as createUserTokenStore, O as parseSlackThreadId, P as editScheduledAutomation, R as AutomationEditError, T as readLiveAttachment, V as resolveTaskOutcomes, bt as conversationSubtreeColumns, g as readStats, ot as getChildAgentLabel, yt as conversationSubtree, z as eventAutomationTriggerAvailable } from "./agent-runner-B-7S_DCS.js";
2
- import { d as logException, f as logInfo, p as logWarn } from "./logging-COUsTFIL.js";
1
+ import { K as listChildAgents, L as editEventAutomation, Lt as createUserTokenStore, O as parseSlackThreadId, P as editScheduledAutomation, R as AutomationEditError, T as readLiveAttachment, V as resolveTaskOutcomes, bt as conversationSubtreeColumns, g as readStats, ot as getChildAgentLabel, yt as conversationSubtree, z as eventAutomationTriggerAvailable } from "./agent-runner-B4FMVbCs.js";
2
+ import { d as logException, f as logInfo, p as logWarn } from "./logging-B0QxCh3D.js";
3
3
  import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-BTtLaeWy.js";
4
- import { E as resolveRootConversationId, T as hasAgentTurnUsage, _ as locationFromRow, b as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, w as agentTurnUsageSchema, x as addAgentTurnUsage } from "./viewer-D96vo_42.js";
4
+ import { E as resolveRootConversationId, T as hasAgentTurnUsage, _ as locationFromRow, b as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, w as agentTurnUsageSchema, x as addAgentTurnUsage } from "./viewer-CPxNfHWa.js";
5
5
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
6
- import { _ as juniorApiTokens, b as juniorCodeRepositories, d as juniorConversationParticipants, g as juniorConversationEvents, h as juniorConversationMetrics, p as juniorConversationBriefs, y as juniorCodeChanges } from "./executor-_4bdoCxe.js";
6
+ import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-YL577nNt.js";
7
7
  import { d as contextProvenance } from "./history-9pO1Zd4Y.js";
8
- import { A as requireAutomationRevision, D as sameDefinitionValue, E as readAutomationVersion, O as AutomationConflictError, a as readScheduledAutomation, b as saveEventAutomation, g as getEventAutomation, jt as loadTurnProjection, k as automationRevision, m as eventAutomationBelongsToUser, mn as piMessageFromHistoryItem, o as saveScheduledAutomation, w as automationDefinition, x as setEventAutomationStatus } from "./tasks-DwGlFX9i.js";
9
- import { C as WorkspaceValidationError, Ct as readLatestConversationBrief, Ht as getSlackClient, Lt as lookupSlackUser, M as workspaceRepoCheckoutPath, Nt as listConversationAnnotations, O as SANDBOX_RUNTIME, Pt as listConversationAnnotationsById, S as updateWorkspace, Tt as buildSentryConversationUrl, _ as deleteWorkspace, _t as conversationHasParticipantEmail, b as listWorkspaces, bt as conversationNotArchivedForUser, ft as createPluginLogger, g as createWorkspace, gt as conversationArchivedForUser, ht as conversationArchivedForEmail, mt as conversationArchiveTimes, pt as readConversationAccessFromSql, qt as withSlackRetries, u as getPlugins, v as getWorkspace, vt as conversationHasParticipantUser, wt as readConversationEventPage, x as listWorkspacesByRepository, xt as viewerConversationMembership, yt as conversationNotArchivedForEmail } from "./agent-hooks-DcoKnnxn.js";
8
+ import { A as requireAutomationRevision, D as sameDefinitionValue, E as readAutomationVersion, O as AutomationConflictError, a as readScheduledAutomation, b as saveEventAutomation, g as getEventAutomation, jt as loadTurnProjection, k as automationRevision, m as eventAutomationBelongsToUser, mn as piMessageFromHistoryItem, o as saveScheduledAutomation, w as automationDefinition, x as setEventAutomationStatus } from "./tasks-DThIG7F-.js";
9
+ import { C as WorkspaceValidationError, Ct as readLatestConversationBrief, Ht as getSlackClient, Lt as lookupSlackUser, M as workspaceRepoCheckoutPath, Nt as listConversationAnnotations, O as SANDBOX_RUNTIME, Pt as listConversationAnnotationsById, S as updateWorkspace, Tt as buildSentryConversationUrl, _ as deleteWorkspace, _t as conversationHasParticipantEmail, b as listWorkspaces, bt as conversationNotArchivedForUser, ft as createPluginLogger, g as createWorkspace, gt as conversationArchivedForUser, ht as conversationArchivedForEmail, mt as conversationArchiveTimes, pt as readConversationAccessFromSql, qt as withSlackRetries, u as getPlugins, v as getWorkspace, vt as conversationHasParticipantUser, wt as readConversationEventPage, x as listWorkspacesByRepository, xt as viewerConversationMembership, yt as conversationNotArchivedForEmail } from "./agent-hooks-CvcbAtJH.js";
10
10
  import { A as forkConversationBodySchema, F as readMessageAttachments, I as INPUT_IMAGE_TYPES, O as createConversationBodySchema, T as conversationStatsReportSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, j as forkConversationResponseSchema, k as createConversationMessageBodySchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-T18Xlkx9.js";
11
- import { n as hash, t as create } from "./profile-DP4LKL6V.js";
12
- import { l as getEventCatalog, v as automationEventCatalog } from "./session-stop-DlRDisF5.js";
11
+ import { n as hash, t as create } from "./profile-p1oiViVs.js";
12
+ import { l as getEventCatalog, v as automationEventCatalog } from "./session-stop-BRq8Vxrr.js";
13
13
  import { t as getFirstRunAtMs } from "./cadence-D00SCzT1.js";
14
- import { t as getCachedSnapshot } from "./resolve-B5ma3igH.js";
15
- import { a as getVercelConversationWorkQueue } from "./job-queue-DSQx1qFY.js";
16
- import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-Dx1U69mm.js";
14
+ import { t as getCachedSnapshot } from "./resolve-CtWKGuKE.js";
15
+ import { a as getVercelConversationWorkQueue } from "./job-queue-CIhKXUE3.js";
16
+ import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-DIFp9K52.js";
17
17
  import { M as compileScheduleIntent, P as weekdaySchema, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, j as ScheduleIntentError, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-gznOMaQ2.js";
18
18
  import { C as skillReportsSchema, a as fillUtcHours, b as pluginsSchema, c as sumUtcHoursIntoSixHours, d as trailingUtcSixHourWindow, f as utcDayKey, h as pluginOperationalReportFeedSchema, i as fillUtcDays, l as trailingUtcDayWindow, m as healthReportSchema, n as DAY_MS$1, o as fillUtcSixHours, p as utcHourKey, r as HOUR_MS$1, s as startOfUtcHour, u as trailingUtcHourWindow, x as runtimeInfoReportSchema } from "./web-message-id-xPI_EFSC.js";
19
- import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, j as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-5mls-41-.js";
20
- import { A as readAutomationTitlesByConversationId, M as conversationActiveDaysColumn, N as conversationAggregateColumns, P as conversationRangeColumns } from "./task-runner-CO55Olal.js";
21
- import { d as legacyWebMailboxMetadataSchema } from "./result-Da0RVuWG.js";
22
- import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection } from "./connections-DJV6mLrH.js";
23
- import { t as decodeInputImages } from "./images-BAN7DHuO.js";
19
+ import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, j as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-DIO177R0.js";
20
+ import { F as conversationRangeColumns, N as conversationActiveDaysColumn, P as conversationAggregateColumns, j as readAutomationTitlesByConversationId } from "./task-runner-DwD-i2ta.js";
21
+ import { d as legacyWebMailboxMetadataSchema } from "./result-DR5JTBcb.js";
22
+ import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection } from "./connections-CGPYNw2B.js";
23
+ import { t as decodeInputImages } from "./images-DopOctPc.js";
24
24
  import { C as locationParamsSchema, E as activitySixHours$1, H as conversationChildAgentsReportSchema, I as codeOverviewReportSchema, L as codePersonReportSchema, M as startConnectionResponseSchema, O as connectionListSchema, R as codeRepositoryParamsSchema, S as locationDirectoryReportSchema, T as activityHours$1, U as stopConversationTurnResponseSchema, W as apiErrorSchema, _ as actorProfileReportSchema, a as workspaceBodySchema, d as createdPersonalTokenSchema, f as personalTokenListSchema, g as actorDirectoryReportSchema, h as revokePersonalTokenResponseSchema, i as deleteWorkspaceResponseSchema, j as disconnectConnectionResponseSchema, k as connectionParamsSchema, l as workspaceSchema, m as personalTokenParamsSchema, n as statsReportSchema, o as workspaceListSchema, s as workspaceParamsSchema, u as createPersonalTokenBodySchema, v as personParamsSchema, w as activityDays$1, x as locationDetailReportSchema, y as personalSpendReportSchema, z as codeRepositoryReportSchema } from "./schema-C9Vnyb_f.js";
25
25
  import { Hono } from "hono";
26
26
  import path from "node:path";
@@ -3592,7 +3592,7 @@ async function readPeoplePluginReports(args) {
3592
3592
  reports: [],
3593
3593
  source: "plugins"
3594
3594
  });
3595
- const { getPluginProfileReports } = await import("./agent-hooks-DcoKnnxn.js").then((n) => n.t);
3595
+ const { getPluginProfileReports } = await import("./agent-hooks-CvcbAtJH.js").then((n) => n.t);
3596
3596
  return pluginOperationalReportFeedSchema.parse({
3597
3597
  generatedAt: new Date(nowMs).toISOString(),
3598
3598
  reports: await getPluginProfileReports({
@@ -4565,7 +4565,7 @@ function readDescriptionText(home) {
4565
4565
  }
4566
4566
  /** Read discovered skill names for authenticated runtime diagnostics. */
4567
4567
  async function readSkillReports() {
4568
- const { discoverSkills } = await import("./skills-CSzgs0EC.js").then((n) => n.o);
4568
+ const { discoverSkills } = await import("./skills-DitcC3Vw.js").then((n) => n.o);
4569
4569
  const skills = await discoverSkills();
4570
4570
  return skillReportsSchema.parse(skills.map((skill) => ({
4571
4571
  name: skill.name,
@@ -4574,7 +4574,7 @@ async function readSkillReports() {
4574
4574
  }
4575
4575
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4576
4576
  async function readPlugins() {
4577
- const { pluginCatalogRuntime } = await import("./catalog-runtime-BQQiwwA7.js").then((n) => n.t);
4577
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-Br8s-TYx.js").then((n) => n.t);
4578
4578
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4579
4579
  configKeys: plugin.manifest.configKeys ?? [],
4580
4580
  description: plugin.manifest.description,
@@ -4586,7 +4586,7 @@ async function readPlugins() {
4586
4586
  async function readRuntimeInfoReport() {
4587
4587
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4588
4588
  import("./package-discovery-BVvSnQBB.js").then((n) => n.r),
4589
- import("./catalog-runtime-BQQiwwA7.js").then((n) => n.t),
4589
+ import("./catalog-runtime-Br8s-TYx.js").then((n) => n.t),
4590
4590
  readPlugins(),
4591
4591
  readSkillReports()
4592
4592
  ]);
@@ -4603,7 +4603,7 @@ async function readRuntimeInfoReport() {
4603
4603
  /** Read sanitized operational summaries contributed by plugins. */
4604
4604
  async function readPluginOperationalReportFeed() {
4605
4605
  const nowMs = Date.now();
4606
- const { getPluginOperationalReports } = await import("./agent-hooks-DcoKnnxn.js").then((n) => n.t);
4606
+ const { getPluginOperationalReports } = await import("./agent-hooks-CvcbAtJH.js").then((n) => n.t);
4607
4607
  return pluginOperationalReportFeedSchema.parse({
4608
4608
  source: "plugins",
4609
4609
  generatedAt: new Date(nowMs).toISOString(),
package/dist/app.js CHANGED
@@ -1,38 +1,38 @@
1
- import { At as consumeSandboxEgressPermissionDeniedSignal, B as effectiveTaskOutcomes, Ct as ingestEvent, Dt as SANDBOX_EGRESS_PROXY_PATH, E as requestAttachmentDeletion, Et as shouldPropagateSandboxEgressTrace, F as logScheduledAutomationRunSkipped, I as scheduledAutomationRunAttributes, It as startOAuthFlow, Kt as getConfigDefaults, Lt as createUserTokenStore, Nt as formatProviderLabel, O as parseSlackThreadId, Ot as clearSandboxEgressSignals, St as processWorkspaceSnapshotJob, Tt as normalizeSandboxEgressTracePropagationDomains, U as stopConversationSession, W as recordSubagentEnded, b as unpublishedArtifactHeaders, i as executeCredentialedEgressRequest, jt as parseSandboxEgressCredentialToken, kt as consumeSandboxEgressAuthRequiredSignal, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, qt as setConfigDefaults, t as createAgentRunner, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as resolveSandboxEgressProviderForHost, x as lookupSlackUserProfile, y as readPublicArtifact } from "./agent-runner-B-7S_DCS.js";
2
- import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-COUsTFIL.js";
1
+ import { At as consumeSandboxEgressPermissionDeniedSignal, B as effectiveTaskOutcomes, Ct as ingestEvent, Dt as SANDBOX_EGRESS_PROXY_PATH, E as requestAttachmentDeletion, Et as shouldPropagateSandboxEgressTrace, F as logScheduledAutomationRunSkipped, I as scheduledAutomationRunAttributes, It as startOAuthFlow, Kt as getConfigDefaults, Lt as createUserTokenStore, Nt as formatProviderLabel, O as parseSlackThreadId, Ot as clearSandboxEgressSignals, St as processWorkspaceSnapshotJob, Tt as normalizeSandboxEgressTracePropagationDomains, U as stopConversationSession, W as recordSubagentEnded, b as unpublishedArtifactHeaders, i as executeCredentialedEgressRequest, jt as parseSandboxEgressCredentialToken, kt as consumeSandboxEgressAuthRequiredSignal, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, qt as setConfigDefaults, t as createAgentRunner, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as resolveSandboxEgressProviderForHost, x as lookupSlackUserProfile, y as readPublicArtifact } from "./agent-runner-B4FMVbCs.js";
2
+ import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-B0QxCh3D.js";
3
3
  import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
4
- import { t as JUNIOR_VERSION } from "./version-CZYqvIFh.js";
5
- import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-DNNkxfGS.js";
4
+ import { t as JUNIOR_VERSION } from "./version-B80CD9sN.js";
5
+ import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-B7joRWt7.js";
6
6
  import { _ as slackMessageTsSchema, d as parseSlackTeamId, f as parseSlackUserId, h as slackUserIdSchema, m as slackTeamIdSchema, o as parseActorUserId, p as slackChannelIdSchema } from "./actor-BTtLaeWy.js";
7
- import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-D96vo_42.js";
7
+ import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-CPxNfHWa.js";
8
8
  import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
9
- import { a as juniorSchedulerRuns, g as juniorConversationEvents, p as juniorConversationBriefs, s as juniorAutomations } from "./executor-_4bdoCxe.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BQQiwwA7.js";
11
- import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-DwGlFX9i.js";
12
- import { $ as bindSlackDirectCredentialSubject, At as resolveRootVisibility, Ht as getSlackClient, Jt as getWorkspaceTeamId, Nt as listConversationAnnotations, Q as bindScheduledAutomationCredentialSubject, U as collectEventMatchKeys, Wt as isDmChannel, X as takeDueTimerWatches, Yt as runWithWorkspaceTeamId, Z as bindEventAutomationCredentialSubject, a as getPluginRoutes, at as getDashboardConversationLink, ct as setDashboardConversationLinkOptions, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, ft as createPluginLogger, h as setBriefsConfig, i as getPluginApiRoutes, lt as createPluginState, nt as verifySlackDirectCredentialSubject, pt as readConversationAccessFromSql, q as findMatchingWatches, st as getDashboardTaskLink, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins } from "./agent-hooks-DcoKnnxn.js";
9
+ import { f as juniorConversationBriefs, h as juniorConversationEvents, o as juniorAutomationRuns, s as juniorAutomations } from "./executor-YL577nNt.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Br8s-TYx.js";
11
+ import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-DThIG7F-.js";
12
+ import { $ as bindSlackDirectCredentialSubject, At as resolveRootVisibility, Ht as getSlackClient, Jt as getWorkspaceTeamId, Nt as listConversationAnnotations, Q as bindScheduledAutomationCredentialSubject, U as collectEventMatchKeys, Wt as isDmChannel, X as takeDueTimerWatches, Yt as runWithWorkspaceTeamId, Z as bindEventAutomationCredentialSubject, a as getPluginRoutes, at as getDashboardConversationLink, ct as setDashboardConversationLinkOptions, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, ft as createPluginLogger, h as setBriefsConfig, i as getPluginApiRoutes, lt as createPluginState, nt as verifySlackDirectCredentialSubject, pt as readConversationAccessFromSql, q as findMatchingWatches, st as getDashboardTaskLink, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins } from "./agent-hooks-CvcbAtJH.js";
13
13
  import { W as annotationCard } from "./conversation-T18Xlkx9.js";
14
- import { O as withLock$1, w as getStateAdapter } from "./profile-DP4LKL6V.js";
15
- import { c as getThreadStopDecision } from "./pending-auth-DDx3EU4M.js";
16
- import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-DlRDisF5.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-p1oiViVs.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-CwA1uLA9.js";
16
+ import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-BRq8Vxrr.js";
17
17
  import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
18
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-B5ma3igH.js";
19
- import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DSQx1qFY.js";
20
- import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-Dx1U69mm.js";
18
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-CtWKGuKE.js";
19
+ import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CIhKXUE3.js";
20
+ import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-DIFp9K52.js";
21
21
  import { D as scheduledRunSchema } from "./automation-gznOMaQ2.js";
22
22
  import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
23
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-yJF9LKOv.js";
23
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DFM4-vDr.js";
24
24
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
25
- import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-5mls-41-.js";
26
- import { a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, j as recordAutomationExecution, m as listPendingDispatchMailboxAppends, o as createOrGetDispatch, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed } from "./task-runner-CO55Olal.js";
27
- import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-Da0RVuWG.js";
28
- import { r as enqueueAgentInvocation } from "./work-D2M2-zCO.js";
29
- import { s as coerceThreadConversationState } from "./thread-state-Ces6tXmB.js";
30
- import { o as unlinkProvider } from "./connections-DJV6mLrH.js";
31
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-CEd2F5PS.js";
32
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BX9YrIsw.js";
33
- import { t as processConversationWork } from "./worker-BwCpf8tB.js";
34
- import { t as bindMessageAgent } from "./message-CtDDEwwV.js";
35
- import { t as bindSpawnAgent } from "./spawn-DT9fMjtd.js";
25
+ import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-DIO177R0.js";
26
+ import { M as recordAutomationExecution, S as existingConversationId, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, m as listPendingDispatchMailboxAppends, o as createOrGetDispatch, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed } from "./task-runner-DwD-i2ta.js";
27
+ import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-DR5JTBcb.js";
28
+ import { r as enqueueAgentInvocation } from "./work-Dl5KPKjW.js";
29
+ import { s as coerceThreadConversationState } from "./thread-state-BQxkL7Xm.js";
30
+ import { o as unlinkProvider } from "./connections-CGPYNw2B.js";
31
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-C-k3fnY5.js";
32
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-UAeJGLYM.js";
33
+ import { t as processConversationWork } from "./worker-CJkE86Co.js";
34
+ import { t as bindMessageAgent } from "./message-DQvor8lM.js";
35
+ import { t as bindSpawnAgent } from "./spawn-CHQ42PAo.js";
36
36
  import { createRequire } from "node:module";
37
37
  import { Hono } from "hono";
38
38
  import { z } from "zod";
@@ -343,6 +343,43 @@ async function getScheduledAutomationDispatch(id) {
343
343
  });
344
344
  }
345
345
  //#endregion
346
+ //#region src/chat/event-automations/runs.ts
347
+ /**
348
+ * Record a dispatched event automation run and link its Conversation when it
349
+ * exists. The dispatch can finish before this write, so a stored run, or a
350
+ * retry of the same Event, keeps the row it has.
351
+ */
352
+ async function recordEventAutomationRunStarted(db, args) {
353
+ await db.insert(juniorAutomationRuns).values({
354
+ id: args.dispatchId,
355
+ automationId: args.automationId,
356
+ conversationId: existingConversationId(getDispatchConversationId({ id: args.dispatchId })),
357
+ startedAtMs: args.nowMs,
358
+ status: "running"
359
+ }).onConflictDoNothing({ target: juniorAutomationRuns.id });
360
+ }
361
+ /**
362
+ * Settle running event automation runs whose dispatch has ended. A run whose
363
+ * dispatch record is gone fails.
364
+ */
365
+ async function settleEventAutomationRuns(db, nowMs) {
366
+ const runs = await db.select({
367
+ automationId: juniorAutomationRuns.automationId,
368
+ id: juniorAutomationRuns.id
369
+ }).from(juniorAutomationRuns).innerJoin(juniorAutomations, eq(juniorAutomations.id, juniorAutomationRuns.automationId)).where(and(eq(juniorAutomations.kind, "event"), eq(juniorAutomationRuns.status, "running")));
370
+ for (const run of runs) {
371
+ const dispatch = await getDispatchRecord(run.id);
372
+ const status = dispatch?.status ?? "failed";
373
+ if (status !== "blocked" && status !== "completed" && status !== "failed") continue;
374
+ await recordAutomationExecution(run.automationId, {
375
+ errorMessage: dispatch ? dispatch.errorMessage : "Event automation dispatch record is missing.",
376
+ executionId: run.id,
377
+ nowMs: dispatch?.updatedAtMs ?? nowMs,
378
+ status
379
+ });
380
+ }
381
+ }
382
+ //#endregion
346
383
  //#region src/chat/automations/reply-attribution.ts
347
384
  /** Name the Automation in the footer of the replies that its runs post. */
348
385
  function automationReplyAttribution(title) {
@@ -357,45 +394,56 @@ function automationReplyAttribution(title) {
357
394
  const PENDING_CLAIM_STALE_MS = 6e4;
358
395
  const MISSED_RUN_MAX_AGE_MS = 864e5;
359
396
  const INCOMPLETE_RUN_STATUSES = ["pending", "running"];
360
- const retainedScheduledRunSchema = scheduledRunSchema.extend({
361
- idempotencyKey: z.string().optional(),
362
- taskVersion: z.number().optional()
363
- }).strict();
364
- /** Decode a scheduler run row and remove retained legacy fields. */
397
+ /** Decode a Scheduled automation run row. Returns undefined for an invalid row. */
365
398
  function parseScheduledRunRow(row) {
366
- const parsed = retainedScheduledRunSchema.safeParse(row.record);
367
- if (!parsed.success) return void 0;
368
- const { idempotencyKey: _idempotencyKey, taskVersion: _taskVersion, ...run } = parsed.data;
369
- return run;
399
+ const parsed = scheduledRunSchema.safeParse({
400
+ id: row.id,
401
+ attempt: row.attempt,
402
+ claimedAtMs: row.claimedAtMs,
403
+ completedAtMs: row.completedAtMs ?? void 0,
404
+ dispatchId: row.dispatchId ?? void 0,
405
+ errorMessage: row.errorMessage ?? void 0,
406
+ resultMessageTs: row.resultMessageTs ?? void 0,
407
+ scheduledForMs: row.scheduledForMs,
408
+ startedAtMs: row.startedAtMs ?? void 0,
409
+ status: row.status,
410
+ taskId: row.automationId
411
+ });
412
+ return parsed.success ? parsed.data : void 0;
370
413
  }
371
414
  function present(value) {
372
415
  return value !== void 0;
373
416
  }
374
417
  async function readRun(db, runId) {
375
- const rows = await db.select({ record: juniorSchedulerRuns.record }).from(juniorSchedulerRuns).where(eq(juniorSchedulerRuns.id, runId)).limit(1);
418
+ const rows = await db.select().from(juniorAutomationRuns).where(eq(juniorAutomationRuns.id, runId)).limit(1);
376
419
  return rows[0] ? parseScheduledRunRow(rows[0]) : void 0;
377
420
  }
378
421
  async function writeRun(db, run) {
379
422
  const stored = scheduledRunSchema.parse(run);
380
- await db.insert(juniorSchedulerRuns).values({
381
- id: stored.id,
382
- record: stored,
423
+ const columns = {
424
+ attempt: stored.attempt,
425
+ automationId: stored.taskId,
426
+ claimedAtMs: stored.claimedAtMs,
427
+ completedAtMs: stored.completedAtMs ?? null,
428
+ conversationId: stored.dispatchId ? existingConversationId(getDispatchConversationId({ id: stored.dispatchId })) : null,
429
+ dispatchId: stored.dispatchId ?? null,
430
+ errorMessage: stored.errorMessage ?? null,
431
+ resultMessageTs: stored.resultMessageTs ?? null,
383
432
  scheduledForMs: stored.scheduledForMs,
384
- status: stored.status,
385
- taskId: stored.taskId
433
+ startedAtMs: stored.startedAtMs ?? null,
434
+ status: stored.status
435
+ };
436
+ await db.insert(juniorAutomationRuns).values({
437
+ id: stored.id,
438
+ ...columns
386
439
  }).onConflictDoUpdate({
387
- target: juniorSchedulerRuns.id,
388
- set: {
389
- record: sql`excluded.record`,
390
- scheduledForMs: sql`excluded.scheduled_for_ms`,
391
- status: sql`excluded.status`,
392
- taskId: sql`excluded.task_id`
393
- }
440
+ target: juniorAutomationRuns.id,
441
+ set: columns
394
442
  });
395
443
  }
396
444
  async function listIncompleteRunsForTaskIds(db, taskIds) {
397
445
  if (taskIds.length === 0) return [];
398
- return (await db.select({ record: juniorSchedulerRuns.record }).from(juniorSchedulerRuns).where(and(inArray(juniorSchedulerRuns.taskId, taskIds), inArray(juniorSchedulerRuns.status, [...INCOMPLETE_RUN_STATUSES]))).orderBy(asc(juniorSchedulerRuns.scheduledForMs), asc(juniorSchedulerRuns.id))).map(parseScheduledRunRow).filter(present);
446
+ return (await db.select().from(juniorAutomationRuns).where(and(inArray(juniorAutomationRuns.automationId, taskIds), inArray(juniorAutomationRuns.status, [...INCOMPLETE_RUN_STATUSES]))).orderBy(asc(juniorAutomationRuns.scheduledForMs), asc(juniorAutomationRuns.id))).map(parseScheduledRunRow).filter(present);
399
447
  }
400
448
  /** List incomplete runs for retained scheduled automations. */
401
449
  async function listIncompleteScheduledRuns(db) {
@@ -695,15 +743,6 @@ function shouldSkipRun(task, run) {
695
743
  if (task.status !== "active") return `Scheduled automation ${task.id} was ${task.status} before the run started.`;
696
744
  if (task.nextRunAtMs !== run.scheduledForMs && task.runNowAtMs !== run.scheduledForMs) return `Scheduled automation ${task.id} no longer targets ${new Date(run.scheduledForMs).toISOString()}.`;
697
745
  }
698
- async function recordScheduledExecution(args) {
699
- const dispatchId = args.run.dispatchId;
700
- await recordAutomationExecution("scheduled", args.run.taskId, {
701
- ...dispatchId ? { conversationId: getDispatchConversationId({ id: dispatchId }) } : void 0,
702
- executionId: args.run.id,
703
- nowMs: args.nowMs,
704
- status: args.status
705
- });
706
- }
707
746
  async function logRunOutcome(args) {
708
747
  const task = args.task ?? await readScheduledAutomation(args.db, args.run.taskId);
709
748
  if (!task) {
@@ -735,11 +774,6 @@ async function applyDispatchResult(args) {
735
774
  run: args.run,
736
775
  status: "completed"
737
776
  });
738
- await recordScheduledExecution({
739
- nowMs: args.nowMs,
740
- run: args.run,
741
- status: "completed"
742
- });
743
777
  await logRunOutcome({
744
778
  eventName: "scheduled_automation.run.completed",
745
779
  run: completed,
@@ -766,11 +800,6 @@ async function applyDispatchResult(args) {
766
800
  kind: "scheduled",
767
801
  reason: blocked.errorMessage ?? "Dispatch blocked."
768
802
  });
769
- await recordScheduledExecution({
770
- nowMs: args.nowMs,
771
- run: args.run,
772
- status: "blocked"
773
- });
774
803
  await logRunOutcome({
775
804
  eventName: "scheduled_automation.run.blocked",
776
805
  run: blocked,
@@ -793,11 +822,6 @@ async function applyDispatchResult(args) {
793
822
  run: args.run,
794
823
  status: "failed"
795
824
  });
796
- await recordScheduledExecution({
797
- nowMs: args.nowMs,
798
- run: args.run,
799
- status: "failed"
800
- });
801
825
  await logRunOutcome({
802
826
  eventName: "scheduled_automation.run.failed",
803
827
  run: failed,
@@ -830,11 +854,6 @@ async function finishClaimedRun(args) {
830
854
  kind: "scheduled",
831
855
  reason: args.errorMessage
832
856
  });
833
- await recordScheduledExecution({
834
- nowMs: args.nowMs,
835
- run: args.run,
836
- status: args.status
837
- });
838
857
  await logRunOutcome({
839
858
  eventName: args.status === "blocked" ? "scheduled_automation.run.blocked" : "scheduled_automation.run.failed",
840
859
  run: finished,
@@ -842,9 +861,13 @@ async function finishClaimedRun(args) {
842
861
  extras: { "app.task.run.error": args.errorMessage }
843
862
  });
844
863
  }
845
- /** Reconcile completed dispatches and enqueue a bounded batch of due tasks. */
864
+ /**
865
+ * Settle finished runs of both Automation kinds, then enqueue a bounded batch
866
+ * of due Scheduled automations.
867
+ */
846
868
  async function runScheduledAutomationHeartbeat(args) {
847
869
  const db = getDb();
870
+ await settleEventAutomationRuns(db, args.nowMs);
848
871
  let processedCount = 0;
849
872
  let dispatchCount = 0;
850
873
  for (const run of await listIncompleteScheduledRuns(db)) {
@@ -2069,7 +2092,7 @@ async function ingestEventAutomations(input, options) {
2069
2092
  allowedWhen: "event-automation",
2070
2093
  taskId: task.id
2071
2094
  } : void 0;
2072
- if ((await dispatchEventAutomation({
2095
+ const dispatch = await dispatchEventAutomation({
2073
2096
  conversationWorkQueue: options.queue,
2074
2097
  nowMs,
2075
2098
  options: {
@@ -2082,7 +2105,13 @@ async function ingestEventAutomations(input, options) {
2082
2105
  replyAttribution: automationReplyAttribution(task.title),
2083
2106
  outcomes
2084
2107
  }
2085
- })).status === "created") dispatched += 1;
2108
+ });
2109
+ await recordEventAutomationRunStarted(db, {
2110
+ automationId: task.id,
2111
+ dispatchId: dispatch.id,
2112
+ nowMs
2113
+ });
2114
+ if (dispatch.status === "created") dispatched += 1;
2086
2115
  } catch (error) {
2087
2116
  errors.push(error);
2088
2117
  }
@@ -1,4 +1,4 @@
1
- import { lt as extractAssistantText } from "./tasks-DwGlFX9i.js";
1
+ import { lt as extractAssistantText } from "./tasks-DThIG7F-.js";
2
2
  //#region src/chat/no-reply.ts
3
3
  const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as completeObject } from "./client-ROZeVjq0.js";
1
+ import { r as completeObject } from "./client-CRVXpEWi.js";
2
2
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
3
3
  import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-T18Xlkx9.js";
4
4
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C04mP1hu.js";
@@ -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-DNNkxfGS.js").then((n) => n.r);
272
+ const { botConfig } = await import("./config-B7joRWt7.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-CeEpPna6.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-BO2LM2oW.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();