@sentry/junior 0.308.0 → 0.310.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 (89) hide show
  1. package/dist/{actor-D2iXzvlN.js → actor-BsBdxDXQ.js} +0 -1
  2. package/dist/{adapter-context-BO432242.js → adapter-context-BhKpjpGD.js} +2 -2
  3. package/dist/{admin-vSmheo3Z.js → admin-tgZEZAk2.js} +2 -2
  4. package/dist/{agent-runner-BnOofGFG.js → agent-runner-D9cvNlQl.js} +245 -204
  5. package/dist/api/schema.d.ts +1 -1
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +4 -2
  8. package/dist/api.js +416 -272
  9. package/dist/{app-CqYqy541.d.ts → app-B_7Wn0en.d.ts} +4 -6
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +74 -193
  12. package/dist/{background-compaction-queue-BpmDEQf6.js → background-compaction-queue-BGHqkhkY.js} +4 -4
  13. package/dist/{briefs-Dbh94cRp.js → briefs-DKxkoruh.js} +3 -3
  14. package/dist/{catalog-runtime-q9AJjuUN.js → catalog-runtime-BxwzbLKY.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +10 -10
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +5 -5
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{config-Cx8H0MRw.js → config-Dkt2Le2b.js} +51 -92
  23. package/dist/{continue-in-slack-CtTv1tkn.js → continue-in-slack-BWVwePKD.js} +6 -6
  24. package/dist/{conversation--f85g4zL.js → conversation-M9KZ5JxF.js} +7 -2
  25. package/dist/{conversation-feed-BNs9KiqC.js → conversation-feed-Ci6YD1N-.js} +1 -1
  26. package/dist/{conversation-privacy-CivmFlWP.js → conversation-privacy-C39g8BY4.js} +1 -1
  27. package/dist/{conversation-turn-C9-Nfnsy.js → conversation-turn-CBlZIH02.js} +20 -21
  28. package/dist/{credential-sync-CWIORwD9.js → credential-sync-vGnrB0BY.js} +31 -23
  29. package/dist/{db-C41UgdBj.d.ts → db-B4Hjxr-u.d.ts} +2 -2
  30. package/dist/{db-CO6Y10eM.js → db-CFZggNoy.js} +20 -10
  31. package/dist/{executor-Doo-N6Yn.js → executor-BPkZDx5-.js} +12 -4
  32. package/dist/fan-out-Cod-yEHG.js +10 -0
  33. package/dist/{history-N7IVbUom.js → history-CYstOMKX.js} +6 -0
  34. package/dist/{connections-DUylBPiR.js → html-2r2KmLwi.js} +146 -11
  35. package/dist/{install-Y2s9ZPvk.js → install-C-oE6C_u.js} +2 -2
  36. package/dist/instrumentation.js +2 -2
  37. package/dist/{lineage-BcqyhMyp.js → lineage-CsvrEFQe.js} +2 -2
  38. package/dist/{logging-DnBYBM8z.js → logging-D5gkyvnK.js} +1 -1
  39. package/dist/{message-fSnXIqvl.js → message-DwvJ-I3w.js} +8 -8
  40. package/dist/{model-input-DRChpXJ7.js → model-input-MAq2881y.js} +15 -10
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +4 -4
  43. package/dist/{oauth-callback-server-BUU6zd_T.js → oauth-callback-server-DIF6Li06.js} +2 -2
  44. package/dist/{oauth-relay-gO_Ynmpb.js → oauth-relay-DPE-wrwO.js} +1 -1
  45. package/dist/{package-discovery-x4AvVhMj.js → package-discovery-DD9vencX.js} +0 -1
  46. package/dist/{projection-Bqn6zdVT.js → projection-jZSlEAXG.js} +116 -123
  47. package/dist/{prompt-DAjjk5fm.js → prompt-CaMyeCpA.js} +25 -14
  48. package/dist/{registry-tHJLCtKS.js → registry-BBkWFCl8.js} +3 -3
  49. package/dist/{resolve-z2sKt8xM.js → resolve-B38MkHXE.js} +3 -3
  50. package/dist/{result-D2wshngt.js → result-BaqSZcJb.js} +12 -13
  51. package/dist/{runner-BvNPWLAy.js → runner-11h8PrHh.js} +10 -10
  52. package/dist/{sandbox-egress-signals-CmHD-6vr.js → sandbox-egress-signals-CTcACAtJ.js} +1 -1
  53. package/dist/{schedule-BG1tEbRF.js → schedule-DWxZ3kja.js} +1 -1
  54. package/dist/{schema-CRXcj4fj.d.ts → schema-DriSvB40.d.ts} +43 -43
  55. package/dist/{schema-D4jdesIu.js → schema-obw5jvR4.js} +65 -28
  56. package/dist/{service-account-B2d1Er_r.js → service-account-Bx93N1n1.js} +3 -3
  57. package/dist/{service-account-CddxU-yC.js → service-account-Zc5bUcIJ.js} +7 -8
  58. package/dist/{session-stop-BQ0J0Fph.js → session-stop-BfY4rhJs.js} +179 -199
  59. package/dist/{skills-Dm2-5nn5.js → skills-C8Npu5zO.js} +99 -57
  60. package/dist/{slack-conversation-unfurl-CLH0tTLk.js → slack-conversation-unfurl-DlRVA02H.js} +18 -15
  61. package/dist/{spawn-PwAuSN59.js → spawn-CXr58R0x.js} +6 -6
  62. package/dist/{state-rXH58smZ.js → state-CGrGVeQC.js} +4 -4
  63. package/dist/{stop-CcHPEcFE.js → stop-DYzjRf2U.js} +176 -135
  64. package/dist/{store-7QA00oK6.js → store-D4FQ1Nml.js} +5 -5
  65. package/dist/{task-queue-DvQZH5rG.js → task-queue-CaZffYaH.js} +7 -4
  66. package/dist/{task-runner-CyZMcuZy.js → task-runner-Dm7BHbGp.js} +11 -12
  67. package/dist/{thread-context-C-hLTQST.js → thread-context-Dyj1KWaY.js} +13 -11
  68. package/dist/{turn-session-routing-Cqjj1B3i.js → turn-session-routing-CD0BRCex.js} +4 -4
  69. package/dist/{turn-user-message-DbU7MNd9.js → turn-user-message-9IxeEv5v.js} +14 -5
  70. package/dist/{queue-CbEHUO0l.d.ts → types-fnU7Xs__.d.ts} +3 -1
  71. package/dist/{users-B-UpCmw9.js → users-CaUAYMb3.js} +1 -1
  72. package/dist/{validation-BEUlev32.js → validation-DxVNIxA0.js} +1 -1
  73. package/dist/{version-BE1OyrXV.js → version-Cr7Z71yG.js} +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/{viewer-CqOkWizK.js → viewer-AHldghAD.js} +7 -5
  76. package/dist/{warmup-HFgFZFwS.js → warmup-C6LOZ2d2.js} +138 -80
  77. package/dist/{worker-CCEDWbsY.js → worker-CUBtu1Li.js} +8 -8
  78. package/migrations/0121_people_list_metric_index.sql +1 -0
  79. package/migrations/0122_automation_rollout_repair.sql +56 -0
  80. package/migrations/0123_cache_warming_history_reset.sql +10 -0
  81. package/migrations/0124_artifact_visibility.sql +9 -0
  82. package/migrations/0125_artifact_public_sha_index.sql +1 -0
  83. package/migrations/meta/0121_snapshot.json +5481 -0
  84. package/migrations/meta/0122_snapshot.json +5481 -0
  85. package/migrations/meta/0123_snapshot.json +5481 -0
  86. package/migrations/meta/0124_snapshot.json +5516 -0
  87. package/migrations/meta/0125_snapshot.json +5516 -0
  88. package/migrations/meta/_journal.json +35 -0
  89. package/package.json +7 -7
@@ -1,36 +1,37 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $ as pauseLostWorkerTurn, $c as readAutomationExecutionSummaries, $n as getTerminalAssistantMessages, Ac as eventWatchUnavailable, B as PluginCredentialFailureError, Bc as listAutomationVersions, Bi as updateWorkspace, Ea as workspaceRepoCheckoutPath, Ec as describeRegisteredEventTrigger, En as createPluginHookRunner, Fa as SANDBOX_WORKSPACE_ROOT, Fc as registeredResourceTypeSchema, Fi as deleteWorkspace, Fr as insertReviewItem, Gc as requireAutomationRevision, Gi as setWorkspaceSnapshotBuild, Gn as seqIn, Gr as canReadReviewItem, Hc as sameDefinitionValue, Hi as invalidateReadySnapshot, Hr as PLUGIN_REVIEW_ITEM_KEY_PREFIX, Ic as requireEventIdentifier, Ii as getWorkspace, Io as defaultTimezone, J as clearPendingAuth, Jc as emptyAutomationRunWindows, Ji as isStale, Jn as eventExcerpt, Jo as getDispatchInputMessageId, Kc as ToolInputError, Ki as create, Kn as SEARCHABLE_EVENT_TYPES, Lc as requireValidEventTrigger, Li as getWorkspaceByName, Ma as SANDBOX_REPOS_ROOT, Mc as registeredEventMatchSchema, Mo as saveObjectAnnotations, Mr as dismissOpenReviewItems, Ms as sleep, Na as SANDBOX_SCRATCH_ROOT, Nc as registeredEventTriggerProblems, Nn as getPlugins, No as createPluginAnnotations, Nr as getOpenReviewItemByDedupeKey, Oo as searchConversations, Os as normalizeSlackConversationId, Pc as registeredEventTypeSchema, Pi as createWorkspace, Pn as getStaticPluginToolDefinitions, Pr as getReviewItem, Q as lostWorkerBeforeFirstSave, Qc as readAutomationExecutionStatusHours, Rc as automationDefinition, Ri as listWorkspaces, Si as listWatches, Ss as getFilePermalink, Tc as automationEventCatalog, Ts as isConversationScopedChannel, Ua as createPluginLogger, Ui as loadSnapshotsForProfile, Un as lexemesSql, Vc as readAutomationVersion, Vi as WorkspaceValidationError, Vr as updateReviewItemContent, Vs as slackMention, W as AuthorizationFlowDisabledError, Wa as canAccessConversation, Wc as automationRevision, Wi as setWorkspaceSnapshot, Wn as searchedEventTextSql, Wr as canAgentChangeReviewItem, Xc as readAutomationExecutionByConversationId, Xi as getSandboxProvider, Xr as requireReviewItemAssignees, Yn as excerptTerms, Yo as getDispatchRecord, Yr as readReviewItemAgentScope, Ys as parseScheduledAutomationRow, Z as loadTurnCheckpoint, Zc as readAutomationExecutionStatusDays, Zr as requireReviewItemLinks, Zs as saveScheduledAutomation, _i as createWatch, ai as resolveAssignees, at as getTurnRecord, bc as saveEventAutomation, bi as getWatch, bo as readLiveAttachment, bs as SlackActionError, ci as getSlackToolContext, cn as getAssistantReplyText, cs as getSlackMessagePermalink, da as WorkspaceSnapshotNotReadyError, di as RESOURCE_WATCH_TOOL_SOURCE, dl as createPluginCache, dn as findLegacyNoReplyMarker, el as readAutomationExecutions, et as saveTurnCheckpoint, fi as STOP_WATCHING_TOOL_NAME, fn as isLegacyNoReplyMarker, gi as createTimerWatch, gn as REPORT_BLOCKED_TOOL_NAME, hc as deleteEventAutomation, ii as resolveAssignee, in as readTurnAnswer, jc as hasEventCatalogEntries, jo as embedConversationQuery, js as withSlackRetries, k as markConversationMessage, kc as eventNamespaceSchema, kr as closeReviewItem, li as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, lo as FORK_INSTRUCTIONS, ls as openSlackDirectMessage, mi as cancelWatch, ni as activeParticipantUserIds, nl as readAutomationRuns, nn as REPLY_TOOL_NAME, ol as fallbackShortTitle, on as replyTextSchema, pa as isWorkspaceSnapshotNotReadyError, po as matchSlackAttachments, qa as readConversationAccessFromSql, qn as callsToolSql, qo as getDispatchIdForConversation, qs as deleteScheduledAutomation, ri as automationCreatorUserId, rt as failTurnRecord, s as openConversationProjection, sa as isAbortError, sc as getDashboardTaskLink, sl as resolveTaskTitle, st as recordTurnSummary, tc as getDashboardConversationLink, ti as EVERYONE_ASSIGNEE, tl as readAutomationRowStats, tn as isTurnExecutionLimitExceededError, tt as abandonTurnRecord, ui as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, un as NO_REPLY_TOOL_NAME, uo as loadForkHistory, v as hydrateConversationMessages, va as createSandboxEgressCredentialToken, vc as listDeletedEventAutomationsCreatedBy, vi as deliverWatch, wa as SANDBOX_RUNTIME, wi as turnEvents, ws as getSlackClient, xa as buildSandboxEgressNetworkPolicy, xc as setEventAutomationStatus, xi as isQuietEvent, xn as getOAuthAccountProviders, xo as recordUploadedAttachment, xs as downloadPrivateSlackFile, yc as parseEventAutomationRow, yi as findMatchingWatches, zr as searchReviewItems } from "./projection-Bqn6zdVT.js";
3
- import { W as escapeClosingTags, X as renderTag, _ as TURN_REASONING_LEVELS, i as getChatConfig, k as resolveGatewayModel, lt as bufferBody, n as botConfig, ot as isProviderRetryError } from "./config-Cx8H0MRw.js";
4
- import { E as withSpan, G as normalizeIdentityEmail, J as toOptionalString, b as setSpanAttributes, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, x as setSpanStatus, z as getDeploymentId } from "./logging-DnBYBM8z.js";
2
+ import { $ as loadTurnCheckpoint, $c as readAutomationExecutionByConversationId, $i as getSandboxProvider, $r as requireReviewItemLinks, Bc as requireValidEventTrigger, Bi as getWorkspaceByName, Cc as saveEventAutomation, Ci as getWatch, Cn as getOAuthAccountProviders, Co as readLiveAttachment, Cs as SlackActionError, Da as SANDBOX_RUNTIME, Di as turnEvents, Ds as getSlackClient, Fa as SANDBOX_REPOS_ROOT, Fc as registeredEventMatchSchema, Fn as getPlugins, Fo as saveObjectAnnotations, Fr as getOpenReviewItemByDedupeKey, Fs as sleep, Gc as sameDefinitionValue, Gi as invalidateReadySnapshot, Gn as lexemesSql, H as PluginCredentialFailureError, Ia as SANDBOX_SCRATCH_ROOT, Ic as registeredEventTriggerProblems, In as getStaticPluginToolDefinitions, Io as createPluginAnnotations, Ir as getReviewItem, Jc as requireAutomationRevision, Ji as setWorkspaceSnapshotBuild, Jn as SEARCHABLE_EVENT_TYPES, K as AuthorizationFlowDisabledError, Ka as createPluginLogger, Ki as loadSnapshotsForProfile, Kn as searchedEventTextSql, Kr as canAgentChangeReviewItem, Lc as registeredEventTypeSchema, Li as createWorkspace, Lr as insertReviewItem, Mc as eventNamespaceSchema, Nc as eventWatchUnavailable, Oc as automationEventCatalog, On as createPluginHookRunner, Os as isConversationScopedChannel, Pc as hasEventCatalogEntries, Po as embedConversationQuery, Pr as dismissOpenReviewItems, Ps as withSlackRetries, Qo as getDispatchRecord, Qr as requireReviewItemAssignees, Qs as parseScheduledAutomationRow, Ra as SANDBOX_WORKSPACE_ROOT, Rc as registeredResourceTypeSchema, Ri as deleteWorkspace, Sc as parseEventAutomationRow, Si as findMatchingWatches, Ti as listWatches, Ts as getFilePermalink, Uc as listAutomationVersions, Ui as updateWorkspace, Ur as updateReviewItemContent, Vc as automationDefinition, Vi as listWorkspaces, Vr as searchReviewItems, Wc as readAutomationVersion, Wi as WorkspaceValidationError, Wr as PLUGIN_REVIEW_ITEM_KEY_PREFIX, Ws as slackMention, X as clearPendingAuth, Xa as readConversationAccessFromSql, Xn as eventExcerpt, Xo as getDispatchIdForConversation, Xs as deleteScheduledAutomation, Yc as ToolInputError, Yi as create, Yn as callsToolSql, Zc as emptyAutomationRunWindows, Zi as isStale, Zn as excerptTerms, Zo as getDispatchInputMessageId, Zr as readReviewItemAgentScope, _i as cancelWatch, ai as activeParticipantUserIds, al as readAutomationRuns, at as failTurnRecord, b as hydrateConversationMessages, bi as createWatch, c as openConversationProjection, ci as resolveAssignees, cn as replyTextSchema, di as getSlackToolContext, ds as getSlackMessagePermalink, ec as saveScheduledAutomation, el as readAutomationExecutionStatusDays, et as lostWorkerBeforeFirstSave, fi as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, fn as NO_REPLY_TOOL_NAME, fo as FORK_INSTRUCTIONS, fs as openSlackDirectMessage, ga as isWorkspaceSnapshotNotReadyError, go as matchSlackAttachments, hi as STOP_WATCHING_TOOL_NAME, ic as getDashboardConversationLink, ii as EVERYONE_ASSIGNEE, il as readAutomationRowStats, in as REPLY_TOOL_NAME, j as markConversationMessage, jo as searchConversations, jr as closeReviewItem, js as normalizeSlackConversationId, ka as workspaceRepoCheckoutPath, kc as describeRegisteredEventTrigger, ll as fallbackShortTitle, lt as recordTurnSummary, ma as WorkspaceSnapshotNotReadyError, mi as RESOURCE_WATCH_TOOL_SOURCE, ml as createPluginCache, mn as isLegacyNoReplyMarker, nl as readAutomationExecutionSummaries, nt as saveTurnCheckpoint, oi as automationCreatorUserId, on as readTurnAnswer, pi as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, pn as findLegacyNoReplyMarker, po as loadForkHistory, qa as canAccessConversation, qc as automationRevision, qi as setWorkspaceSnapshot, qn as seqIn, qr as canReadReviewItem, rl as readAutomationExecutions, rn as isTurnExecutionLimitExceededError, rt as abandonTurnRecord, si as resolveAssignee, st as getTurnRecord, tl as readAutomationExecutionStatusHours, tr as getTerminalAssistantMessages, tt as pauseLostWorkerTurn, ua as isAbortError, uc as getDashboardTaskLink, ul as resolveTaskTitle, un as getAssistantReplyText, vc as deleteEventAutomation, vn as REPORT_BLOCKED_TOOL_NAME, wa as buildSandboxEgressNetworkPolicy, wc as setEventAutomationStatus, wi as isQuietEvent, wo as recordUploadedAttachment, ws as downloadPrivateSlackFile, xa as createSandboxEgressCredentialToken, xc as listDeletedEventAutomationsCreatedBy, xi as deliverWatch, yi as createTimerWatch, zc as requireEventIdentifier, zi as getWorkspace, zo as defaultTimezone } from "./projection-jZSlEAXG.js";
3
+ import { K as renderParentAgentTask, _ as TURN_REASONING_LEVELS, at as bufferBody, i as getChatConfig, k as resolveGatewayModel, n as botConfig, nt as isProviderRetryError } from "./config-Dkt2Le2b.js";
4
+ import { E as withSpan, G as normalizeIdentityEmail, J as toOptionalString, b as setSpanAttributes, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, x as setSpanStatus, z as getDeploymentId } from "./logging-D5gkyvnK.js";
5
5
  import { h as startSpan, n as captureMessage, u as sentry_exports } from "./sentry-CPbZjomA.js";
