@sentry/junior 0.246.0 → 0.248.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 (69) hide show
  1. package/dist/{admin-Bh-MYw-j.js → admin-BlHz8fGl.js} +1 -1
  2. package/dist/{agent-hooks-DpklSWZg.js → agent-hooks-DWCHBPYw.js} +25 -12
  3. package/dist/{agent-invocations-BO6ddZax.js → agent-invocations-D_YoNnAn.js} +8 -2
  4. package/dist/{agent-runner-DSKpHjHW.js → agent-runner-CnlFtbzb.js} +608 -2434
  5. package/dist/api/schema.d.ts +171 -3
  6. package/dist/api/schema.js +3 -3
  7. package/dist/api.js +219 -153
  8. package/dist/{app-BYB7szGb.d.ts → app-B0gT1Slp.d.ts} +11 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +30 -27
  11. package/dist/assistant-reply-BxCi7V4v.js +45 -0
  12. package/dist/{briefs-cZ5vWqP_.js → briefs-CdkIl79U.js} +4 -4
  13. package/dist/{catalog-runtime-CTaQXYqS.js → catalog-runtime-CTBsdSam.js} +1 -1
  14. package/dist/cli/chat.js +22 -16
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +2 -2
  17. package/dist/cli/plugins.js +4 -4
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.js +3 -3
  20. package/dist/{client--xtsAxKP.js → client-CWQtbizj.js} +2 -2
  21. package/dist/{config-BK53Ip5C.js → config-aitDvTQm.js} +16 -9
  22. package/dist/{conversation-CvBG57Io.js → conversation-Cjo9tHGm.js} +85 -1
  23. package/dist/{conversation-privacy-BDBFw6Ws.js → conversation-privacy-BsqXHVBz.js} +1 -1
  24. package/dist/{credential-sync-BiuhC9Ds.js → credential-sync-DqZF735a.js} +14 -14
  25. package/dist/{executor-bmmuRY-w.js → executor-oIZAkQZb.js} +3 -3
  26. package/dist/{images-DZliDtSH.js → images-Dzh3RBXY.js} +4 -21
  27. package/dist/instrumentation.js +2 -2
  28. package/dist/{job-queue-Cz3M7gg4.js → job-queue-DyA2AEnY.js} +1 -1
  29. package/dist/{logging-DVtMYOdD.js → logging-OpC2jwiV.js} +1 -1
  30. package/dist/message-EyMrVXEf.js +59 -0
  31. package/dist/nitro.d.ts +1 -1
  32. package/dist/nitro.js +3 -3
  33. package/dist/{oauth-authorization-By_MVRDC.js → oauth-authorization-BA4Dt6a7.js} +1 -45
  34. package/dist/{oauth-callback-server-BrUo6w1e.js → oauth-callback-server-ClDv9Z5Y.js} +2 -2
  35. package/dist/{pending-auth-BuQLZ6dK.js → pending-auth-D_nf121N.js} +2 -2
  36. package/dist/{profile-BevMNSlr.js → profile-Dfg76pvk.js} +4 -4
  37. package/dist/{prompt-C9Q9cjD3.js → prompt-C7bRJ2vg.js} +1 -1
  38. package/dist/{registry-C2rSEio1.js → registry-fpIZHoqE.js} +1 -1
  39. package/dist/{resolve-qPhrznTf.js → resolve-LMCZhQVg.js} +2 -2
  40. package/dist/result-C1ZCRPLx.js +463 -0
  41. package/dist/{runner-CNh5eMWx.js → runner-DNZMviFH.js} +11 -10
  42. package/dist/{sandbox-egress-signals-BnDEKu8d.js → sandbox-egress-signals-Dcc-mwkl.js} +1 -1
  43. package/dist/{schema-BWMRg8JS.js → schema-BRZsYL5-.js} +5 -4
  44. package/dist/session-stop-dyvsZDB0.js +782 -0
  45. package/dist/{skills-C6zJbudq.js → skills-BgGiQt5Y.js} +2 -2
  46. package/dist/{spawn-C3efZSx3.js → spawn-CpqxMPWE.js} +3 -2
  47. package/dist/store-OMQAFrJG.js +1417 -0
  48. package/dist/{task-queue-BX4vG6uA.js → task-queue-SWsXPSp-.js} +3 -3
  49. package/dist/{task-runner-T51kll0U.js → task-runner-BOxv7shv.js} +11 -11
  50. package/dist/{tasks-B9OIjl2K.js → tasks-DREdnhVP.js} +49 -16
  51. package/dist/{thread-state-AGZtVyXp.js → thread-state-BoNCtSwk.js} +7 -7
  52. package/dist/{turn-failure-response-DJ8KU2bo.js → turn-failure-response-C6jrCPjc.js} +9 -9
  53. package/dist/{turn-lifecycle-DZJkJ95q.js → turn-lifecycle-cQFsZFOU.js} +1 -1
  54. package/dist/{turn-session-routing-mRqLbMZW.js → turn-session-routing-Ba12fwXz.js} +1 -1
  55. package/dist/{validation-Dg0Ihxzo.js → validation-Dmfh2cTj.js} +1 -1
  56. package/dist/{version-Deub4try.js → version-ByV7nGOn.js} +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/{viewer-D5hbx6TE.js → viewer-CX41TWYr.js} +4 -4
  59. package/dist/{web-authorization-DCxixz5S.js → web-authorization-rDLlKIS0.js} +6 -6
  60. package/dist/{web-input-0sorYVLh.js → web-input-Bn9HHZEo.js} +43 -208
  61. package/dist/{work-rm2X7jj4.js → work-CvFoEpRT.js} +90 -14
  62. package/dist/{worker-bnGsAOP3.js → worker-CI5B63vk.js} +7 -7
  63. package/migrations/0053_conversation_stopped_at.sql +1 -0
  64. package/migrations/0054_flowery_rage.sql +1 -0
  65. package/migrations/meta/0053_snapshot.json +3771 -0
  66. package/migrations/meta/0054_snapshot.json +3777 -0
  67. package/migrations/meta/_journal.json +14 -0
  68. package/package.json +6 -5
  69. package/dist/message-BSN-Ma5f.js +0 -317
