@sentry/junior 0.278.0 → 0.280.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 (90) hide show
  1. package/dist/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
  2. package/dist/{adapter-BXosqTMx.js → adapter-DVN3iwf9.js} +1 -1
  3. package/dist/{admin-Thn7NfOi.js → admin-Q_UI--9W.js} +1 -1
  4. package/dist/{agent-runner-DE-43MPb.js → agent-runner-_PYLv4Qo.js} +79 -39
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +7 -7
  7. package/dist/api.d.ts +3 -3
  8. package/dist/api.js +184 -418
  9. package/dist/{app-CHNS-AX2.d.ts → app-CL2zzzE0.d.ts} +5 -5
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +462 -80
  12. package/dist/{assistant-reply-pauL6qyn.js → assistant-reply-DbebsAxi.js} +1 -1
  13. package/dist/{automation-DphoTRYl.js → automation-CPqRFjIa.js} +2 -2
  14. package/dist/{background-compaction-queue-CAL4A2y7.js → background-compaction-queue-B9lmh8Ml.js} +3 -3
  15. package/dist/{briefs-4fyPJJEu.js → briefs-Dej7V0Bz.js} +11 -10
  16. package/dist/{catalog-runtime-BoOb5oUv.js → catalog-runtime-DpN0sWQ6.js} +2 -2
  17. package/dist/cli/chat.js +16 -16
  18. package/dist/cli/check.js +3 -3
  19. package/dist/cli/main.js +4 -4
  20. package/dist/cli/plugins.js +5 -5
  21. package/dist/cli/snapshot-create.js +4 -4
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +4 -4
  24. package/dist/{client-v_OVYuHZ.js → client-h2A2ZPzY.js} +7 -3
  25. package/dist/{config-o2jLRY5J.js → config-CusBFORe.js} +3 -3
  26. package/dist/{connections-RC4NXAx8.js → connections-C4h6mGha.js} +11 -11
  27. package/dist/{conversation-CZfyQvdm.js → conversation-DExTZw8B.js} +22 -7
  28. package/dist/conversation-pending-messages-Dgz6hrJs.js +173 -0
  29. package/dist/{conversation-privacy-C23M8KaD.js → conversation-privacy-2cm6OpNg.js} +1 -1
  30. package/dist/{credential-sync-Dd0WyNfF.js → credential-sync-DK06Jgt-.js} +17 -17
  31. package/dist/{db-BjLzDJCt.d.ts → db-Dsvk1Tp1.d.ts} +2 -2
  32. package/dist/{executor-CJfsD0VX.js → executor-Cmr0J8W3.js} +152 -7
  33. package/dist/instrumentation.d.ts +12 -0
  34. package/dist/instrumentation.js +56 -23
  35. package/dist/{logging-dFaXvBRK.js → logging-CGnh65_X.js} +2 -2
  36. package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
  37. package/dist/{message-DSwxIZet.js → message-RpAnqHPY.js} +10 -10
  38. package/dist/nitro.d.ts +1 -1
  39. package/dist/nitro.js +18 -6
  40. package/dist/{oauth-callback-server-CDcuCp27.js → oauth-callback-server-BBnhVKuX.js} +2 -2
  41. package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D6xxVywK.js} +2 -2
  42. package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
  43. package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
  44. package/dist/{projection-BTge9wrH.js → projection-C1MghKyI.js} +257 -137
  45. package/dist/{prompt-DDtCnlHP.js → prompt-BcHg-BMy.js} +2 -2
  46. package/dist/proxy-path-BHYoKZdq.js +15 -0
  47. package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
  48. package/dist/{registry-Cp6CNmtP.js → registry-DR7DjX9H.js} +4 -4
  49. package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
  50. package/dist/{resolve-B_7h2cXx.js → resolve-0Ful4oDv.js} +4 -4
  51. package/dist/{result-5LBEfnLX.js → result-Dd9kCuQ-.js} +12 -12
  52. package/dist/{runner-C5-S4oq-.js → runner-yiY8gUUu.js} +11 -11
  53. package/dist/{sandbox-egress-signals-B4GehT1L.js → sandbox-egress-signals-BzQVHCMz.js} +1 -1
  54. package/dist/{schema-Tr484cCC.d.ts → schema-BkMmF552.d.ts} +1232 -222
  55. package/dist/{schema-B5fpczDw.js → schema-C5pEgfHc.js} +30 -70
  56. package/dist/sentry-BRTJqumy.js +51 -0
  57. package/dist/sentry-DrKC2NeM.d.ts +1 -0
  58. package/dist/sentry-route-name-BhwWnfqj.js +51 -0
  59. package/dist/{service-account-Cq_dLrZJ.js → service-account-Cu7HFLZQ.js} +3 -3
  60. package/dist/{service-account-BkEv20zf.js → service-account-PIMpWZHF.js} +3 -3
  61. package/dist/{session-stop-BsS4qFS2.js → session-stop-CDEMsNtv.js} +14 -15
  62. package/dist/{skills-M0BA0_s6.js → skills-B2xIoe0f.js} +5 -5
  63. package/dist/{spawn-BO3y7H4d.js → spawn-C0DySQRV.js} +3 -3
  64. package/dist/{stop-D5R82Wla.js → stop-Dj5-nrAo.js} +740 -285
  65. package/dist/{store-BGBzQWNf.js → store-Dlio-o6u.js} +6 -6
  66. package/dist/{store-CGJZTEVz.js → store-QzOfDwKA.js} +3 -3
  67. package/dist/{task-queue-UD27ei2U.js → task-queue-Cp1V_XW3.js} +4 -4
  68. package/dist/{task-runner-noxjOjkM.js → task-runner-CQkkUj3o.js} +23 -11
  69. package/dist/{thread-state-BSu6rM6p.js → thread-state-Bn87cfzE.js} +4 -4
  70. package/dist/{turn-failure-response-wahwyPrZ.js → turn-failure-response-CQebxByj.js} +8 -8
  71. package/dist/{turn-lifecycle-Bo4Trccw.js → turn-lifecycle-CJJsOhXB.js} +1 -1
  72. package/dist/{turn-session-routing-DnSaaEpn.js → turn-session-routing-bmG330Cf.js} +10 -11
  73. package/dist/{validation-B9-8iKyw.js → validation-D1wcf7hp.js} +2 -2
  74. package/dist/{version-C7HejFP2.js → version-BeHSXUK6.js} +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/{viewer-DLXajQZE.js → viewer-BZ0Hp5Nb.js} +6 -7
  77. package/dist/{work-DRGSlfia.js → work-BTcCIbWu.js} +12 -12
  78. package/dist/{worker-BGh5Dwc6.js → worker-D3fDK6zc.js} +7 -7
  79. package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
  80. package/migrations/0078_plugin_conversation_index.sql +20 -0
  81. package/migrations/0079_conversation_event_author_index.sql +20 -0
  82. package/migrations/meta/0077_snapshot.json +4141 -0
  83. package/migrations/meta/0078_snapshot.json +4175 -0
  84. package/migrations/meta/0079_snapshot.json +4203 -0
  85. package/migrations/meta/_journal.json +21 -0
  86. package/package.json +4 -4
  87. package/dist/agent-invocations-D7c4BQGc.js +0 -182
  88. package/dist/common-Eu6sx09c.js +0 -107
  89. package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
  90. package/dist/sentry-MDkYAVPV.js +0 -23