6
- import { n as pluginCatalogRuntime } from "./catalog-runtime-q9AJjuUN.js";
7
- import { Ct as workspaceSnapshotFinishedEvent, E as getAuthPausedConversationTurnId, F as EVENT_WAIT_MS, H as addConversationNote, I as addQuietEventNote, J as resolveEventAuthor, L as enqueueEventNotification, O as listActiveMailboxTurnSources, Q as maybePostAutomatedTurnLimitNotice, St as WORKSPACE_SNAPSHOT_READY_EVENT, Tt as buildDeploymentSystemPrompt, bt as slackChannelMessageTrigger, ct as resetAutomatedTurnLimit, f as buildSteeringPiMessage, ft as isExperimentalFeatureEnabled, g as withoutSavedSteeringMessages, gt as requireSlackChannelMessageScope, i as resumeStoppedConversationTree, k as listActiveMailboxTurns, lt as conversationSubtree, m as instructionForInputs, mt as getEventCatalog, n as isSkippedAfterConversationStop, nt as resolveEventMentions, r as markConversationsStopped, st as recordFinishedTurnForAutomatedLimit, t as getConversationStoppedAtMs, ut as conversationSubtreeColumns, v as saveUserCustomization, w as renderPlanAssignee, wt as workspaceSnapshotWatch, x as listPlanItems, xt as WORKSPACE_SNAPSHOT_FAILED_EVENT, y as changePlan, z as isEventMailboxMetadata } from "./session-stop-BQ0J0Fph.js";
8
- import { A as agentTypeSchema, N as briefLinkSchema, O as AGENT_TYPES, P as briefOutcomeStatusSchema, Y as removedCardSchema, j as formatAgentTypes, k as agentTypeInstructions } from "./conversation--f85g4zL.js";
9
- import { B as compileScheduleIntent, F as eventAutomationTriggerSchema, H as toolScheduleIntentSchema, J as automationSkillNameSchema, K as getZonedDateTimeParts, Q as automationTaskText, U as weekdaySchema, W as getFirstRunAtMs, X as automationTaskDescription, Z as automationTaskSchema, m as automationListQuerySchema, q as isValidTimeZone, z as ScheduleIntentError } from "./schedule-BG1tEbRF.js";
10
- import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, o as isUserActor, p as parseSlackUserId, u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
11
- import { $ as getStateAdapter, A as conversationKindFromRow, E as isTopLevelKind, I as resolveActorIdentityId, O as promptModeTurnTools, P as SYSTEM_IDENTITY_ID, St as rootConversationIsArchived, T as isPersonInput, _ as readConversationTrees, a as getConversationStore, at as withLock, d as eventFromRow, et as getStateValues, ft as usdToMicroUsd, g as conversationDescendants, h as conversationAncestors, i as getConversationMessageSearchStore, it as fenceLock, k as turnBehavior, kt as sameDestination, o as getDb, r as getConversationEventStore, s as getSqlExecutor, v as setArchivedAt, wt as nextDetailVersion, x as userMessageQueries, xt as resolveRootConversationId } from "./db-CO6Y10eM.js";
12
- import { A as juniorConversationEvents, B as juniorUsers, C as juniorConversationEventLexemes, F as juniorAttachmentUploads, I as juniorAttachments, R as juniorConversations, V as juniorDestinations, b as juniorConversationReadPositions, g as juniorStats, h as juniorAutomations, p as juniorAutomationRuns, v as juniorAgentBindings, w as juniorConversationEventEmbeddings, x as juniorConversationParticipants, y as juniorAgentInvocations, z as juniorIdentities } from "./executor-Doo-N6Yn.js";
13
- import { t as discoverSkills } from "./skills-Dm2-5nn5.js";
6
+ import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
7
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BxwzbLKY.js";
8
+ import { $ as maybePostAutomatedTurnLimitNotice, Ct as WORKSPACE_SNAPSHOT_READY_EVENT, E as getAuthPausedConversationTurnId, Et as buildDeploymentSystemPrompt, F as EVENT_WAIT_MS, H as addConversationNote, I as addQuietEventNote, J as resolveEventAuthor, L as enqueueEventNotification, O as listActiveMailboxTurnSources, St as WORKSPACE_SNAPSHOT_FAILED_EVENT, Tt as workspaceSnapshotWatch, _t as requireSlackChannelMessageScope, ct as recordFinishedTurnForAutomatedLimit, dt as conversationSubtreeColumns, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, ht as getEventCatalog, i as resumeStoppedConversationTree, k as listActiveMailboxTurns, lt as resetAutomatedTurnLimit, m as instructionForInputs, n as isSkippedAfterConversationStop, pt as isExperimentalFeatureEnabled, r as markConversationsStopped, rt as resolveEventMentions, t as getConversationStoppedAtMs, ut as conversationSubtree, v as saveUserCustomization, w as renderPlanAssignee, wt as workspaceSnapshotFinishedEvent, x as listPlanItems, xt as slackChannelMessageTrigger, y as changePlan, z as isEventMailboxMetadata } from "./session-stop-BfY4rhJs.js";
9
+ import { A as agentTypeSchema, N as briefLinkSchema, O as AGENT_TYPES, P as briefOutcomeStatusSchema, Y as removedCardSchema, j as formatAgentTypes, k as agentTypeInstructions } from "./conversation-M9KZ5JxF.js";
10
+ import { B as compileScheduleIntent, F as eventAutomationTriggerSchema, H as toolScheduleIntentSchema, J as automationSkillNameSchema, K as getZonedDateTimeParts, Q as automationTaskText, U as weekdaySchema, W as getFirstRunAtMs, X as automationTaskDescription, Z as automationTaskSchema, m as automationListQuerySchema, q as isValidTimeZone, z as ScheduleIntentError } from "./schedule-DWxZ3kja.js";
11
+ import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, o as isUserActor, p as parseSlackUserId, u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
12
+ import { A as turnBehavior, Ct as resolveRootConversationId, D as isTopLevelKind, E as isPersonInput, Et as nextDetailVersion, F as SYSTEM_IDENTITY_ID, L as resolveActorIdentityId, _ as readConversationTrees, a as getConversationStore, d as eventFromRow, g as conversationDescendants, h as conversationAncestors, i as getConversationMessageSearchStore, j as conversationKindFromRow, jt as sameDestination, k as promptModeTurnTools, mt as usdToMicroUsd, nt as getStateValues, o as getDb, ot as fenceLock, r as getConversationEventStore, rt as setStateValues, s as getSqlExecutor, st as withLock, tt as getStateAdapter, v as setArchivedAt, wt as rootConversationIsArchived, x as userMessageQueries } from "./db-CFZggNoy.js";
13
+ import { A as juniorConversationEvents, B as juniorUsers, C as juniorConversationEventLexemes, F as juniorAttachmentUploads, I as juniorAttachments, R as juniorConversations, V as juniorDestinations, b as juniorConversationReadPositions, g as juniorStats, h as juniorAutomations, p as juniorAutomationRuns, v as juniorAgentBindings, w as juniorConversationEventEmbeddings, x as juniorConversationParticipants, y as juniorAgentInvocations, z as juniorIdentities } from "./executor-BPkZDx5-.js";
14
+ import { t as discoverSkills } from "./skills-C8Npu5zO.js";
14
15
  import { D as isAgentInvocationResultEventType, F as sumUtcHoursIntoSixHours, O as apiErrorSchema, S as AGENT_INVOCATION_EVENT_NAMESPACE, b as SELF_PLAN_ASSIGNEE, c as formatUserInputAnswer, d as userInputRequestSchema, g as USER_CUSTOMIZATION_MAX_CHARS, h as isVisionImageMediaType, m as detectImageMediaType, n as AGENT_INVOCATION_MAILBOX_STATUSES, r as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as webMessageId, v as userCustomizationTextSchema, w as AGENT_PARENT_MESSAGE_EVENT_TYPE, x as isOpenPlanItemStatus, y as PLAN_ITEM_STATUSES } from "./web-message-id-BT8Mg8LL.js";