package/dist/app.js CHANGED
@@ -1,34 +1,37 @@
1
- import { At as appendAndEnqueueInboundMessage, B as effectiveTaskOutcomes, Ct as SLACK_EVENT_NAMESPACE, Dt as eventGuidance, E as requestAttachmentDeletion, F as logScheduledAutomationRunSkipped, Ft as clearExpiredConversationLease, Gt as listActiveConversationIds, Ht as getConversation, I as scheduledAutomationRunAttributes, Nn as getConfigDefaults, O as parseSlackThreadId, Pn as setConfigDefaults, Sn as createUserTokenStore, St as getEventCatalog, Tt as slackChannelMessageReplyThreadTs, U as recordSubagentEnded, Ut as getConversationWorkState, Vt as ensureConversationWake, Wt as hasRunnableConversationWork, Yt as removeActiveConversation, _t as processWorkspaceSnapshotJob, an as isInvalidConversationRecordError, b as unpublishedArtifactHeaders, c as deleteMcpAuthSessionsForUserProvider, ct as listPendingAgentInvocationResults, dn as shouldPropagateSandboxEgressTrace, fn as SANDBOX_EGRESS_PROXY_PATH, gn as parseSandboxEgressCredentialToken, hn as consumeSandboxEgressPermissionDeniedSignal, i as executeCredentialedEgressRequest, l as deleteMcpServerSessionId, ln as resolveSandboxEgressProviderForHost, mn as consumeSandboxEgressAuthRequiredSignal, n as executeAgentRun, on as renderTaskInput, pn as clearSandboxEgressSignals, rn as hasRunnableConversationWork$1, st as listPendingAgentInvocationMailboxAppends, t as createAgentRunner, tn as CONVERSATION_WORK_STALE_ENQUEUE_MS, u as deleteMcpStoredOAuthCredentials, un as normalizeSandboxEgressTracePropagationDomains, v as publicArtifactHeaders, vn as formatProviderLabel, vt as ingestEvent, w as collectAttachmentGarbage, wt as slackChannelMessageEvent, x as lookupSlackUserProfile, xn as startOAuthFlow, y as readPublicArtifact } from "./agent-runner-DSKpHjHW.js";
2
- import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-DVtMYOdD.js";
1
+ import { B as effectiveTaskOutcomes, Ct as normalizeSandboxEgressTracePropagationDomains, Dt as consumeSandboxEgressAuthRequiredSignal, E as requestAttachmentDeletion, Et as clearSandboxEgressSignals, F as logScheduledAutomationRunSkipped, Ft as createUserTokenStore, Gt as setConfigDefaults, I as scheduledAutomationRunAttributes, O as parseSlackThreadId, Ot as consumeSandboxEgressPermissionDeniedSignal, Pt as startOAuthFlow, St as resolveSandboxEgressProviderForHost, Tt as SANDBOX_EGRESS_PROXY_PATH, U as stopConversationSession, W as recordSubagentEnded, Wt as getConfigDefaults, b as unpublishedArtifactHeaders, bt as processWorkspaceSnapshotJob, c as deleteMcpAuthSessionsForUserProvider, i as executeCredentialedEgressRequest, jt as formatProviderLabel, kt as parseSandboxEgressCredentialToken, l as deleteMcpServerSessionId, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, t as createAgentRunner, u as deleteMcpStoredOAuthCredentials, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as shouldPropagateSandboxEgressTrace, x as lookupSlackUserProfile, xt as ingestEvent, y as readPublicArtifact } from "./agent-runner-CnlFtbzb.js";
2
+ import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-OpC2jwiV.js";
3
3
  import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
4
- import { t as JUNIOR_VERSION } from "./version-Deub4try.js";
5
- import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-BK53Ip5C.js";
4
+ import { t as JUNIOR_VERSION } from "./version-ByV7nGOn.js";
5
+ import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-aitDvTQm.js";
6
6
  import { _ as slackMessageTsSchema, d as parseSlackTeamId, f as parseSlackUserId, h as slackUserIdSchema, m as slackTeamIdSchema, o as parseActorUserId, p as slackChannelIdSchema } from "./actor-BTtLaeWy.js";
