@sentry/junior 0.275.0 → 0.277.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 (80) hide show
  1. package/dist/{adapter-dE2BiWP_.js → adapter-BtfBHVM5.js} +1 -1
  2. package/dist/{admin-CkPaAYuZ.js → admin-DzAKbZsm.js} +1 -1
  3. package/dist/{agent-invocations-C1RNOCs8.js → agent-invocations-Crs3XHhg.js} +6 -1
  4. package/dist/{agent-runner-bE7aH7ew.js → agent-runner-BsYAbniN.js} +394 -244
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.d.ts +13 -2
  8. package/dist/api.js +186 -68
  9. package/dist/{app-CgkquhZ8.d.ts → app-BjEQwNVP.d.ts} +11 -3
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +227 -112
  12. package/dist/{assistant-reply-CjRU9Z59.js → assistant-reply-NebRGG4G.js} +1 -1
  13. package/dist/{automation-BGrd03QO.js → automation-Cql9h2vO.js} +42 -13
  14. package/dist/{background-compaction-queue-BYuOt3qK.js → background-compaction-queue-hh18yCeU.js} +2 -2
  15. package/dist/{briefs-6xUvmGos.js → briefs-BBo0Eimi.js} +4 -4
  16. package/dist/{catalog-runtime-DcJ5NHDW.js → catalog-runtime-DE-F4Awo.js} +1 -1
  17. package/dist/cli/chat.d.ts +1 -1
  18. package/dist/cli/chat.js +14 -14
  19. package/dist/cli/check.js +3 -3
  20. package/dist/cli/main.js +3 -3
  21. package/dist/cli/plugins.d.ts +1 -1
  22. package/dist/cli/plugins.js +4 -4
  23. package/dist/cli/snapshot-create.js +4 -4
  24. package/dist/cli/upgrade.d.ts +2 -2
  25. package/dist/cli/upgrade.js +3 -3
  26. package/dist/{client-gnKpkpqP.js → client-DZ8HTnYH.js} +2 -2
  27. package/dist/{config-D0GKc9sC.js → config-D5uUtrCP.js} +2 -2
  28. package/dist/{connections-DLqP5Bp1.js → connections-Do24CGP5.js} +14 -14
  29. package/dist/{conversation-BjTo9ZFL.js → conversation-SsASlWL7.js} +35 -12
  30. package/dist/{conversation-privacy-BCXFshP9.js → conversation-privacy-VuylvlKr.js} +1 -1
  31. package/dist/{credential-sync-BjihXFF2.js → credential-sync-BGQK3pOa.js} +13 -13
  32. package/dist/{db-BMZhoYKj.d.ts → db-DEiwO5Sh.d.ts} +1 -1
  33. package/dist/{executor-j8VMt-To.js → executor-hPfFTH0C.js} +13 -5
  34. package/dist/instrumentation.d.ts +14 -0
  35. package/dist/instrumentation.js +29 -6
  36. package/dist/{logging-CFHIO4Vs.js → logging-cI3T1dNc.js} +4 -2
  37. package/dist/{message-DH0cqFRS.js → message-DBwsAl7O.js} +9 -9
  38. package/dist/nitro.d.ts +2 -2
  39. package/dist/nitro.js +7 -3
  40. package/dist/{oauth-callback-server-BgU4EZsJ.js → oauth-callback-server-DXrnbplb.js} +2 -2
  41. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
  42. package/dist/{projection-CTvLSwcm.js → projection-7EFIqzuj.js} +4108 -3898
  43. package/dist/{prompt-JEWUUpLW.js → prompt-oRfGsxd3.js} +1 -1
  44. package/dist/{registry-OsyWR4GO.js → registry-Bzefs7kT.js} +24 -8
  45. package/dist/{resolve-DCrKjmVP.js → resolve-CuiEY_2u.js} +3 -3
  46. package/dist/{result-Btdt5bSl.js → result-DrcUtFaD.js} +9 -9
  47. package/dist/{runner-C1AwS93W.js → runner-CDE4CZ52.js} +12 -12
  48. package/dist/{sandbox-egress-signals-C-5i7Zxm.js → sandbox-egress-signals-0tcmGd13.js} +1 -1
  49. package/dist/{schema-DfdHlBnb.d.ts → schema-B6N2nc6v.d.ts} +108 -15
  50. package/dist/{schema-CX9XGKCm.js → schema-Dzi3lkdP.js} +25 -8
  51. package/dist/{service-account-DZX1KlQl.js → service-account-BOz9pqOE.js} +3 -3
  52. package/dist/{service-account-CQIW6At4.js → service-account-DIyz_9Uh.js} +3 -3
  53. package/dist/{session-stop-DjIyORJw.js → session-stop-0juF_BP0.js} +159 -55
  54. package/dist/{skills-BEfAAT6p.js → skills-CU5Is147.js} +2 -2
  55. package/dist/{spawn-Dgj4xxvO.js → spawn-6C9jHH4b.js} +2 -2
  56. package/dist/{stop-DomyNvuv.js → stop-6FVG1c-r.js} +487 -203
  57. package/dist/{store-Dp3RMEQd.js → store-DKs1WwdB.js} +3 -3
  58. package/dist/{store-B7Z6zIc7.js → store-DtHZviJ1.js} +11 -9
  59. package/dist/{task-queue-CVQ9cWnC.js → task-queue-CcvFQE_p.js} +3 -3
  60. package/dist/{task-runner-DHBG47gS.js → task-runner-DBkNejLl.js} +6 -6
  61. package/dist/{thread-state-BF8VwIxd.js → thread-state-4hjEIkIq.js} +4 -4
  62. package/dist/{turn-failure-response-Di7TbgsF.js → turn-failure-response-BZNLydC3.js} +7 -7
  63. package/dist/{turn-lifecycle-DzXwXmLg.js → turn-lifecycle-BhqYjaa4.js} +6 -1
  64. package/dist/{turn-session-routing-CIWhXKeT.js → turn-session-routing-jnLOfBHJ.js} +17 -16
  65. package/dist/{validation-BRmwRaXc.js → validation-BUFmsnKs.js} +1 -1
  66. package/dist/{version-DBVMsgvA.js → version-DJTk0ZCE.js} +1 -1
  67. package/dist/version.js +1 -1
  68. package/dist/{viewer-BFADRGP8.js → viewer-WY0RYE4E.js} +53 -15
  69. package/dist/{work-DDaoxZAw.js → work-C5AKvXJV.js} +30 -12
  70. package/dist/{worker-Bub0fDtW.js → worker-BcYVDVUy.js} +6 -6
  71. package/migrations/0073_conversation_quick_question.sql +1 -0
  72. package/migrations/0074_conversation_participant_pins.sql +1 -0
  73. package/migrations/0075_conversation_detail_version.sql +1 -0
  74. package/migrations/0076_conversation_auto_archive.sql +5 -0
  75. package/migrations/meta/0073_snapshot.json +4070 -0
  76. package/migrations/meta/0074_snapshot.json +4076 -0
  77. package/migrations/meta/0075_snapshot.json +4299 -0
  78. package/migrations/meta/0076_snapshot.json +4363 -0
  79. package/migrations/meta/_journal.json +29 -1
  80. package/package.json +5 -4
@@ -1,35 +1,35 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { $ as loadTurnCheckpoint, $a as resolveUserTimezone, $i as runWithSlackInstallationToken, $r as uploadFilesToConversation, An as createPluginHookRunner, Ar as getSandboxProvider, B as createPluginEgress, Br as normalizeSlackReplyMarkdown, Bt as TurnSliceLimitExceededError, Ca as sandboxSkillPathResolution, Ci as getSlackToolContext, Cr as loadSnapshotsForProfile, D as fallbackShortTitle, Di as STOP_WATCHING_TOOL_NAME, Dn as getOAuthAccountProviders, Dr as hash, Ei as RESOURCE_WATCH_TOOL_SOURCE, En as createUserTokenStore, Er as create, Fi as getWatch, Fn as getPluginTools, G as AuthorizationFlowDisabledError, Gi as SlackActionError, Gr as deleteSlackMessage, Gt as CODEMODE_TOOL_NAME, H as createPluginAuthOrchestration, Hr as slackMention, Ii as listWatches, In as getPluginUserPromptContributions, Ir as resolveBaseUrl, J as canReusePendingAuthLink, Ja as saveObjectAnnotations, Jn as getReviewItem, Jt as getPiMessageRole, K as AuthorizationPauseError, Ki as downloadPrivateSlackFile, Kn as dismissOpenReviewItems, Kr as getSlackMessagePermalink, Ln as getPlugins, Mi as createWatch, Ni as deliverWatch, Nr as deliverOAuthAuthorization, O as resolveTaskTitle, Oi as cancelSubscriptions, Or as isStale, Pi as findMatchingWatches, Pn as getPluginSystemPromptContributions, Pr as formatProviderLabel, Q as continuableMessages, Qa as defaultTimezone, Qi as normalizeSlackConversationId, Qn as searchReviewItems, Qr as updateSlackMessage, Qt as hasRuntimeTurnContext, Rr as escapeSlackMrkdwnText, Rt as TURN_LIMIT_WRAP_UP_MESSAGE, Sa as sandboxSkillFile, Si as resolveChannelCapabilities, Sn as getAgentContextInputLimitTokens, Sr as invalidateReadySnapshot, Ti as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, Tr as setWorkspaceSnapshotBuild, U as authorizationId, Ut as createTurnLimitGate, V as PluginCredentialFailureError, Vt as TurnToolCallLimitExceededError, W as AuthPausePersistenceError, Wa as matchSlackAttachments, Wn as closeReviewItem, Wr as addReactionToMessage, Wt as isTurnExecutionLimitExceededError, Xi as isConversationScopedChannel, Xr as postSlackMessage, Xt as getUserMessageInstructionText, Ya as createPluginAnnotations, Yi as getSlackClient, Yn as insertReviewItem, Yt as getTerminalAssistantMessages, Zt as hasCurrentInstruction, _a as SANDBOX_JUNIOR_ROOT, _i as resolveSandboxCommandEnvironment, _r as getWorkspaceByName, a as loadLastModelProfile, aa as getDashboardConversationLink, ai as wrapSandboxSetupError, an as normalizeToolNameFromResult, ao as piMessageFromHistoryItem, ba as SANDBOX_WORKSPACE_ROOT, bi as tryWorkspaceRepoCheckoutPath, bn as getAgentBackgroundCompactionMarkTokens, br as updateWorkspace, c as loadTurnRoute, ca as getDashboardTaskLink, ci as isWorkspaceSnapshotNotReadyError, cn as trimTrailingAssistantMessages, co as conversationNoteEvent, cr as requireReviewItemLinks, d as recordAttachmentsDelivered, da as PluginToolDeniedError, di as consumeSandboxEgressAuthRequiredSignal, dn as TURN_CONTEXT_TAG, dr as automationCreatorUserId, ea as withSlackRetries, en as isAssistantMessage, er as updateReviewItemContent, et as saveTurnCheckpoint, fa as buildCommandScript, fi as consumeSandboxEgressPermissionDeniedSignal, fr as resolveAssignee, g as recordMcpProviderConnected, ga as SANDBOX_DATA_ROOT, gi as buildSandboxEgressNetworkPolicy, gr as getWorkspace, h as recordGuardianActionReviewed, ha as SANDBOX_COMMAND_PATH, hr as deleteWorkspace, i as loadConversationProjection, ii as throwSandboxOperationError, in as isToolResultMessage, io as historyItemFromPiMessage, ir as canReadReviewItem, ji as createTimerWatch, ki as cancelWatch, kr as ensureDockerDaemon, l as openConversationProjection, li as workspaceSnapshotNotReadyUserMessage, ln as REQUEST_CONTEXT_SECTION_TAG, lo as getConfigDefaults, m as recordAuthorizationRequested, ma as runNonInteractiveCommand, mr as createWorkspace, ni as isAbortError, nn as isStandaloneRuntimeContextMessage, oi as WorkspaceSnapshotNotReadyError, on as retainRuntimeTurnContext, oo as projectConversationEvents, or as readReviewItemAgentScope, pa as buildNonInteractiveShellScript, pi as createSandboxEgressCredentialToken, pn as buildDeterministicTurnId, pr as resolveAssignees, q as abandonReplacedPendingAuth, qi as getFilePermalink, qn as getOpenReviewItemByDedupeKey, qr as openSlackDirectMessage, qt as extractAssistantText, r as loadConnectedMcpProviders, ri as isAlreadyExistsError, rn as isToolResultError, rr as canAgentChangeReviewItem, sa as getDashboardReviewItemLink, si as getWorkspaceSnapshotNotReadyError, sn as stripRuntimeTurnContext, so as JUNIOR_NATIVE_EVENT_NAMESPACE, sr as requireReviewItemAssignees, ta as sleep, tn as isContinuablePiBoundary, tr as PLUGIN_REVIEW_ITEM_KEY_PREFIX, u as recordAgentsInstructionsUpdated, ua as ToolInputError, ui as clearSandboxEgressSignals, un as SESSION_CONTEXT_SECTION_TAG, ur as EVERYONE_ASSIGNEE, v as recordToolExecutionStarted, va as SANDBOX_REPOS_ROOT, vn as calculateContextCompactionTargetTokens, vr as listWorkspaces, wi as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, wn as isExperimentalFeatureEnabled, wr as setWorkspaceSnapshot, xa as sandboxSkillDir, xi as workspaceRepoCheckoutPath, xn as getAgentContextCompactionTriggerTokens, xr as WorkspaceValidationError, y as recordTurnRoute, ya as SANDBOX_SKILLS_ROOT, yi as SANDBOX_RUNTIME, yn as estimateTextTokens, zt as TurnBudgetExceededError } from "./projection-CTvLSwcm.js";
3
- import { S as resolveGatewayCredential, _ as findProviderError, a as completeText, b as isProviderRetryError, c as resolveGatewayModel, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeObject, l as COMPACTION_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, p as unwrapCurrentInstruction, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as getGatewayApiKey } from "./client-gnKpkpqP.js";
4
- import { _ as normalizeSlackEmojiName, n as botConfig } from "./config-D0GKc9sC.js";
5
- import { C as summarizeMessageText, E as withSpan, H as isRecord$4, R as runWithLogAttributes, S as setTags, T as withLogContext, V as normalizeIdentityEmail, W as toOptionalString, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, f as logError, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, l as getLogContextAttributesForSpan, m as logInfo, p as logException, u as getTracePropagationHeaders, v as serializeGenAiAttribute, x as setSpanStatus } from "./logging-CFHIO4Vs.js";
2
+ import { $ as loadTurnCheckpoint, $i as wrapSandboxSetupError, $r as getWorkspaceByName, Aa as buildNonInteractiveShellScript, An as getOAuthAccountProviders, Ar as findMatchingWatches, B as createPluginEgress, Bi as getFilePermalink, Bn as getPlugins, Bt as TurnSliceLimitExceededError, Ca as SANDBOX_REPOS_ROOT, Cn as getAgentContextInputLimitTokens, Cr as STOP_WATCHING_TOOL_NAME, D as fallbackShortTitle, Da as sandboxSkillFile, Di as deleteSlackMessage, Dn as createUserTokenStore, Dr as createTimerWatch, Ea as sandboxSkillDir, Ei as addReactionToMessage, Fi as uploadFilesToConversation, G as AuthorizationFlowDisabledError, Gi as normalizeSlackConversationId, Gr as getDashboardTaskLink, Gt as CODEMODE_TOOL_NAME, H as createPluginAuthOrchestration, Hi as getSlackClient, Hr as getDashboardConversationLink, J as canReusePendingAuthLink, Jt as getPiMessageRole, K as AuthorizationPauseError, Ki as runWithSlackInstallationToken, Ln as getPluginSystemPromptContributions, Mi as postSlackMessage, Mr as listWatches, Nn as createPluginHookRunner, O as resolveTaskTitle, Oa as sandboxSkillPathResolution, Oi as getSlackMessagePermalink, On as findLegacyWebActorUserId, Or as createWatch, Pi as updateSlackMessage, Q as continuableMessages, Qi as throwSandboxOperationError, Qn as insertReviewItem, Qr as getWorkspace, Qt as hasRuntimeTurnContext, Ri as SlackActionError, Rn as getPluginTools, Rt as TURN_LIMIT_WRAP_UP_MESSAGE, Sa as SANDBOX_JUNIOR_ROOT, Si as normalizeSlackReplyMarkdown, Sn as getAgentContextCompactionTriggerTokens, Sr as RESOURCE_WATCH_TOOL_SOURCE, Ta as SANDBOX_WORKSPACE_ROOT, Tn as isExperimentalFeatureEnabled, Tr as cancelWatch, U as authorizationId, Ui as isConversationScopedChannel, Ut as createTurnLimitGate, V as PluginCredentialFailureError, Vt as TurnToolCallLimitExceededError, W as AuthPausePersistenceError, Wr as getDashboardReviewItemLink, Wt as isTurnExecutionLimitExceededError, Xi as isAbortError, Xn as getOpenReviewItemByDedupeKey, Xr as createWorkspace, Xt as getUserMessageInstructionText, Yn as dismissOpenReviewItems, Yr as renderToolResultNudge, Yt as getTerminalAssistantMessages, Za as matchSlackAttachments, Zi as isAlreadyExistsError, Zn as getReviewItem, Zr as deleteWorkspace, Zt as hasCurrentInstruction, _a as PluginToolDeniedError, _r as resolveAssignees, a as loadLastModelProfile, aa as consumeSandboxEgressAuthRequiredSignal, ai as loadSnapshotsForProfile, an as normalizeToolNameFromResult, ao as defaultTimezone, ba as SANDBOX_COMMAND_PATH, bi as escapeSlackMrkdwnText, bn as estimateTextTokens, br as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, c as loadTurnRoute, ci as create, cn as trimTrailingAssistantMessages, d as recordAttachmentsDelivered, da as resolveSandboxCommandEnvironment, di as ensureDockerDaemon, dn as TURN_CONTEXT_TAG, do as historyItemFromPiMessage, dr as requireReviewItemLinks, ea as WorkspaceSnapshotNotReadyError, ei as listWorkspaces, en as isAssistantMessage, et as saveTurnCheckpoint, fi as getSandboxProvider, fo as piMessageFromHistoryItem, g as recordMcpProviderConnected, ga as workspaceRepoCheckoutPath, gi as formatProviderLabel, go as getConfigDefaults, gr as resolveAssignee, h as recordGuardianActionReviewed, ha as tryWorkspaceRepoCheckoutPath, hi as deliverOAuthAuthorization, ho as conversationNoteEvent, hr as automationCreatorUserId, i as loadConversationProjection, ia as clearSandboxEgressSignals, ii as invalidateReadySnapshot, in as isToolResultMessage, ir as PLUGIN_REVIEW_ITEM_KEY_PREFIX, ja as runNonInteractiveCommand, jr as getWatch, ka as buildCommandScript, ki as openSlackDirectMessage, kr as deliverWatch, l as openConversationProjection, li as hash, ln as REQUEST_CONTEXT_SECTION_TAG, lr as readReviewItemAgentScope, m as recordAuthorizationRequested, ma as sleep, mo as JUNIOR_NATIVE_EVENT_NAMESPACE, mr as EVERYONE_ASSIGNEE, na as isWorkspaceSnapshotNotReadyError, ni as updateWorkspace, nn as isStandaloneRuntimeContextMessage, no as createPluginAnnotations, oa as consumeSandboxEgressPermissionDeniedSignal, oi as setWorkspaceSnapshot, on as retainRuntimeTurnContext, oo as resolveUserTimezone, or as canAgentChangeReviewItem, pa as SANDBOX_RUNTIME, pn as buildDeterministicTurnId, po as projectConversationEvents, q as abandonReplacedPendingAuth, qi as withSlackRetries, qn as closeReviewItem, qr as ToolInputError, qt as extractAssistantText, r as loadConnectedMcpProviders, ra as workspaceSnapshotNotReadyUserMessage, ri as WorkspaceValidationError, rn as isToolResultError, rr as updateReviewItemContent, sa as createSandboxEgressCredentialToken, si as setWorkspaceSnapshotBuild, sn as stripRuntimeTurnContext, sr as canReadReviewItem, ta as getWorkspaceSnapshotNotReadyError, tn as isContinuablePiBoundary, to as saveObjectAnnotations, tr as searchReviewItems, u as recordAgentsInstructionsUpdated, ua as buildSandboxEgressNetworkPolicy, ui as isStale, un as SESSION_CONTEXT_SECTION_TAG, ur as requireReviewItemAssignees, v as recordToolExecutionStarted, vi as resolveBaseUrl, vn as calculateContextCompactionTargetTokens, vr as resolveChannelCapabilities, wa as SANDBOX_SKILLS_ROOT, wi as slackMention, wr as cancelSubscriptions, xa as SANDBOX_DATA_ROOT, xn as getAgentBackgroundCompactionMarkTokens, xr as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, y as recordTurnRoute, yn as estimateRequestOverheadTokens, yr as getSlackToolContext, zi as downloadPrivateSlackFile, zn as getPluginUserPromptContributions, zt as TurnBudgetExceededError } from "./projection-7EFIqzuj.js";
3
+ import { S as resolveGatewayCredential, _ as findProviderError, a as completeText, b as isProviderRetryError, c as resolveGatewayModel, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeObject, l as COMPACTION_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, p as unwrapCurrentInstruction, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as getGatewayApiKey } from "./client-DZ8HTnYH.js";
4
+ import { _ as normalizeSlackEmojiName, n as botConfig } from "./config-D5uUtrCP.js";
5
+ import { B as runWithLogAttributes, C as summarizeMessageText, E as withSpan, K as toOptionalString, S as setTags, T as withLogContext, U as normalizeIdentityEmail, W as isRecord$4, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, d as logAudit, f as logError, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, l as getLogContextAttributesForSpan, m as logInfo, p as logException, u as getTracePropagationHeaders, v as serializeGenAiAttribute, x as setSpanStatus } from "./logging-cI3T1dNc.js";
6
6
  import { g as withActiveSpan, i as getActiveSpan, m as startInactiveSpan } from "./sentry-MDkYAVPV.js";