15
- import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-CqOkWizK.js";
16
- import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, I as getUnnamedAgentConversationId, N as getChildAgentLockName, O as getAgentInvocationIdForResult, P as getNamedAgentConversationId, R as buildDeterministicTurnId, S as listChildMessages, T as getAgentInvocationId, _ as ConversationTurnLifecycleService, b as hasAgentInvocationReply, d as isTurnInputCommitLostError, j as getAgentInvocationTurnId, k as getAgentInvocationMessageId, l as getConversationTurnBoundaryError, p as markTurnClosed, s as TurnInputCommitLostError, t as getTurnUserMessage, w as readChildMessageSender } from "./turn-user-message-DbU7MNd9.js";
17
- import { D as stopConversationWork, _ as getConversationWorkState, h as ensureConversationWake, m as dropPendingMessages, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, v as getConversationWorkStates, w as requestConversationWork } from "./store-7QA00oK6.js";
18
- import { d as contextProvenance, m as sameActorIdentity, t as KNOWN_CONVERSATION_EVENT_TYPES, u as agentInstructionProvenance } from "./history-N7IVbUom.js";
19
- import { m as credentialContextSchema, p as credentialContextForActor } from "./registry-tHJLCtKS.js";
20
- import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, n as resolveTurnResumeRouting, s as persistThreadStateById } from "./turn-session-routing-Cqjj1B3i.js";
21
- import { g as getTurnRequestDeadline } from "./task-queue-DvQZH5rG.js";
22
- import { d as sendNextWorkspaceSnapshotJob, f as sendWorkspaceSnapshotJob, l as sendCacheWarmup, m as getVercelConversationWorkQueue } from "./background-compaction-queue-BpmDEQf6.js";
23
- import { d as completeText, m as searchWeb, r as EVENT_AUTHOR_ID } from "./prompt-DAjjk5fm.js";
24
- import { a as searchSlackUsers, i as lookupSlackUserProfile, r as lookupSlackUserByEmail } from "./users-B-UpCmw9.js";
25
- import { n as postinstall, o as getSandboxResources, t as dependencies } from "./install-Y2s9ZPvk.js";
26
- import pLimit from "p-limit";
16
+ import { f as identityAvatarUrl, h as readUserAvatarUrls } from "./viewer-AHldghAD.js";
17
+ import { A as getAgentInvocationMessageId, C as ownAgentInvocation, E as getAgentInvocationId, F as getNamedAgentConversationId, L as getUnnamedAgentConversationId, M as getAgentInvocationTurnId, P as getChildAgentLockName, S as listChildMessages, T as readChildMessageSenders, _ as ConversationTurnLifecycleService, b as hasAgentInvocationReply, d as isTurnInputCommitLostError, j as getAgentInvocationResultMessageId, k as getAgentInvocationIdForResult, l as getConversationTurnBoundaryError, p as markTurnClosed, s as TurnInputCommitLostError, t as getTurnUserMessage, w as readChildMessageSender, z as buildDeterministicTurnId } from "./turn-user-message-9IxeEv5v.js";
18
+ import { D as stopConversationWork, _ as getConversationWorkState, h as ensureConversationWake, m as dropPendingMessages, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, v as getConversationWorkStates, w as requestConversationWork } from "./store-D4FQ1Nml.js";
19
+ import { d as contextProvenance, m as sameActorIdentity, t as KNOWN_CONVERSATION_EVENT_TYPES, u as agentInstructionProvenance } from "./history-CYstOMKX.js";
20
+ import { m as credentialContextSchema, p as credentialContextForActor } from "./registry-BBkWFCl8.js";
21
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, n as resolveTurnResumeRouting, s as persistThreadStateById } from "./turn-session-routing-CD0BRCex.js";
22
+ import { g as getTurnRequestDeadline } from "./task-queue-CaZffYaH.js";
23
+ import { d as sendNextWorkspaceSnapshotJob, f as sendWorkspaceSnapshotJob, l as sendCacheWarmup, m as getVercelConversationWorkQueue } from "./background-compaction-queue-BGHqkhkY.js";
24
+ import { d as completeText, m as searchWeb, r as EVENT_AUTHOR_ID } from "./prompt-CaMyeCpA.js";
25
+ import { a as searchSlackUsers, i as lookupSlackUserProfile, r as lookupSlackUserByEmail } from "./users-CaUAYMb3.js";
26
+ import { n as postinstall, o as getSandboxResources, t as dependencies } from "./install-C-oE6C_u.js";
27
27
  import * as z from "zod";