7
- import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-D5hbx6TE.js";
8
- import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
9
- import { _ as juniorConversationEvents, a as juniorSchedulerRuns, m as juniorConversationBriefs, o as juniorSchedulerTasks } from "./executor-bmmuRY-w.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
11
- import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, Vt as appendConversationMessages, W as slackEntitySchema, Wt as projectConversationMessages, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as settleConversationTitleWork, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-B9OIjl2K.js";
12
- import { $ as verifySlackDirectCredentialSubject, At as listConversationAnnotations, Dt as resolveRootVisibility, G as findMatchingWatches, Gt as getWorkspaceTeamId, J as bindEventAutomationCredentialSubject, Kt as runWithWorkspaceTeamId, Q as verifyScheduledAutomationCredentialSubject, V as collectEventMatchKeys, Vt as isDmChannel, X as bindSlackDirectCredentialSubject, Y as bindScheduledAutomationCredentialSubject, Z as verifyEventAutomationCredentialSubject, a as getPluginRoutes, at as setDashboardConversationLinkOptions, d as setPlugins, f as validatePlugins, h as setBriefsConfig, i as getPluginApiRoutes, it as getDashboardTaskLink, lt as createPluginLogger, nt as getDashboardConversationLink, ot as createPluginState, q as takeDueTimerWatches, u as getPlugins, ut as readConversationAccessFromSql, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-DpklSWZg.js";
13
- import { H as annotationCard } from "./conversation-CvBG57Io.js";
14
- import { O as withLock$1, w as getStateAdapter } from "./profile-BevMNSlr.js";
15
- import { c as getThreadStopDecision } from "./pending-auth-BuQLZ6dK.js";
7
+ import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-CX41TWYr.js";
8
+ import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
9
+ import { _ as juniorConversationEvents, a as juniorSchedulerRuns, m as juniorConversationBriefs, o as juniorSchedulerTasks } from "./executor-oIZAkQZb.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CTBsdSam.js";
11
+ import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-DREdnhVP.js";
12
+ import { $ as verifyEventAutomationCredentialSubject, Jt as runWithWorkspaceTeamId, Mt as listConversationAnnotations, Q as bindSlackDirectCredentialSubject, U as collectEventMatchKeys, Ut as isDmChannel, Vt as getSlackClient, X as bindEventAutomationCredentialSubject, Y as takeDueTimerWatches, Z as bindScheduledAutomationCredentialSubject, a as getPluginRoutes, ct as createPluginState, d as setPlugins, dt as createPluginLogger, et as verifyScheduledAutomationCredentialSubject, f as validatePlugins, ft as readConversationAccessFromSql, h as setBriefsConfig, i as getPluginApiRoutes, it as getDashboardConversationLink, kt as resolveRootVisibility, ot as getDashboardTaskLink, q as findMatchingWatches, qt as getWorkspaceTeamId, st as setDashboardConversationLinkOptions, tt as verifySlackDirectCredentialSubject, u as getPlugins } from "./agent-hooks-DWCHBPYw.js";
13
+ import { W as annotationCard } from "./conversation-Cjo9tHGm.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-Dfg76pvk.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-D_nf121N.js";
16
+ import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-dyvsZDB0.js";
16
17
  import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
17
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-qPhrznTf.js";
18
- import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-Cz3M7gg4.js";
18
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-LMCZhQVg.js";
19
+ import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DyA2AEnY.js";
20
+ import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-OMQAFrJG.js";
19
21
  import { D as scheduledRunSchema } from "./automation-gznOMaQ2.js";
20
22
  import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
21
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Dg0Ihxzo.js";
23
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Dmfh2cTj.js";
22
24
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
23
- import { A as withNormalizedThreadId, B as enqueueAgentDispatch, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as startProcessingReaction, I as parseContent, L as renderSlackObjectCard, M as getAuthPausedConversationTurnId, O as stopSlackThread, P as THREAD_OPTOUT_ACK, R as createVercelAttachmentStorage, S as recordSkippedConversationMessage, T as runWithSlackInstallation, V as GET$3, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions } from "./web-input-0sorYVLh.js";
24
- import { _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, k as recordAutomationExecution, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask, y as notifyAutomationBlocked } from "./task-runner-T51kll0U.js";
25
- import { r as enqueueAgentInvocation } from "./work-rm2X7jj4.js";
26
- import { s as coerceThreadConversationState } from "./thread-state-AGZtVyXp.js";
27
- import { r as enqueueAgentInvocationResult, t as bindMessageAgent } from "./message-BSN-Ma5f.js";
28
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BiuhC9Ds.js";
29
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BX4vG6uA.js";
30
- import { t as processConversationWork } from "./worker-bnGsAOP3.js";
31
- import { t as bindSpawnAgent } from "./spawn-C3efZSx3.js";
25
+ import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-Bn9HHZEo.js";
26
+ import { _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, k as recordAutomationExecution, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask, y as notifyAutomationBlocked } from "./task-runner-BOxv7shv.js";
27
+ import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-C1ZCRPLx.js";
28
+ import { r as enqueueAgentInvocation } from "./work-CvFoEpRT.js";
29
+ import { s as coerceThreadConversationState } from "./thread-state-BoNCtSwk.js";
30
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-DqZF735a.js";
31
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-SWsXPSp-.js";
32
+ import { t as processConversationWork } from "./worker-CI5B63vk.js";
33
+ import { t as bindMessageAgent } from "./message-EyMrVXEf.js";
34
+ import { t as bindSpawnAgent } from "./spawn-CpqxMPWE.js";
32
35
  import { createRequire } from "node:module";
33
36
  import { Hono } from "hono";
34
37
  import { z } from "zod";
@@ -2514,7 +2517,7 @@ async function persistSlackMessage(args) {
2514
2517
  });