7
- 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-BCXFshP9.js";
7
+ 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-VuylvlKr.js";
8
8
  import { a as formatModelProfile, c as modelProfileSchema, l as profileConfig, n as ModelProfileNotConfiguredError, o as formatModelProfiles, r as boundProfile, s as modelIdForProfile, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
9
9
  import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, n as createSlackActor, o as isUserActor, p as parseSlackUserId, u as parseSlackChannelId } from "./actor-B4DYygOB.js";
10
- import { $ as sameDestination, C as getSqlExecutor, G as agentTurnCostUsd, J as hasAgentTurnUsage, M as SYSTEM_IDENTITY_ID, N as resolveActorIdentityId, S as getDb, W as addAgentTurnUsage, Z as parseDestination, a as readActorIdentityFromSql, b as getConversationMessageSearchStore, f as identityAvatarUrl, h as readUserAvatarUrls, i as readActorIdentity, x as getConversationStore, y as getConversationEventStore } from "./viewer-BFADRGP8.js";
11
- import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
12
- import { E as juniorArtifacts, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, d as juniorAutomations, f as juniorStats, l as juniorAutomationRuns, s as juniorReviewItemSlackCards } from "./executor-j8VMt-To.js";
10
+ import { C as getSqlExecutor, J as agentTurnCostUsd, K as touchConversationDetail, M as SYSTEM_IDENTITY_ID, N as resolveActorIdentityId, S as getDb, W as conversationDetailTouch, Z as hasAgentTurnUsage, a as readActorIdentityFromSql, b as getConversationMessageSearchStore, et as parseDestination, f as identityAvatarUrl, h as readUserAvatarUrls, i as readActorIdentity, nt as sameDestination, q as addAgentTurnUsage, x as getConversationStore, y as getConversationEventStore } from "./viewer-WY0RYE4E.js";
11
+ import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
12
+ import { E as juniorArtifacts, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, d as juniorAutomations, f as juniorStats, l as juniorAutomationRuns, s as juniorReviewItemSlackCards } from "./executor-hPfFTH0C.js";
13
13
  import { _ as sameActorIdentity, g as instructionProvenanceFor, h as instructionActors, i as KNOWN_CONVERSATION_EVENT_TYPES, m as contextProvenance, n as detectImageMediaType, p as agentInstructionProvenance, r as isVisionImageMediaType } from "./media-DstkkoNP.js";
14
14
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJBompdd.js";
15
- import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, s as OAuthProviderError } from "./registry-OsyWR4GO.js";
16
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DcJ5NHDW.js";
17
- import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-BEfAAT6p.js";
15
+ import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, s as OAuthProviderError } from "./registry-Bzefs7kT.js";
16
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DE-F4Awo.js";
17
+ import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-CU5Is147.js";
18
18
  import { a as withLock, i as fenceLock } from "./locks-D-0h111u.js";