28
+ import pLimit from "p-limit";
28
29
  import { streamSimple } from "@earendil-works/pi-ai/compat";
29
30
  import path from "node:path";
30
31
  import { isDeepStrictEqual, promisify } from "node:util";
31
32
  import { createHash, randomUUID } from "node:crypto";
32
- import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, max, min, ne, not, notExists, notInArray, or, sql } from "drizzle-orm";
33
33
  import { actorSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, createWebSource, declaredEventKeys, destinationSchema, eventMatchFieldSchema, eventSchema, eventTriggerText, localDestinationSchema, ownedObjectAnnotationSchema, sourceSchema, stableEventMatchKey, watchResultSchema } from "@sentry/junior-plugin-api";
34
+ import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, max, min, ne, not, notExists, notInArray, or, sql } from "drizzle-orm";
34
35
  import { alias, unionAll } from "drizzle-orm/pg-core";
35
36
  import { guardedCosineDistance } from "@sentry/junior-plugin-api/embeddings";
36
37
  import http from "node:http";
@@ -522,6 +523,7 @@ async function readAutomationFacets({ collection, where }) {
522
523
  /** Resolve explicit message outcomes to the Slack Destinations stored on an Automation. */
523
524
  async function resolveTaskOutcomes(outcomes, currentDestination, creatorSlackUserId) {
524
525
  if (outcomes === void 0) return [];
526
+ const directMessageChannelId = outcomes.some((outcome) => outcome.destination !== "current_conversation") ? await openSlackDirectMessage(creatorSlackUserId) : void 0;
525
527
  const resolved = [];
526
528
  for (const outcome of outcomes) {
527
529
  if (outcome.destination === "current_conversation") {
@@ -531,13 +533,13 @@ async function resolveTaskOutcomes(outcomes, currentDestination, creatorSlackUse
531
533
  });
532
534
  continue;
533
535
  }
534
- const channelId = await openSlackDirectMessage(creatorSlackUserId);
536
+ if (!directMessageChannelId) continue;
535
537
  resolved.push({
536
538
  action: "send_message",
537
539
  destination: {
538
540
  platform: "slack",
539
541
  teamId: currentDestination.teamId,
540
- channelId
542
+ channelId: directMessageChannelId
541
543
  }
542
544
  });
543
545
  }
@@ -1793,7 +1795,7 @@ async function requireToolCaller(context) {
1793
1795
  }
1794
1796
  /** Require the Destination of this Conversation for a new or moved Automation. */
1795
1797
  function requireToolDestination(context) {
1796
- if (!context.destination) throw new ToolInputError("This Conversation has no channel or DM that an Automation can deliver to. Ask from the channel or DM where it should deliver.");
1798
+ if (!context.destination) throw new ToolInputError("This Conversation has no channel or DM that an Automation can deliver to. Set destination to a public Slack channel, or ask from the Slack channel or DM where it should deliver.");
1797
1799
  return context.destination;
1798
1800
  }
1799
1801
  /**
@@ -6044,12 +6046,10 @@ async function skipUnreadResults(conversationId, nowMs, state) {
6044
6046
  conversationId,
6045
6047
  state
6046
6048
  }))?.messages ?? [];
6047
- const invocationIds = [];
6048
- for (const message of messages) {
6049
- const sender = await readChildMessageSender(message);
6049
+ const invocationIds = (await readChildMessageSenders(messages)).flatMap((sender) => {
6050
6050
  const invocation = sender && ownAgentInvocation(sender);
6051
- if (invocation) invocationIds.push(invocation);
6052
- }
6051
+ return invocation ? [invocation] : [];
6052
+ });
6053
6053
  if (invocationIds.length === 0) return;
6054
6054
  await getSqlExecutor().db().update(juniorAgentInvocations).set({
6055
6055
  parentMailboxStatus: "skipped",
@@ -6068,22 +6068,22 @@ async function skipUnreadResults(conversationId, nowMs, state) {
6068
6068
  */
6069
6069
  async function dropUnreadLoopReplies(mailboxIds, stoppedIds, state) {
6070
6070
  const stopped = new Set(stoppedIds);
6071
- for (const conversationId of mailboxIds) {
6071
+ await mapBounded(mailboxIds, async (conversationId) => {
6072
6072
  const messages = (await getConversationWorkState({
6073
6073
  conversationId,
6074
6074
  state
6075
6075
  }))?.messages ?? [];
6076
- const inboundMessageIds = [];
6077
- for (const message of messages) {
6078
- const sender = await readChildMessageSender(message);
6079
- if (sender && !ownAgentInvocation(sender) && stopped.has(sender.conversationId)) inboundMessageIds.push(message.inboundMessageId);
6080
- }
6076
+ const senders = await readChildMessageSenders(messages);
6077
+ const inboundMessageIds = messages.flatMap((message, index) => {
6078
+ const sender = senders[index];
6079
+ return sender && !ownAgentInvocation(sender) && stopped.has(sender.conversationId) ? [message.inboundMessageId] : [];
6080
+ });
6081
6081
  if (inboundMessageIds.length > 0) await dropPendingMessages({
6082
6082
  conversationId,
6083
6083
  inboundMessageIds,
6084
6084
  state
6085
6085
  });
6086
- }
6086
+ });
6087
6087
  }
6088
6088
  /**
6089
6089
  * Drop the unread loop replies that a Conversation that a person stopped
@@ -6101,13 +6101,13 @@ async function dropOwnUnreadLoopReplies(conversationId, state) {
6101
6101
  async function finishStoppedTree(tree, conversationIdsToStop, options) {
6102
6102
  for (const invocation of tree.stopped) await recordSubagentEnded(invocation);
6103
6103
  await markConversationsStopped(conversationIdsToStop, options);
6104
- for (const conversationId of conversationIdsToStop) {
6104
+ await mapBounded(conversationIdsToStop, async (conversationId) => {
6105
6105
  await cancelSignInWait(conversationId);
6106
6106
  await stopConversationWork({
6107
6107
  conversationId,
6108
6108
  state: options.state
6109
6109
  });
6110
- }
6110
+ });
6111
6111
  }
6112
6112
  /**
6113
6113
  * List one child Conversation and every Conversation below it, child first.
@@ -6269,7 +6269,7 @@ function invocationIdFromMessages(messages) {
6269
6269
  function agentInvocationInputText(invocation) {
6270
6270
  if (!invocation.parentToolCallId) return invocation.input;
6271
6271
  const instructions = [invocation.fork ? FORK_INSTRUCTIONS : void 0, agentTypeInstructions(invocation.agentType)].filter((text) => text !== void 0);
6272
- return renderTag("parent-agent-task", {}, [...instructions.flatMap((text) => [escapeClosingTags(text), ""]), escapeClosingTags(invocation.input)]);
6272
+ return renderParentAgentTask([...instructions.flatMap((text) => [text, ""]), invocation.input]);
6273
6273
  }
6274
6274
  /**
6275
6275
  * A parent agent task or message is the child's instruction. Another input,
@@ -7006,10 +7006,7 @@ async function hasOpenChildWork(invocation) {
7006
7006
  const conversationId = invocation.childConversationId;
7007
7007
  if ((await listOpenAgentInvocations(conversationId)).some((row) => row.invocationId !== invocation.invocationId) || (await listOpenChildAgentsWithoutAgentInvocations(conversationId)).length > 0) return true;
7008
7008
  const work = await getConversationWorkState({ conversationId });
7009
- for (const message of work?.messages ?? []) {
7010
- const sender = await readChildMessageSender(message);
7011
- if (sender && !sender.agentInvocationId) return true;
7012
- }
7009
+ if ((await readChildMessageSenders(work?.messages ?? [])).some((sender) => sender && !sender.agentInvocationId)) return true;
7013
7010
  const marked = await getSqlExecutor().db().select({
7014
7011
  invocationId: juniorAgentInvocations.invocationId,
7015
7012
  parentMailboxStatus: juniorAgentInvocations.parentMailboxStatus,
@@ -7203,8 +7200,7 @@ async function listChildAgentsFromInvocations(parentConversationId) {
7203
7200
  const active = conversations.filter((row) => row.executionStatus === "pending" || row.executionStatus === "running" || row.executionStatus === "paused");
7204
7201
  const activeIds = active.map((row) => row.conversationId);
7205
7202
  const [workStates, mailboxTurnSources] = await Promise.all([getConversationWorkStates(activeIds), listActiveMailboxTurnSources(activeIds)]);
7206
- const limit = pLimit(8);
7207
- const onConversationLoop = new Set((await Promise.all(active.map((row) => limit(async () => await runsOnConversationLoop(conversationKindFromRow(row), byChild.get(row.conversationId)[0], row.stoppedAt?.getTime(), workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []) ? row.conversationId : void 0)))).filter((id) => id !== void 0));
7203
+ const onConversationLoop = new Set((await mapBounded(active, async (row) => await runsOnConversationLoop(conversationKindFromRow(row), byChild.get(row.conversationId)[0], row.stoppedAt?.getTime(), workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []) ? row.conversationId : void 0)).filter((id) => id !== void 0));
7208
7204
  const factsByChild = new Map(conversations.map((row) => [row.conversationId, {
7209
7205
  ...row.archivedAt ? { archivedAtMs: row.archivedAt.getTime() } : void 0,
7210
7206
  kind: conversationKindFromRow(row) === "thread" ? "thread" : "task",
@@ -7292,11 +7288,10 @@ async function listOpenLoopTurnIds(conversationId) {
7292
7288
  }
7293
7289
  async function listAnsweredLoopChildren(children, parentMessages) {
7294
7290
  if (children.length === 0 || parentMessages.length === 0) return [];
7295
- const limit = pLimit(8);
7296
- return (await Promise.all(children.map(({ childConversationId }) => limit(async () => {
7291
+ return (await mapBounded(children, async ({ childConversationId }) => {
7297
7292
  const turnIds = await listOpenLoopTurnIds(childConversationId);
7298
7293
  return parentMessages.some(({ sender }) => sender.conversationId === childConversationId && turnIds.includes(sender.turnId)) ? childConversationId : void 0;
7299
- })))).filter((id) => id !== void 0);
7294
+ })).filter((id) => id !== void 0);
7300
7295
  }
7301
7296
  /**
7302
7297
  * List the other child agents of one parent whose results have not reached
@@ -7375,11 +7370,10 @@ async function listAgentRelatives(input) {
7375
7370
  /** List the active watches that one Conversation owns, oldest first. */
7376
7371
  async function listOwnedWatches(conversationId) {
7377
7372
  const [own, childAgents] = await Promise.all([listWatches({ conversationId }), listDescendantAgents(conversationId)]);
7378
- const limit = pLimit(8);
7379
- const childWatches = await Promise.all(childAgents.map((childAgent) => limit(async () => (await listWatches({ conversationId: childAgent.conversationId })).map((watch) => ({
7373
+ const childWatches = await mapBounded(childAgents, async (childAgent) => (await listWatches({ conversationId: childAgent.conversationId })).map((watch) => ({
7380
7374
  childAgent,
7381
7375
  watch
7382
- })))));
7376
+ })));
7383
7377
  return [...own.map((watch) => ({ watch })), ...childWatches.flat()].sort((left, right) => left.watch.createdAtMs - right.watch.createdAtMs);
7384
7378
  }
7385
7379
  /**
@@ -7857,8 +7851,7 @@ async function verifyAttachmentUploads(args) {
7857
7851
  }
7858
7852
  /** Record checked uploads as attachments of their Conversation. */
7859
7853
  async function recordAttachmentUploads(args) {
7860
- const limit = pLimit(8);
7861
- await Promise.all(args.uploads.filter((upload) => !upload.recorded).map((upload) => limit(() => recordUploadedAttachment({
7854
+ await mapBounded(args.uploads.filter((upload) => !upload.recorded), (upload) => recordUploadedAttachment({
7862
7855
  attachment: {
7863
7856
  ...upload.attachment,
7864
7857
  conversationId: args.conversationId,
@@ -7868,7 +7861,7 @@ async function recordAttachmentUploads(args) {
7868
7861
  db: args.db,
7869
7862
  nowMs: args.nowMs ?? Date.now(),
7870
7863
  storage: args.storage
7871
- }))));
7864
+ }));
7872
7865
  return args.uploads.map((upload) => upload.attachment);
7873
7866
  }
7874
7867
  /**
@@ -8265,11 +8258,12 @@ async function sendOne(args) {
8265
8258
  async function sendReviewItemMessages(args) {
8266
8259
  const conversationIds = (await openConversationIds(args.item.conversationIds)).filter((id) => id !== args.exceptConversationId);
8267
8260
  const text = renderReviewItemMessage(args.item, args.change);
8268
- const results = await Promise.allSettled(conversationIds.map((conversationId) => sendOne({
8261
+ const limit = pLimit(8);
8262
+ const results = await Promise.allSettled(conversationIds.map((conversationId) => limit(() => sendOne({
8269
8263
  ...args,
8270
8264
  conversationId,
8271
8265
  text
8272
- })));
8266
+ }))));
8273
8267
  for (const [index, result] of results.entries()) if (result.status === "rejected") logWarn("review_item.message.failed", {
8274
8268
  "app.review_item.id": args.item.id,
8275
8269
  "app.review_item.change": args.change.kind,
@@ -8322,6 +8316,12 @@ const subjectSchema = z.object({
8322
8316
  title: z.string().trim().min(1).max(200).nullable().optional(),
8323
8317
  url: z.string().url().max(2e3).nullable().optional()
8324
8318
  }).strict();
8319
+ const evidenceSchema = z.array(z.object({
8320
+ url: z.string().url().max(2e3).refine((url) => URL.canParse(url) && ["http:", "https:"].includes(new URL(url).protocol), "Use an http(s) URL.").nullable().optional().describe("Link to the source, such as a chart or a log search."),
8321
+ conversation_id: z.string().trim().min(1).max(500).nullable().optional().describe("A Conversation that holds the evidence. Set this or `url`."),
8322
+ label: z.string().trim().min(1).max(120).describe("Short name of the source, such as `Checkout p95 chart`."),
8323
+ note: z.string().trim().min(1).max(200).regex(/^[^\r\n]*$/, "Use one line.").nullable().optional().describe("One line: what this source shows.")
8324
+ }).strict()).max(10);
8325
8325
  const conversationIdsSchema = z.array(z.string().trim().min(1).max(500)).max(10);
8326
8326
  const titleSchema$1 = z.string().trim().min(1).max(200);
8327
8327
  const bodySchema = z.string().trim().min(1).max(4e3).describe("Markdown details for the person.");
@@ -8374,7 +8374,7 @@ function itemResult(item) {
8374
8374
  updated_at: item.updatedAt.toISOString(),
8375
8375
  ...item.subject ? { subject: item.subject } : void 0,
8376
8376
  ...item.automationId ? { automation_id: item.automationId } : void 0,
8377
- ...item.request ? { request: item.request } : void 0,
8377
+ ...item.request ? { request: requestResult(item.request) } : void 0,
8378
8378
  ...item.answer ? { answer: item.answer } : void 0,
8379
8379
  ...item.closedAt ? {
8380
8380
  closed_at: item.closedAt.toISOString(),
@@ -8405,18 +8405,51 @@ const addReviewItemToolDefinition = zodToolDefinition({
8405
8405
  body: bodySchema,
8406
8406
  assignees: assigneesSchema.nullable().optional().describe("Who can act on the item. Omit for the person in this Turn, else the Automation creator in an Automation run, else the people still subscribed to the Conversation."),
8407
8407
  dedupe_key: z.string().trim().min(1).max(200).nullable().optional().describe("Stable key for what the item is about, such as `fair-source:entry:acme`. If an open item has this key, the call updates that item instead of adding another. Use the same key on each run. Omit for a one-time question."),
8408
- request: userInputRequestSchema.nullable().optional().describe("Required for an action item. Not allowed for a notice. Ask for related input in one item. Write the question so it stands alone: a person who sees only the card must understand it."),
8408
+ request: userInputRequestSchema.safeExtend({ evidence: evidenceSchema.nullable().optional().describe("Sources for the facts in the question. With a suggested answer, cite what supports it and what argues against it, such as a Conversation or chart that disagrees. Each entry has a `url` or a `conversation_id`.") }).nullable().optional().describe("Required for an action item. Not allowed for a notice. Ask for related input in one item. Write the question so it stands alone: a person who sees only the card must understand it."),
8409
8409
  subject: subjectSchema.nullable().optional(),
8410
8410
  conversation_ids: conversationIdsSchema.nullable().optional().describe("Other Conversations to link. The current Conversation is always linked.")
8411
8411
  }).strict(),
8412
8412
  outputSchema: juniorToolOutputSchema
8413
8413
  });
8414
+ /**
8415
+ * Normalize the evidence input: each entry names exactly one source, and
8416
+ * null fields mean omitted.
8417
+ */
8418
+ function evidenceInput(evidence) {
8419
+ return (evidence ?? []).map((entry) => {
8420
+ if (Boolean(entry.url) === Boolean(entry.conversation_id)) throw new ToolInputError("Each `evidence` entry needs a `url` or a `conversation_id`, not both.");
8421
+ return {
8422
+ label: entry.label,
8423
+ ...entry.url ? { url: entry.url } : void 0,
8424
+ ...entry.conversation_id ? { conversationId: entry.conversation_id } : void 0,
8425
+ ...entry.note ? { note: entry.note } : void 0
8426
+ };
8427
+ });
8428
+ }
8429
+ /** Store the question with its normalized evidence, if it cites any. */
8430
+ function requestInput({ evidence: _input, ...question }, evidence) {
8431
+ return {
8432
+ ...question,
8433
+ ...evidence.length > 0 ? { evidence } : void 0
8434
+ };
8435
+ }
8436
+ /** Show the stored question with the tool's snake_case evidence keys. */
8437
+ function requestResult({ evidence, ...question }) {
8438
+ return {
8439
+ ...question,
8440
+ ...evidence ? { evidence: evidence.map(({ conversationId, ...entry }) => ({
8441
+ ...entry,
8442
+ ...conversationId ? { conversation_id: conversationId } : void 0
8443
+ })) } : void 0
8444
+ };
8445
+ }
8414
8446
  /** Create the tool that adds a Review item or updates the open one. */
8415
8447
  function createAddReviewItemTool(context, services) {
8416
8448
  return zodTool({
8417
8449
  ...addReviewItemToolDefinition,
8418
8450
  execute: async (input, options) => {
8419
8451
  requireRequest(input.kind, Boolean(input.request));
8452
+ const evidence = evidenceInput(input.request?.evidence);
8420
8453
  if (input.dedupe_key?.startsWith("plugin:")) throw new ToolInputError(`A \`dedupe_key\` that starts with \`${PLUGIN_REVIEW_ITEM_KEY_PREFIX}\` belongs to a plugin. Use a different key.`);
8421
8454
  const db = getDb();
8422
8455
  const scope = await readReviewItemAgentScope(context);
@@ -8431,7 +8464,7 @@ function createAddReviewItemTool(context, services) {
8431
8464
  ])];
8432
8465
  await requireReviewItemLinks({
8433
8466
  allowedIds: /* @__PURE__ */ new Set([context.conversationId, ...existing?.conversationIds ?? []]),
8434
- conversationIds,
8467
+ conversationIds: [.../* @__PURE__ */ new Set([...conversationIds, ...evidence.flatMap((entry) => entry.conversationId ? [entry.conversationId] : [])])],
8435
8468
  scope,
8436
8469
  tenant: existing ? existing.tenant : scope.tenant,
8437
8470
  visibility
@@ -8456,7 +8489,7 @@ function createAddReviewItemTool(context, services) {
8456
8489
  kind: input.kind,
8457
8490
  title: input.title,
8458
8491
  visibility,
8459
- ...input.request ? { request: input.request } : void 0,
8492
+ ...input.request ? { request: requestInput(input.request, evidence) } : void 0,
8460
8493
  ...input.subject ? { subject: subjectInput(input.subject) } : void 0
8461
8494
  };
8462
8495
  if (existing) {
@@ -9862,7 +9895,7 @@ function createSearchConversationsTool(context) {
9862
9895
  rootsOnly: input.roots_only ?? true
9863
9896
  }
9864
9897
  });
9865
- return { conversations: await Promise.all(matches.map((match) => conversationMatch(match, channels))) };
9898
+ return { conversations: await mapBounded(matches, (match) => conversationMatch(match, channels)) };
9866
9899
  }
9867
9900
  });
9868
9901
  }
@@ -12839,6 +12872,22 @@ function idlePeriodSavings(input) {
12839
12872
  savedUsd: hit ? writeSavedUsd : 0
12840
12873
  };
12841
12874
  }
12875
+ /**
12876
+ * Return the savings of an idle period from stored history, as
12877
+ * `idlePeriodSavings` counts them. History has the warmup calls but not the
12878
+ * warm state. So a hit saves the write only when a warmup call ran in the
12879
+ * period and the return came before the cache of that warmup expired. Any
12880
+ * other hit read a cache that lived without warming, so it is not a hit.
12881
+ */
12882
+ function historyPeriodSavings(input) {
12883
+ const savings = idlePeriodSavings(input);
12884
+ if (!savings) return void 0;
12885
+ return input.sinceLastWarmupMs !== void 0 && input.sinceLastWarmupMs <= input.cacheTtlMs + TTL_START_DELAY_MS ? savings : {
12886
+ ...savings,
12887
+ hit: false,
12888
+ savedUsd: 0
12889
+ };
12890
+ }
12842
12891
  const savingsStats = (modelId, counts) => Object.entries(counts).map(([metric, count]) => ({
12843
12892
  namespace: SAVINGS_NAMESPACE,
12844
12893
  metric: METRICS[metric],
@@ -12881,12 +12930,13 @@ async function recordWarmupCost(modelId, costUsd) {
12881
12930
  await addSavingsStats(modelId, { warmupCost: usdToMicroUsd(costUsd) });
12882
12931
  }
12883
12932
  const utcDate = (ms) => new Date(ms).toISOString().slice(0, 10);
12933
+ const HISTORY_NAME = "history";
12884
12934
  /**
12885
- * Add one idle period from stored history that `idlePeriodSavings` counted,
12886
- * on the day of `endedAtMs`, the start of the call that ended it.
12935
+ * Add one idle period from stored history that `historyPeriodSavings`
12936
+ * counted, on the day of `endedAtMs`, the start of the call that ended it.
12887
12937
  *
12888
12938
  * History does not say whether a period had warm state, so it does not count
12889
- * as unwarmed. History has no warmup calls, so it adds no warmup cost.
12939
+ * as unwarmed.
12890
12940
  */
12891
12941
  function addHistoryPeriod(sums, endedAtMs, modelId, savings) {
12892
12942
  const byModel = sums[utcDate(endedAtMs)] ??= {};
@@ -12897,6 +12947,14 @@ function addHistoryPeriod(sums, endedAtMs, modelId, savings) {
12897
12947
  }
12898
12948
  }
12899
12949
  /**
12950
+ * Add the recorded cost of the warmup calls of one day of history. The cost
12951
+ * events have no model.
12952
+ */
12953
+ function addHistoryWarmupCost(sums, date, costUsd) {
12954
+ const counts = (sums[date] ??= {})[HISTORY_NAME] ??= {};
12955
+ counts.warmupCost = (counts.warmupCost ?? 0) + usdToMicroUsd(costUsd);
12956
+ }
12957
+ /**
12900
12958
  * Return the first day with counters that live recording wrote, if any. Days
12901
12959
  * that `replaceHistorySavings` wrote do not count.
12902
12960
  */
@@ -12906,15 +12964,15 @@ async function firstLiveSavingsDate() {
12906
12964
  /**
12907
12965
  * Replace the counters of the UTC days from `start` up to `end`, not
12908
12966
  * included, with these sums from history. Each day that has sums gets a
12909
- * `history_days` marker, so the System page knows that its warmup cost is
12910
- * unknown and `firstLiveSavingsDate` skips it.
12967
+ * `history_days` marker, so the System page marks it and
12968
+ * `firstLiveSavingsDate` skips it.
12911
12969
  */
12912
12970
  async function replaceHistorySavings(sums, range) {
12913
12971
  const days = Object.entries(sums).filter(([date]) => date >= range.start && date < range.end);
12914
12972
  await replaceStats(SAVINGS_NAMESPACE, range, days.flatMap(([date, byModel]) => [{
12915
12973
  namespace: SAVINGS_NAMESPACE,
12916
12974
  metric: METRICS.historyDays,
12917
- name: "history",
12975
+ name: HISTORY_NAME,
12918
12976
  count: 1,
12919
12977
  date
12920
12978
  }, ...Object.entries(byModel).flatMap(([modelId, counts]) => savingsStats(modelId, counts).map((stat) => ({
@@ -13015,7 +13073,10 @@ async function saveSnapshot(state, conversationId, key, context, ttlMs) {
13015
13073
  skipReason: "images_too_large"
13016
13074
  };
13017
13075
  await state.set(key, snapshot, ttlMs);
13018
- await Promise.all([...images].map(([sha256, data]) => state.set(imageKey(conversationId, sha256), data, ttlMs)));
13076
+ await setStateValues(state, [...images].map(([sha256, data]) => ({
13077
+ key: imageKey(conversationId, sha256),
13078
+ value: data
13079
+ })), ttlMs);
13019
13080
  return size;
13020
13081
  }
13021
13082
  /**
@@ -13027,8 +13088,7 @@ async function loadSnapshot(state, conversationId, key) {
13027
13088
  if (!snapshot) return "stopped";
13028
13089
  const context = JSON.parse((await zstdDecompress(Buffer.from(snapshot, "base64"))).toString("utf8"));
13029
13090
  const parts = context.messages.flatMap(imageParts).filter((part) => part.data.startsWith(IMAGE_REF_PREFIX));
13030
- const limit = pLimit(8);
13031
- const images = await Promise.all(parts.map((part) => limit(() => state.get(imageKey(conversationId, part.data.slice(7))))));
13091
+ const images = await mapBounded(parts, (part) => state.get(imageKey(conversationId, part.data.slice(7))));
13032
13092
  for (const [index, part] of parts.entries()) {
13033
13093
  const data = images[index];
13034
13094
  if (data === null || data === void 0) return "image_missing";
@@ -13323,8 +13383,7 @@ async function listConversationWork(conversationIds) {
13323
13383
  const finishedAtById = /* @__PURE__ */ new Map();
13324
13384
  const unfinished = /* @__PURE__ */ new Set();
13325
13385
  let failed = false;
13326
- const limit = pLimit(8);
13327
- await Promise.all(getPlugins().map((plugin) => limit(async () => {
13386
+ await mapBounded(getPlugins(), async (plugin) => {
13328
13387
  const hook = plugin.hooks?.unfinishedWork;
13329
13388
  if (!hook) return;
13330
13389
  try {
@@ -13360,7 +13419,7 @@ async function listConversationWork(conversationIds) {
13360
13419
  "exception.message": error instanceof Error ? error.message : String(error)
13361
13420
  });
13362
13421
  }
13363
- })));
13422
+ });
13364
13423
  return {
13365
13424
  assignedIds: conversationIds.filter((conversationId) => assigned.has(conversationId)),
13366
13425
  failed,
@@ -13478,11 +13537,10 @@ async function scheduleWarmup(message, requestStartedAtMs, warm) {
13478
13537
  }
13479
13538
  async function recordGap(state, conversationId, generation, warm, gapMs) {
13480
13539
  if (!await state.setIfNotExists(gapClaimKey(conversationId, generation), true, CONVERSATION_STATE_TTL_MS)) return;
13481
- const limit = pLimit(8);
13482
- await Promise.all(recordedSegments(warm).map((segment) => limit(() => state.appendToList(segmentGapsKey(segment), gapMs, {
13540
+ await mapBounded(recordedSegments(warm), (segment) => state.appendToList(segmentGapsKey(segment), gapMs, {
13483
13541
  maxLength: GLOBAL_GAPS_MAX,
13484
13542
  ttlMs: GLOBAL_GAPS_TTL_MS
13485
- }))));
13543
+ }));
13486
13544
  await state.appendToList(conversationGapsKey(conversationId, decisionSegment(warm)), gapMs, {
13487
13545
  maxLength: CONVERSATION_GAPS_MAX,
13488
13546
  ttlMs: CONVERSATION_STATE_TTL_MS
@@ -13856,4 +13914,4 @@ async function runCacheWarmup(message) {
13856
13914
  }, startedAtMs, warm);
13857
13915
  }, attributes);
13858
13916
  }
13859
- export { createStopAgentTool as $, createSlackListUpdateItemTool as $n, requireToolCreator as $r, readChildConversationSender as $t, createWebSearchTool as A, MINUTE_MS$1 as Ai, recordFailedDispatchTurn as An, createRunAutomationNowTool as Ar, verifyAttachmentUploads as At, createSearchEventTypesTool as B, getWebAuthorization as Bn, automationTriggerChangesSchema as Br, getActiveAgentInvocationForConversation as Bt, incrementStat as C, findAutomationSkill as Ci, findChildAgentConversationId as Cn, SLACK_TOOL_SOURCE as Cr, createConversationId as Ct, requireReadyWorkspaceSnapshot as D, resolveTaskOutcomes as Di, supersedeTurnForInput as Dn, createOperationKey as Dr, AttachmentUploadError as Dt, processWorkspaceSnapshotJob as E, moveTaskOutcomes as Ei, supersedeOpenMailboxTurns as En, resolveWorkspacePath as Er, resolveConversationDestination as Et, userLookupIdentityProviders as F, canShareTurn as Fn, zodToolDefinition as Fr, listOwnedWatches as Ft, missingFileResult as G, emptyResponse as Gn, injectContinuationToolName as Gr, listAgentInvocationsForConversation as Gt, createSearchConversationsTool as H, executeTurn as Hn, editedAutomationTask as Hr, getChildAgentLabel as Ht, createUpdateUserCustomizationTool as I, isAttemptInterrupt as In, automationIdForToolCall as Ir, listChildAgents as It, capToolResult as J, createSlackThreadReadTool as Jn, getConversationAccess as Jr, markAgentInvocationParentMailboxAppended as Jt, sliceFileContent as K, jsonResponse as Kn, juniorToolOutputSchema as Kr, listPendingAgentInvocationMailboxAppends as Kt, createSubmitFeedbackTool as L, selectAttemptMessages as Ln, automationSkillToolSchema as Lr, listUnreportedSiblingAgents as Lt, createWatchTimerTool as M, NO_REPLY_GAP_MS as Mi, wakePausedTurn as Mn, AUTOMATIONS_TOOL_SOURCE as Mr, createReadConversationEventTool as Mt, createWatchEventsTool as N, gapSegment as Ni, getTurnAuthorization as Nn, parseToolInput as Nr, createRunOperatorSqlTool as Nt, prepareWorkspaceSnapshot as O, countOwnedAutomationsNeedingAttention as Oi, createPausedTurns as On, createCanvas as Or, collectAttachmentUploadGarbage as Ot, createUserLookupTool as P, canJoinTurn as Pn, zodTool as Pr, createListWatchesTool as Pt, createUpdatePlanTool as Q, createSlackPublicSearchTool as Qn, requireToolCaller as Qr, getChildAgentInputSender as Qt, createSystemTimeTool as R, createWebAuthorization as Rn, automationToolResult as Rr, NON_TERMINAL_AGENT_INVOCATION_STATUSES as Rt, createWorkspaceTools as S, requireAutomationSkill as Si, AgentMessageTargetError as Sn, createSlackCanvasEditTool as Sr, createAndEnqueueConversation as St, ensureWorkspaceSnapshotBuild as T, effectiveTaskOutcomes as Ti, PARENT_AGENT_TARGET as Tn, positiveInteger$1 as Tr, webActorFromUser as Tt, createWriteFileTool as U, createSetConversationSubscriptionTool as Un, newAutomationTask as Ur, getLatestAgentInvocationForConversation as Ut, createSearchConversationEventsTool as V, AgentRunError as Vn, automationTriggerSchema as Vr, getAgentInvocation as Vt, createReadFileTool as W, setConversationSubscription as Wn, triggerKind as Wr, isTerminalAgentInvocation as Wt, editFile as X, renderBlockText as Xn, automationToolsDisabledReason as Xr, sendsResultToParent as Xt, createEditFileTool as Y, renderAttachmentText as Yn, automationToolContext as Yr, reportReplacedWithoutOpenWork as Yt, createBashTool as Z, parseSlackMessageReference as Zn, requireToolAutomation as Zr, childAgentInput as Zt, closeBreaker as _, changedEventMatch as _i, recordSubagentEnded as _n, isPublicSlackChannel as _r, renderReviewItemMessage as _t, createCacheWarmingRecorder as a, deleteViewerTask as ai, readParentMessage as an, createSlackChannelListMessagesTool as ar, createNoReplyTool as at, coreToolSlots as b, requireAutomationTaskText as bi, AgentDepthLimitError as bn, createSlackCanvasWriteTool as br, appendAndEnqueueWebMessage as bt, isConversationWorkDone as c, ViewerTaskNotFoundError as ci, endActiveAgentInvocations as cn, resolveSlackChannelIdFromMessage as cr, readLastUserMessageAtByConversation as ct, addHistoryPeriod as d, readViewerAutomationRuns as di, resolveAgentInvocationId as dn, slackChannelRefParam as dr, markConversationRead as dt, requireToolDestination as ei, routeChildInput as en, createSlackListGetItemsTool as er, createSpawnAgentTool as et, firstLiveSavingsDate as f, readViewerAutomationSummary as fi, dropOwnUnreadLoopReplies as fn, checkSlackChannelReadAccess as fr, reportConversationRead as ft, breakerStates as g, editEventAutomation as gi, completeCancelledConversationTurn as gn, isConversationMember as gr, deliverReviewItemChange as gt, savingsTotals as h, editScheduledAutomation as hi, cancelSignInWait as hn, getConversationInfo as hr, createUpdateReviewItemTool as ht, GLOBAL_GAPS_TTL_MS as i, changeViewerAutomationLifecycle as ii, parentMessageText as in, createSlackConversationSearchChannelPort as ir, createReplyTool as it, createWebFetchTool as j, MIN_WARMUP_PREFIX_TOKENS as ji, wakeAuthorizedTurn as jn, createDeleteAutomationTool as jr, writeAttachmentUpload as jt, ingestEvent as k, IDLE_HORIZON_MS as ki, getPausedTurnRequest as kn, createSearchAutomationsTool as kr, createAttachmentUpload as kt, listConversationWork as l, readConversationSourceTask as li, endAgentInvocationsOfStoppedWork as ln, createSlackChannelJoinTool as lr, archiveConversation as lt, replaceHistorySavings as m, readViewerAutomations as mi, stopChildAgentsOf as mn, getChannelMessage as mr, createSearchReviewItemsTool as mt, CONVERSATION_STATE_TTL_MS as n, automationEditor as ni, isParentMessageMeta as nn, createSlackListAddItemsTool as nr, createReportProgressTool as nt, segmentGapsKey as o, readViewerAutomationEdit as oi, createAgentInvocationWorker as on, parseSlackThreadId as or, createMessageAgentTool as ot, idlePeriodSavings as p, readViewerAutomationVersions as pi, stopChildAgentsBelow as pn, joinPublicChannelForRead as pr, createAddReviewItemTool as pt, TOOL_RESULT_MAX_CHARS as q, throwApiError as qn, makeStructuredToolOutput as qr, listPendingAgentInvocationResults as qt, GLOBAL_GAPS_MAX as r, changeAutomationLifecycle as ri, logDroppedParentMessage as rn, createSlackConversationMessageSearchTool as rr, createReportBlockedTool as rt, warmup_exports as s, updateViewerAutomation as si, createAndEnqueueAgentInvocation as sn, readSlackRawMessageContext as sr, createArchiveAgentTool as st, ANSWER_TOOL_ENDINGS as t, activateViewerAutomationVersion as ti, childAgentTurnOptions as tn, createSlackListCreateTool as tr, createListAgentsTool as tt, SAVINGS_NAMESPACE as u, readViewerAutomationExecutions as ui, enqueueAgentInvocation as un, resolveSlackChannelRef as ur, conversationReadPositionQuery as ut, connectedState as v, requireEventAutomationTrigger as vi, createAgentInvocationForMessage as vn, joinPublicChannel as vr, reviewItemChangeRecord as vt, readStats as w, missingAutomationSkillReason as wi, getAgentBinding as wn, isMissingPathError as wr, recordWebConversationActivity as wt, enabledMode as x, AutomationEditError as xi, AgentMessagePausedError as xn, createSlackCanvasReadTool as xr, conversationTurnIdForMessage as xt, providerCacheTtlMs as y, automationCardStatus as yi, createAgentInvocationFromLatest as yn, listThreadReplies as yr, acceptsWebMessages as yt, createStopWatchingResourcesTool as z, deleteWebAuthorization as zn, automationToolResultSchema as zr, TERMINAL_AGENT_INVOCATION_STATUSES as zt };
13917
+ export { createUpdatePlanTool as $, createSlackPublicSearchTool as $n, requireToolCaller as $r, getChildAgentInputSender as $t, ingestEvent as A, IDLE_HORIZON_MS as Ai, getPausedTurnRequest as An, createSearchAutomationsTool as Ar, createAttachmentUpload as At, createStopWatchingResourcesTool as B, deleteWebAuthorization as Bn, automationToolResultSchema as Br, TERMINAL_AGENT_INVOCATION_STATUSES as Bt, createWorkspaceTools as C, requireAutomationSkill as Ci, AgentMessageTargetError as Cn, createSlackCanvasEditTool as Cr, createAndEnqueueConversation as Ct, processWorkspaceSnapshotJob as D, moveTaskOutcomes as Di, supersedeOpenMailboxTurns as Dn, resolveWorkspacePath as Dr, resolveConversationDestination as Dt, ensureWorkspaceSnapshotBuild as E, effectiveTaskOutcomes as Ei, PARENT_AGENT_TARGET as En, positiveInteger$1 as Er, webActorFromUser as Et, createUserLookupTool as F, canJoinTurn as Fn, zodTool as Fr, createListWatchesTool as Ft, createReadFileTool as G, setConversationSubscription as Gn, triggerKind as Gr, isTerminalAgentInvocation as Gt, createSearchConversationEventsTool as H, AgentRunError as Hn, automationTriggerSchema as Hr, getAgentInvocation as Ht, userLookupIdentityProviders as I, canShareTurn as In, zodToolDefinition as Ir, listOwnedWatches as It, TOOL_RESULT_MAX_CHARS as J, throwApiError as Jn, makeStructuredToolOutput as Jr, listPendingAgentInvocationResults as Jt, missingFileResult as K, emptyResponse as Kn, injectContinuationToolName as Kr, listAgentInvocationsForConversation as Kt, createUpdateUserCustomizationTool as L, isAttemptInterrupt as Ln, automationIdForToolCall as Lr, listChildAgents as Lt, createWebFetchTool as M, MIN_WARMUP_PREFIX_TOKENS as Mi, wakeAuthorizedTurn as Mn, createDeleteAutomationTool as Mr, writeAttachmentUpload as Mt, createWatchTimerTool as N, NO_REPLY_GAP_MS as Ni, wakePausedTurn as Nn, AUTOMATIONS_TOOL_SOURCE as Nr, createReadConversationEventTool as Nt, requireReadyWorkspaceSnapshot as O, resolveTaskOutcomes as Oi, supersedeTurnForInput as On, createOperationKey as Or, AttachmentUploadError as Ot, createWatchEventsTool as P, gapSegment as Pi, getTurnAuthorization as Pn, parseToolInput as Pr, createRunOperatorSqlTool as Pt, createBashTool as Q, parseSlackMessageReference as Qn, requireToolAutomation as Qr, childAgentInput as Qt, createSubmitFeedbackTool as R, selectAttemptMessages as Rn, automationSkillToolSchema as Rr, listUnreportedSiblingAgents as Rt, enabledMode as S, AutomationEditError as Si, AgentMessagePausedError as Sn, createSlackCanvasReadTool as Sr, conversationTurnIdForMessage as St, readStats as T, missingAutomationSkillReason as Ti, getAgentBinding as Tn, isMissingPathError as Tr, recordWebConversationActivity as Tt, createSearchConversationsTool as U, executeTurn as Un, editedAutomationTask as Ur, getChildAgentLabel as Ut, createSearchEventTypesTool as V, getWebAuthorization as Vn, automationTriggerChangesSchema as Vr, getActiveAgentInvocationForConversation as Vt, createWriteFileTool as W, createSetConversationSubscriptionTool as Wn, newAutomationTask as Wr, getLatestAgentInvocationForConversation as Wt, createEditFileTool as X, renderAttachmentText as Xn, automationToolContext as Xr, reportReplacedWithoutOpenWork as Xt, capToolResult as Y, createSlackThreadReadTool as Yn, getConversationAccess as Yr, markAgentInvocationParentMailboxAppended as Yt, editFile as Z, renderBlockText as Zn, automationToolsDisabledReason as Zr, sendsResultToParent as Zt, breakerStates as _, editEventAutomation as _i, completeCancelledConversationTurn as _n, isConversationMember as _r, deliverReviewItemChange as _t, createCacheWarmingRecorder as a, changeViewerAutomationLifecycle as ai, parentMessageText as an, createSlackConversationSearchChannelPort as ar, createReplyTool as at, providerCacheTtlMs as b, automationCardStatus as bi, createAgentInvocationFromLatest as bn, listThreadReplies as br, acceptsWebMessages as bt, isConversationWorkDone as c, updateViewerAutomation as ci, createAndEnqueueAgentInvocation as cn, readSlackRawMessageContext as cr, createArchiveAgentTool as ct, addHistoryPeriod as d, readViewerAutomationExecutions as di, enqueueAgentInvocation as dn, resolveSlackChannelRef as dr, conversationReadPositionQuery as dt, requireToolCreator as ei, readChildConversationSender as en, createSlackListUpdateItemTool as er, createStopAgentTool as et, addHistoryWarmupCost as f, readViewerAutomationRuns as fi, resolveAgentInvocationId as fn, slackChannelRefParam as fr, markConversationRead as ft, savingsTotals as g, editScheduledAutomation as gi, cancelSignInWait as gn, getConversationInfo as gr, createUpdateReviewItemTool as gt, replaceHistorySavings as h, readViewerAutomations as hi, stopChildAgentsOf as hn, getChannelMessage as hr, createSearchReviewItemsTool as ht, GLOBAL_GAPS_TTL_MS as i, changeAutomationLifecycle as ii, logDroppedParentMessage as in, createSlackConversationMessageSearchTool as ir, createReportBlockedTool as it, createWebSearchTool as j, MINUTE_MS$1 as ji, recordFailedDispatchTurn as jn, createRunAutomationNowTool as jr, verifyAttachmentUploads as jt, prepareWorkspaceSnapshot as k, countOwnedAutomationsNeedingAttention as ki, createPausedTurns as kn, createCanvas as kr, collectAttachmentUploadGarbage as kt, listConversationWork as l, ViewerTaskNotFoundError as li, endActiveAgentInvocations as ln, resolveSlackChannelIdFromMessage as lr, readLastUserMessageAtByConversation as lt, historyPeriodSavings as m, readViewerAutomationVersions as mi, stopChildAgentsBelow as mn, joinPublicChannelForRead as mr, createAddReviewItemTool as mt, CONVERSATION_STATE_TTL_MS as n, activateViewerAutomationVersion as ni, childAgentTurnOptions as nn, createSlackListCreateTool as nr, createListAgentsTool as nt, segmentGapsKey as o, deleteViewerTask as oi, readParentMessage as on, createSlackChannelListMessagesTool as or, createNoReplyTool as ot, firstLiveSavingsDate as p, readViewerAutomationSummary as pi, dropOwnUnreadLoopReplies as pn, checkSlackChannelReadAccess as pr, reportConversationRead as pt, sliceFileContent as q, jsonResponse as qn, juniorToolOutputSchema as qr, listPendingAgentInvocationMailboxAppends as qt, GLOBAL_GAPS_MAX as r, automationEditor as ri, isParentMessageMeta as rn, createSlackListAddItemsTool as rr, createReportProgressTool as rt, warmup_exports as s, readViewerAutomationEdit as si, createAgentInvocationWorker as sn, parseSlackThreadId as sr, createMessageAgentTool as st, ANSWER_TOOL_ENDINGS as t, requireToolDestination as ti, routeChildInput as tn, createSlackListGetItemsTool as tr, createSpawnAgentTool as tt, SAVINGS_NAMESPACE as u, readConversationSourceTask as ui, endAgentInvocationsOfStoppedWork as un, createSlackChannelJoinTool as ur, archiveConversation as ut, closeBreaker as v, changedEventMatch as vi, recordSubagentEnded as vn, isPublicSlackChannel as vr, renderReviewItemMessage as vt, incrementStat as w, findAutomationSkill as wi, findChildAgentConversationId as wn, SLACK_TOOL_SOURCE as wr, createConversationId as wt, coreToolSlots as x, requireAutomationTaskText as xi, AgentDepthLimitError as xn, createSlackCanvasWriteTool as xr, appendAndEnqueueWebMessage as xt, connectedState as y, requireEventAutomationTrigger as yi, createAgentInvocationForMessage as yn, joinPublicChannel as yr, reviewItemChangeRecord as yt, createSystemTimeTool as z, createWebAuthorization as zn, automationToolResult as zr, NON_TERMINAL_AGENT_INVOCATION_STATUSES as zt };
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Mt as isInvalidConversationRecordError, jt as isFinalAttempt, kt as hasConversationStop, xt as countPendingConversationMessages } from "./projection-Bqn6zdVT.js";
3
- import { i as getChatConfig, ot as isProviderRetryError } from "./config-Cx8H0MRw.js";
4
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DnBYBM8z.js";
5
- import { t as getConversationStoppedAtMs } from "./session-stop-BQ0J0Fph.js";
6
- import { g as getTurnRequestDeadline } from "./task-queue-DvQZH5rG.js";
7
- import { _ as ConversationQueueMessageRejectedError, b as nudgeIdempotencyKey } from "./background-compaction-queue-BpmDEQf6.js";
8
- import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-7QA00oK6.js";
9
- import { In as isAttemptInterrupt, Ln as selectAttemptMessages } from "./warmup-HFgFZFwS.js";
2
+ import { Ct as countPendingConversationMessages, Nt as isFinalAttempt, Pt as isInvalidConversationRecordError, jt as hasConversationStop } from "./projection-jZSlEAXG.js";
3
+ import { i as getChatConfig, nt as isProviderRetryError } from "./config-Dkt2Le2b.js";
4
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-D5gkyvnK.js";
5
+ import { t as getConversationStoppedAtMs } from "./session-stop-BfY4rhJs.js";
6
+ import { g as getTurnRequestDeadline } from "./task-queue-CaZffYaH.js";
7
+ import { _ as ConversationQueueMessageRejectedError, b as nudgeIdempotencyKey } from "./background-compaction-queue-BGHqkhkY.js";
8
+ import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-D4FQ1Nml.js";
9
+ import { Ln as isAttemptInterrupt, Rn as selectAttemptMessages } from "./warmup-C6LOZ2d2.js";
10
10
  // src/chat/task-execution/lost-lease.ts
11
11
  /**
12
12
  * Count a slice that lost its Conversation Lease as a failed attempt, then
@@ -0,0 +1 @@
1
+ CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_conversation_metrics_turn_metric_occurred_at_idx" ON "junior_conversation_metrics" USING btree ("metric","occurred_at","actor_identity_id","conversation_id","value") WHERE "junior_conversation_metrics"."metric" IN ('duration_ms', 'total_tokens', 'cost_micro_usd');