@@ -1,10 +1,10 @@
1
- import { g as TURN_REASONING_LEVELS } from "./config-o2jLRY5J.js";
2
- import { C as getSqlExecutor, x as getConversationStore } from "./viewer-DLXajQZE.js";
3
- import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-D7c4BQGc.js";
4
- import "./executor-CJfsD0VX.js";
5
- import { p as credentialContextSchema } from "./registry-Cp6CNmtP.js";
1
+ import { g as TURN_REASONING_LEVELS } from "./config-CusBFORe.js";
2
+ import { C as getSqlExecutor, x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
3
+ import { h as juniorAgentInvocations, m as juniorAgentBindings } from "./executor-Cmr0J8W3.js";
4
+ import { p as credentialContextSchema } from "./registry-DR7DjX9H.js";
5
+ import { S as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, x as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B-QP9zX1.js";
6
6
  import { createHash } from "node:crypto";
7
- import { z } from "zod";
7
+ import * as z from "zod";
8
8
  import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
9
9
  import { actorSchema, destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
10
10
  // src/chat/runtime/turn.ts
@@ -1,6 +1,6 @@
1
- import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-BTge9wrH.js";
2
- import { x as getConversationStore } from "./viewer-DLXajQZE.js";
3
- import "./background-compaction-queue-CAL4A2y7.js";
1
+ import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-C1MghKyI.js";
2
+ import { x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
3
+ import "./background-compaction-queue-B9lmh8Ml.js";
4
4
  // src/chat/task-execution/store.ts
5
5
  function metadataStore(options) {
6
6
  return options.conversationStore ?? getConversationStore();
@@ -1,7 +1,7 @@
1
- import { h as logWarn } from "./logging-dFaXvBRK.js";
2
- import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-CAL4A2y7.js";
1
+ import { h as logWarn } from "./logging-CGnh65_X.js";
2
+ import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-B9lmh8Ml.js";
3
3
  import { createHash } from "node:crypto";
4
- import { z } from "zod";
4
+ import * as z from "zod";
5
5
  // src/chat/queue/callback.ts
6
6
  /** Shared queue callback wiring for signed messages. */
7
7
  /** Build the HTTP callback and local-dev consumer for one signed queue. */
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
110
110
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
111
111
  onRejected: logPluginTaskQueueMessageRejected,
112
112
  run: async (message) => {
113
- const { processPluginTask } = await import("./task-runner-noxjOjkM.js").then((n) => n.r);
113
+ const { processPluginTask } = await import("./task-runner-CQkkUj3o.js").then((n) => n.r);
114
114
  await processPluginTask(message);
115
115
  },
116
116
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,12 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ha as createPluginConversationEvents, Ln as getPlugins, Xt as instructionTextForProjection, co as createPluginCache, en as isToolResultError, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginLogger, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-BTge9wrH.js";
3
- import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
4
- import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-DLXajQZE.js";
5
- import { _ as sameActorIdentity } from "./media-DTAA8Qs_.js";
6
- import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
7
- import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-DnSaaEpn.js";
8
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
9
- import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-UD27ei2U.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection, en as isToolResultError, fo as createPluginCache, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginModelCostRecorder, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-C1MghKyI.js";
3
+ import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
4
+ import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-BZ0Hp5Nb.js";
5
+ import { _ as sameActorIdentity } from "./media-Dq9_svfQ.js";
6
+ import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
7
+ import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-bmG330Cf.js";
8
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.js";
9
+ import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-Cp1V_XW3.js";
10
10
  import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
11
11
  // src/chat/plugins/task-runner.ts
12
12
  /**
@@ -209,9 +209,18 @@ async function loadPluginRun(params) {
209
209
  function taskPluginContext(plugin, message, options = {}) {
210
210
  const pluginName = plugin.manifest.name;
211
211
  const sessionParams = pluginTaskParamsSchema.parse(message.params);
212
+ const onCost = createPluginModelCostRecorder({
213
+ conversationId: sessionParams.conversationId,
214
+ pluginName,
215
+ source: "task",
216
+ turnId: sessionParams.sessionId
217
+ });
212
218
  return {
213
219
  db: getDb(),
214
- embedder: createPluginEmbedder(pluginName, { signal: options.signal }),
220
+ embedder: createPluginEmbedder(pluginName, {
221
+ onCost,
222
+ signal: options.signal
223
+ }),
215
224
  events: createPluginConversationEvents({
216
225
  conversationId: sessionParams.conversationId,
217
226
  operationId: pluginTaskId(message),
@@ -220,7 +229,10 @@ function taskPluginContext(plugin, message, options = {}) {
220
229
  }),
221
230
  id: pluginTaskId(message),
222
231
  log: createPluginLogger(pluginName),
223
- model: createPluginModel(pluginName, plugin.model, { signal: options.signal }),
232
+ model: createPluginModel(pluginName, plugin.model, {
233
+ onCost,
234
+ signal: options.signal
235
+ }),
224
236
  name: message.name,
225
237
  plugin: { name: pluginName },
226
238
  cache: createPluginCache(pluginName),
@@ -1,7 +1,7 @@
1
- import { Rr as JUNIOR_THREAD_STATE_TTL_MS, lo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-BTge9wrH.js";
2
- import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-dFaXvBRK.js";
3
- import { S as getDb } from "./viewer-DLXajQZE.js";
4
- import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
1
+ import { Rr as JUNIOR_THREAD_STATE_TTL_MS, po as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-C1MghKyI.js";
2
+ import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-CGnh65_X.js";
3
+ import { S as getDb } from "./viewer-BZ0Hp5Nb.js";
4
+ import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
5
5
  // src/chat/state/conversation.ts
6
6
  function defaultConversationState() {
7
7
  return {
@@ -1,11 +1,11 @@
1
- import { K as clearPendingAuth, M as markConversationMessage, ro as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-BTge9wrH.js";
2
- import { _ as findProviderError, h as ProviderError, v as getProviderErrorAttributes, y as getProviderErrorUserMessage } from "./client-v_OVYuHZ.js";
3
- import { W as isRecord, t as buildTurnFailureResponse } from "./logging-dFaXvBRK.js";
4
- import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
5
- import { S as getDb, y as getConversationEventStore } from "./viewer-DLXajQZE.js";
6
- import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-CZfyQvdm.js";
7
- import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-BGBzQWNf.js";
8
- import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
1
+ import { K as clearPendingAuth, M as markConversationMessage, so as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-C1MghKyI.js";
2
+ import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-h2A2ZPzY.js";
3
+ import { W as isRecord, t as buildTurnFailureResponse } from "./logging-CGnh65_X.js";
4
+ import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
5
+ import { S as getDb, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
6
+ import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-DExTZw8B.js";
7
+ import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-Dlio-o6u.js";
8
+ import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.js";
9
9
  // src/chat/conversations/pending-cards.ts
10
10
  /**
11
11
  * Add the cards that tool results selected since the last visible assistant
@@ -1,4 +1,4 @@
1
- import { y as getConversationEventStore } from "./viewer-DLXajQZE.js";
1
+ import { y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
2
2
  // src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {
@@ -1,14 +1,13 @@
1
- import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-BTge9wrH.js";
2
- import { n as botConfig } from "./config-o2jLRY5J.js";
3
- import { _ as runBestEffort, h as logWarn } from "./logging-dFaXvBRK.js";
4
- import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-DLXajQZE.js";
5
- import { s as juniorConversations } from "./agent-invocations-D7c4BQGc.js";
6
- import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-CJfsD0VX.js";
7
- import { h as credentialSubjectSchema } from "./registry-Cp6CNmtP.js";
8
- import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
9
- import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-DphoTRYl.js";
1
+ import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-C1MghKyI.js";
2
+ import { n as botConfig } from "./config-CusBFORe.js";
3
+ import { _ as runBestEffort, h as logWarn } from "./logging-CGnh65_X.js";
4
+ import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-BZ0Hp5Nb.js";
5
+ import { d as juniorAutomations, k as juniorConversations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-Cmr0J8W3.js";
6
+ import { h as credentialSubjectSchema } from "./registry-DR7DjX9H.js";
7
+ import { r as getStateAdapter } from "./adapter-DVN3iwf9.js";
8
+ import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-CPqRFjIa.js";
10
9
  import { createHash } from "node:crypto";
11
- import { z } from "zod";
10
+ import * as z from "zod";
12
11
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
13
12
  import { agentEventMatchSchema, anyResourceMatchFields, describeEventTrigger, destinationSchema, destinationVisibilitySchema, eventMatches, eventTriggerChoices, eventTriggerProblems, isSlackDestination, normalizeEventIdentifier, normalizeEventMatch, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
14
13
  // src/chat/events/catalog.ts
@@ -1584,7 +1583,7 @@ function slackSourceForDestination(args) {
1584
1583
  * Reads parent Conversations when this Conversation has no Destination.
1585
1584
  */
1586
1585
  async function resolveConversationRouting(args) {
1587
- const conversationStore = args.conversationStore ?? (await import("./viewer-DLXajQZE.js").then((n) => n.v)).getConversationStore();
1586
+ const conversationStore = args.conversationStore ?? (await import("./viewer-BZ0Hp5Nb.js").then((n) => n.v)).getConversationStore();
1588
1587
  const chain = await loadConversationChain(args.conversationId, conversationStore);
1589
1588
  let destination;
1590
1589
  let source;
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DpN0sWQ6.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.278.0";
2
+ var version = "0.280.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-C7HejFP2.js";
1
+ export { t as JUNIOR_VERSION } from "./version-BeHSXUK6.js";
@@ -1,10 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { i as getChatConfig } from "./config-o2jLRY5J.js";
3
- import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-dFaXvBRK.js";
4
- import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-B4DYygOB.js";
5
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-D7c4BQGc.js";
6
- import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-CJfsD0VX.js";
7
- import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DTAA8Qs_.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { i as getChatConfig } from "./config-CusBFORe.js";
3
+ import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-CGnh65_X.js";
4
+ import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
5
+ import { A as juniorIdentities, M as juniorDestinations, O as conversationReadColumns, S as juniorConversationEvents, _ as juniorConversationParticipants, b as CONVERSATION_METRICS, j as juniorUsers, k as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationBindings, w as juniorConversationAnnotations, x as juniorConversationMetrics } from "./executor-Cmr0J8W3.js";
6
+ import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-Dq9_svfQ.js";
8
7
  import { a as withLock } from "./locks-D-0h111u.js";
9
8
  import { createHash, randomUUID } from "node:crypto";
10
9
  import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -1,16 +1,16 @@
1
- import { H as AuthorizationFlowDisabledError, Ja as loadForkHistory, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-BTge9wrH.js";
2
- import { n as botConfig } from "./config-o2jLRY5J.js";
3
- import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-DLXajQZE.js";
4
- import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DTAA8Qs_.js";
5
- import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-DE-43MPb.js";
6
- import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-BGBzQWNf.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-pauL6qyn.js";
8
- import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-BsS4qFS2.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-CGJZTEVz.js";
10
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-Bo4Trccw.js";
11
- import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
1
+ import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, Qa as loadForkHistory, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-C1MghKyI.js";
2
+ import { n as botConfig } from "./config-CusBFORe.js";
3
+ import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
4
+ import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-Dq9_svfQ.js";
5
+ import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-_PYLv4Qo.js";
6
+ import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-Dlio-o6u.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-DbebsAxi.js";
8
+ import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-CDEMsNtv.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-QzOfDwKA.js";
10
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CJJsOhXB.js";
11
+ import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-Bn87cfzE.js";
12
12
  import { isDeepStrictEqual } from "node:util";
13
- import { z } from "zod";
13
+ import * as z from "zod";
14
14
  // src/chat/runtime/turn-execution.ts
15
15
  /** An error thrown while the agent advances a Run. */
16
16
  var AgentRunError = class extends Error {
@@ -1,10 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-BTge9wrH.js";
3
- import { b as isProviderRetryError } from "./client-v_OVYuHZ.js";
4
- import { i as getChatConfig } from "./config-o2jLRY5J.js";
5
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-dFaXvBRK.js";
6
- import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-CAL4A2y7.js";
7
- import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-CGJZTEVz.js";
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-C1MghKyI.js";
3
+ import { x as isProviderRetryError } from "./client-h2A2ZPzY.js";
4
+ import { i as getChatConfig } from "./config-CusBFORe.js";
5
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CGnh65_X.js";
6
+ import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-B9lmh8Ml.js";
7
+ import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-QzOfDwKA.js";
8
8
  // src/chat/task-execution/attempt-selection.ts
9
9
  function selectContiguousTurnBatch(messages) {
10
10
  const first = messages[0];
@@ -0,0 +1 @@
1
+ ALTER TABLE "junior_agent_invocations" DROP COLUMN "model_profile";
@@ -0,0 +1,20 @@
1
+ -- For a busy database, first run the index definition below with CONCURRENTLY,
2
+ -- as one statement outside a transaction. Before junior upgrade, check its
3
+ -- pg_get_indexdef, pg_index.indisvalid, and pg_index.indisready.
4
+ DO $$
5
+ BEGIN
6
+ -- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
7
+ IF to_regclass('junior_conversation_events_plugin_conversation_idx') IS NULL THEN
8
+ CREATE INDEX "junior_conversation_events_plugin_conversation_idx" ON "junior_conversation_events" USING btree ("conversation_id",("payload"->>'namespace'),("payload"->>'name'),"seq") WHERE "junior_conversation_events"."type" = 'structured_event';
9
+ END IF;
10
+
11
+ -- A failed concurrent build can leave an index that exists but cannot be used.
12
+ IF NOT EXISTS (
13
+ SELECT 1 FROM pg_index
14
+ WHERE indexrelid = 'junior_conversation_events_plugin_conversation_idx'::regclass
15
+ AND indrelid = 'junior_conversation_events'::regclass
16
+ AND indisvalid AND indisready
17
+ ) THEN
18
+ RAISE EXCEPTION 'The plugin conversation index is not valid and ready. Repair the concurrent build before running junior upgrade.';
19
+ END IF;
20
+ END $$;
@@ -0,0 +1,20 @@
1
+ -- For a busy database, first run the index definition below with CONCURRENTLY,
2
+ -- as one statement outside a transaction. Before junior upgrade, check its
3
+ -- pg_get_indexdef, pg_index.indisvalid, and pg_index.indisready.
4
+ DO $$
5
+ BEGIN
6
+ -- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
7
+ IF to_regclass('junior_conversation_events_author_idx') IS NULL THEN
8
+ CREATE INDEX "junior_conversation_events_author_idx" ON "junior_conversation_events" USING btree ("conversation_id","actor_identity_id","seq") WHERE "junior_conversation_events"."actor_identity_id" is not null;
9
+ END IF;
10
+
11
+ -- A failed concurrent build can leave an index that exists but cannot be used.
12
+ IF NOT EXISTS (
13
+ SELECT 1 FROM pg_index
14
+ WHERE indexrelid = 'junior_conversation_events_author_idx'::regclass
15
+ AND indrelid = 'junior_conversation_events'::regclass
16
+ AND indisvalid AND indisready
17
+ ) THEN
18
+ RAISE EXCEPTION 'The conversation event author index is not valid and ready. Repair the concurrent build before running junior upgrade.';
19
+ END IF;
20
+ END $$;