2515
2518
  }
2516
2519
  /**
2517
- * Interrupt the active Run, cancel resource watches, unsubscribe, and record
2520
+ * Interrupt the active Run, stop the session, unsubscribe, and record
2518
2521
  * the stop message in history. Stop input never enters the mailbox, so a
2519
2522
  * mention-route stop cannot resubscribe the thread by starting a new Turn.
2520
2523
  *
@@ -2549,7 +2552,7 @@ async function handleSlackThreadStop(args) {
2549
2552
  messages: work?.execution.pendingMessages ?? [],
2550
2553
  state: args.state
2551
2554
  });
2552
- await cancelSubscriptions({
2555
+ await stopConversationSession({
2553
2556
  conversationId,
2554
2557
  state: args.state
2555
2558
  });
@@ -0,0 +1,45 @@
1
+ import { lt as extractAssistantText } from "./tasks-DREdnhVP.js";
2
+ //#region src/chat/no-reply.ts
3
+ const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
+ /**
5
+ * True when one assistant message ends with the silence marker.
6
+ * Mid-sentence mentions do not match. Detection is per message only.
7
+ */
8
+ function isNoReplyMarker(text) {
9
+ return text.trimEnd().endsWith(NO_REPLY_MARKER);
10
+ }
11
+ //#endregion
12
+ //#region src/chat/services/assistant-reply.ts
13
+ const THINKING_XML_BLOCK_PATTERN = /[ \t]*<thinking\b[^>]*>[\s\S]*?<\/thinking>[ \t]*(?:\r?\n)?/gi;
14
+ const FENCED_CODE_BLOCK_PATTERN = /```[\s\S]*?```/g;
15
+ /** Remove provider reasoning wrappers while preserving fenced code examples. */
16
+ function sanitizeAssistantText(text) {
17
+ let result = "";
18
+ let cursor = 0;
19
+ for (const match of text.matchAll(FENCED_CODE_BLOCK_PATTERN)) {
20
+ const start = match.index;
21
+ if (start === void 0) continue;
22
+ result += text.slice(cursor, start).replace(THINKING_XML_BLOCK_PATTERN, "");
23
+ result += match[0];
24
+ cursor = start + match[0].length;
25
+ }
26
+ return (result + text.slice(cursor).replace(THINKING_XML_BLOCK_PATTERN, "")).trim();
27
+ }
28
+ /** Decide whether one completed assistant message becomes a reply. */
29
+ function decideReply(message) {
30
+ if (message.content.some((part) => part.type === "toolCall")) return { kind: "suppress" };
31
+ const text = sanitizeAssistantText(extractAssistantText(message));
32
+ if (!text) return { kind: "empty" };
33
+ if (isNoReplyMarker(text)) return { kind: "suppress" };
34
+ return {
35
+ kind: "deliver",
36
+ text
37
+ };
38
+ }
39
+ /** Return destination-visible reply text when the message is deliverable. */
40
+ function getAssistantReplyText(message) {
41
+ const decision = decideReply(message);
42
+ return decision.kind === "deliver" ? decision.text : void 0;
43
+ }
44
+ //#endregion
45
+ export { isNoReplyMarker as a, NO_REPLY_MARKER as i, getAssistantReplyText as n, sanitizeAssistantText as r, decideReply as t };
@@ -1,7 +1,7 @@
1
- import { r as completeObject } from "./client--xtsAxKP.js";
1
+ import { r as completeObject } from "./client-CWQtbizj.js";
2
2
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
3
- import { L as briefCodeChangeSchema, V as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-CvBG57Io.js";
4
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C9Q9cjD3.js";
3
+ import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-Cjo9tHGm.js";
4
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C7bRJ2vg.js";
5
5
  import { CLI_USAGE } from "./cli/run.js";
6
6
  import path from "node:path";
7
7
  import { z } from "zod";
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
269
269
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
270
270
  */
271
271
  async function configuredDefaultModelId() {
272
- const { botConfig } = await import("./config-BK53Ip5C.js").then((n) => n.r);
272
+ const { botConfig } = await import("./config-aitDvTQm.js").then((n) => n.r);
273
273
  return defaultModelId(botConfig);
274
274
  }
275
275
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-C2rSEio1.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-fpIZHoqE.js";
3
3
  //#region src/chat/plugins/catalog-runtime.ts
4
4
  var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
5
5
  const pluginCatalogRuntime = createPluginCatalogRuntime();
package/dist/cli/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DSKpHjHW.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-CnlFtbzb.js";
2
2
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -100,10 +100,10 @@ async function loadLocalPluginSet() {
100
100
  async function configureLocalChatPlugins(pluginSet) {
101
101
  const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
102
102
  import("../plugins-egKWjgue.js").then((n) => n.o),
103
- import("../agent-hooks-DpklSWZg.js").then((n) => n.t),
104
- import("../catalog-runtime-CTaQXYqS.js").then((n) => n.t),
105
- import("../validation-Dg0Ihxzo.js").then((n) => n.r),
106
- import("../viewer-D5hbx6TE.js").then((n) => n.s)
103
+ import("../agent-hooks-DWCHBPYw.js").then((n) => n.t),
104
+ import("../catalog-runtime-CTBsdSam.js").then((n) => n.t),
105
+ import("../validation-Dmfh2cTj.js").then((n) => n.r),
106
+ import("../viewer-CX41TWYr.js").then((n) => n.s)
107
107
  ]);
108
108
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
109
109
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -155,23 +155,29 @@ async function prepareLocalChatRun(io, pluginSet) {
155
155
  await configureLocalChatPlugins(pluginSet);
156
156
  const { setExperimentalFeatures } = await import("../experimental-Qn9rKLgx.js").then((n) => n.t);
157
157
  setExperimentalFeatures({ subagents: true });
158
- const { setBriefsConfig } = await import("../agent-hooks-DpklSWZg.js").then((n) => n.m);
158
+ const { setBriefsConfig } = await import("../agent-hooks-DWCHBPYw.js").then((n) => n.m);
159
159
  setBriefsConfig({ enabled: true });
160
- const { runLocalAgentTurn } = await import("../runner-CNh5eMWx.js");
161
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-BrUo6w1e.js");
160
+ const { runLocalAgentTurn } = await import("../runner-DNZMviFH.js");
161
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-ClDv9Z5Y.js");
162
162
  const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
163
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BnDEKu8d.js");
164
- const { bindSpawnAgent } = await import("../spawn-C3efZSx3.js").then((n) => n.n);
165
- const { bindMessageAgent } = await import("../message-BSN-Ma5f.js").then((n) => n.n);
166
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-rm2X7jj4.js").then((n) => n.a);
163
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-Dcc-mwkl.js");
164
+ const { bindSpawnAgent } = await import("../spawn-CpqxMPWE.js").then((n) => n.n);
165
+ const { bindMessageAgent } = await import("../message-EyMrVXEf.js").then((n) => n.n);
166
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-CvFoEpRT.js").then((n) => n.a);
167
+ const { startAgentInvocationsForChildInput } = await import("../result-C1ZCRPLx.js").then((n) => n.r);
168
+ const { skipInputBeforeConversationStop } = await import("../session-stop-dyvsZDB0.js").then((n) => n.r);
167
169
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
168
- const { processConversationWork } = await import("../worker-bnGsAOP3.js").then((n) => n.n);
170
+ const { processConversationWork } = await import("../worker-CI5B63vk.js").then((n) => n.n);
169
171
  let agentRunner;
170
172
  const localConversationWork = createLocalConversationWork(async (message) => {
171
173
  if (!agentRunner) throw new Error("Local agent runner is not ready");
172
174
  const run = routeAgentInvocationWork({
173
- fallbackWorker: async () => {
174
- throw new Error("Local child queue received non-invocation work");
175
+ fallbackWorker: async (context) => {
176
+ const skipped = await skipInputBeforeConversationStop(context);
177
+ if (skipped) return skipped;
178
+ const started = await startAgentInvocationsForChildInput(context, { queue: localConversationWork.queue });
179
+ if (!started) throw new Error("Local child queue received non-invocation work");
180
+ return started;
175
181
  },
176
182
  invocationWorker: createAgentInvocationWorker(agentRunner)
177
183
  });
@@ -181,7 +187,7 @@ async function prepareLocalChatRun(io, pluginSet) {
181
187
  });
182
188
  });
183
189
  agentRunner = createAgentRunner(executeAgentRun, {
184
- bindMessageAgent: (request) => request.source.kind === "agent_invocation" ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
190
+ bindMessageAgent: (request) => request.parentConversationId ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
185
191
  bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: localConversationWork.queue })
186
192
  });