19
- import { r as getStateAdapter } from "./adapter-dE2BiWP_.js";
19
+ import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
20
20
  import { i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
21
- import { J as briefOutcomeStatusSchema, V as removedCardSchema, Y as conversationBriefSchema, q as briefLinkSchema } from "./conversation-BjTo9ZFL.js";
22
- import { r as EVENT_AUTHOR_ID } from "./prompt-JEWUUpLW.js";
23
- import { A as AgentMessagePausedError, F as CHILD_AGENT_RESULTS, I as PARENT_AGENT_TARGET, J as isTurnInputCommitLostError, L as agentNameSchema, M as AgentMessageTargetError, N as AgentNameInUseError, R as AGENT_TYPES, U as CooperativeTurnYieldError, V as formatAgentTypes, W as TurnInputCommitLostError, _ as invocationFromRow, d as getAgentInvocationMessageId, g as getLatestAgentInvocationForConversation, h as getChildAgentLockName, j as AgentMessageQueueFullError, k as AgentInvocationLimitError, t as NON_TERMINAL_AGENT_INVOCATION_STATUSES, u as getAgentInvocationIdForResult, v as isTerminalAgentInvocation } from "./store-B7Z6zIc7.js";
24
- import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-CjRU9Z59.js";
25
- import { E as resolveSlackReplyTarget, L as readAutomationResult, M as FINISH_AUTOMATION_RUN_TOOL_NAME, N as automationResultSchema$1, R as remindMissingAutomationResult, _ as slackChannelMessageTrigger, a as EVENT_WAIT_MS, b as workspaceSnapshotFinishedEvent, d as getEventCatalog, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_FAILED_EVENT, x as workspaceSnapshotWatch, y as WORKSPACE_SNAPSHOT_READY_EVENT } from "./session-stop-DjIyORJw.js";
21
+ import { B as removedCardSchema, J as conversationBriefSchema, K as briefLinkSchema, q as briefOutcomeStatusSchema } from "./conversation-SsASlWL7.js";
22
+ import { r as EVENT_AUTHOR_ID } from "./prompt-oRfGsxd3.js";
23
+ import { A as AgentInvocationLimitError, G as TurnInputCommitLostError, H as formatAgentTypes, I as CHILD_AGENT_RESULTS, L as PARENT_AGENT_TARGET, M as AgentMessageQueueFullError, N as AgentMessageTargetError, P as AgentNameInUseError, R as agentNameSchema, W as CooperativeTurnYieldError, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, d as getAgentInvocationIdForResult, f as getAgentInvocationMessageId, g as getChildAgentLockName, j as AgentMessagePausedError, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, v as invocationFromRow, y as isTerminalAgentInvocation, z as AGENT_TYPES } from "./store-DtHZviJ1.js";
24
+ import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-NebRGG4G.js";
25
+ import { B as remindMissingAutomationResult, F as automationResultSchema$1, O as resolveSlackReplyTarget, P as FINISH_AUTOMATION_RUN_TOOL_NAME, _ as slackChannelMessageTrigger, a as EVENT_WAIT_MS, b as workspaceSnapshotFinishedEvent, d as getEventCatalog, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_FAILED_EVENT, x as workspaceSnapshotWatch, y as WORKSPACE_SNAPSHOT_READY_EVENT, z as readAutomationResult } from "./session-stop-0juF_BP0.js";
26
26
  import { C as userCustomizationTextSchema, b as webMessageId, g as formatUserInputAnswer, h as buttonUserInputField, m as USER_INPUT_NOTE, p as USER_INPUT_LIMITS, s as sumUtcHoursIntoSixHours, v as normalizeUserInputAnswer, x as USER_CUSTOMIZATION_MAX_CHARS, y as userInputRequestSchema } from "./reporting-window-DgHgwQB3.js";
27
- import { a as setSnapshotSpanAttributes, i as postinstall, n as resolve$1, r as dependencies, s as getSandboxResources } from "./resolve-DCrKjmVP.js";
28
- import { f as QUEUE_SIGNATURE_MAX_AGE_MS, g as getTurnRequestDeadline, l as getVercelConversationWorkQueue, n as backgroundCompactionId, o as sendNextWorkspaceSnapshotJob, s as sendWorkspaceSnapshotJob } from "./background-compaction-queue-BYuOt3qK.js";
29
- import { D as stopConversationWork, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage } from "./store-Dp3RMEQd.js";
30
- import { $ as saveEventAutomation, A as readAutomationRuns, B as readScheduledAutomation, C as readAutomationExecutionByConversationId, Ct as requireEventIdentifier, D as readAutomationExecutionStatusHours, E as readAutomationExecutionStatusDays, I as createScheduledAutomation, J as deleteEventAutomation, L as deleteScheduledAutomation, O as readAutomationExecutionSummaries, Q as parseEventAutomationRow, St as registeredResourceTypeSchema, T as readAutomationExecutionHours, V as saveScheduledAutomation, X as getEventAutomation, Z as listDeletedEventAutomationsCreatedBy, _t as eventWatchUnavailable, at as listAutomationVersions, bt as registeredEventTriggerProblems, c as getDispatchIdForConversation, et as setEventAutomationStatus, ft as automationEventCatalog, gt as eventNamespaceSchema, k as readAutomationExecutions, l as getDispatchInputMessageId, lt as automationRevision, ot as readAutomationVersion, pt as describeRegisteredEventTrigger, q as createEventAutomation, rt as automationDefinition, st as sameDefinitionValue, t as resolveConversationRouting, u as getDispatchRecord, ut as requireAutomationRevision, vt as hasEventCatalogEntries, w as readAutomationExecutionDays, wt as requireValidEventTrigger, x as emptyAutomationRunWindows, xt as registeredEventTypeSchema, yt as registeredEventMatchSchema, z as parseScheduledAutomationRow } from "./turn-session-routing-CIWhXKeT.js";
31
- import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-CQIW6At4.js";
32
- import { A as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as taskOutcomeInputSchema, E as automationTitleSchema, F as scheduleIntentSchema, I as weekdaySchema, N as ScheduleIntentError, P as compileScheduleIntent, T as automationInstructionToolSchema, k as eventAutomationTriggerSchema, l as automationListQuerySchema } from "./automation-BGrd03QO.js";
27
+ import { a as setSnapshotSpanAttributes, i as postinstall, n as resolve$1, r as dependencies, s as getSandboxResources } from "./resolve-CuiEY_2u.js";
28
+ import { f as QUEUE_SIGNATURE_MAX_AGE_MS, g as getTurnRequestDeadline, l as getVercelConversationWorkQueue, n as backgroundCompactionId, o as sendNextWorkspaceSnapshotJob, s as sendWorkspaceSnapshotJob } from "./background-compaction-queue-hh18yCeU.js";
29
+ import { D as stopConversationWork, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage } from "./store-DKs1WwdB.js";
30
+ import { $ as saveEventAutomation, A as readAutomationRuns, B as readScheduledAutomation, C as readAutomationExecutionByConversationId, Ct as requireEventIdentifier, D as readAutomationExecutionStatusHours, E as readAutomationExecutionStatusDays, I as createScheduledAutomation, J as deleteEventAutomation, L as deleteScheduledAutomation, O as readAutomationExecutionSummaries, Q as parseEventAutomationRow, St as registeredResourceTypeSchema, T as readAutomationExecutionHours, V as saveScheduledAutomation, X as getEventAutomation, Z as listDeletedEventAutomationsCreatedBy, _t as eventWatchUnavailable, at as listAutomationVersions, bt as registeredEventTriggerProblems, c as getDispatchIdForConversation, et as setEventAutomationStatus, ft as automationEventCatalog, gt as eventNamespaceSchema, k as readAutomationExecutions, l as getDispatchInputMessageId, lt as automationRevision, ot as readAutomationVersion, pt as describeRegisteredEventTrigger, q as createEventAutomation, rt as automationDefinition, st as sameDefinitionValue, t as resolveConversationRouting, u as getDispatchRecord, ut as requireAutomationRevision, vt as hasEventCatalogEntries, w as readAutomationExecutionDays, wt as requireValidEventTrigger, x as emptyAutomationRunWindows, xt as registeredEventTypeSchema, yt as registeredEventMatchSchema, z as parseScheduledAutomationRow } from "./turn-session-routing-jnLOfBHJ.js";
31
+ import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-DIyz_9Uh.js";
32
+ import { A as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as taskOutcomeInputSchema, E as automationTitleSchema, F as scheduleIntentFromTool, I as toolScheduleIntentSchema, L as weekdaySchema, N as ScheduleIntentError, P as compileScheduleIntent, T as automationInstructionToolSchema, k as eventAutomationTriggerSchema, l as automationListQuerySchema } from "./automation-Cql9h2vO.js";
33
33
  import { n as privateTraceResultAttributes } from "./private-trace-result-CE7_lEdq.js";
34
34
  import { streamSimple } from "@earendil-works/pi-ai/compat";
35
35
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -40,9 +40,9 @@ import { AsyncLocalStorage } from "node:async_hooks";
40
40
  import { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
41
41
  import { z } from "zod";
42
42
  import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, notExists, notInArray, or, sql } from "drizzle-orm";
43
- import { PluginToolInputError, createWebSource, eventMatchFieldSchema, eventMatchSchema, eventReachSchema, eventSchema, eventTriggerText, localDestinationSchema, missingToolAnnotationKeys, ownedObjectAnnotationSchema, sourceSchema, stableEventMatchKey, watchResultSchema } from "@sentry/junior-plugin-api";
43
+ import { PluginToolInputError, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, createWebSource, declaredEventKeys, eventMatchFieldSchema, eventSchema, eventTriggerText, localDestinationSchema, missingToolAnnotationKeys, ownedObjectAnnotationSchema, sourceSchema, stableEventMatchKey, watchResultSchema } from "@sentry/junior-plugin-api";
44
44
  import { alias } from "drizzle-orm/pg-core";
45
- import { Agent, estimateContextTokens } from "@earendil-works/pi-agent-core";
45
+ import { Agent, estimateContextTokens, estimateTokens } from "@earendil-works/pi-agent-core";
46
46
  import fs from "node:fs/promises";
47
47
  import fs$1 from "node:fs";
48
48
  import http from "node:http";
@@ -56,8 +56,8 @@ import { Bash, defineCommand } from "just-bash";
56
56
  import { structuredPatch } from "diff";
57
57
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
58
58
  import { Kind } from "@sinclair/typebox";
59
- import https from "node:https";
60
59
  import { NodeHtmlMarkdown } from "node-html-markdown";
60
+ import https from "node:https";
61
61
  import { Value } from "@sinclair/typebox/value";
62
62
  import { CodemodeSandbox, renderToolSignature } from "@earendil-works/pi-codemode";
63
63
  // src/chat/sandbox/skill-sandbox.ts
@@ -1703,7 +1703,7 @@ const SAFETY_RULES = [
1703
1703
  const TOOL_POLICY_RULES = [
1704
1704
  "- Do not use tools to rediscover content already present in the current conversation. For drafting or rewriting with no referenced retrievable source, do not search unrelated memory, history, files, or providers. Put a clear placeholder where a fact that only the person knows goes, and ask for those facts with one `addReviewItem` item.",
1705
1705
  "- Resolve provider action targets before calls: explicit target wins; ambient `<configuration>` fills omitted targets. Treat non-target links/references as context.",
1706
- "- When a tool result includes a subscription, those events are already watched; do not call watchEvents for them. When a tool result includes a subscribable resource with suggestedEvents, use watchEvents only for those remaining events that serve the current intent. If suggestedEvents is empty or omitted, do not invent a watch. Do not create scheduled polling tasks for events a watch can deliver. Write a concise intent summary. Stop only the requested watch by id unless the user explicitly asks to stop every watch in the thread.",
1706
+ "- When a tool result includes a subscription, those events are already watched; do not call watchEvents for them. When a tool result includes a subscribable resource with suggested_events, use watchEvents only for those remaining events that serve the current intent. If suggested_events is empty or omitted, do not invent a watch. Do not create scheduled polling tasks for events a watch can deliver. Write a concise intent summary. Stop only the requested watch by id unless the user explicitly asks to stop every watch in the thread.",
1707
1707
  "- Scheduled and event automations use their creator's connected credentials by default when the requested work needs them. Do not ask for separate confirmation merely to use those credentials.",
1708
1708
  "- Before loading a skill or starting substantial work, decide whether `handoff` or `spawnAgent` fits better than inline work."
1709
1709
  ];
@@ -4690,7 +4690,10 @@ function firstChangedLine(oldLines, newLines) {
4690
4690
  const count = Math.max(oldLines.length, newLines.length);
4691
4691
  for (let index = 0; index < count; index += 1) if (oldLines[index] !== newLines[index]) return index + 1;
4692
4692
  }
4693
- /** Accept common exact-edit argument variants before schema validation. */
4693
+ /**
4694
+ * Accept common exact-edit argument variants, such as the camelCase keys that
4695
+ * models often send, before schema validation.
4696
+ */
4694
4697
  function prepareTextReplacementArguments(input) {
4695
4698
  if (!input || typeof input !== "object") return input;
4696
4699
  const raw = { ...input };
@@ -4700,20 +4703,20 @@ function prepareTextReplacementArguments(input) {
4700
4703
  return raw;
4701
4704
  }
4702
4705
  const edits = Array.isArray(raw.edits) ? [...raw.edits] : [];
4703
- const oldText = raw.oldText ?? raw.old_text;
4704
- const newText = raw.newText ?? raw.new_text;
4706
+ const oldText = raw.old_text ?? raw.oldText;
4707
+ const newText = raw.new_text ?? raw.newText;
4705
4708
  if (typeof oldText === "string" && typeof newText === "string") edits.push({
4706
- oldText,
4707
- newText
4709
+ old_text: oldText,
4710
+ new_text: newText
4708
4711
  });
4709
4712
  if (edits.length > 0) raw.edits = edits.map((edit) => {
4710
4713
  if (!edit || typeof edit !== "object") return edit;
4711
4714
  const record = edit;
4712
- const { old_text, new_text, ...rest } = record;
4715
+ const { oldText, newText, ...rest } = record;
4713
4716
  return {
4714
4717
  ...rest,
4715
- oldText: record.oldText ?? old_text,
4716
- newText: record.newText ?? new_text
4718
+ old_text: record.old_text ?? oldText,
4719
+ new_text: record.new_text ?? newText
4717
4720
  };
4718
4721
  });
4719
4722
  delete raw.oldText;
@@ -4767,19 +4770,19 @@ function buildCompactDiff(oldContent, newContent) {
4767
4770
  function validateAndApplyTextEdits(content, edits, targetName) {
4768
4771
  if (!Array.isArray(edits) || edits.length === 0) throw new ToolInputError(`${targetName} requires at least one edit.`);
4769
4772
  const normalizedEdits = edits.map((edit, index) => {
4770
- if (typeof edit.oldText !== "string" || edit.oldText.length === 0) throw new ToolInputError(`edits[${index}].oldText must not be empty in ${targetName}.`);
4771
- if (typeof edit.newText !== "string") throw new ToolInputError(`edits[${index}].newText must be a string in ${targetName}.`);
4773
+ if (typeof edit.old_text !== "string" || edit.old_text.length === 0) throw new ToolInputError(`edits[${index}].old_text must not be empty in ${targetName}.`);
4774
+ if (typeof edit.new_text !== "string") throw new ToolInputError(`edits[${index}].new_text must be a string in ${targetName}.`);
4772
4775
  return {
4773
- oldText: normalizeToLf$1(edit.oldText),
4774
- newText: normalizeToLf$1(edit.newText)
4776
+ oldText: normalizeToLf$1(edit.old_text),
4777
+ newText: normalizeToLf$1(edit.new_text)
4775
4778
  };
4776
4779
  });
4777
4780
  const matchedEdits = [];
4778
4781
  for (const [index, edit] of normalizedEdits.entries()) {
4779
4782
  const matchIndex = content.indexOf(edit.oldText);
4780
- if (matchIndex === -1) throw new ToolInputError(`Could not find edits[${index}] in ${targetName}. oldText must match exactly including whitespace and newlines.`);
4783
+ if (matchIndex === -1) throw new ToolInputError(`Could not find edits[${index}] in ${targetName}. old_text must match exactly including whitespace and newlines.`);
4781
4784
  const occurrences = countOccurrences(content, edit.oldText);
4782
- if (occurrences > 1) throw new ToolInputError(`Found ${occurrences} occurrences of edits[${index}] in ${targetName}. Each oldText must be unique.`);
4785
+ if (occurrences > 1) throw new ToolInputError(`Found ${occurrences} occurrences of edits[${index}] in ${targetName}. Each old_text must be unique.`);
4783
4786
  matchedEdits.push({
4784
4787
  editIndex: index,
4785
4788
  matchIndex,
@@ -4888,8 +4891,8 @@ async function editFile(params) {
4888
4891
  });
4889
4892
  }
4890
4893
  const editReplacementSchema$1 = z.object({
4891
- oldText: z.string().min(1).describe("Exact text to replace. It must be unique in the original file and must not overlap another edit."),
4892
- newText: z.string().describe("Replacement text for this edit.")
4894
+ old_text: z.string().min(1).describe("Exact text to replace. It must be unique in the original file and must not overlap another edit."),
4895
+ new_text: z.string().describe("Replacement text for this edit.")
4893
4896
  });
4894
4897
  /** Create the sandbox edit tool definition exposed to the agent. */
4895
4898
  function createEditFileTool() {
@@ -4900,7 +4903,7 @@ function createEditFileTool() {
4900
4903
  openWorldHint: false,
4901
4904
  readOnlyHint: false
4902
4905
  },
4903
- description: "Edit one sandbox workspace file with exact text replacements. Use for precise changes to existing files; prefer this over writeFile for targeted changes. Each oldText must match exactly, be unique, and not overlap another edit. Returns a diff. Multiple changes to the same file: use one edits[] call.",
4906
+ description: "Edit one sandbox workspace file with exact text replacements. Use for precise changes to existing files; prefer this over writeFile for targeted changes. Each old_text must match exactly, be unique, and not overlap another edit. Returns a diff. Multiple changes to the same file: use one edits[] call.",
4904
4907
  prepareArguments: prepareEditFileArguments,
4905
4908
  executionMode: "sequential",
4906
4909
  inputSchema: z.object({
@@ -5327,7 +5330,7 @@ function createGrepTool() {
5327
5330
  pattern: z.string().min(1).describe("Regex pattern or literal text to search for."),
5328
5331
  path: z.string().min(1).describe("Directory or file path in the sandbox workspace. Defaults to the workspace root.").optional(),
5329
5332
  glob: z.string().min(1).describe("Optional glob filter such as '*.ts' or '**/*.test.ts'.").optional(),
5330
- ignoreCase: booleanInput$2("Whether matching should ignore case.").optional(),
5333
+ ignore_case: booleanInput$2("Whether matching should ignore case.").optional(),
5331
5334
  literal: booleanInput$2("Treat pattern as literal text instead of regex.").optional(),
5332
5335
  context: z.coerce.number().int().min(0).describe("Number of surrounding context lines to include.").optional(),
5333
5336
  limit: z.coerce.number().int().min(1).describe("Maximum matches to return. Defaults to 100.").optional()
@@ -5962,13 +5965,13 @@ const SANDBOX_ARTIFACTS_DIR = "/tmp/junior/artifacts";
5962
5965
  const sandboxFileReferenceSchema = z.object({
5963
5966
  path: z.string().min(1).describe("Exact source path of an existing sandbox file. Preserve paths returned by other tools unchanged; do not move or rewrite them before sending."),
5964
5967
  filename: z.string().min(1).nullable().optional().describe("Optional filename override shown to the recipient. Null is treated as omitted."),
5965
- mimeType: z.string().min(1).nullable().optional().describe("Optional MIME type override. Null is treated as omitted."),
5968
+ mime_type: z.string().min(1).nullable().optional().describe("Optional MIME type override. Null is treated as omitted."),
5966
5969
  bytes: z.number().int().nonnegative().nullable().optional().describe("Optional known file size returned by a producing tool. Null is treated as omitted; sending tools validate the file contents directly.")
5967
5970
  });
5968
5971
  /** Generated file reference whose path and metadata can be passed directly to sendFiles. */
5969
5972
  const generatedArtifactFileRefSchema = sandboxFileReferenceSchema.extend({
5970
5973
  filename: z.string().min(1),
5971
- mimeType: z.string().min(1).optional(),
5974
+ mime_type: z.string().min(1).optional(),
5972
5975
  bytes: z.number().int().nonnegative()
5973
5976
  }).strict();
5974
5977
  const MIME_BY_EXTENSION = {
@@ -6046,7 +6049,7 @@ async function readSandboxFileUpload(workspace, input) {
6046
6049
  if (fileBuffer.byteLength > 10485760) throw new ToolInputError(`file exceeds ${MAX_SANDBOX_FILE_UPLOAD_BYTES} bytes: ${targetPath} (${fileBuffer.byteLength} bytes)`);
6047
6050
  const resolvedFilename = sanitizeFilename(input.filename, targetPath);
6048
6051
  const detectedMimeType = await detectMimeType(workspace, targetPath);
6049
- const resolvedMimeType = inferMimeType(resolvedFilename, input.mimeType ?? detectedMimeType);
6052
+ const resolvedMimeType = inferMimeType(resolvedFilename, input.mime_type ?? detectedMimeType);
6050
6053
  return {
6051
6054
  bytes: fileBuffer.byteLength,
6052
6055
  data: fileBuffer,
@@ -6076,7 +6079,7 @@ async function writeSandboxGeneratedArtifacts(workspace, files) {
6076
6079
  ref: {
6077
6080
  bytes: content.byteLength,
6078
6081
  filename: file.filename,
6079
- mimeType: file.mimeType,
6082
+ mime_type: file.mimeType,
6080
6083
  path: artifactPath
6081
6084
  }
6082
6085
  };
@@ -6591,6 +6594,19 @@ var McpToolManager = class {
6591
6594
  this.actorClientsByProvider.set(provider, actorClient);
6592
6595
  return actorClient;
6593
6596
  }
6597
+ /**
6598
+ * Record a completed call to an audit tool, with the account that made it.
6599
+ * Arguments stay out: the conversation history keeps them.
6600
+ */
6601
+ logToolCallAudit(plugin, toolName, attributes) {
6602
+ const usedServiceAccount = this.serviceAccountProviders.has(plugin.manifest.name) && serviceAccountAllows(plugin.manifest, { tool: toolName });
6603
+ logAudit("mcp.tool_call.completed", {
6604
+ ...attributes,
6605
+ "mcp.method.name": "tools/call",
6606
+ "app.plugin.name": plugin.manifest.name,
6607
+ "app.credential.account": usedServiceAccount ? "service_account" : "actor"
6608
+ });
6609
+ }
6594
6610
  toManagedTool(plugin, client, tool) {
6595
6611
  const outputSchema = toOptionalRecord(tool.outputSchema);
6596
6612
  const annotations = tool.annotations;
@@ -6627,6 +6643,10 @@ var McpToolManager = class {
6627
6643
  try {
6628
6644
  const result = await (await this.clientForTool(plugin, client, tool.name)).callTool(tool.name, resolvedArgs, options?.signal);
6629
6645
  if ("isError" in result && result.isError) throw new McpToolError(extractMcpErrorMessage(result));
6646
+ if (plugin.manifest.mcp?.auditTools?.includes(tool.name)) this.logToolCallAudit(plugin, tool.name, {
6647
+ "gen_ai.tool.name": managedToolName,
6648
+ ...options?.toolCallId ? { "gen_ai.tool.call.id": options.toolCallId } : void 0
6649
+ });
6630
6650
  const resultAttribute = serializeMcpPayload(result, conversationPrivacy, { privateMetadata: true });
6631
6651
  if (resultAttribute) setSpanAttributes({ "gen_ai.tool.call.result": resultAttribute });
6632
6652
  const providerContent = boundMcpContent(toAgentToolContent(result));
@@ -6767,7 +6787,7 @@ function createBashTool() {
6767
6787
  inputSchema: z.object({
6768
6788
  command: z.string().min(1).describe("Bash command to run inside the sandbox."),
6769
6789
  cwd: z.string().min(1).describe("Optional working directory for this command only.").optional(),
6770
- timeoutMs: z.coerce.number().int().min(1e3).describe("Optional command timeout in milliseconds. Use for commands that may hang.").optional()
6790
+ timeout_ms: z.coerce.number().int().min(1e3).describe("Optional command timeout in milliseconds. Use for commands that may hang.").optional()
6771
6791
  }),
6772
6792
  outputSchema: juniorToolOutputSchema,
6773
6793
  executionMode: "sequential",
@@ -6813,7 +6833,7 @@ const resizedImageSchema = z.object({
6813
6833
  const imageGenerateOutputSchema = juniorToolOutputSchema.extend({
6814
6834
  model: z.string(),
6815
6835
  prompt: z.string(),
6816
- enrichedPrompt: z.string(),
6836
+ enriched_prompt: z.string(),
6817
6837
  image_count: z.number().int().nonnegative(),
6818
6838
  images: z.array(generatedArtifactFileRefSchema),
6819
6839
  delivery: z.string(),
@@ -6970,7 +6990,7 @@ function createImageGenerateTool(hooks, options, deps = {}) {
6970
6990
  return {
6971
6991
  model,
6972
6992
  prompt,
6973
- enrichedPrompt,
6993
+ enriched_prompt: enrichedPrompt,
6974
6994
  image_count: artifactRefs.length,
6975
6995
  images: artifactRefs,
6976
6996
  ...resizeResult,
@@ -6980,7 +7000,7 @@ function createImageGenerateTool(hooks, options, deps = {}) {
6980
7000
  return {
6981
7001
  model,
6982
7002
  prompt,
6983
- enrichedPrompt,
7003
+ enriched_prompt: enrichedPrompt,
6984
7004
  image_count: 0,
6985
7005
  images: [],
6986
7006
  ...resizeResult,
@@ -8047,7 +8067,8 @@ async function assertConversationNotPurged(db, conversationId) {
8047
8067
  }
8048
8068
  /** Mark a just-written row for deletion and drop its unused object. */
8049
8069
  async function rejectPurgedAttachmentWrite(args) {
8050
- await args.db.db().update(juniorAttachments).set({ deleteRequestedAt: args.now }).where(eq(juniorAttachments.id, args.id));
8070
+ const db = args.db.db();
8071
+ await db.with(conversationDetailTouch(db, [args.conversationId])).update(juniorAttachments).set({ deleteRequestedAt: args.now }).where(eq(juniorAttachments.id, args.id));
8051
8072
  await bestEffortDelete(args.storage, args.storageKey);
8052
8073
  throw purgedConversationError(args.conversationId);
8053
8074
  }
@@ -8123,7 +8144,7 @@ async function storeAttachment(args) {
8123
8144
  throw purgedConversationError(args.conversationId);
8124
8145
  }
8125
8146
  const oldStorageKey = existing.storageKey;
8126
- if ((await args.db.db().update(juniorAttachments).set({
8147
+ if ((await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).update(juniorAttachments).set({
8127
8148
  deleteRequestedAt: null,
8128
8149
  storageKey
8129
8150
  }).where(and(eq(juniorAttachments.id, id), isNotNull(juniorAttachments.deleteRequestedAt))).returning({ id: juniorAttachments.id })).length > 0) {
@@ -8153,7 +8174,7 @@ async function storeAttachment(args) {
8153
8174
  }
8154
8175
  let inserted = [];
8155
8176
  try {
8156
- inserted = await args.db.db().insert(juniorAttachments).values({
8177
+ inserted = await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).insert(juniorAttachments).values({
8157
8178
  id,
8158
8179
  conversationId: args.conversationId,
8159
8180
  storageProvider: args.storage.provider,
@@ -8201,7 +8222,7 @@ async function storeAttachment(args) {
8201
8222
  await bestEffortDelete(args.storage, storageKey);
8202
8223
  throw purgedConversationError(args.conversationId);
8203
8224
  }
8204
- if ((await args.db.db().update(juniorAttachments).set({
8225
+ if ((await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).update(juniorAttachments).set({
8205
8226
  deleteRequestedAt: null,
8206
8227
  storageKey
8207
8228
  }).where(and(eq(juniorAttachments.id, id), isNotNull(juniorAttachments.deleteRequestedAt))).returning({ id: juniorAttachments.id })).length > 0) {
@@ -8269,7 +8290,7 @@ async function storeAttachments(args) {
8269
8290
  /** Mark attachments unavailable when their conversation content is purged. */
8270
8291
  async function requestAttachmentDeletion(db, conversationIds, nowMs) {
8271
8292
  if (conversationIds.length === 0) return;
8272
- await db.db().update(juniorAttachments).set({ deleteRequestedAt: new Date(nowMs) }).where(and(inArray(juniorAttachments.conversationId, conversationIds), isNull(juniorAttachments.deleteRequestedAt)));
8293
+ await db.db().with(conversationDetailTouch(db.db(), conversationIds)).update(juniorAttachments).set({ deleteRequestedAt: new Date(nowMs) }).where(and(inArray(juniorAttachments.conversationId, conversationIds), isNull(juniorAttachments.deleteRequestedAt)));
8273
8294
  }
8274
8295
  /**
8275
8296
  * Delete purged attachments in one bounded batch.
@@ -8289,7 +8310,9 @@ async function collectAttachmentGarbage(args) {
8289
8310
  await args.storage.delete(rows.map((row) => row.storageKey));
8290
8311
  const stillEligible = await args.db.db().select({ id: juniorAttachments.id }).from(juniorAttachments).innerJoin(juniorConversations, eq(juniorAttachments.conversationId, juniorConversations.conversationId)).where(and(inArray(juniorAttachments.id, rows.map((row) => row.id)), or(lte(juniorAttachments.createdAt, expiresBefore), isNotNull(juniorAttachments.deleteRequestedAt), isNotNull(juniorConversations.transcriptPurgedAt))));
8291
8312
  if (stillEligible.length === 0) return { deleted: 0 };
8292
- return { deleted: (await args.db.db().delete(juniorAttachments).where(inArray(juniorAttachments.id, stillEligible.map((row) => row.id))).returning({ id: juniorAttachments.id })).length };
8313
+ const removed = await args.db.db().delete(juniorAttachments).where(inArray(juniorAttachments.id, stillEligible.map((row) => row.id))).returning({ conversationId: juniorAttachments.conversationId });
8314
+ await touchConversationDetail(args.db.db(), removed.map((row) => row.conversationId));
8315
+ return { deleted: removed.length };
8293
8316
  }
8294
8317
  // src/chat/attachments/images.ts
8295
8318
  var images_exports = /* @__PURE__ */ __exportAll({
@@ -8409,14 +8432,16 @@ function acceptsWebMessages(conversationId, destination) {
8409
8432
  if (destination?.platform === "slack") return true;
8410
8433
  return destination?.platform === "local" && conversationId.startsWith("local:web:");
8411
8434
  }
8412
- /** Rebuild the web Actor from durable Conversation identity. */
8413
- function webActorFromEmail(email, profile) {
8414
- const normalized = normalizeEmail(email);
8435
+ /**
8436
+ * Build the web Actor for one signed-in User. Junior is the web provider,
8437
+ * so the provider-scoped Actor id is the User id.
8438
+ */
8439
+ function webActorFromUser(user, profile) {
8415
8440
  return {
8416
8441
  platform: "web",
8417
- userId: `dashboard:${stableHex(normalized)}`,
8418
- email: normalized,
8419
- ...profile?.fullName ? { fullName: profile.fullName } : void 0,
8442
+ userId: user.id,
8443
+ email: normalizeEmail(user.email),
8444
+ ...user.displayName ? { fullName: user.displayName } : void 0,
8420
8445
  ...profile?.userName ? { userName: profile.userName } : void 0
8421
8446
  };
8422
8447
  }
@@ -8441,6 +8466,7 @@ function buildWebInboundMessage(args) {
8441
8466
  ...args.authorIdentityId ? { authorIdentityId: args.authorIdentityId } : void 0,
8442
8467
  text,
8443
8468
  ...args.attachments?.length ? { attachments: args.attachments } : void 0,
8469
+ ...args.reviewItemChange ? { reviewItemChange: args.reviewItemChange } : void 0,
8444
8470
  metadata: {
8445
8471
  authorEmail: normalizeEmail(args.actor.email),
8446
8472
  ...args.actor.fullName && { authorFullName: args.actor.fullName },
@@ -8526,7 +8552,8 @@ async function appendAndEnqueueWebMessage(input, options) {
8526
8552
  message: text,
8527
8553
  attachments,
8528
8554
  messageId,
8529
- nowMs
8555
+ nowMs,
8556
+ ...input.reviewItemChange && { reviewItemChange: input.reviewItemChange }
8530
8557
  }),
8531
8558
  conversationStore: options.conversationStore,
8532
8559
  nowMs,
@@ -8541,6 +8568,16 @@ async function appendAndEnqueueWebMessage(input, options) {
8541
8568
  };
8542
8569
  }
8543
8570
  // src/chat/review-items/messages.ts
8571
+ /**
8572
+ * Return the record that a message about a person change carries. A reply or
8573
+ * an agent close is not a person change, so it has no record.
8574
+ */
8575
+ function reviewItemChangeRecord(item, change) {
8576
+ return "user" in change ? {
8577
+ kind: change.kind,
8578
+ reviewItemId: item.id
8579
+ } : void 0;
8580
+ }
8544
8581
  function personName$1(user) {
8545
8582
  return user.displayName ? `${user.displayName} (${user.email})` : user.email;
8546
8583
  }
@@ -8594,14 +8631,16 @@ function eventMessageText(text, change) {
8594
8631
  }
8595
8632
  async function sendOne(args) {
8596
8633
  const key = messageKey(args.item, args.change);
8634
+ const record = reviewItemChangeRecord(args.item, args.change);
8597
8635
  if ("user" in args.change) {
8598
8636
  const conversation = await getConversationStore().get({ conversationId: args.conversationId });
8599
8637
  if (acceptsWebMessages(args.conversationId, conversation?.destination)) {
8600
8638
  await appendAndEnqueueWebMessage({
8601
- actor: webActorFromEmail(args.change.user.email, { ...args.change.user.displayName ? { fullName: args.change.user.displayName } : void 0 }),
8639
+ actor: webActorFromUser(args.change.user),
8602
8640
  conversationId: args.conversationId,
8603
8641
  idempotencyKey: key,
8604
- message: args.text
8642
+ message: args.text,
8643
+ reviewItemChange: record
8605
8644
  }, {
8606
8645
  nowMs: args.nowMs,
8607
8646
  queue: args.queue
@@ -8629,6 +8668,7 @@ async function sendOne(args) {
8629
8668
  authorId: EVENT_AUTHOR_ID,
8630
8669
  authorIdentityId: SYSTEM_IDENTITY_ID,
8631
8670
  metadata,
8671
+ ...record ? { reviewItemChange: record } : void 0,
8632
8672
  text: eventMessageText(args.text, args.change)
8633
8673
  },
8634
8674
  receivedAtMs: args.nowMs,
@@ -9080,14 +9120,14 @@ const listedResourceWatchSchema = z.object({
9080
9120
  label: z.string().min(1),
9081
9121
  identifier: z.string().min(1),
9082
9122
  namespace: z.string().min(1),
9083
- resourceType: z.string().min(1),
9123
+ resource_type: z.string().min(1),
9084
9124
  events: z.array(z.string().min(1)).min(1),
9085
9125
  match: z.record(z.string(), z.unknown()).optional(),
9086
9126
  intent: z.string().min(1),
9087
- expiresAtMs: z.number().finite(),
9088
- firesAtMs: z.number().finite().optional(),
9089
- childAgent: z.object({
9090
- conversationId: z.string().min(1),
9127
+ expires_at: z.string().datetime(),
9128
+ fires_at: z.string().datetime().optional(),
9129
+ child_agent: z.object({
9130
+ conversation_id: z.string().min(1),
9091
9131
  name: z.string().min(1).optional()
9092
9132
  }).strict().optional()
9093
9133
  }).strict();
@@ -9105,7 +9145,7 @@ function createListWatchesTool(context) {
9105
9145
  openWorldHint: false,
9106
9146
  readOnlyHint: true
9107
9147
  },
9108
- description: "List active watches for the current conversation and for every child agent below it. A watch with childAgent belongs to that child agent; one without belongs to the current conversation.",
9148
+ description: "List active watches for the current conversation and for every child agent below it. A watch with child_agent belongs to that child agent; one without belongs to the current conversation.",
9109
9149
  exposure: "deferred",
9110
9150
  source: RESOURCE_WATCH_TOOL_SOURCE,
9111
9151
  inputSchema: z.object({}).strict(),
@@ -9116,13 +9156,16 @@ function createListWatchesTool(context) {
9116
9156
  label: subscription.label,
9117
9157
  identifier: subscription.identifier,
9118
9158
  namespace: subscription.namespace,
9119
- resourceType: subscription.resourceType,
9159
+ resource_type: subscription.resourceType,
9120
9160
  events: subscription.events,
9121
- ...subscription.match ? { match: subscription.match } : void 0,
9161
+ ...subscription.match ? { match: agentEventKeys(subscription.match) } : void 0,
9122
9162
  intent: subscription.intent,
9123
- expiresAtMs: subscription.expiresAtMs,
9124
- firesAtMs: subscription.firesAtMs,
9125
- ...childAgent ? { childAgent } : void 0
9163
+ expires_at: new Date(subscription.expiresAtMs).toISOString(),
9164
+ ...subscription.firesAtMs !== void 0 ? { fires_at: new Date(subscription.firesAtMs).toISOString() } : void 0,
9165
+ ...childAgent ? { child_agent: {
9166
+ conversation_id: childAgent.conversationId,
9167
+ ...childAgent.name ? { name: childAgent.name } : void 0
9168
+ } } : void 0
9126
9169
  })) };
9127
9170
  }
9128
9171
  });
@@ -9133,20 +9176,27 @@ const MAX_SEARCH_RESULTS = 20;
9133
9176
  const searchedResourceTypeSchema = z.object({
9134
9177
  namespace: z.string(),
9135
9178
  type: z.string(),
9136
- identifierFormat: z.string().optional(),
9137
- supportedEvents: z.array(z.string()),
9138
- suggestedEvents: z.array(z.string()).optional(),
9139
- matchFields: z.record(z.string(), eventMatchFieldSchema).optional()
9179
+ identifier_format: z.string().optional(),
9180
+ supported_events: z.array(z.string()),
9181
+ suggested_events: z.array(z.string()).optional(),
9182
+ match_fields: z.record(z.string(), eventMatchFieldSchema).optional()
9140
9183
  }).strict();
9141
9184
  const searchedNamespaceSchema = z.object({
9142
9185
  namespace: z.string(),
9143
- reach: z.record(z.string(), eventReachSchema)
9186
+ reach: z.record(z.string(), z.union([
9187
+ z.literal("all"),
9188
+ z.literal("resource"),
9189
+ z.object({ any_of: z.array(z.string()).min(1) }).strict()
9190
+ ]))
9144
9191
  }).strict();
9192
+ function agentReach(reach) {
9193
+ return typeof reach === "string" ? reach : { any_of: reach.anyOf.map(agentEventMatchKey) };
9194
+ }
9145
9195
  const outputSchema$4 = juniorToolOutputSchema.extend({
9146
9196
  query: z.string().nullable(),
9147
9197
  namespace: z.string().nullable(),
9148
- totalMatches: z.number().int().nonnegative(),
9149
- resourceTypes: z.array(searchedResourceTypeSchema),
9198
+ total_matches: z.number().int().nonnegative(),
9199
+ resource_types: z.array(searchedResourceTypeSchema),
9150
9200
  namespaces: z.array(searchedNamespaceSchema)
9151
9201
  }).strict();
9152
9202
  function normalizeSearchText(value) {
@@ -9156,14 +9206,14 @@ function namespaceReach(catalog, resourceTypes) {
9156
9206
  const events = /* @__PURE__ */ new Map();
9157
9207
  for (const resourceType of resourceTypes) {
9158
9208
  const set = events.get(resourceType.namespace) ?? /* @__PURE__ */ new Set();
9159
- for (const eventType of resourceType.supportedEvents) set.add(eventType);
9209
+ for (const eventType of resourceType.supported_events) set.add(eventType);
9160
9210
  events.set(resourceType.namespace, set);
9161
9211
  }
9162
9212
  return [...events].map(([namespace, eventTypes]) => ({
9163
9213
  namespace,
9164
9214
  reach: Object.fromEntries([...eventTypes].sort().flatMap((eventType) => {
9165
9215
  const reach = catalog[namespace]?.events[eventType]?.reach;
9166
- return reach ? [[eventType, reach]] : [];
9216
+ return reach ? [[eventType, agentReach(reach)]] : [];
9167
9217
  }))
9168
9218
  }));
9169
9219
  }
@@ -9171,10 +9221,10 @@ function searchableResourceTypes(catalog) {
9171
9221
  return Object.entries(catalog).flatMap(([namespace, registration]) => registration.resourceTypes.map((resourceType) => ({
9172
9222
  namespace,
9173
9223
  type: resourceType.type,
9174
- ...resourceType.identifier ? { identifierFormat: resourceType.identifier.format } : void 0,
9175
- supportedEvents: [...resourceType.supportedEvents].sort(),
9176
- ...resourceType.suggestedEvents ? { suggestedEvents: [...resourceType.suggestedEvents].sort() } : void 0,
9177
- ...resourceType.matchFields ? { matchFields: resourceType.matchFields } : void 0
9224
+ ...resourceType.identifier ? { identifier_format: resourceType.identifier.format } : void 0,
9225
+ supported_events: [...resourceType.supportedEvents].sort(),
9226
+ ...resourceType.suggestedEvents ? { suggested_events: [...resourceType.suggestedEvents].sort() } : void 0,
9227
+ ...resourceType.matchFields ? { match_fields: agentEventKeys(resourceType.matchFields) } : void 0
9178
9228
  }))).sort((left, right) => left.namespace.localeCompare(right.namespace) || left.type.localeCompare(right.type));
9179
9229
  }
9180
9230
  /** Create the read-only tool that searches enabled event types. */
@@ -9186,23 +9236,23 @@ function createSearchEventTypesTool(catalog) {
9186
9236
  openWorldHint: false,
9187
9237
  readOnlyHint: true
9188
9238
  },
9189
- description: "Search the event types currently enabled without creating anything. Use only when the user asks what events are supported or the required resource type or event name is unclear. Includes plugin resources and core Workspace snapshot events. namespaces gives the reach of each event. An event automation selects its events with match filters from the matchFields of its namespace. With reach \"all\", match can be left out to run for every resource. With { anyOf }, match must set at least one of those filters. With reach \"resource\", only watchEvents can use the event. Use watchEvents for temporary updates in the current conversation; use createAutomation with an event trigger for durable automation. This tool does not watch a resource, create an automation, or list concrete resources.",
9239
+ description: "Search the event types currently enabled without creating anything. Use only when the user asks what events are supported or the required resource type or event name is unclear. Includes plugin resources and core Workspace snapshot events. namespaces gives the reach of each event. An event automation selects its events with match filters from the match_fields of its namespace. With reach \"all\", match can be left out to run for every resource. With { any_of }, match must set at least one of those filters. With reach \"resource\", only watchEvents can use the event. Use watchEvents for temporary updates in the current conversation; use createAutomation with an event trigger for durable automation. This tool does not watch a resource, create an automation, or list concrete resources.",
9190
9240
  inputSchema: z.object({
9191
9241
  query: z.string().nullable().describe("Optional terms matching a namespace, resource type, or event name. Resource types that match more terms come first. Empty lists all enabled event types.").optional(),
9192
9242
  namespace: eventNamespaceSchema(catalog).nullable().describe("Optional enabled plugin namespace to search within.").optional(),
9193
- maxResults: z.number().int().min(1).max(MAX_SEARCH_RESULTS).nullable().describe("Maximum matching resource types to return.").optional()
9243
+ max_results: z.number().int().min(1).max(MAX_SEARCH_RESULTS).nullable().describe("Maximum matching resource types to return.").optional()
9194
9244
  }).strict(),
9195
9245
  outputSchema: outputSchema$4,
9196
- async execute({ query, namespace, maxResults }) {
9246
+ async execute({ query, namespace, max_results: maxResults }) {
9197
9247
  const terms = normalizeSearchText(query ?? "").split(/\s+/).filter(Boolean);
9198
9248
  const candidates = searchableResourceTypes(catalog).filter((resourceType) => !namespace || resourceType.namespace === namespace);
9199
9249
  const matches = terms.length === 0 ? candidates : candidates.map((resourceType) => {
9200
9250
  const text = normalizeSearchText([
9201
9251
  resourceType.namespace,
9202
9252
  resourceType.type,
9203
- ...resourceType.supportedEvents,
9204
- ...resourceType.suggestedEvents ?? [],
9205
- ...Object.keys(resourceType.matchFields ?? {})
9253
+ ...resourceType.supported_events,
9254
+ ...resourceType.suggested_events ?? [],
9255
+ ...Object.keys(resourceType.match_fields ?? {})
9206
9256
  ].join(" "));
9207
9257
  return {
9208
9258
  resourceType,
@@ -9213,8 +9263,8 @@ function createSearchEventTypesTool(catalog) {
9213
9263
  return {
9214
9264
  query: query ?? null,
9215
9265
  namespace: namespace ?? null,
9216
- totalMatches: matches.length,
9217
- resourceTypes,
9266
+ total_matches: matches.length,
9267
+ resource_types: resourceTypes,
9218
9268
  namespaces: namespaceReach(catalog, resourceTypes)
9219
9269
  };
9220
9270
  }
@@ -9223,7 +9273,7 @@ function createSearchEventTypesTool(catalog) {
9223
9273
  // src/chat/tools/stop-watches.ts
9224
9274
  const resultDataSchema$1 = z.object({
9225
9275
  watching_status: z.literal("stopped"),
9226
- stoppedIds: z.array(z.string().min(1))
9276
+ stopped_ids: z.array(z.string().min(1))
9227
9277
  }).strict();
9228
9278
  const outputSchema$3 = juniorToolOutputSchema.merge(resultDataSchema$1);
9229
9279
  /**
@@ -9271,7 +9321,7 @@ function createStopWatchingResourcesTool(context) {
9271
9321
  }
9272
9322
  return {
9273
9323
  watching_status: "stopped",
9274
- stoppedIds
9324
+ stopped_ids: stoppedIds
9275
9325
  };
9276
9326
  }
9277
9327
  });
@@ -9288,25 +9338,26 @@ function createWatchTimerTool(context) {
9288
9338
  },
9289
9339
  description: "Wake this conversation once after a delay so you can check back later. Returns immediately. Timing is approximate. Use watchEvents instead when you can watch for the event.",
9290
9340
  inputSchema: z.object({
9291
- afterMs: z.number().int().positive().max(RESOURCE_SUBSCRIPTION_MAX_TTL_MS - 864e5).describe("Delay in milliseconds, up to 29 days."),
9341
+ after_ms: z.number().int().positive().max(RESOURCE_SUBSCRIPTION_MAX_TTL_MS - 864e5).describe("Delay in milliseconds, up to 29 days."),
9292
9342
  intent: z.string().trim().min(1).max(1e3).describe("What to do when the timer fires.")
9293
9343
  }).strict(),
9294
9344
  outputSchema: z.object({
9295
9345
  id: z.string(),
9296
- firesAtMs: z.number()
9346
+ fires_at: z.string().datetime()
9297
9347
  }).strict(),
9298
9348
  async execute(input, options) {
9299
9349
  if (!options.toolCallId) throw new Error("Timer creation requires a tool-call identity");
9300
9350
  const creatorUserId = context.actor && context.actor.platform !== "system" ? context.actor.userId : void 0;
9301
9351
  const watch = await createTimerWatch({
9302
- ...input,
9352
+ afterMs: input.after_ms,
9353
+ intent: input.intent,
9303
9354
  conversationId: context.conversationId,
9304
9355
  ...creatorUserId ? { creatorUserId } : void 0,
9305
9356
  toolCallId: options.toolCallId
9306
9357
  });
9307
9358
  return {
9308
9359
  id: watch.id,
9309
- firesAtMs: watch.firesAtMs
9360
+ fires_at: new Date(watch.firesAtMs).toISOString()
9310
9361
  };
9311
9362
  }
9312
9363
  });
@@ -9316,12 +9367,12 @@ function inputSchema(catalog) {
9316
9367
  return z.object({
9317
9368
  identifier: z.string().trim().min(1).describe("Plugin-defined resource identifier."),
9318
9369
  namespace: eventNamespaceSchema(catalog).describe("Enabled plugin namespace for this resource."),
9319
- resourceType: registeredResourceTypeSchema(catalog).describe("Plugin-defined resource type."),
9370
+ resource_type: registeredResourceTypeSchema(catalog).describe("Plugin-defined resource type."),
9320
9371
  label: z.string().trim().min(1).max(500).describe("Human-readable resource label."),
9321
9372
  events: z.array(registeredEventTypeSchema(catalog)).min(1).describe("High-signal event names to deliver to this conversation when they occur."),
9322
9373
  match: registeredEventMatchSchema(),
9323
9374
  intent: z.string().trim().min(1).max(4e3).describe("Concise reason this conversation wants these events, used when an event arrives."),
9324
- ttlMs: z.coerce.number().describe("How long to keep the subscription active. Defaults to 14 days and must not exceed 30 days.").optional()
9375
+ ttl_ms: z.coerce.number().describe("How long to keep the subscription active. Defaults to 14 days and must not exceed 30 days.").optional()
9325
9376
  }).strict();
9326
9377
  }
9327
9378
  const stopWatchingActionSchema = z.object({
@@ -9341,7 +9392,7 @@ const resultDataSchema = z.object({
9341
9392
  identifier: z.string().min(1),
9342
9393
  events: z.array(z.string().min(1)).min(1),
9343
9394
  match: z.record(z.string(), z.unknown()).optional(),
9344
- expiresAtMs: z.number().finite(),
9395
+ expires_at: z.string().datetime(),
9345
9396
  stop_watching: stopWatchingActionSchema
9346
9397
  }).strict();
9347
9398
  const outputSchema$2 = juniorToolOutputSchema.merge(resultDataSchema);
@@ -9349,10 +9400,10 @@ function cleanStrings(values) {
9349
9400
  return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
9350
9401
  }
9351
9402
  function ttlMs(input) {
9352
- if (input.ttlMs === void 0) return RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS;
9353
- if (!Number.isFinite(input.ttlMs) || input.ttlMs <= 0) throw new ToolInputError("ttlMs must be a positive finite number");
9354
- if (input.ttlMs > 2592e6) throw new ToolInputError("Watches cannot exceed 30 days");
9355
- return input.ttlMs;
9403
+ if (input.ttl_ms === void 0) return RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS;
9404
+ if (!Number.isFinite(input.ttl_ms) || input.ttl_ms <= 0) throw new ToolInputError("ttl_ms must be a positive finite number");
9405
+ if (input.ttl_ms > 2592e6) throw new ToolInputError("Watches cannot exceed 30 days");
9406
+ return input.ttl_ms;
9356
9407
  }
9357
9408
  /** Create the tool that temporarily watches events in one conversation. */
9358
9409
  function createWatchEventsTool(context, catalog) {
@@ -9367,16 +9418,16 @@ function createWatchEventsTool(context, catalog) {
9367
9418
  inputSchema: inputSchema(catalog),
9368
9419
  outputSchema: outputSchema$2,
9369
9420
  async execute(input) {
9370
- const unavailable = eventWatchUnavailable(catalog, input.namespace, input.resourceType);
9421
+ const unavailable = eventWatchUnavailable(catalog, input.namespace, input.resource_type);
9371
9422
  if (unavailable) throw new ToolInputError(unavailable);
9372
9423
  const events = cleanStrings(input.events);
9373
9424
  const intent = input.intent.trim();
9374
9425
  if (!intent) throw new ToolInputError("intent is required");
9375
9426
  const match = requireValidEventTrigger(catalog, {
9376
9427
  events,
9377
- match: input.match,
9428
+ match: input.match ? declaredEventKeys(input.match) : void 0,
9378
9429
  namespace: input.namespace,
9379
- resourceType: input.resourceType
9430
+ resourceType: input.resource_type
9380
9431
  }, "watch");
9381
9432
  const nowMs = Date.now();
9382
9433
  const subscription = await createWatch({
@@ -9387,16 +9438,19 @@ function createWatchEventsTool(context, catalog) {
9387
9438
  label: input.label.trim(),
9388
9439
  ...match ? { match } : void 0,
9389
9440
  namespace: input.namespace.trim(),
9390
- identifier: requireEventIdentifier(catalog, input),
9391
- resourceType: input.resourceType.trim()
9441
+ identifier: requireEventIdentifier(catalog, {
9442
+ ...input,
9443
+ resourceType: input.resource_type
9444
+ }),
9445
+ resourceType: input.resource_type.trim()
9392
9446
  });
9393
9447
  return {
9394
9448
  id: subscription.id,
9395
9449
  subscription_status: subscription.status,
9396
9450
  identifier: subscription.identifier,
9397
9451
  events: subscription.events,
9398
- ...subscription.match ? { match: subscription.match } : void 0,
9399
- expiresAtMs: subscription.expiresAtMs,
9452
+ ...subscription.match ? { match: agentEventKeys(subscription.match) } : void 0,
9453
+ expires_at: new Date(subscription.expiresAtMs).toISOString(),
9400
9454
  stop_watching: {
9401
9455
  execution_tool: "executeTool",
9402
9456
  execution_example: {
@@ -9670,14 +9724,14 @@ const compactEventAutomationResultSchema = z.object({
9670
9724
  "paused",
9671
9725
  "deleted"
9672
9726
  ]),
9673
- statusReason: z.string().nullable(),
9727
+ status_reason: z.string().nullable(),
9674
9728
  title: z.string().min(1).nullable(),
9675
- dashboardUrl: z.string().url().nullable(),
9729
+ dashboard_url: z.string().url().nullable(),
9676
9730
  instruction: z.string().min(1),
9677
9731
  trigger: z.object({
9678
9732
  namespace: z.string().min(1),
9679
9733
  identifier: z.string().min(1).nullable(),
9680
- resourceType: z.string().min(1).nullable(),
9734
+ resource_type: z.string().min(1).nullable(),
9681
9735
  label: z.string().min(1),
9682
9736
  events: z.array(z.string().min(1)).min(1),
9683
9737
  match: z.record(z.string(), z.unknown()).optional(),
@@ -9689,8 +9743,8 @@ const compactEventAutomationResultSchema = z.object({
9689
9743
  channel: z.string().min(1),
9690
9744
  thread: z.string().min(1).nullable()
9691
9745
  }).strict(),
9692
- credentialMode: z.enum(["system", "creator"]),
9693
- isCreator: z.boolean(),
9746
+ credential_mode: z.enum(["system", "creator"]),
9747
+ is_creator: z.boolean(),
9694
9748
  outcomes: z.array(z.object({
9695
9749
  action: z.literal("send_message"),
9696
9750
  destination: z.object({
@@ -9698,7 +9752,7 @@ const compactEventAutomationResultSchema = z.object({
9698
9752
  thread: z.string().min(1).nullable()
9699
9753
  }).strict()
9700
9754
  }).strict()).max(5),
9701
- createdBy: z.object({
9755
+ created_by: z.object({
9702
9756
  name: z.string().min(1).nullable(),
9703
9757
  username: z.string().min(1).nullable()
9704
9758
  }).strict()
@@ -9710,7 +9764,7 @@ function registeredEventAutomationTriggerSchema(catalog) {
9710
9764
  namespace: eventNamespaceSchema(plugins),
9711
9765
  label: z.string().trim().min(1).max(500),
9712
9766
  events: z.array(registeredEventTypeSchema(plugins)).min(1),
9713
- match: registeredEventMatchSchema().describe("Filters that select the events, from the matchFields of the namespace. Use the match of a subscribable tool result to select one resource, such as { repo, pullRequest } for one pull request. Leave it out to run for every resource, when the reach of each event allows that. A single value must equal the event data. A list means the event value may be any one entry. For a field with list: true, the event value is a list, and it matches when it includes the value or any entry.")
9767
+ match: registeredEventMatchSchema().describe("Filters that select the events, from the match_fields of the namespace. Use the match of a subscribable tool result to select one resource, such as { repo, pull_request } for one pull request. Leave it out to run for every resource, when the reach of each event allows that. A single value must equal the event data. A list means the event value may be any one entry. For a field with list: true, the event value is a list, and it matches when it includes the value or any entry.")
9714
9768
  }).strict();
9715
9769
  }
9716
9770
  /**
@@ -9718,7 +9772,7 @@ function registeredEventAutomationTriggerSchema(catalog) {
9718
9772
  * A filter that is left out keeps its saved value, so an update cannot make
9719
9773
  * a trigger broader by leaving out a filter.
9720
9774
  */
9721
- const eventMatchChangesSchema = z.record(z.string(), z.union([eventMatchSchema.valueType, z.null()])).optional().describe("Filter changes, from the matchFields of the namespace. A value sets the filter, null removes it, and a filter that is left out keeps its saved value. When the namespace changes, the saved filters are dropped.");
9775
+ const eventMatchChangesSchema = z.record(agentEventMatchSchema.keyType, z.union([agentEventMatchSchema.valueType, z.null()])).optional().describe("Filter changes, from the match_fields of the namespace. A value sets the filter, null removes it, and a filter that is left out keeps its saved value. When the namespace changes, the saved filters are dropped.");
9722
9776
  /** Build the event trigger that the update tool accepts. */
9723
9777
  function registeredEventAutomationTriggerChangesSchema(catalog) {
9724
9778
  return registeredEventAutomationTriggerSchema(catalog).extend({ match: eventMatchChangesSchema });
@@ -9739,7 +9793,7 @@ function changedEventMatch(saved, namespace, changes) {
9739
9793
  * The identifier gets its plugin's convention. Events and list values lose
9740
9794
  * repeats.
9741
9795
  */
9742
- function requireEventAutomationTrigger(catalog, input) {
9796
+ function requireEventAutomationTrigger(catalog, input, options) {
9743
9797
  const identifier = input.identifier ?? void 0;
9744
9798
  const resourceType = input.resourceType ?? void 0;
9745
9799
  if (identifier === void 0 !== (resourceType === void 0)) throw new ToolInputError("Set both resourceType and identifier for one resource, or leave out both to run for every resource.");
@@ -9749,7 +9803,7 @@ function requireEventAutomationTrigger(catalog, input) {
9749
9803
  resourceType,
9750
9804
  events,
9751
9805
  match: input.match
9752
- }, "event_automation");
9806
+ }, "event_automation", options);
9753
9807
  return {
9754
9808
  namespace: input.namespace,
9755
9809
  ...identifier !== void 0 && resourceType !== void 0 ? {
@@ -9776,22 +9830,22 @@ function describeEventAutomationTrigger(trigger, catalog) {
9776
9830
  }
9777
9831
  /** Project an event automation into the bounded tool-result shape. */
9778
9832
  function compactEventAutomation(task, catalog, isCreator) {
9779
- const { problems } = describeEventAutomationTrigger(task.trigger, catalog);
9833
+ const problems = registeredEventTriggerProblems(automationEventCatalog(catalog), task.trigger, { inputKeys: true }).map((problem) => problem.message);
9780
9834
  return compactEventAutomationResultSchema.parse({
9781
9835
  type: "event",
9782
9836
  id: task.id,
9783
9837
  status: task.status,
9784
- statusReason: task.statusReason ?? null,
9838
+ status_reason: task.statusReason ?? null,
9785
9839
  title: task.title?.trim() || null,
9786
- dashboardUrl: getDashboardTaskLink(task.id) ?? null,
9840
+ dashboard_url: getDashboardTaskLink(task.id) ?? null,
9787
9841
  instruction: task.task.text,
9788
9842
  trigger: {
9789
9843
  namespace: task.trigger.namespace,
9790
9844
  identifier: task.trigger.identifier ?? null,
9791
- resourceType: task.trigger.resourceType ?? null,
9845
+ resource_type: task.trigger.resourceType ?? null,
9792
9846
  label: task.trigger.label,
9793
9847
  events: task.trigger.events,
9794
- ...task.trigger.match ? { match: task.trigger.match } : void 0,
9848
+ ...task.trigger.match ? { match: agentEventKeys(task.trigger.match) } : void 0,
9795
9849
  available: problems.length === 0,
9796
9850
  ...problems.length > 0 ? { problems } : void 0
9797
9851
  },
@@ -9800,8 +9854,8 @@ function compactEventAutomation(task, catalog, isCreator) {
9800
9854
  channel: task.destination.channelId,
9801
9855
  thread: null
9802
9856
  },
9803
- credentialMode: task.credentialMode,
9804
- isCreator,
9857
+ credential_mode: task.credentialMode,
9858
+ is_creator: isCreator,
9805
9859
  outcomes: effectiveTaskOutcomes(task.outcomes, task.destination).map((outcome) => ({
9806
9860
  action: outcome.action,
9807
9861
  destination: {
@@ -9809,7 +9863,7 @@ function compactEventAutomation(task, catalog, isCreator) {
9809
9863
  thread: outcome.destination.threadTs ?? null
9810
9864
  }
9811
9865
  })),
9812
- createdBy: {
9866
+ created_by: {
9813
9867
  name: task.createdBy.fullName ?? null,
9814
9868
  username: task.createdBy.userName ?? null
9815
9869
  }
@@ -9828,7 +9882,7 @@ async function eventAutomationToolResult(conversationId, task, catalog, isCreato
9828
9882
  label: title,
9829
9883
  key: task.id,
9830
9884
  title,
9831
- url: automation.dashboardUrl,
9885
+ url: automation.dashboard_url,
9832
9886
  description: task.task.text,
9833
9887
  status: description.problems.length === 0 ? "ready" : "unavailable",
9834
9888
  trigger: eventTriggerText(task.trigger.label, description),
@@ -9843,12 +9897,12 @@ function changesEventAutomationTrigger(current, next) {
9843
9897
  return current.namespace !== next.namespace || current.identifier !== next.identifier || currentEvents.length !== nextEvents.length || currentEvents.some((event, index) => event !== nextEvents[index]) || stableEventMatchKey(current.match) !== stableEventMatchKey(next.match);
9844
9898
  }
9845
9899
  /** Build a validated edit while retaining an unchanged, possibly unavailable trigger. */
9846
- async function editEventAutomation(current, input, isCreator, catalog) {
9900
+ async function editEventAutomation(current, input, isCreator, catalog, options) {
9847
9901
  let trigger = current.trigger;
9848
9902
  if (input.trigger !== void 0) {
9849
9903
  const inputTrigger = slackChannelMessageTrigger(input.trigger, current.destination.channelId);
9850
9904
  if (changesEventAutomationTrigger(current.trigger, inputTrigger) || current.trigger.resourceType !== inputTrigger.resourceType) try {
9851
- trigger = requireEventAutomationTrigger(catalog, inputTrigger);
9905
+ trigger = requireEventAutomationTrigger(catalog, inputTrigger, options);
9852
9906
  } catch (error) {
9853
9907
  if (error instanceof ToolInputError) throw new AutomationEditError(error.message, "trigger");
9854
9908
  throw error;
@@ -10445,7 +10499,7 @@ async function saveViewerEdit(user, current, input, restored) {
10445
10499
  }, isCreator);
10446
10500
  }
10447
10501
  if (input.kind === "event" && current.kind === "event") {
10448
- const next = await editEventAutomation(current.task, input, isCreator, getEventCatalog());
10502
+ const next = await editEventAutomation(current.task, input, isCreator, getEventCatalog(), { inputKeys: false });
10449
10503
  const task = await saveEventAutomation(getDb(), restored ? {
10450
10504
  ...next,
10451
10505
  title: restored.title
@@ -10827,21 +10881,21 @@ const compactTaskResultSchema = z.object({
10827
10881
  "completed",
10828
10882
  "deleted"
10829
10883
  ]),
10830
- statusReason: z.string().nullable(),
10831
- createdAt: z.string().datetime(),
10832
- updatedAt: z.string().datetime(),
10833
- originalRequest: z.string().nullable(),
10884
+ status_reason: z.string().nullable(),
10885
+ created_at: z.string().datetime(),
10886
+ updated_at: z.string().datetime(),
10887
+ original_request: z.string().nullable(),
10834
10888
  instruction: z.string(),
10835
10889
  schedule: z.string(),
10836
10890
  timezone: z.string(),
10837
10891
  recurrence: z.unknown().nullable(),
10838
- nextRunAt: z.string().nullable(),
10892
+ next_run_at: z.string().nullable(),
10839
10893
  destination: z.object({
10840
10894
  id: z.string().min(1),
10841
10895
  channel: z.string().min(1),
10842
10896
  thread: z.string().min(1).nullable()
10843
10897
  }).strict(),
10844
- conversationAccess: z.object({
10898
+ conversation_access: z.object({
10845
10899
  audience: z.enum([
10846
10900
  "direct",
10847
10901
  "group",
@@ -10849,9 +10903,9 @@ const compactTaskResultSchema = z.object({
10849
10903
  ]),
10850
10904
  visibility: z.enum(["private", "public"])
10851
10905
  }).strict(),
10852
- credentialMode: z.enum(["system", "creator"]),
10853
- isCreator: z.boolean(),
10854
- createdBy: z.object({
10906
+ credential_mode: z.enum(["system", "creator"]),
10907
+ is_creator: z.boolean(),
10908
+ created_by: z.object({
10855
10909
  name: z.string().min(1).nullable(),
10856
10910
  username: z.string().min(1).nullable()
10857
10911
  }).strict(),
@@ -10862,9 +10916,9 @@ const compactTaskResultSchema = z.object({
10862
10916
  thread: z.string().min(1).nullable()
10863
10917
  }).strict()
10864
10918
  }).strict()).max(5),
10865
- dashboardUrl: z.string().url().nullable(),
10866
- lastRunAt: z.string().nullable(),
10867
- runNowAt: z.string().nullable()
10919
+ dashboard_url: z.string().url().nullable(),
10920
+ last_run_at: z.string().nullable(),
10921
+ run_now_at: z.string().nullable()
10868
10922
  }).strict();
10869
10923
  /**
10870
10924
  * Return the access class of a Destination. A DM is direct and a group DM is
@@ -10891,32 +10945,32 @@ function compactTask(task, isCreator) {
10891
10945
  id: task.id,
10892
10946
  title: task.title?.trim() || null,
10893
10947
  status: task.status,
10894
- statusReason: task.statusReason ?? null,
10895
- createdAt: new Date(task.createdAtMs).toISOString(),
10896
- updatedAt: new Date(task.updatedAtMs).toISOString(),
10897
- originalRequest: task.originalRequest ?? null,
10948
+ status_reason: task.statusReason ?? null,
10949
+ created_at: new Date(task.createdAtMs).toISOString(),
10950
+ updated_at: new Date(task.updatedAtMs).toISOString(),
10951
+ original_request: task.originalRequest ?? null,
10898
10952
  instruction: task.task.text,
10899
10953
  schedule: task.schedule.description,
10900
10954
  timezone: task.schedule.timezone,
10901
10955
  recurrence: task.schedule.recurrence ? {
10902
10956
  frequency: task.schedule.recurrence.frequency,
10903
10957
  interval: task.schedule.recurrence.interval,
10904
- startDate: task.schedule.recurrence.startDate,
10958
+ start_date: task.schedule.recurrence.startDate,
10905
10959
  time: task.schedule.recurrence.time,
10906
10960
  weekdays: task.schedule.recurrence.weekdays,
10907
10961
  month: task.schedule.recurrence.month,
10908
- dayOfMonth: task.schedule.recurrence.dayOfMonth
10962
+ day_of_month: task.schedule.recurrence.dayOfMonth
10909
10963
  } : null,
10910
- nextRunAt: task.nextRunAtMs ? new Date(task.nextRunAtMs).toISOString() : null,
10964
+ next_run_at: task.nextRunAtMs ? new Date(task.nextRunAtMs).toISOString() : null,
10911
10965
  destination: {
10912
10966
  id: destinationFilterValue(task.destination),
10913
10967
  channel: task.destination.channelId,
10914
10968
  thread: null
10915
10969
  },
10916
- conversationAccess: task.conversationAccess,
10917
- credentialMode: task.credentialMode,
10918
- isCreator,
10919
- createdBy: {
10970
+ conversation_access: task.conversationAccess,
10971
+ credential_mode: task.credentialMode,
10972
+ is_creator: isCreator,
10973
+ created_by: {
10920
10974
  name: task.createdBy.fullName ?? null,
10921
10975
  username: task.createdBy.userName ?? null
10922
10976
  },
@@ -10927,9 +10981,9 @@ function compactTask(task, isCreator) {
10927
10981
  thread: outcome.destination.threadTs ?? null
10928
10982
  }
10929
10983
  })),
10930
- dashboardUrl: getDashboardTaskLink(task.id) ?? null,
10931
- lastRunAt: task.lastRunAtMs ? new Date(task.lastRunAtMs).toISOString() : null,
10932
- runNowAt: task.runNowAtMs ? new Date(task.runNowAtMs).toISOString() : null
10984
+ dashboard_url: getDashboardTaskLink(task.id) ?? null,
10985
+ last_run_at: task.lastRunAtMs ? new Date(task.lastRunAtMs).toISOString() : null,
10986
+ run_now_at: task.runNowAtMs ? new Date(task.runNowAtMs).toISOString() : null
10933
10987
  });
10934
10988
  }
10935
10989
  /** Build the result of a tool that changed one scheduled automation, with its card. */
@@ -10942,7 +10996,7 @@ async function scheduleAutomationToolResult(conversationId, task, isCreator) {
10942
10996
  label: title,
10943
10997
  key: task.id,
10944
10998
  title,
10945
- url: automation.dashboardUrl,
10999
+ url: automation.dashboard_url,
10946
11000
  description: automation.instruction,
10947
11001
  status: automation.status,
10948
11002
  trigger: task.schedule.kind === "one_off" && task.nextRunAtMs !== void 0 ? `${new Intl.DateTimeFormat("en-US", {
@@ -10950,7 +11004,7 @@ async function scheduleAutomationToolResult(conversationId, task, isCreator) {
10950
11004
  timeStyle: "short",
10951
11005
  timeZone: task.schedule.timezone
10952
11006
  }).format(task.nextRunAtMs)} · ${task.schedule.timezone}` : automation.schedule,
10953
- warning: automation.status === "blocked" ? automation.statusReason ?? "This automation is blocked." : automation.status === "completed" ? "This automation has completed." : void 0
11007
+ warning: automation.status === "blocked" ? automation.status_reason ?? "This automation is blocked." : automation.status === "completed" ? "This automation has completed." : void 0
10954
11008
  };
10955
11009
  return {
10956
11010
  automation,
@@ -10972,7 +11026,7 @@ const automationSearchResultSchema = juniorToolOutputSchema.extend({
10972
11026
  }).strict();
10973
11027
  const scheduleTriggerSchema = z.object({
10974
11028
  type: z.literal("schedule"),
10975
- schedule: scheduleIntentSchema.describe("When the automation runs. The scheduler computes the exact next run from this intent and the server clock.")
11029
+ schedule: toolScheduleIntentSchema.describe("When the automation runs. The scheduler computes the exact next run from this intent and the server clock.")
10976
11030
  }).strict();
10977
11031
  /**
10978
11032
  * Build the trigger input of the create tool: a schedule, or the events of an
@@ -11071,7 +11125,7 @@ async function compileSchedule(caller, creator, destination, trigger, nowMs) {
11071
11125
  try {
11072
11126
  return compileScheduleIntent({
11073
11127
  defaultTimezone: timezone,
11074
- intent: trigger.schedule,
11128
+ intent: scheduleIntentFromTool(trigger.schedule),
11075
11129
  nowMs
11076
11130
  });
11077
11131
  } catch (error) {
@@ -11161,12 +11215,12 @@ function createAutomationTool(context, catalog) {
11161
11215
  title: z.string().trim().min(1).max(60).nullable().describe("Optional short display title. Omit or use null to generate one from the instruction.").optional(),
11162
11216
  trigger,
11163
11217
  outcomes: z.array(taskOutcomeInputSchema).max(5).describe("Successful work is silent by default. Omit this field or use an empty list when the Automation should act through tools without a status message. Add send_message only when the user asks for a reminder, notification, post, digest, summary, or other visible result.").optional(),
11164
- credentialMode: z.enum(["creator", "system"]).nullable().describe("Use creator to make the creator's connected credentials available, or system when the creator says not to use them. Omit or use null for the creator default.").optional()
11218
+ credential_mode: z.enum(["creator", "system"]).nullable().describe("Use creator to make the creator's connected credentials available, or system when the creator says not to use them. Omit or use null for the creator default.").optional()
11165
11219
  }).strict(),
11166
11220
  prepareArguments(args) {
11167
11221
  const prepared = { ...args };
11168
11222
  if (prepared.title == null) delete prepared.title;
11169
- if (prepared.credentialMode === "creator" || prepared.credentialMode === null) delete prepared.credentialMode;
11223
+ if (prepared.credential_mode === "creator" || prepared.credential_mode === null) delete prepared.credential_mode;
11170
11224
  return prepared;
11171
11225
  },
11172
11226
  outputSchema: automationToolResultSchema,
@@ -11180,7 +11234,10 @@ function createAutomationTool(context, catalog) {
11180
11234
  creator: createdBy,
11181
11235
  destinationChannelId: destination.channelId
11182
11236
  });
11183
- const eventTrigger = input.trigger.type === "event" ? requireEventAutomationTrigger(catalog, slackChannelMessageTrigger(input.trigger, destination.channelId)) : void 0;
11237
+ const eventTrigger = input.trigger.type === "event" ? requireEventAutomationTrigger(catalog, slackChannelMessageTrigger({
11238
+ ...input.trigger,
11239
+ match: input.trigger.match ? declaredEventKeys(input.trigger.match) : void 0
11240
+ }, destination.channelId)) : void 0;
11184
11241
  const toolCallId = options.toolCallId?.trim();
11185
11242
  if (!toolCallId) throw new Error("Automation creation requires a tool-call identity.");
11186
11243
  const id = automationIdForToolCall({
@@ -11203,7 +11260,7 @@ function createAutomationTool(context, catalog) {
11203
11260
  id,
11204
11261
  instruction: input.instruction,
11205
11262
  nowMs,
11206
- credentialMode: input.credentialMode ?? "creator",
11263
+ credentialMode: input.credential_mode ?? "creator",
11207
11264
  outcomes: await resolveTaskOutcomes(input.outcomes, destination, createdBy.slackUserId),
11208
11265
  title: await resolveTaskTitle({
11209
11266
  signal: options.signal,
@@ -11229,9 +11286,9 @@ function createDeleteAutomationTool(context, catalog) {
11229
11286
  },
11230
11287
  executionMode: "sequential",
11231
11288
  description: "Delete one scheduled or event automation. Anyone in the workspace can delete an automation in a public channel. Automations in private channels and DMs can be deleted from there or by their creator.",
11232
- inputSchema: z.object({ automationId: z.string().min(1).describe("ID of the automation to delete, from searchAutomations or its dashboard URL.") }).strict(),
11289
+ inputSchema: z.object({ automation_id: z.string().min(1).describe("ID of the automation to delete, from searchAutomations or its dashboard URL.") }).strict(),
11233
11290
  outputSchema: automationToolResultSchema.omit({ objectCards: true }).extend({ removedCards: z.array(removedCardSchema) }),
11234
- async execute({ automationId }) {
11291
+ async execute({ automation_id: automationId }) {
11235
11292
  const current = await requireToolAutomation(await requireToolCaller(context), automationId);
11236
11293
  return {
11237
11294
  automation: compactAutomation(await deleteToolAutomation(context.conversationId, current), catalog),
@@ -11256,9 +11313,9 @@ function createRunAutomationNowTool(context, catalog) {
11256
11313
  },
11257
11314
  executionMode: "sequential",
11258
11315
  description: "Queue an existing active scheduled automation to run as soon as possible, without changing its schedule. Use when the user asks to run it now. Anyone who can manage the automation can run it. When it uses its creator's credentials, only the creator can run it now. Event automations run only when a matching event arrives, so they cannot run now.",
11259
- inputSchema: z.object({ automationId: z.string().min(1).describe("ID of the active scheduled automation to run now, from searchAutomations or its dashboard URL.") }).strict(),
11316
+ inputSchema: z.object({ automation_id: z.string().min(1).describe("ID of the active scheduled automation to run now, from searchAutomations or its dashboard URL.") }).strict(),
11260
11317
  outputSchema: automationToolResultSchema.omit({ objectCards: true }),
11261
- async execute({ automationId }) {
11318
+ async execute({ automation_id: automationId }) {
11262
11319
  const current = await requireToolAutomation(await requireToolCaller(context), automationId);
11263
11320
  if (current.kind !== "scheduled") throw new ToolInputError("Only scheduled automations can run now. Event automations run when a matching event arrives.");
11264
11321
  const { task, ownedByViewer } = current;
@@ -11292,7 +11349,7 @@ function createSearchAutomationsTool(context, catalog) {
11292
11349
  openWorldHint: false,
11293
11350
  readOnlyHint: true
11294
11351
  },
11295
- description: "Search scheduled and event automations. It finds the requester's automations, automations in public channels, and automations that deliver to this conversation. Each result has its type and says whether the requester is the creator (isCreator); only the creator can change its credential use. For an event automation, warn when trigger.available is false and explain trigger.problems: the automation stays stored, but a plugin no longer supports its resource type, an event, or a filter. Update the trigger to fix it.",
11352
+ description: "Search scheduled and event automations. It finds the requester's automations, automations in public channels, and automations that deliver to this conversation. Each result has its type and says whether the requester is the creator (is_creator); only the creator can change its credential use. For an event automation, warn when trigger.available is false and explain trigger.problems: the automation stays stored, but a plugin no longer supports its resource type, an event, or a filter. Update the trigger to fix it.",
11296
11353
  inputSchema: automationSearchInputSchema,
11297
11354
  outputSchema: automationSearchResultSchema,
11298
11355
  async execute(input) {
@@ -11589,13 +11646,13 @@ async function updateScheduled(context, current, input, editor) {
11589
11646
  const target = input.destination ? await requireMoveDestination(context, input.destination) : void 0;
11590
11647
  const destination = target?.destination;
11591
11648
  const moving = destination !== void 0 && !sameDestination(task.destination, destination);
11592
- if (destination && !moving && Object.keys(input).every((key) => key === "destination" || key === "credentialMode" && input.credentialMode === task.credentialMode)) return current;
11649
+ if (destination && !moving && Object.keys(input).every((key) => key === "destination" || key === "credential_mode" && input.credential_mode === task.credentialMode)) return current;
11593
11650
  if (moving) await requireNoIncompleteRun(task.id);
11594
11651
  const next = await editScheduledAutomation(task, {
11595
11652
  title: input.title,
11596
11653
  instruction: input.instruction,
11597
- schedule: input.trigger?.type === "schedule" ? input.trigger.schedule : void 0,
11598
- credentialMode: input.credentialMode,
11654
+ schedule: input.trigger?.type === "schedule" ? scheduleIntentFromTool(input.trigger.schedule) : void 0,
11655
+ credentialMode: input.credential_mode,
11599
11656
  outcomes: moving ? void 0 : input.outcomes
11600
11657
  }, isCreator, context.now?.() ?? Date.now());
11601
11658
  if (moving) {
@@ -11624,10 +11681,10 @@ async function updateEvent(current, input, editor, catalog) {
11624
11681
  identifier: task.trigger.identifier,
11625
11682
  resourceType: task.trigger.resourceType
11626
11683
  } : void 0,
11627
- match: changedEventMatch(task.trigger, trigger.namespace, trigger.match)
11684
+ match: changedEventMatch(task.trigger, trigger.namespace, trigger.match ? declaredEventKeys(trigger.match) : void 0)
11628
11685
  } : void 0,
11629
11686
  outcomes: input.outcomes,
11630
- credentialMode: input.credentialMode
11687
+ credentialMode: input.credential_mode
11631
11688
  }, current.ownedByViewer, catalog);
11632
11689
  const saved = await saveEventAutomation(getDb(), next, automationRevision(task), editor);
11633
11690
  if (!saved) throw new ToolInputError("Automation was not found.");
@@ -11650,12 +11707,12 @@ function createUpdateAutomationTool(context, catalog) {
11650
11707
  executionMode: "sequential",
11651
11708
  description: "Update the title, instruction, trigger, outcomes, credential use, or status of a scheduled or event automation. Anyone in the workspace can update anything on an automation in a public channel, including its outcomes and destination. Automations in private channels and DMs can be updated from there or by their creator, and only their creator can move them. Only the creator can enable creator credentials. A non-creator who changes the instruction, trigger, outcomes, or destination switches it to system credentials. The trigger type cannot change. Set destination to move a scheduled automation to this conversation or to a public channel.",
11652
11709
  inputSchema: z.object({
11653
- automationId: z.string().min(1).describe("ID of the automation, from searchAutomations or its dashboard URL."),
11710
+ automation_id: z.string().min(1).describe("ID of the automation, from searchAutomations or its dashboard URL."),
11654
11711
  title: automationTitleSchema.optional(),
11655
11712
  instruction: automationInstructionToolSchema.nullable().optional(),
11656
11713
  trigger: trigger.nullable().describe("Replacement trigger of the same type. For an event trigger, match changes only the filters that it names. Omit or use null to keep the trigger.").optional(),
11657
11714
  outcomes: z.array(taskOutcomeInputSchema).max(5).nullable().describe("Replacement messages to send after successful work. Use an empty list to send nothing. Omit or use null to leave unchanged.").optional(),
11658
- credentialMode: z.enum(["system", "creator"]).nullable().describe("Set creator to make the automation creator's credentials available, or system to disable them. Creator always means the automation's createdBy actor, never the current requester. Only that creator may enable creator mode. Omit or use null to leave unchanged.").optional(),
11715
+ credential_mode: z.enum(["system", "creator"]).nullable().describe("Set creator to make the automation creator's credentials available, or system to disable them. Creator always means the automation's createdBy actor, never the current requester. Only that creator may enable creator mode. Omit or use null to leave unchanged.").optional(),
11659
11716
  status: z.enum(["active", "paused"]).nullable().describe("Set active to resume a paused or blocked automation, or paused to stop it. When it uses its creator's credentials, only the creator can resume it. Omit or use null to leave unchanged.").optional(),
11660
11717
  destination: slackChannelRefParam.nullable().describe("Where to move a scheduled automation. Set \"current_conversation\" for the channel or DM of this conversation, or name a public Slack channel by id, mention, or known name. Omit to keep its destination.").optional()
11661
11718
  }).strict(),
@@ -11663,11 +11720,11 @@ function createUpdateAutomationTool(context, catalog) {
11663
11720
  return Object.fromEntries(Object.entries(args).filter(([, value]) => value != null));
11664
11721
  },
11665
11722
  outputSchema: automationToolResultSchema,
11666
- async execute({ automationId, status: requestedStatus, ...fields }) {
11723
+ async execute({ automation_id, status: requestedStatus, ...fields }) {
11667
11724
  const input = fields;
11668
11725
  const status = requestedStatus ?? void 0;
11669
11726
  const caller = await requireToolCaller(context);
11670
- const current = await requireToolAutomation(caller, automationId);
11727
+ const current = await requireToolAutomation(caller, automation_id);
11671
11728
  if (input.trigger && triggerKind(input.trigger) !== current.kind) throw new ToolInputError(`This automation runs on ${current.kind === "scheduled" ? "a schedule" : "events"}. The trigger type cannot change. Create a new automation instead.`);
11672
11729
  if (Object.keys(input).length === 0 && status === void 0) throw new ToolInputError("Automation update requires a change.");
11673
11730
  if (current.kind === "scheduled" && current.task.status === "completed") throw new ToolInputError("Completed scheduled automations cannot be updated. Create a new automation instead.");
@@ -12284,6 +12341,10 @@ const slackSearchFileWireSchema = z.object({
12284
12341
  ...value.content ?? value.preview ? { content: value.content ?? value.preview } : void 0
12285
12342
  };
12286
12343
  });
12344
+ /** Read the channel ID from a Slack archive permalink such as `/archives/C123`. */
12345
+ function channelIdFromPermalink(permalink) {
12346
+ return permalink?.match(/\/archives\/([A-Z0-9]+)(?:[/?#]|$)/)?.[1];
12347
+ }
12287
12348
  /** Slack wire shape for one search channel. */
12288
12349
  const slackSearchChannelWireSchema = z.object({
12289
12350
  id: optionalWireString,
@@ -12296,7 +12357,7 @@ const slackSearchChannelWireSchema = z.object({
12296
12357
  purpose: optionalWireString,
12297
12358
  permalink: optionalWireUrl
12298
12359
  }).transform((value) => {
12299
- const channelId = value.channel_id ?? value.id;
12360
+ const channelId = value.channel_id ?? value.id ?? channelIdFromPermalink(value.permalink);
12300
12361
  if (!channelId) return;
12301
12362
  return {
12302
12363
  channel_id: channelId,
@@ -12973,7 +13034,7 @@ function normalizeFiles(files) {
12973
13034
  return files.map((file) => ({
12974
13035
  path: file.path,
12975
13036
  ...file.filename ? { filename: file.filename } : void 0,
12976
- ...file.mimeType ? { mimeType: file.mimeType } : void 0
13037
+ ...file.mime_type ? { mime_type: file.mime_type } : void 0
12977
13038
  }));
12978
13039
  }
12979
13040
  /** Include file bytes in idempotency so rewritten paths can be sent again. */
@@ -13092,6 +13153,40 @@ function extractCanvasId(input) {
13092
13153
  return;
13093
13154
  }
13094
13155
  }
13156
+ // src/chat/slack/tool-support/canvas/html.ts
13157
+ const canvasHtmlConverter = new NodeHtmlMarkdown({
13158
+ bulletMarker: "-",
13159
+ codeBlockStyle: "fenced",
13160
+ maxConsecutiveNewlines: 2
13161
+ }, { lnk: ({ node }) => ({
13162
+ prefix: "[",
13163
+ postfix: `](${node.getAttribute("href") ?? ""})`
13164
+ }) });
13165
+ const listItemTranslator = canvasHtmlConverter.translators.get("li");
13166
+ canvasHtmlConverter.translators.set("li", (context) => {
13167
+ const config = typeof listItemTranslator === "function" ? listItemTranslator(context) : listItemTranslator;
13168
+ if (context.node.closest("[data-section-style]")?.getAttribute("data-section-style") !== "7") return config;
13169
+ const checkbox = context.node.classList.contains("checked") ? "[x] " : "[ ] ";
13170
+ return {
13171
+ ...config,
13172
+ prefix: `${config?.prefix ?? ""}${checkbox}`
13173
+ };
13174
+ });
13175
+ const leadingHtmlTag = /^\s*<[a-z][a-z0-9-]*[\s/>]/i;
13176
+ /**
13177
+ * Convert a downloaded canvas body to Markdown. Canvas writes take Markdown,
13178
+ * so an HTML body passed back unchanged renders as escaped HTML text.
13179
+ */
13180
+ function canvasBodyToMarkdown(body, title) {
13181
+ if (!leadingHtmlTag.test(body)) return body;
13182
+ const markdown = canvasHtmlConverter.translate(body).trim();
13183
+ const titleHeading = title ? canvasHtmlConverter.translate(`<h1>${escapeHtml(title)}</h1>`).trim() : void 0;
13184
+ if (titleHeading && markdown.split("\n", 1)[0] === titleHeading) return markdown.slice(titleHeading.length).trimStart();
13185
+ return markdown;
13186
+ }
13187
+ function escapeHtml(text) {
13188
+ return text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
13189
+ }
13095
13190
  // src/chat/slack/tool-support/canvas/markdown.ts
13096
13191
  function getListType(marker) {
13097
13192
  return /^\d/.test(marker) ? "numbered" : "bullet";
@@ -13321,10 +13416,10 @@ function isCanvasFile(file) {
13321
13416
  return filetype === "quip" || filetype === "canvas" || mimetype.includes("quip") || mimetype.includes("canvas");
13322
13417
  }
13323
13418
  /**
13324
- * Read a Slack canvas the bot has access to and return its raw downloadable
13325
- * content. Slack does not expose a structured canvas-read API, so we fetch
13326
- * file metadata via `files.info` and download the canvas body via the private
13327
- * file URL with the bot token.
13419
+ * Read a Slack canvas the bot has access to and return its body as Markdown.
13420
+ * Slack does not expose a structured canvas-read API, so we fetch file
13421
+ * metadata via `files.info` and download the canvas body via the private file
13422
+ * URL with the bot token.
13328
13423
  */
13329
13424
  async function readCanvas(canvasIdOrUrl) {
13330
13425
  const canvasId = extractCanvasId(canvasIdOrUrl);
@@ -13339,13 +13434,14 @@ async function readCanvas(canvasIdOrUrl) {
13339
13434
  const downloadUrl = file.url_private_download ?? file.url_private;
13340
13435
  if (!downloadUrl) throw new Error("Canvas has no downloadable URL; bot token may lack file access.");
13341
13436
  const buffer = await downloadPrivateSlackFile(downloadUrl);
13437
+ const title = file.title ?? file.name;
13342
13438
  return {
13343
13439
  canvasId,
13344
- title: file.title ?? file.name,
13440
+ title,
13345
13441
  permalink: file.permalink,
13346
13442
  mimetype: file.mimetype,
13347
13443
  filetype: file.filetype,
13348
- content: buffer.toString("utf-8"),
13444
+ content: canvasBodyToMarkdown(buffer.toString("utf-8"), title),
13349
13445
  byteLength: buffer.byteLength
13350
13446
  };
13351
13447
  }
@@ -13420,8 +13516,8 @@ function prepareCanvasEditArguments(input) {
13420
13516
  return prepareTextReplacementArguments(input);
13421
13517
  }
13422
13518
  const editReplacementSchema = z.object({
13423
- oldText: z.string().min(1).describe("Exact Canvas markdown to replace. It must be unique in the current Canvas body and must not overlap another edit."),
13424
- newText: z.string().describe("Replacement Canvas markdown for this edit.")
13519
+ old_text: z.string().min(1).describe("Exact Canvas markdown to replace. It must be unique in the current Canvas body and must not overlap another edit."),
13520
+ new_text: z.string().describe("Replacement Canvas markdown for this edit.")
13425
13521
  });
13426
13522
  const slackCanvasEditOutputSchema = juniorToolOutputSchema.extend({
13427
13523
  canvas_id: z.string().optional(),
@@ -14212,7 +14308,7 @@ function sanitizeMessage(msg, attachmentIdsBySlackFileId) {
14212
14308
  const attachmentText = renderAttachmentText(msg.attachments);
14213
14309
  const files = collectMessageFiles(msg);
14214
14310
  return {
14215
- ts: msg.ts,
14311
+ slack_ts: msg.ts,
14216
14312
  user: msg.user,
14217
14313
  text: msg.text,
14218
14314
  thread_ts: msg.thread_ts,
@@ -14284,12 +14380,12 @@ function createSlackThreadReadTool(context, attachmentDeps) {
14284
14380
  inputSchema: z.object({
14285
14381
  url: z.string().min(1).describe("Slack message archive URL.").nullable().optional(),
14286
14382
  channel_id: slackChannelRefParam.nullable().optional(),
14287
- ts: slackTimestampParam("Slack message timestamp. May be the thread root or any message in the thread.").nullable().optional(),
14383
+ slack_ts: slackTimestampParam("Slack message timestamp. May be the thread root or any message in the thread.").nullable().optional(),
14288
14384
  limit: z.coerce.number().int().min(1).max(1e3).describe("Maximum number of thread messages to fetch.").nullable().optional(),
14289
14385
  max_pages: z.coerce.number().int().min(1).max(10).describe("Maximum number of Slack API pages to traverse.").nullable().optional()
14290
14386
  }),
14291
14387
  outputSchema: juniorToolOutputSchema,
14292
- execute: async ({ url, channel_id, ts, limit, max_pages }) => {
14388
+ execute: async ({ url, channel_id, slack_ts, limit, max_pages }) => {
14293
14389
  let channelId;
14294
14390
  let messageTs;
14295
14391
  let threadTs;
@@ -14299,8 +14395,8 @@ function createSlackThreadReadTool(context, attachmentDeps) {
14299
14395
  channelId = parsed.reference.channelId;
14300
14396
  messageTs = parsed.reference.messageTs;
14301
14397
  threadTs = parsed.reference.threadTs;
14302
- } else if (channel_id && ts) {
14303
- const parsedTs = parseRequiredSlackTimestampParam("ts", ts);
14398
+ } else if (channel_id && slack_ts) {
14399
+ const parsedTs = parseRequiredSlackTimestampParam("slack_ts", slack_ts);
14304
14400
  if (!parsedTs.ok) throw new ToolInputError(parsedTs.error);
14305
14401
  channelId = (await resolveSlackChannelRef({
14306
14402
  field: "channel_id",
@@ -14308,7 +14404,7 @@ function createSlackThreadReadTool(context, attachmentDeps) {
14308
14404
  teamId: context.teamId
14309
14405
  })).channelId;
14310
14406
  messageTs = parsedTs.value;
14311
- } else throw new ToolInputError("Provide either a Slack message `url` or both `channel_id` and `ts`.");
14407
+ } else throw new ToolInputError("Provide either a Slack message `url` or both `channel_id` and `slack_ts`.");
14312
14408
  const access = await checkSlackChannelReadAccess({
14313
14409
  currentChannelIds: [context.destinationChannelId, context.locationChannelId],
14314
14410
  targetChannelId: channelId,
@@ -14676,7 +14772,7 @@ function createUserLookupTool(teamId, providers) {
14676
14772
  // src/chat/tools/system-time.ts
14677
14773
  const systemTimeInputSchema = z.object({ timezone: z.string().trim().min(1).optional().describe("Optional IANA timezone, for example America/Los_Angeles. When set, iso_local and timezone_offset_minutes are for that zone.") });
14678
14774
  const systemTimeOutputSchema = juniorToolOutputSchema.extend({
14679
- unix_ms: z.number(),
14775
+ unix_ms: z.number().describe("Current time in epoch milliseconds, for millisecond inputs."),
14680
14776
  iso_utc: z.string(),
14681
14777
  iso_local: z.string(),
14682
14778
  timezone: z.string().nullable(),
@@ -15462,6 +15558,7 @@ async function searchConversationBriefs(db, args) {
15462
15558
  const conditions = [
15463
15559
  notExists(db.select({ one: sql`1` }).from(newer).where(and(eq(newer.conversationId, briefs.conversationId), gt(newer.version, briefs.version)))),
15464
15560
  isNull(juniorConversations.parentConversationId),
15561
+ isNull(juniorConversations.quickQuestionAt),
15465
15562
  ne(juniorConversations.conversationId, args.currentConversationId),
15466
15563
  eq(juniorDestinations.visibility, "public")
15467
15564
  ];
@@ -16790,7 +16887,7 @@ function buildSandboxInput(toolName, params) {
16790
16887
  command: String(params.command ?? ""),
16791
16888
  ...typeof params.cwd === "string" ? { cwd: params.cwd } : void 0,
16792
16889
  ...params.env && typeof params.env === "object" && !Array.isArray(params.env) ? { env: params.env } : void 0,
16793
- ...optionalNumber(params.timeoutMs) ? { timeoutMs: optionalNumber(params.timeoutMs) } : void 0
16890
+ ...optionalNumber(params.timeout_ms) ? { timeoutMs: optionalNumber(params.timeout_ms) } : void 0
16794
16891
  };
16795
16892
  if (toolName === "readFile") return {
16796
16893
  path: String(params.path ?? ""),
@@ -16805,7 +16902,7 @@ function buildSandboxInput(toolName, params) {
16805
16902
  pattern: String(params.pattern ?? ""),
16806
16903
  ...typeof params.path === "string" ? { path: params.path } : void 0,
16807
16904
  ...typeof params.glob === "string" ? { glob: params.glob } : void 0,
16808
- ...typeof params.ignoreCase === "boolean" ? { ignoreCase: params.ignoreCase } : void 0,
16905
+ ...typeof params.ignore_case === "boolean" ? { ignoreCase: params.ignore_case } : void 0,
16809
16906
  ...typeof params.literal === "boolean" ? { literal: params.literal } : void 0,
16810
16907
  ...optionalNumber(params.context) ? { context: optionalNumber(params.context) } : void 0,
16811
16908
  ...optionalNumber(params.limit) ? { limit: optionalNumber(params.limit) } : void 0
@@ -17834,6 +17931,7 @@ async function runCodeModeScript(run) {
17834
17931
  });
17835
17932
  call.status = undeliverable ? "error" : "ok";
17836
17933
  if (undeliverable) call.error = cut(undeliverable, MAX_CALL_ERROR_CHARS);
17934
+ if (outcome.nudges.length > 0) call.nudges = outcome.nudges;
17837
17935
  return;
17838
17936
  }
17839
17937
  case "rejected":
@@ -18100,9 +18198,7 @@ const STATUS_TEXT = {
18100
18198
  not_started: "not started"
18101
18199
  };
18102
18200
  function renderCall(call, index) {
18103
- const line = `${index + 1}. ${call.toolName}: ${STATUS_TEXT[call.status]}`;
18104
- if (!call.error) return line;
18105
- return `${line}\n ${call.error.replace(/\n/g, "\n ")}`;
18201
+ return [`${index + 1}. ${call.toolName}: ${STATUS_TEXT[call.status]}`, ...[...call.error ? [call.error] : [], ...(call.nudges ?? []).map(renderToolResultNudge)].map((note) => ` ${note.replace(/\n/g, "\n ")}`)].join("\n");
18106
18202
  }
18107
18203
  /** The output and return value sections, cut or in full. */
18108
18204
  function renderBody(output, value) {
@@ -18213,6 +18309,20 @@ async function untilPreempted(work, signal) {
18213
18309
  }
18214
18310
  }
18215
18311
  /**
18312
+ * Add plugin guidance after the tool's own content. Details stay the same, so
18313
+ * structured (JSON) output is not changed.
18314
+ */
18315
+ function withToolResultNudges(result, nudges) {
18316
+ if (nudges.length === 0) return result;
18317
+ return {
18318
+ ...result,
18319
+ content: [...result.content, ...nudges.map((nudge) => ({
18320
+ type: "text",
18321
+ text: renderToolResultNudge(nudge)
18322
+ }))]
18323
+ };
18324
+ }
18325
+ /**
18216
18326
  * Create the path every tool call takes: argument checks, plugin hooks,
18217
18327
  * action review, credentials and auth handling, then the executor, under one
18218
18328
  * `gen_ai.execute_tool` span.
@@ -18298,12 +18408,17 @@ function createToolPipeline(options) {
18298
18408
  conversationPrivacy: effectiveConversationPrivacy,
18299
18409
  toolCallId
18300
18410
  })), signal);
18301
- const normalized = normalizeToolResult(result, {
18411
+ const toolResult = normalizeToolResult(result, {
18302
18412
  requireStructuredResult: Boolean(toolDef.outputSchema),
18303
18413
  toolName
18304
18414
  });
18305
- if (isSandbox && pluginAuthOrchestration) await pluginAuthOrchestration.maybeHandleAuthSignal(normalized.details);
18306
- const resultAttributeValue = reportedToolResult(result, isSandbox, normalized);
18415
+ if (isSandbox && pluginAuthOrchestration) await pluginAuthOrchestration.maybeHandleAuthSignal(toolResult.details);
18416
+ const nudges = agentHooks ? await agentHooks.afterToolExecute({
18417
+ input: toolInput,
18418
+ name: toolName,
18419
+ ...signal ? { signal } : void 0
18420
+ }) : [];
18421
+ const resultAttributeValue = reportedToolResult(result, isSandbox, toolResult);
18307
18422
  let projectedPrivateResult;
18308
18423
  let hasProjectedPrivateResult = false;
18309
18424
  if (effectiveConversationPrivacy === "private" && toolDef.privateTraceResult) try {
@@ -18331,17 +18446,21 @@ function createToolPipeline(options) {
18331
18446
  toolCallId,
18332
18447
  toolName
18333
18448
  });
18334
- return normalized;
18449
+ return {
18450
+ result: toolResult,
18451
+ nudges
18452
+ };
18335
18453
  };
18336
18454
  const executeDefinition = async (args) => {
18337
18455
  const prepared = await prepareCall(args);
18338
18456
  const reviews = await reviewToolActions([prepared.action], actionReview, args.signal);
18339
- return await executeReviewed({
18457
+ const { result, nudges } = await executeReviewed({
18340
18458
  prepared,
18341
18459
  review: reviews.get(args.toolCallId),
18342
18460
  signal: args.signal,
18343
18461
  setSpanAttributes: args.setSpanAttributes
18344
18462
  });
18463
+ return withToolResultNudges(result, nudges);
18345
18464
  };
18346
18465
  const reportStatus = async (executionToolName, params) => {
18347
18466
  const status = executionToolName === "updatePlan" ? buildPlanStatus(params) : executionToolName === "reportProgress" ? buildReportedProgressStatus(params) : void 0;
@@ -18470,6 +18589,7 @@ function createToolPipeline(options) {
18470
18589
  */
18471
18590
  async callFromScript(call) {
18472
18591
  const { signal, tool, toolCallId, toolName } = call;
18592
+ let nudges = [];
18473
18593
  let traced;
18474
18594
  try {
18475
18595
  traced = await traceCall({
@@ -18494,12 +18614,14 @@ function createToolPipeline(options) {
18494
18614
  toolDef: tool,
18495
18615
  toolName
18496
18616
  });
18497
- return await executeReviewed({
18617
+ const reviewed = await executeReviewed({
18498
18618
  prepared,
18499
18619
  review: await call.review(prepared.action),
18500
18620
  signal,
18501
18621
  setSpanAttributes
18502
18622
  });
18623
+ nudges = reviewed.nudges;
18624
+ return reviewed.result;
18503
18625
  });
18504
18626
  } catch (error) {
18505
18627
  if (error instanceof AuthorizationPauseError || error instanceof AuthorizationFlowDisabledError) throw error;
@@ -18510,7 +18632,8 @@ function createToolPipeline(options) {
18510
18632
  }
18511
18633
  if (traced.kind === "completed") return {
18512
18634
  status: "ok",
18513
- result: traced.result
18635
+ result: traced.result,
18636
+ nudges
18514
18637
  };
18515
18638
  if (traced.kind === "preempted") return { status: "preempted" };
18516
18639
  const projected = actionReview?.projectToolResult(toolCallId, {
@@ -18787,13 +18910,26 @@ async function deleteMcpAuthSessionsForUserProvider(userId, provider) {
18787
18910
  await stateAdapter.delete(indexKey);
18788
18911
  }
18789
18912
  async function getMcpStoredOAuthCredentials(userId, provider) {
18790
- return parseStoredCredentials(await (await getConnectedStateAdapter()).get(credentialsKey(userId, provider)));
18913
+ const stateAdapter = await getConnectedStateAdapter();
18914
+ const stored = parseStoredCredentials(await stateAdapter.get(credentialsKey(userId, provider)));
18915
+ if (stored) return stored;
18916
+ const legacyUserId = await findLegacyWebActorUserId(userId);
18917
+ if (!legacyUserId) return void 0;
18918
+ const legacyKey = credentialsKey(legacyUserId, provider);
18919
+ const legacy = parseStoredCredentials(await stateAdapter.get(legacyKey));
18920
+ if (!legacy) return void 0;
18921
+ await putMcpStoredOAuthCredentials(userId, provider, legacy);
18922
+ await stateAdapter.delete(legacyKey);
18923
+ return legacy;
18791
18924
  }
18792
18925
  async function putMcpStoredOAuthCredentials(userId, provider, value, ttlMs = MCP_AUTH_CREDENTIALS_TTL_MS) {
18793
18926
  await (await getConnectedStateAdapter()).set(credentialsKey(userId, provider), JSON.stringify(value), ttlMs);
18794
18927
  }
18795
18928
  async function deleteMcpStoredOAuthCredentials(userId, provider) {
18796
- await (await getConnectedStateAdapter()).delete(credentialsKey(userId, provider));
18929
+ const stateAdapter = await getConnectedStateAdapter();
18930
+ await stateAdapter.delete(credentialsKey(userId, provider));
18931
+ const legacyUserId = await findLegacyWebActorUserId(userId);
18932
+ if (legacyUserId) await stateAdapter.delete(credentialsKey(legacyUserId, provider));
18797
18933
  }
18798
18934
  async function getMcpServerSessionId(userId, provider) {
18799
18935
  return parseServerSession(await (await getConnectedStateAdapter()).get(serverSessionKey(userId, provider)))?.sessionId;
@@ -19828,28 +19964,33 @@ async function readRootConversation(args) {
19828
19964
  async function createRunSandbox(args) {
19829
19965
  const pluginHooks = createPluginHookRunner({
19830
19966
  actor: args.currentActor,
19831
- actors: args.currentActors
19967
+ actors: args.currentActors,
19968
+ sandbox: () => ({
19969
+ workspace: agentSandbox.workspace,
19970
+ workspaceId: () => agentSandbox.sandboxRef()?.workspaceId
19971
+ })
19832
19972
  });
19833
19973
  const workspace = args.state.sandboxRef?.workspaceId ? await getWorkspace(getDb(), args.state.sandboxRef.workspaceId) : void 0;
19974
+ const agentSandbox = createAgentSandbox({
19975
+ sandboxRef: args.state.sandboxRef,
19976
+ workspace,
19977
+ skills: args.availableSkills,
19978
+ traceContext: args.spanContext,
19979
+ tracePropagation: args.run.environment?.sandboxTracePropagation,
19980
+ egressSignals: args.run.environment?.sandboxEgressSignals,
19981
+ conversationId: args.run.conversationId,
19982
+ credentialEgress: args.run.credentialContext,
19983
+ actor: args.currentActor,
19984
+ locationConfiguration: args.run.environment?.locationConfiguration,
19985
+ configurationValues: args.configurationValues,
19986
+ getActiveSkill: () => args.skillSandbox.getActiveSkill(),
19987
+ prepareSandbox: pluginHooks.prepareSandbox,
19988
+ prepareWorkspace: async (sandbox, recipe, signal) => await pluginHooks.prepareWorkspace(sandbox, recipe.repos, signal),
19989
+ onSandboxRefChanged: args.onSandboxRefChanged,
19990
+ persistSandboxRef: args.durability.onSandboxRefChanged
19991
+ });
19834
19992
  return {
19835
- agentSandbox: createAgentSandbox({
19836
- sandboxRef: args.state.sandboxRef,
19837
- workspace,
19838
- skills: args.availableSkills,
19839
- traceContext: args.spanContext,
19840
- tracePropagation: args.run.environment?.sandboxTracePropagation,
19841
- egressSignals: args.run.environment?.sandboxEgressSignals,
19842
- conversationId: args.run.conversationId,
19843
- credentialEgress: args.run.credentialContext,
19844
- actor: args.currentActor,
19845
- locationConfiguration: args.run.environment?.locationConfiguration,
19846
- configurationValues: args.configurationValues,
19847
- getActiveSkill: () => args.skillSandbox.getActiveSkill(),
19848
- prepareSandbox: pluginHooks.prepareSandbox,
19849
- prepareWorkspace: async (sandbox, recipe, signal) => await pluginHooks.prepareWorkspace(sandbox, recipe.repos, signal),
19850
- onSandboxRefChanged: args.onSandboxRefChanged,
19851
- persistSandboxRef: args.durability.onSandboxRefChanged
19852
- }),
19993
+ agentSandbox,
19853
19994
  pluginHooks
19854
19995
  };
19855
19996
  }
@@ -20724,6 +20865,14 @@ function renderCompactionSummary(summary) {
20724
20865
  function estimateHistoryTokens(messages) {
20725
20866
  return estimateContextTokens(messages).tokens;
20726
20867
  }
20868
+ /**
20869
+ * Estimate a replacement request from each message's own size. A kept
20870
+ * assistant message holds provider usage for the whole request before the
20871
+ * replacement, so usage is ignored here.
20872
+ */
20873
+ function estimateReplacementTokens(messages, requestOverheadTokens = 0) {
20874
+ return messages.reduce((total, message) => total + estimateTokens(message), requestOverheadTokens);
20875
+ }
20727
20876
  async function loadLastInstruction(conversationId) {
20728
20877
  const event = await getConversationEventStore().loadLatestInstruction(conversationId);
20729
20878
  if (!event) return void 0;
@@ -20857,7 +21006,7 @@ async function compactActiveAboveThreshold(args, summarize, source, triggerToken
20857
21006
  ];
20858
21007
  const retainedMessageCount = retainedUserMessages.length + instructionMessages.length;
20859
21008
  const messages = replacement.map((entry) => entry.message);
20860
- const replacementInputTokens = estimateHistoryTokens(messages);
21009
+ const replacementInputTokens = estimateReplacementTokens(messages, args.requestOverheadTokens);
20861
21010
  if (replacementInputTokens >= inputLimitTokens) throw new ContextInputLimitExceededError(replacementInputTokens, inputLimitTokens);
20862
21011
  args.signal?.throwIfAborted();
20863
21012
  await getConversationEventStore().replaceHistory(args.conversationId, {
@@ -21119,14 +21268,14 @@ async function applyPreparedSummary(args, prepared, budget) {
21119
21268
  ...pendingMessages
21120
21269
  ];
21121
21270
  const messages = replacement.map((entry) => entry.message);
21122
- const replacementTokens = estimateHistoryTokens(messages);
21271
+ const replacementTokens = estimateReplacementTokens(messages, args.requestOverheadTokens);
21123
21272
  const targetTokens = calculateContextCompactionTargetTokens(budget.triggerTokens);
21124
21273
  setSpanAttributes({
21125
21274
  "app.compaction.input.estimate": budget.estimatedTokens,
21126
21275
  "app.compaction.replacement.estimate": replacementTokens,
21127
21276
  "app.compaction.threshold": budget.triggerTokens,
21128
21277
  "app.compaction.carried_messages": kept.length,
21129
- "app.compaction.carried.estimate": estimateHistoryTokens(trimmedEntries.map((entry) => entry.message)),
21278
+ "app.compaction.carried.estimate": estimateReplacementTokens(trimmedEntries.map((entry) => entry.message)),
21130
21279
  "app.compaction.trimmed_results": trimming.trimmedResults,
21131
21280
  "app.compaction.trimmed_chars": trimming.removedChars
21132
21281
  });
@@ -22228,6 +22377,7 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
22228
22377
  pendingMessages,
22229
22378
  mode,
22230
22379
  piMessages: messages,
22380
+ requestOverheadTokens: estimateRequestOverheadTokens(agent.state.systemPrompt, agent.state.tools),
22231
22381
  ...pairPendingRuntimeContext && pendingMessages ? { runtimeContextMessages: [...messages, ...pendingMessages.map((entry) => entry.message)] } : void 0,
22232
22382
  signal: hookSignal,
22233
22383
  turnStartMessageIndex: runResume.turnStartMessageIndex
@@ -22757,4 +22907,4 @@ function createAgentRunner(execute, options) {
22757
22907
  return await execute(nextRun, streamFn);
22758
22908
  } };
22759
22909
  }
22760
- export { readViewerAutomations as $, runWithSlackInstallation as A, readUserCustomization as At, logScheduledAutomationRunSkipped as B, readSlackReviewItemCardConversationId as C, listUnreportedSiblingAgents as Ct, parseSlackReviewItemClick as D, ingestEvent as Dt, buildSlackReviewItemModal as E, processWorkspaceSnapshotJob as Et, resolveSlackChannelIdFromThreadId as F, readBlockedReport as Ft, readViewerAutomationEdit as G, activateViewerAutomationVersion as H, getConversationInfo as I, shouldEmitDevAgentTrace as It, readConversationSourceTask as J, updateViewerAutomation as K, joinPublicChannel as L, parseSlackThreadId as M, RetryableDeliveryError as Mt, readSlackRawMessageContext as N, actorFromRun as Nt, parseSlackReviewItemFormTarget as O, buildSteeringPiMessage as Ot, resolveSlackChannelIdFromMessage as P, toolInvocationDestination as Pt, readViewerAutomationVersions as Q, listThreadReplies as R, createSlackReviewItemShow as S, listChildAgents as St, SLACK_REVIEW_ITEM_VIEW_ID as T, conversationSubtreeColumns as Tt, changeViewerAutomationLifecycle as U, scheduledAutomationRunAttributes as V, deleteViewerTask as W, readViewerAutomationRuns as X, readViewerAutomationExecutions as Y, readViewerAutomationSummary as Z, readPublicArtifact as _, storeAttachment as _t, buildAuthPauseResponse as a, acceptsWebMessages as at, renderAttachmentText as b, recordSubagentEnded as bt, deleteMcpAuthSessionsForUserProvider as c, createAndEnqueueConversation as ct, getMcpAuthSession as d, webActorFromEmail as dt, AutomationEditError as et, getMcpStoredOAuthCredentials as f, resolveConversationDestination as ft, publicArtifactHeaders as g, requestAttachmentDeletion as gt, readStats as h, readLiveAttachment as ht, measureTurnCompactionWait as i, renderReviewItemMessage as it, verifySlackSignature as j, saveUserCustomization as jt, parseSlackUserInputSubmission as k, withoutSavedSteeringMessages as kt, deleteMcpServerSessionId as l, createConversationId as lt, latestProgressStatus as m, collectAttachmentGarbage as mt, executeAgentRun as n, listOwnedWatches as nt, finalizeMcpAuthorization as o, appendAndEnqueueWebMessage as ot, putMcpStoredOAuthCredentials as p, decodeInputImages as pt, ViewerTaskNotFoundError as q, processBackgroundCompaction as r, deliverReviewItemChange as rt, deleteMcpAuthSession as s, conversationTurnIdForMessage as st, createAgentRunner as t, effectiveTaskOutcomes as tt, deleteMcpStoredOAuthCredentials as u, recordWebConversationActivity as ut, unpublishedArtifactHeaders as v, stopChildAgentsOf as vt, syncReviewItemSlackCards as w, conversationSubtree as wt, renderBlockText as x, recordSubagentStarted as xt, lookupSlackUserProfile as y, stopConversationSession as yt, resolveDestinationVisibility as z };
22910
+ export { readViewerAutomations as $, runWithSlackInstallation as A, withoutSavedSteeringMessages as At, logScheduledAutomationRunSkipped as B, readSlackReviewItemCardConversationId as C, listChildAgents as Ct, parseSlackReviewItemClick as D, processWorkspaceSnapshotJob as Dt, buildSlackReviewItemModal as E, conversationSubtreeColumns as Et, resolveSlackChannelIdFromThreadId as F, toolInvocationDestination as Ft, readViewerAutomationEdit as G, activateViewerAutomationVersion as H, getConversationInfo as I, readBlockedReport as It, readConversationSourceTask as J, updateViewerAutomation as K, joinPublicChannel as L, shouldEmitDevAgentTrace as Lt, parseSlackThreadId as M, saveUserCustomization as Mt, readSlackRawMessageContext as N, RetryableDeliveryError as Nt, parseSlackReviewItemFormTarget as O, ingestEvent as Ot, resolveSlackChannelIdFromMessage as P, actorFromRun as Pt, readViewerAutomationVersions as Q, listThreadReplies as R, createSlackReviewItemShow as S, recordSubagentStarted as St, SLACK_REVIEW_ITEM_VIEW_ID as T, conversationSubtree as Tt, changeViewerAutomationLifecycle as U, scheduledAutomationRunAttributes as V, deleteViewerTask as W, readViewerAutomationRuns as X, readViewerAutomationExecutions as Y, readViewerAutomationSummary as Z, readPublicArtifact as _, requestAttachmentDeletion as _t, buildAuthPauseResponse as a, reviewItemChangeRecord as at, renderAttachmentText as b, stopConversationSession as bt, deleteMcpAuthSessionsForUserProvider as c, conversationTurnIdForMessage as ct, getMcpAuthSession as d, recordWebConversationActivity as dt, AutomationEditError as et, getMcpStoredOAuthCredentials as f, webActorFromUser as ft, publicArtifactHeaders as g, readLiveAttachment as gt, readStats as h, collectAttachmentGarbage as ht, measureTurnCompactionWait as i, renderReviewItemMessage as it, verifySlackSignature as j, readUserCustomization as jt, parseSlackUserInputSubmission as k, buildSteeringPiMessage as kt, deleteMcpServerSessionId as l, createAndEnqueueConversation as lt, latestProgressStatus as m, decodeInputImages as mt, executeAgentRun as n, listOwnedWatches as nt, finalizeMcpAuthorization as o, acceptsWebMessages as ot, putMcpStoredOAuthCredentials as p, resolveConversationDestination as pt, ViewerTaskNotFoundError as q, processBackgroundCompaction as r, deliverReviewItemChange as rt, deleteMcpAuthSession as s, appendAndEnqueueWebMessage as st, createAgentRunner as t, effectiveTaskOutcomes as tt, deleteMcpStoredOAuthCredentials as u, createConversationId as ut, unpublishedArtifactHeaders as v, storeAttachment as vt, syncReviewItemSlackCards as w, listUnreportedSiblingAgents as wt, renderBlockText as x, recordSubagentEnded as xt, lookupSlackUserProfile as y, stopChildAgentsOf as yt, resolveDestinationVisibility as z };