187
193
  const oauthCallback = await startLocalOAuthCallbackServer();
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DVtMYOdD.js";
2
- import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-C2rSEio1.js";
3
- import { i as parseSkillFile } from "../skills-C6zJbudq.js";
1
+ import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-OpC2jwiV.js";
2
+ import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-fpIZHoqE.js";
3
+ import { i as parseSkillFile } from "../skills-BgGiQt5Y.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs/promises";
6
6
  import { pathToFileURL } from "node:url";
package/dist/cli/main.js CHANGED
@@ -25,10 +25,10 @@ async function runChat(argv, pluginSet) {
25
25
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
26
26
  }
27
27
  async function runAdmin(argv) {
28
- return await (await import("../admin-Bh-MYw-j.js")).runAdmin(argv);
28
+ return await (await import("../admin-BlHz8fGl.js")).runAdmin(argv);
29
29
  }
30
30
  async function runBriefs(argv) {
31
- return await (await import("../briefs-cZ5vWqP_.js")).runBriefs(argv);
31
+ return await (await import("../briefs-CdkIl79U.js")).runBriefs(argv);
32
32
  }
33
33
  function topLevelCommand(argv) {
34
34
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,7 +1,7 @@
1
- import { d as getDb } from "../viewer-D5hbx6TE.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-CTaQXYqS.js";
3
- import { d as setPlugins, f as validatePlugins, lt as createPluginLogger } from "../agent-hooks-DpklSWZg.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Dg0Ihxzo.js";
1
+ import { d as getDb } from "../viewer-CX41TWYr.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-CTBsdSam.js";
3
+ import { d as setPlugins, dt as createPluginLogger, f as validatePlugins } from "../agent-hooks-DWCHBPYw.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Dmfh2cTj.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-egKWjgue.js";
6
6
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
7
7
  import { stderr, stdout } from "node:process";
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "../catalog-runtime-CTaQXYqS.js";
2
- import { S as disconnectStateAdapter, t as create } from "../profile-BevMNSlr.js";
3
- import { r as resolve } from "../resolve-qPhrznTf.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-CTBsdSam.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-Dfg76pvk.js";
3
+ import { r as resolve } from "../resolve-LMCZhQVg.js";
4
4
  //#region src/cli/snapshot-create.ts
5
5
  const DEFAULT_RUNTIME = "node22";
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-BK53Ip5C.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-bmmuRY-w.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-C2rSEio1.js";
1
+ import { i as getChatConfig } from "../config-aitDvTQm.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-oIZAkQZb.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-fpIZHoqE.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-egKWjgue.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-DVtMYOdD.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BDBFw6Ws.js";
1
+ import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-OpC2jwiV.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BsqXHVBz.js";
3
3
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
4
4
  import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
5
5
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client--xtsAxKP.js";
3
- import { p as logWarn } from "./logging-DVtMYOdD.js";
2
+ import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client-CWQtbizj.js";
3
+ import { p as logWarn } from "./logging-OpC2jwiV.js";
4
4
  import { l as TURN_REASONING_LEVELS, s as modelProfileSchema, t as DEFAULT_MODEL_PROFILES, u as parseTurnReasoningLevel } from "./model-profile-BwU8mqwD.js";
5
5
  //#region src/chat/slack/emoji.ts
6
6
  const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
@@ -37,21 +37,26 @@ const MIN_AGENT_TURN_TIMEOUT_MS = 1e4;
37
37
  const DEFAULT_AGENT_TURN_TIMEOUT_MS = 72e4;
38
38
  const MAX_SLICES_PER_TURN = 100;
39
39
  /**
40
+ * Max model spend in USD for one turn, including later execution slices of
41
+ * that turn. Sentry span estimates put a child agent that made 250 tool calls
42
+ * of real work at about $50.
43
+ */
44
+ const MAX_TURN_COST_USD = 100;
45
+ /**
40
46
  * Max tool calls for one turn, including later execution slices of that turn.
41
- * Chosen from production dispatch traces: healthy runs cluster well under 50;
42
- * runaway CI-watch loops land in the hundreds. Raised from 150 after that cap
43
- * fired on legitimate long-form human turns, not just runaway automation.
47
+ * A backstop for models without cost data. The spend limit should stop a turn
48
+ * first. 250 calls stopped child agents that were still doing real work.
44
49
  */
45
- const MAX_TOOL_CALLS_PER_TURN = 250;
50
+ const MAX_TOOL_CALLS_PER_TURN = 1e3;
46
51
  /**
47
52
  * Max consecutive automated turns before event wakes stop until a user message.
48
53
  * Resource-event CI watches and event-automation loops are the common runaway paths.
49
54
  * Sentry telemetry has no direct instrumentation for how long real automated
50
55
  * chains run (only failure paths on the notice are logged, and those show zero
51
56
  * hits in the last 30d), so this is sized qualitatively: it stays well under
52
- * the runaway CI-watch-loop range noted for maxToolCallsPerTurn (hundreds of
53
- * tool calls) while giving multi-phase event-automation/scheduled-automation work enough
54
- * headroom to avoid pausing on legitimate longer-running automation.
57
+ * the runaway CI-watch-loop range (hundreds of tool calls) while giving
58
+ * multi-phase event-automation/scheduled-automation work enough headroom to
59
+ * avoid pausing on legitimate longer-running automation.
55
60
  */
56
61
  const MAX_CONSECUTIVE_AUTOMATED_TURNS = 25;
57
62
  /**
@@ -263,6 +268,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
263
268
  maxAgentDepth: 0,
264
269
  maxSlicesPerTurn: MAX_SLICES_PER_TURN,
265
270
  maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
271
+ maxTurnCostUsd: MAX_TURN_COST_USD,
266
272
  maxConsecutiveAutomatedTurns: MAX_CONSECUTIVE_AUTOMATED_TURNS,
267
273
  maxEventAutomationRunsPerHour: MAX_EVENT_AUTOMATION_RUNS_PER_HOUR,
268
274
  turnTimeoutMs: parseAgentTurnTimeoutMs(env.AGENT_TURN_TIMEOUT_MS, maxTurnTimeoutMs),
@@ -381,6 +387,7 @@ function setRuntimeLimits(limits) {
381
387
  if (limits?.maxEventAutomationRunsPerHour !== void 0) bot.maxEventAutomationRunsPerHour = requirePositiveLimit("maxEventAutomationRunsPerHour", limits.maxEventAutomationRunsPerHour);
382
388
  if (limits?.maxSlicesPerTurn !== void 0) bot.maxSlicesPerTurn = requirePositiveLimit("maxSlicesPerTurn", limits.maxSlicesPerTurn);
383
389
  if (limits?.maxToolCallsPerTurn !== void 0) bot.maxToolCallsPerTurn = requirePositiveLimit("maxToolCallsPerTurn", limits.maxToolCallsPerTurn);
390
+ if (limits?.maxTurnCostUsd !== void 0) bot.maxTurnCostUsd = requirePositiveLimit("maxTurnCostUsd", limits.maxTurnCostUsd);
384
391
  if (limits?.turnTimeoutMs !== void 0) bot.turnTimeoutMs = Math.min(requirePositiveLimit("turnTimeoutMs", limits.turnTimeoutMs), resolveMaxTurnTimeoutMs(chatConfig.functionMaxDurationSeconds));
385
392
  }
386
393
  /** Apply the Slack cross-actor steering mode from createApp(). */
@@ -219,6 +219,76 @@ const INPUT_IMAGE_TYPES = [
219
219
  "image/gif",
220
220
  "image/webp"
221
221
  ];
222
+ /** Leading bytes of each accepted image type. `null` matches any byte. */
223
+ const IMAGE_SIGNATURES = [
224
+ {
225
+ mediaType: "image/png",
226
+ bytes: [
227
+ 137,
228
+ 80,
229
+ 78,
230
+ 71,
231
+ 13,
232
+ 10,
233
+ 26,
234
+ 10
235
+ ]
236
+ },
237
+ {
238
+ mediaType: "image/jpeg",
239
+ bytes: [
240
+ 255,
241
+ 216,
242
+ 255
243
+ ]
244
+ },
245
+ {
246
+ mediaType: "image/gif",
247
+ bytes: [
248
+ 71,
249
+ 73,
250
+ 70,
251
+ 56,
252
+ 55,
253
+ 97
254
+ ]
255
+ },
256
+ {
257
+ mediaType: "image/gif",
258
+ bytes: [
259
+ 71,
260
+ 73,
261
+ 70,
262
+ 56,
263
+ 57,
264
+ 97
265
+ ]
266
+ },
267
+ {
268
+ mediaType: "image/webp",
269
+ bytes: [
270
+ 82,
271
+ 73,
272
+ 70,
273
+ 70,
274
+ null,
275
+ null,
276
+ null,
277
+ null,
278
+ 87,
279
+ 69,
280
+ 66,
281
+ 80
282
+ ]
283
+ }
284
+ ];
285
+ /**
286
+ * Detect an accepted image type from file bytes. Use this instead of a file
287
+ * name or declared content type, which can be wrong.
288
+ */
289
+ function detectImageMediaType(data) {
290
+ return IMAGE_SIGNATURES.find(({ bytes }) => data.length >= bytes.length && bytes.every((byte, index) => byte === null || data[index] === byte))?.mediaType;
291
+ }
222
292
  /** Report whether a media type is a raster image accepted by vision models. */
223
293
  function isVisionImageMediaType(mediaType) {
224
294
  const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
@@ -247,6 +317,19 @@ function readMessageAttachments(value) {
247
317
  return messageAttachmentSchema.array().parse(value ?? []);
248
318
  }
249
319
  //#endregion
320
+ //#region src/api/schema/child-agent-totals.ts
321
+ /**
322
+ * The part of a Conversation total that its child agents spent, at any depth.
323
+ * Present only when the Conversation has child agents. The Conversation's own
324
+ * part is the total minus this part.
325
+ */
326
+ const conversationChildAgentTotalsSchema = z.object({
327
+ auxiliaryCostUsd: z.number().finite().nonnegative().optional(),
328
+ count: z.number().int().positive(),
329
+ cumulativeDurationMs: z.number(),
330
+ cumulativeUsage: usageSchema.optional()
331
+ }).strict();
332
+ //#endregion
250
333
  //#region src/api/schema/conversation.ts
251
334
  const conversationReportStatusSchema = z.enum([
252
335
  "active",
@@ -386,6 +469,7 @@ const conversationSummaryReportSchema = z.object({
386
469
  cumulativeDurationMs: z.number(),
387
470
  cumulativeUsage: conversationUsageSchema.optional(),
388
471
  auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
472
+ childAgentTotals: conversationChildAgentTotalsSchema.optional(),
389
473
  conversationId: z.string(),
390
474
  isParticipant: z.boolean(),
391
475
  visibility: z.enum(["private", "public"]).optional(),
@@ -868,4 +952,4 @@ const conversationStatsReportSchema = z.object({
868
952
  windowStart: z.string()
869
953
  }).strict();
870
954
  //#endregion
871
- export { forkConversationBodySchema as A, conversationBriefSchema as B, conversationReportEventSchema as C, conversationUsageSchema as D, conversationSummaryReportSchema as E, INPUT_IMAGE_TYPES as F, readMessageCardRefs as G, annotationCard as H, isVisionImageMediaType as I, removedCardSchema as K, briefCodeChangeSchema as L, MAX_INPUT_IMAGES as M, MAX_INPUT_IMAGE_BYTES as N, createConversationBodySchema as O, readMessageAttachments as P, briefLinkSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, messageCardRef as U, parseBriefInput as V, messageCardText as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationResponseSchema as j, createConversationMessageBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, resolveMessageCards as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, briefOutcomeStatusSchema as z };
955
+ export { forkConversationBodySchema as A, briefLinkSchema as B, conversationReportEventSchema as C, conversationUsageSchema as D, conversationSummaryReportSchema as E, readMessageAttachments as F, messageCardRef as G, conversationBriefSchema as H, INPUT_IMAGE_TYPES as I, removedCardSchema as J, messageCardText as K, detectImageMediaType as L, conversationChildAgentTotalsSchema as M, MAX_INPUT_IMAGES as N, createConversationBodySchema as O, MAX_INPUT_IMAGE_BYTES as P, isVisionImageMediaType as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, parseBriefInput as U, briefOutcomeStatusSchema as V, annotationCard as W, resolveMessageCards as Y, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationResponseSchema as j, createConversationMessageBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, readMessageCardRefs as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, briefCodeChangeSchema as z };
@@ -1,4 +1,4 @@
1
- import { p as logWarn } from "./logging-DVtMYOdD.js";
1
+ import { p as logWarn } from "./logging-OpC2jwiV.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,19 +1,19 @@
1
- import { Sn as createUserTokenStore, _ as resolvePluginOAuthAccount, bn as resolveBaseUrl, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, gt as getMcpProviderErrorAttributes, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, vn as formatProviderLabel, x as lookupSlackUserProfile, yn as parseOAuthStatePayload } from "./agent-runner-DSKpHjHW.js";
2
- import { f as escapeXml } from "./client--xtsAxKP.js";
3
- import { d as logException, h as runBestEffort, p as logWarn } from "./logging-DVtMYOdD.js";
4
- import { a as getRuntimeMetadata, n as botConfig } from "./config-BK53Ip5C.js";
1
+ import { Ft as createUserTokenStore, Mt as parseOAuthStatePayload, Nt as resolveBaseUrl, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, jt as formatProviderLabel, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, x as lookupSlackUserProfile, yt as getMcpProviderErrorAttributes } from "./agent-runner-CnlFtbzb.js";
2
+ import { f as escapeXml } from "./client-CWQtbizj.js";
3
+ import { d as logException, h as runBestEffort, p as logWarn } from "./logging-OpC2jwiV.js";
4
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-aitDvTQm.js";
5
5
  import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
6
- import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-D5hbx6TE.js";
6
+ import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-CX41TWYr.js";
7
7
  import { i as homeDir } from "./package-discovery-BVvSnQBB.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-C2rSEio1.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
10
- import { t as discoverSkills } from "./skills-C6zJbudq.js";
11
- import { Nt as recordAuthenticationLinked, Pt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-B9OIjl2K.js";
12
- import { zt as getSlackClient } from "./agent-hooks-DpklSWZg.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-BevMNSlr.js";
14
- import { i as getConversationPendingAuth } from "./pending-auth-BuQLZ6dK.js";
15
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-AGZtVyXp.js";
16
- import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-DCxixz5S.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-fpIZHoqE.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CTBsdSam.js";
10
+ import { t as discoverSkills } from "./skills-BgGiQt5Y.js";
11
+ import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-DREdnhVP.js";
12
+ import { Vt as getSlackClient } from "./agent-hooks-DWCHBPYw.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-Dfg76pvk.js";
14
+ import { i as getConversationPendingAuth } from "./pending-auth-D_nf121N.js";
15
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-BoNCtSwk.js";
16
+ import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-rDLlKIS0.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
18
18
  import path from "node:path";
19
19
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
- import { d as logException } from "./logging-DVtMYOdD.js";
1
+ import { d as logException } from "./logging-OpC2jwiV.js";
2
2
  import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
3
- import "./config-BK53Ip5C.js";
4
- import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
3
+ import "./config-aitDvTQm.js";
4
+ import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { sql } from "drizzle-orm";
7
7
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -1,35 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-DSKpHjHW.js";
3
- import { f as getSqlExecutor } from "./viewer-D5hbx6TE.js";
4
- import "./conversation-CvBG57Io.js";
2
+ import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-CnlFtbzb.js";
3
+ import { f as getSqlExecutor } from "./viewer-CX41TWYr.js";
4
+ import { L as detectImageMediaType } from "./conversation-Cjo9tHGm.js";
5
5
  //#region src/chat/attachments/images.ts
6
6
  var images_exports = /* @__PURE__ */ __exportAll({
7
7
  decodeInputImages: () => decodeInputImages,
8
8
  loadInputImages: () => loadInputImages,
9
9
  storeInputImages: () => storeInputImages
10
10
  });
11
- function matchesImageType(data, contentType) {
12
- switch (contentType) {
13
- case "image/png": return data.subarray(0, 8).equals(Buffer.from([
14
- 137,
15
- 80,
16
- 78,
17
- 71,
18
- 13,
19
- 10,
20
- 26,
21
- 10
22
- ]));
23
- case "image/jpeg": return data[0] === 255 && data[1] === 216 && data[2] === 255;
24
- case "image/gif": return ["GIF87a", "GIF89a"].includes(data.toString("ascii", 0, 6));
25
- case "image/webp": return data.toString("ascii", 0, 4) === "RIFF" && data.toString("ascii", 8, 12) === "WEBP";
26
- }
27
- }
28
11
  /** Check declared image types against file signatures before storing uploads. */
29
12
  function decodeInputImages(images) {
30
13
  const files = images.map((image) => {
31
14
  const data = Buffer.from(image.data, "base64");
32
- if (!matchesImageType(data, image.contentType) || data.toString("base64") !== image.data) throw new Error("Use PNG, JPEG, GIF, or WebP image files.");
15
+ if (detectImageMediaType(data) !== image.contentType || data.toString("base64") !== image.data) throw new Error("Use PNG, JPEG, GIF, or WebP image files.");
33
16
  return {
34
17
  data,
35
18
  bytes: data.byteLength,
@@ -1,6 +1,6 @@
1
- import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-DVtMYOdD.js";
1
+ import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-OpC2jwiV.js";
2
2
  import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BDBFw6Ws.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BsqXHVBz.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
5
  //#region src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { i as getChatConfig } from "./config-BK53Ip5C.js";
1
+ import { i as getChatConfig } from "./config-aitDvTQm.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { z } from "zod";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";