@sentry/junior 0.287.0 → 0.289.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 (79) hide show
  1. package/dist/{adapter-CL-HUKgd.js → adapter-tE1wnl0T.js} +1 -1
  2. package/dist/{admin-C9urXVfi.js → admin-BmsPbmO_.js} +2 -2
  3. package/dist/{agent-runner-Bfnw551N.js → agent-runner-bvl8U5uH.js} +489 -165
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +628 -238
  8. package/dist/{app-DBY5TnfY.d.ts → app-Cu454FXq.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +550 -71
  11. package/dist/assistant-reply-1N9oxyyb.js +58 -0
  12. package/dist/{automation-DksGNDRO.js → automation-DWbjJltM.js} +2 -2
  13. package/dist/{background-compaction-queue-CYI909P5.js → background-compaction-queue-D36oCldp.js} +161 -90
  14. package/dist/{briefs-DaXiMWzT.js → briefs-CV-1qkXa.js} +3 -3
  15. package/dist/{catalog-runtime-BCIuBe4d.js → catalog-runtime-BNK4uJVZ.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-CkHcUMN7.js → config-DHAy7XlP.js} +363 -8
  24. package/dist/{connections-BnIj0wtx.js → connections-C3VmH3cf.js} +7 -129
  25. package/dist/{conversation-E7ZPJx2H.js → conversation-CwC8K3RZ.js} +22 -5
  26. package/dist/{conversation-pending-messages-DVch6YQw.js → conversation-pending-messages-B0cuLReP.js} +1 -1
  27. package/dist/{conversation-privacy-DF1hW0ja.js → conversation-privacy-Bky_veSp.js} +1 -1
  28. package/dist/{credential-sync-CzMar9hq.js → credential-sync-dY9o0YSj.js} +28 -20
  29. package/dist/{db-DJ11eZqq.js → db-BS2Kql3j.js} +81 -46
  30. package/dist/{db-YDKKDxlh.d.ts → db-BebRmhsH.d.ts} +10 -2
  31. package/dist/{executor-BY9TB31g.js → executor-cc4nH86C.js} +125 -18
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-BO5zU6Mt.js → logging-CtCJmt9p.js} +3 -2
  34. package/dist/{media-Cz1ZiV1U.js → media-BepyEUNm.js} +5 -1
  35. package/dist/{message-CsUbuEc8.js → message-C5VuRcP9.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +19 -41
  38. package/dist/{oauth-callback-server-hiDKK0_n.js → oauth-callback-server-KRrYUZ35.js} +2 -2
  39. package/dist/{projection-CL_YWeGf.js → projection-BFJG58TG.js} +448 -721
  40. package/dist/{prompt-BHOEQSmf.js → prompt-D15oftoL.js} +5 -5
  41. package/dist/{registry-BriFLnaJ.js → registry-C_JrgqUz.js} +1 -1
  42. package/dist/{resolve-Bt6GgAiA.js → resolve-Cn_7JfP-.js} +3 -3
  43. package/dist/{result-Bo1TZu0Q.js → result-CIbQFLp6.js} +16 -10
  44. package/dist/{runner-D3YeCQgt.js → runner-BwmaMJVO.js} +8 -8
  45. package/dist/{sandbox-egress-signals-CcnSPP4S.js → sandbox-egress-signals-BOQ8gn7i.js} +1 -1
  46. package/dist/{schedule-BTp__wrw.js → schedule-cP0AACm1.js} +11 -2
  47. package/dist/{schema-BWE3RJEB.js → schema-Bptz19Ja.js} +72 -14
  48. package/dist/{schema-C6fsEwjo.d.ts → schema-DQaFSkZZ.d.ts} +122 -3
  49. package/dist/{service-account-DiQQuuw7.js → service-account-AGw_pANb.js} +3 -3
  50. package/dist/{service-account-r6fl0b-9.js → service-account-CLZfF8O1.js} +3 -3
  51. package/dist/{session-stop-B2Nut40V.js → session-stop-CbzKf7UI.js} +84 -31
  52. package/dist/{skills-CD5aJdzg.js → skills-CcAJBquq.js} +2 -2
  53. package/dist/{spawn-CalgZQiu.js → spawn-BvAk2vTI.js} +5 -5
  54. package/dist/{stop-kujZLbi0.js → stop-BQU4u7la.js} +893 -519
  55. package/dist/{store-DdIEUL1q.js → store-DE7NJOvQ.js} +4 -16
  56. package/dist/{task-runner-D_RDr2Hu.js → task-runner-Q_7duP_T.js} +31 -27
  57. package/dist/{turn-failure-response-B5nV1Er-.js → turn-failure-response-aWZLfUM8.js} +18 -9
  58. package/dist/{validation-K4pqwoVZ.js → validation-BOoPeIJR.js} +1 -1
  59. package/dist/{version-DBvhk1X9.js → version-Db0MFy61.js} +1 -1
  60. package/dist/version.js +1 -1
  61. package/dist/{viewer-DrMmFUul.js → viewer-FFEFu9In.js} +4 -4
  62. package/dist/warmup-DDzrA9Gv.js +967 -0
  63. package/dist/{work-ljRoODGu.js → work-BBJK458E.js} +16 -15
  64. package/dist/{worker-CYO1Q0Js.js → worker-2iU5RFyq.js} +7 -31
  65. package/migrations/0089_conversation_paused_status.sql +3 -0
  66. package/migrations/0090_guardian_review_time_index.sql +20 -0
  67. package/migrations/0091_conversation_participant_unsubscribed_index.sql +20 -0
  68. package/migrations/0092_turn_metric_actor.sql +12 -0
  69. package/migrations/0093_participant_root_actor_backfill.sql +18 -0
  70. package/migrations/0094_conversation_delivery_paused_at.sql +1 -0
  71. package/migrations/meta/0089_snapshot.json +4372 -0
  72. package/migrations/meta/0090_snapshot.json +4388 -0
  73. package/migrations/meta/0091_snapshot.json +4410 -0
  74. package/migrations/meta/0092_snapshot.json +4446 -0
  75. package/migrations/meta/0093_snapshot.json +4446 -0
  76. package/migrations/meta/0094_snapshot.json +4452 -0
  77. package/migrations/meta/_journal.json +42 -0
  78. package/package.json +6 -5
  79. package/dist/assistant-reply-u_PRYzuz.js +0 -65
@@ -1,6 +1,6 @@
1
- import { Bt as stopConversationWork$1, Ct as getConversationWorkState$1, Ft as removeActiveConversation$1, It as requestAnotherSlice$1, Lt as requestConversationWork$1, Mt as recordConversationRetry$1, Nt as releaseConversationWork$1, Ot as listActiveConversationIds$1, Pt as releaseInboundMessage, Rt as startConversationWork$1, St as getConversation$1, _t as clearExpiredConversationLease$1, bt as deadLetterAttempt$1, dt as appendInboundMessage, ft as beginConversationResume$1, gt as clearConsumedConversationWake$1, ht as claimInboundMessage$1, jt as recordAttemptFailure$1, kt as markConversationWorkEnqueued$1, lt as ackMessages$1, mt as checkInConversationWork$1, pt as cancelHumanFacingPendingMessages$1, ut as appendExclusiveInboundMessage, vt as completeConversationStop$1, xt as drainConversationMailbox$1, yt as completeConversationWork$1, zt as steerWebPendingMessages$1 } from "./projection-CL_YWeGf.js";
2
- import { a as getConversationStore } from "./db-DJ11eZqq.js";
3
- import "./background-compaction-queue-CYI909P5.js";
1
+ import { Bt as requestConversationWork$1, Ct as deadLetterAttempt$1, Et as getConversationWorkState$1, Ft as recordAttemptFailure$1, Ht as steerWebPendingMessages$1, It as recordConversationRetry$1, Lt as releaseConversationWork$1, Mt as markConversationWorkEnqueued$1, Ot as hasRunnableConversationWork, Rt as releaseInboundMessage, Tt as getConversation$1, Ut as stopConversationWork$1, Vt as startConversationWork$1, _t as claimInboundMessage$1, bt as completeConversationStop$1, dt as ackMessages$1, ft as appendExclusiveInboundMessage, gt as checkInConversationWork$1, ht as cancelHumanFacingPendingMessages$1, jt as listActiveConversationIds$1, mt as beginConversationResume$1, pt as appendInboundMessage, vt as clearConsumedConversationWake$1, wt as drainConversationMailbox$1, xt as completeConversationWork$1, yt as clearExpiredConversationLease$1, zt as requestAnotherSlice$1 } from "./projection-BFJG58TG.js";
2
+ import { a as getConversationStore } from "./db-BS2Kql3j.js";
3
+ import "./background-compaction-queue-D36oCldp.js";
4
4
  // src/chat/task-execution/store.ts
5
5
  function metadataStore(options) {
6
6
  return options.conversationStore ?? getConversationStore();
@@ -55,14 +55,6 @@ async function recordConversationRetry(args) {
55
55
  await recordExecutionMetadata(args);
56
56
  return result;
57
57
  }
58
- /** Count mailbox messages that have not yet reached the conversation event log. */
59
- function countPendingConversationMessages(conversation) {
60
- return conversation.execution.pendingMessages.length;
61
- }
62
- /** Return whether a conversation has pending or resumable execution work. */
63
- function hasRunnableConversationWork(conversation) {
64
- return conversation.execution.status !== "idle" || countPendingConversationMessages(conversation) > 0;
65
- }
66
58
  /**
67
59
  * Ensure runnable conversation work has one accepted queue wake-up nudge.
68
60
  *
@@ -309,12 +301,8 @@ async function clearExpiredConversationLease(args) {
309
301
  await recordExecutionMetadata(args);
310
302
  return result;
311
303
  }
312
- /** Remove one conversation from the active index after it is missing or idle. */
313
- async function removeActiveConversation(args) {
314
- return await removeActiveConversation$1(args);
315
- }
316
304
  /** List active conversation ids by oldest execution update first. */
317
305
  async function listActiveConversationIds(args = {}) {
318
306
  return await listActiveConversationIds$1(args);
319
307
  }
320
- export { removeActiveConversation as C, steerWebPendingMessages as D, startConversationWork as E, stopConversationWork as O, releaseConversationWork as S, requestConversationWork as T, getConversationWorkState as _, cancelHumanFacingPendingMessages as a, recordAttemptFailure as b, clearConsumedConversationWake as c, completeConversationWork as d, countPendingConversationMessages as f, getConversation as g, ensureConversationWake as h, beginConversationResume as i, clearExpiredConversationLease as l, drainConversationMailbox as m, appendAndEnqueueExclusiveInboundMessage as n, checkInConversationWork as o, deadLetterAttempt as p, appendAndEnqueueInboundMessage as r, claimInboundMessage as s, ackMessages as t, completeConversationStop as u, hasRunnableConversationWork as v, requestAnotherSlice as w, recordConversationRetry as x, listActiveConversationIds as y };
308
+ export { startConversationWork as C, requestConversationWork as S, stopConversationWork as T, listActiveConversationIds as _, cancelHumanFacingPendingMessages as a, releaseConversationWork as b, clearConsumedConversationWake as c, completeConversationWork as d, deadLetterAttempt as f, getConversationWorkState as g, getConversation as h, beginConversationResume as i, clearExpiredConversationLease as l, ensureConversationWake as m, appendAndEnqueueExclusiveInboundMessage as n, checkInConversationWork as o, drainConversationMailbox as p, appendAndEnqueueInboundMessage as r, claimInboundMessage as s, ackMessages as t, completeConversationStop as u, recordAttemptFailure as v, steerWebPendingMessages as w, requestAnotherSlice as x, recordConversationRetry as y };
@@ -1,16 +1,16 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { $a as createPluginLogger, $i as postSlackMessage, Ba as createPluginModel, Fo as createPluginCache, Hi as formatSlackLink, Io as createDurableLocationConfigurationService, Qa as createPluginModelCostRecorder, T as fallbackShortTitle, Vi as escapeSlackMrkdwnText, Xi as openSlackDirectMessage, Zn as getPlugins, Zt as getPiMessageRole, b as persistConversationMessages, cn as normalizeToolNameFromResult, er as coreTaskRegistrations, fi as getDashboardTaskLink, hi as createPluginState, it as getTurnRecord, mi as ToolInputError, nn as instructionTextForProjection, on as isToolResultError, si as JUNIOR_THREAD_STATE_TTL_MS, sn as isToolResultMessage, un as stripRuntimeTurnContext, uo as createPluginConversationEvents, v as hydrateConversationMessages, za as createPluginEmbedder } from "./projection-CL_YWeGf.js";
3
- import { n as botConfig } from "./config-CkHcUMN7.js";
4
- import { E as withSpan, G as toOptionalNumber, K as toOptionalString, W as isRecord$1, _ as runBestEffort, h as logWarn } from "./logging-BO5zU6Mt.js";
2
+ import { Fa as createPluginEmbedder, Gi as openSlackDirectMessage, Hn as coreTaskRegistrations, Ia as createPluginModel, Ii as escapeSlackMrkdwnText, Ja as createPluginModelCostRecorder, Ji as postSlackMessage, Li as formatSlackLink, Mo as createDurableLocationConfigurationService, Ya as createPluginLogger, an as instructionTextForProjection, b as persistConversationMessages, dn as normalizeToolNameFromResult, en as getPiMessageRole, jo as createPluginCache, li as ToolInputError, ln as isToolResultError, oi as getDashboardTaskLink, oo as createPluginConversationEvents, ot as getTurnRecord, pn as stripRuntimeTurnContext, ti as JUNIOR_THREAD_STATE_TTL_MS, ui as createPluginState, un as isToolResultMessage, v as hydrateConversationMessages, w as fallbackShortTitle, zn as getPlugins } from "./projection-BFJG58TG.js";
3
+ import { n as botConfig } from "./config-DHAy7XlP.js";
4
+ import { E as withSpan, G as isRecord$1, K as toOptionalNumber, _ as runBestEffort, h as logWarn, q as toOptionalString } from "./logging-CtCJmt9p.js";
5
5
  import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
6
- import { H as agentTurnCostUsd, U as agentTurnTotalTokens, a as getConversationStore, o as getDb } from "./db-DJ11eZqq.js";
7
- import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-BY9TB31g.js";
8
- import { v as sameActorIdentity } from "./media-Cz1ZiV1U.js";
9
- import { h as credentialSubjectSchema } from "./registry-BriFLnaJ.js";
10
- import { i as readActorIdentity } from "./viewer-DrMmFUul.js";
11
- import { r as getStateAdapter } from "./adapter-CL-HUKgd.js";
12
- import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-CYI909P5.js";
13
- import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-DksGNDRO.js";
6
+ import { H as agentTurnTotalTokens, V as agentTurnCostUsd, a as getConversationStore, o as getDb } from "./db-BS2Kql3j.js";
7
+ import { A as juniorConversations, d as juniorAutomationVersions, f as juniorAutomations, u as juniorAutomationRuns } from "./executor-cc4nH86C.js";
8
+ import { v as sameActorIdentity } from "./media-BepyEUNm.js";
9
+ import { h as credentialSubjectSchema } from "./registry-C_JrgqUz.js";
10
+ import { i as readActorIdentity } from "./viewer-FFEFu9In.js";
11
+ import { r as getStateAdapter } from "./adapter-tE1wnl0T.js";
12
+ import { c as pluginTaskParamsSchema, d as sendVercelPluginTask, s as pluginTaskId } from "./background-compaction-queue-D36oCldp.js";
13
+ import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-DWbjJltM.js";
14
14
  import { createHash } from "node:crypto";
15
15
  import * as z from "zod";
16
16
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
@@ -349,7 +349,7 @@ function slackSourceForDestination(args) {
349
349
  * Reads parent Conversations when this Conversation has no Destination.
350
350
  */
351
351
  async function resolveConversationRouting(args) {
352
- const conversationStore = args.conversationStore ?? (await import("./db-DJ11eZqq.js").then((n) => n.n)).getConversationStore();
352
+ const conversationStore = args.conversationStore ?? (await import("./db-BS2Kql3j.js").then((n) => n.n)).getConversationStore();
353
353
  const chain = await loadConversationChain(args.conversationId, conversationStore);
354
354
  let destination;
355
355
  let source;
@@ -466,10 +466,6 @@ function conversationRangeColumns() {
466
466
  lastSeenAt: sql`MAX(${juniorConversations.lastActivityAt})`.mapWith(juniorConversations.lastActivityAt)
467
467
  };
468
468
  }
469
- /** Count distinct UTC activity dates without loading conversation timestamps into the app. */
470
- function conversationActiveDaysColumn() {
471
- return sql`COUNT(DISTINCT (${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC')::date)::integer`;
472
- }
473
469
  // src/chat/automations/execution-stats.ts
474
470
  const AUTOMATION_EXECUTION_STATUSES = [
475
471
  "blocked",
@@ -1235,19 +1231,25 @@ async function collectEventAutomationMatchKeys(db, input) {
1235
1231
  return [...keys].sort();
1236
1232
  }
1237
1233
  /**
1238
- * Find every live task matching one normalized event: tasks for its exact
1239
- * identifier, and tasks with no identifier whose filters match. The gate
1240
- * skips a row whose trigger and identifier column disagree, and a row with
1241
- * no identifier whose trigger the enabled `catalog` rejects.
1234
+ * Find every live task matching each normalized event, with one read for all
1235
+ * of them: tasks for its exact identifier, and tasks with no identifier whose
1236
+ * filters match. Returns one list per event, in order. The events must share
1237
+ * one namespace. The gate skips a row whose trigger and identifier column
1238
+ * disagree, and a row with no identifier whose trigger the enabled `catalog`
1239
+ * rejects.
1242
1240
  */
1243
- async function findMatchingEventAutomations(db, event, teamId, catalog) {
1244
- return (await readGatedEventAutomations(db, {
1241
+ async function findMatchingEventAutomations(db, events, teamId, catalog) {
1242
+ const namespace = events[0]?.namespace;
1243
+ if (namespace === void 0) return [];
1244
+ if (events.some((event) => event.namespace !== namespace)) throw new Error("Events to match must share one namespace.");
1245
+ const tasks = await readGatedEventAutomations(db, {
1245
1246
  catalog,
1246
- eventTypes: [event.eventType],
1247
- identifiers: [event.identifier],
1248
- namespace: event.namespace,
1247
+ eventTypes: [...new Set(events.map((event) => event.eventType))],
1248
+ identifiers: [...new Set(events.map((event) => event.identifier))],
1249
+ namespace,
1249
1250
  teamId
1250
- })).filter((task) => task.trigger.events.includes(event.eventType) && eventMatches(task.trigger.match, event.data));
1251
+ });
1252
+ return events.map((event) => tasks.filter((task) => (task.trigger.identifier === void 0 || task.trigger.identifier === event.identifier) && task.trigger.events.includes(event.eventType) && eventMatches(task.trigger.match, event.data)));
1251
1253
  }
1252
1254
  /**
1253
1255
  * Change lifecycle under the same row lock as edits, without changing
@@ -1500,6 +1502,7 @@ const dispatchRecordSchema = z.object({
1500
1502
  source: sourceSchema,
1501
1503
  outcomes: z.array(taskOutcomeSchema).max(5).optional(),
1502
1504
  status: dispatchStatusSchema,
1505
+ title: z.string().min(1).optional(),
1503
1506
  updatedAtMs: z.number().finite()
1504
1507
  }).strict().superRefine((record, ctx) => {
1505
1508
  if (!isSlackDestination(record.destination)) {
@@ -1667,6 +1670,7 @@ async function createOrGetDispatch(args) {
1667
1670
  ...args.options.outcomes ? { outcomes: args.options.outcomes } : void 0,
1668
1671
  status: "pending",
1669
1672
  source: args.options.source,
1673
+ ...args.options.title?.trim() ? { title: args.options.title.trim() } : void 0,
1670
1674
  updatedAtMs: args.nowMs
1671
1675
  };
1672
1676
  await updatePendingDispatchMailboxAppendIndex(state, (ids) => ids.includes(id) ? ids : [...ids, id]);
@@ -2069,4 +2073,4 @@ async function processPluginTask(message, options = {}) {
2069
2073
  "app.plugin.task": message.name
2070
2074
  });
2071
2075
  }
2072
- export { readAutomationExecutionByConversationId as $, withScheduledAutomationLock as A, registeredEventTriggerProblems as At, setEventAutomationStatus as B, deleteScheduledAutomation as C, describeRegisteredEventTrigger as Ct, saveScheduledAutomation as D, eventWatchUnavailable as Dt, readScheduledAutomation as E, eventNamespaceSchema as Et, findMatchingEventAutomations as F, listAutomationVersions as G, eventAutomationRunLimitReason as H, getEventAutomation as I, AutomationConflictError as J, readAutomationVersion as K, listDeletedEventAutomationsCreatedBy as L, collectEventAutomationMatchKeys as M, registeredResourceTypeSchema as Mt, createEventAutomation as N, requireEventIdentifier as Nt, saveScheduledAutomationInLock as O, hasEventCatalogEntries as Ot, deleteEventAutomation as P, requireValidEventTrigger as Pt, existingConversationId as Q, parseEventAutomationRow as R, createScheduledAutomation as S, automationEventCatalog as St, parseScheduledAutomationRow as T, eventGuidance as Tt, automationDefinition as U, admitEventAutomationRun as V, automationVersionOf as W, requireAutomationRevision as X, automationRevision as Y, emptyAutomationRunWindows as Z, markDispatchBlocked as _, getPersistedThreadState as _t, claimDispatchMailboxAppend as a, readAutomationExecutions as at, markDispatchRunning as b, coerceThreadConversationState as bt, getDispatchConversationId as c, recordAutomationExecution as ct, getDispatchRecord as d, conversationRangeColumns as dt, readAutomationExecutionDays as et, getDispatchTurnId as f, conversationUsageCostExpr as ft, markDispatchAwaitingResume as g, getPersistedSandboxState as gt, listPendingDispatchMailboxAppends as h, getLocationConfigurationService as ht, buildDispatchId as i, readAutomationExecutionSummaries as it, blockEventAutomation as j, registeredEventTypeSchema as jt, scheduledRunId as k, registeredEventMatchSchema as kt, getDispatchIdForConversation as l, conversationActiveDaysColumn as lt, isTerminalDispatchStatus as m, resolveTurnSessionRouting as mt, scheduleSessionCompletedPluginTasks as n, readAutomationExecutionStatusDays as nt, confirmDispatchMailboxAppend as o, readAutomationRuns as ot, getPluginDispatchProjection as p, resolveConversationRouting as pt, sameDefinitionValue as q, task_runner_exports as r, readAutomationExecutionStatusHours as rt, createOrGetDispatch as s, readAutomationTitlesByConversationId as st, processPluginTask as t, readAutomationExecutionHours as tt, getDispatchInputMessageId as u, conversationAggregateColumns as ut, markDispatchCompleted as v, persistThreadRuntimeState as vt, listScheduledAutomationsForTeam as w, eventCatalogEntry as wt, notifyAutomationBlocked as x, CORE_EVENT_NAMESPACE as xt, markDispatchFailed as y, persistThreadStateById as yt, saveEventAutomation as z };
2076
+ export { readAutomationExecutionByConversationId as $, withScheduledAutomationLock as A, registeredResourceTypeSchema as At, setEventAutomationStatus as B, deleteScheduledAutomation as C, eventGuidance as Ct, saveScheduledAutomation as D, registeredEventMatchSchema as Dt, readScheduledAutomation as E, hasEventCatalogEntries as Et, findMatchingEventAutomations as F, listAutomationVersions as G, eventAutomationRunLimitReason as H, getEventAutomation as I, AutomationConflictError as J, readAutomationVersion as K, listDeletedEventAutomationsCreatedBy as L, collectEventAutomationMatchKeys as M, requireValidEventTrigger as Mt, createEventAutomation as N, saveScheduledAutomationInLock as O, registeredEventTriggerProblems as Ot, deleteEventAutomation as P, existingConversationId as Q, parseEventAutomationRow as R, createScheduledAutomation as S, eventCatalogEntry as St, parseScheduledAutomationRow as T, eventWatchUnavailable as Tt, automationDefinition as U, admitEventAutomationRun as V, automationVersionOf as W, requireAutomationRevision as X, automationRevision as Y, emptyAutomationRunWindows as Z, markDispatchBlocked as _, persistThreadStateById as _t, claimDispatchMailboxAppend as a, readAutomationExecutions as at, markDispatchRunning as b, automationEventCatalog as bt, getDispatchConversationId as c, recordAutomationExecution as ct, getDispatchRecord as d, resolveConversationRouting as dt, readAutomationExecutionDays as et, getDispatchTurnId as f, resolveTurnSessionRouting as ft, markDispatchAwaitingResume as g, persistThreadRuntimeState as gt, listPendingDispatchMailboxAppends as h, getPersistedThreadState as ht, buildDispatchId as i, readAutomationExecutionSummaries as it, blockEventAutomation as j, requireEventIdentifier as jt, scheduledRunId as k, registeredEventTypeSchema as kt, getDispatchIdForConversation as l, conversationAggregateColumns as lt, isTerminalDispatchStatus as m, getPersistedSandboxState as mt, scheduleSessionCompletedPluginTasks as n, readAutomationExecutionStatusDays as nt, confirmDispatchMailboxAppend as o, readAutomationRuns as ot, getPluginDispatchProjection as p, getLocationConfigurationService as pt, sameDefinitionValue as q, task_runner_exports as r, readAutomationExecutionStatusHours as rt, createOrGetDispatch as s, readAutomationTitlesByConversationId as st, processPluginTask as t, readAutomationExecutionHours as tt, getDispatchInputMessageId as u, conversationRangeColumns as ut, markDispatchCompleted as v, coerceThreadConversationState as vt, listScheduledAutomationsForTeam as w, eventNamespaceSchema as wt, notifyAutomationBlocked as x, describeRegisteredEventTrigger as xt, markDispatchFailed as y, CORE_EVENT_NAMESPACE as yt, saveEventAutomation as z };
@@ -1,17 +1,26 @@
1
- import { Cn as buildDeterministicTurnId, D as buildConversationContext, M as markConversationMessage, ko as listConversationAnnotations, q as clearPendingAuth, v as hydrateConversationMessages } from "./projection-CL_YWeGf.js";
2
- import { I as findProviderError, L as getProviderErrorAttributes, P as ProviderError, R as getProviderErrorUserMessage, g as TURN_REASONING_LEVELS } from "./config-CkHcUMN7.js";
3
- import { W as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-BO5zU6Mt.js";
1
+ import { E as buildConversationContext, To as listConversationAnnotations, X as clearPendingAuth, j as markConversationMessage, v as hydrateConversationMessages } from "./projection-BFJG58TG.js";
2
+ import { H as getProviderErrorAttributes, U as getProviderErrorUserMessage, V as findProviderError, g as TURN_REASONING_LEVELS, z as ProviderError } from "./config-DHAy7XlP.js";
3
+ import { G as isRecord, b as setSpanAttributes, t as buildTurnFailureResponse } from "./logging-CtCJmt9p.js";
4
4
  import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
5
- import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-DJ11eZqq.js";
6
- import { g as juniorAgentInvocations } from "./executor-BY9TB31g.js";
7
- import { p as credentialContextSchema } from "./registry-BriFLnaJ.js";
8
- import { F as removedCardSchema, I as resolveMessageCards, P as readMessageCardRefs } from "./conversation-E7ZPJx2H.js";
5
+ import { o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-BS2Kql3j.js";
6
+ import { g as juniorAgentInvocations } from "./executor-cc4nH86C.js";
7
+ import { p as credentialContextSchema } from "./registry-C_JrgqUz.js";
8
+ import { B as resolveMessageCards, R as readMessageCardRefs, z as removedCardSchema } from "./conversation-CwC8K3RZ.js";
9
9
  import { C as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, S as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B3Ze-Qnt.js";
10
- import { _t as getPersistedThreadState, bt as coerceThreadConversationState, yt as persistThreadStateById } from "./task-runner-D_RDr2Hu.js";
10
+ import { _t as persistThreadStateById, ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-Q_7duP_T.js";
11
11
  import { createHash } from "node:crypto";
12
12
  import * as z from "zod";
13
13
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
14
14
  import { actorSchema, destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
15
+ // src/chat/state/turn-id.ts
16
+ /** Build a stable turn identifier from a message ID. */
17
+ function buildDeterministicTurnId(messageId) {
18
+ return `turn_${messageId.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
19
+ }
20
+ /** Build the stable visible assistant-message identity for one logical turn. */
21
+ function buildDeterministicAssistantMessageId(turnId) {
22
+ return `${turnId}:assistant:1`;
23
+ }
15
24
  // src/chat/runtime/turn.ts
16
25
  /** Classified Slack turn failure carrying the owning Sentry capture outward. */
17
26
  var ConversationTurnBoundaryError = class extends Error {
@@ -804,4 +813,4 @@ function finalizeFailedTurnReplyWithEvent(args) {
804
813
  }
805
814
  };
806
815
  }
807
- export { getUnnamedAgentConversationId as $, markAgentInvocationPaused as A, AGENT_TYPES as B, isTerminalAgentInvocation as C, listPendingAgentInvocationResults as D, listPendingAgentInvocationMailboxAppends as E, CHILD_AGENT_RESULTS as F, getAgentInvocationIdForEvents as G, agentTypeStartsWithParentHistory as H, PARENT_AGENT_TARGET as I, getAgentInvocationMessageId as J, getAgentInvocationIdForMessage as K, agentBindingSchema as L, markAgentInvocationSteered as M, reportReplacedAgentInvocation as N, markAgentInvocationMailboxAppended as O, CHILD_AGENT_KINDS as P, getNamedAgentConversationId as Q, agentNameSchema as R, invocationFromRow as S, listOpenAgentInvocations as T, formatAgentTypes as U, agentTypeInstructions as V, getAgentInvocationId as W, getAgentInvocationTurnId as X, getAgentInvocationResultMessageId as Y, getChildAgentLockName as Z, completeAgentInvocation as _, persistAuthPauseTurnState as a, getConversationTurnBoundaryError as at, getChildAgentLabel as b, getTurnUserSlackMessageTs as c, isTurnInputDeferredError as ct, loadThreadContextTrimFloor as d, markTurnFailed as dt, parseAgentInvocationResultMessageId as et, ConversationTurnLifecycleService as f, startActiveTurn as ft, NON_TERMINAL_AGENT_INVOCATION_STATUSES as g, ACTIVE_AGENT_INVOCATION_STATUSES as h, completeAuthPauseTurn as i, TurnInputDeferredError as it, markAgentInvocationRunning as j, markAgentInvocationParentMailboxAppended as k, buildDeliveredTurnStatePatch as l, markTurnClosed as lt, loadPendingMessageCards as m, getAgentTurnDiagnosticsAttributes as n, CooperativeTurnYieldError as nt, getTurnUserMessage as o, isCooperativeTurnYieldError as ot, getTurnLifecycle as p, getAgentInvocationIdForResult as q, requireTurnFailureEventId as r, TurnInputCommitLostError as rt, getTurnUserReplyAttachmentContext as s, isTurnInputCommitLostError as st, finalizeFailedTurnReplyWithEvent as t, ConversationTurnBoundaryError as tt, buildTurnThreadContext as u, markTurnCompleted as ut, getActiveAgentInvocationForConversation as v, listAgentInvocationsForConversation as w, getLatestAgentInvocationForConversation as x, getAgentInvocation as y, createAgentInvocationSchema as z };
816
+ export { getUnnamedAgentConversationId as $, markAgentInvocationPaused as A, AGENT_TYPES as B, isTerminalAgentInvocation as C, listPendingAgentInvocationResults as D, listPendingAgentInvocationMailboxAppends as E, CHILD_AGENT_RESULTS as F, getAgentInvocationIdForEvents as G, agentTypeStartsWithParentHistory as H, PARENT_AGENT_TARGET as I, getAgentInvocationMessageId as J, getAgentInvocationIdForMessage as K, agentBindingSchema as L, markAgentInvocationSteered as M, reportReplacedAgentInvocation as N, markAgentInvocationMailboxAppended as O, CHILD_AGENT_KINDS as P, getNamedAgentConversationId as Q, agentNameSchema as R, invocationFromRow as S, listOpenAgentInvocations as T, formatAgentTypes as U, agentTypeInstructions as V, getAgentInvocationId as W, getAgentInvocationTurnId as X, getAgentInvocationResultMessageId as Y, getChildAgentLockName as Z, completeAgentInvocation as _, persistAuthPauseTurnState as a, getConversationTurnBoundaryError as at, getChildAgentLabel as b, getTurnUserSlackMessageTs as c, isTurnInputDeferredError as ct, loadThreadContextTrimFloor as d, markTurnFailed as dt, parseAgentInvocationResultMessageId as et, ConversationTurnLifecycleService as f, startActiveTurn as ft, NON_TERMINAL_AGENT_INVOCATION_STATUSES as g, ACTIVE_AGENT_INVOCATION_STATUSES as h, completeAuthPauseTurn as i, TurnInputDeferredError as it, markAgentInvocationRunning as j, markAgentInvocationParentMailboxAppended as k, buildDeliveredTurnStatePatch as l, markTurnClosed as lt, loadPendingMessageCards as m, buildDeterministicTurnId as mt, getAgentTurnDiagnosticsAttributes as n, CooperativeTurnYieldError as nt, getTurnUserMessage as o, isCooperativeTurnYieldError as ot, getTurnLifecycle as p, buildDeterministicAssistantMessageId as pt, getAgentInvocationIdForResult as q, requireTurnFailureEventId as r, TurnInputCommitLostError as rt, getTurnUserReplyAttachmentContext as s, isTurnInputCommitLostError as st, finalizeFailedTurnReplyWithEvent as t, ConversationTurnBoundaryError as tt, buildTurnThreadContext as u, markTurnCompleted as ut, getActiveAgentInvocationForConversation as v, listAgentInvocationsForConversation as w, getLatestAgentInvocationForConversation as x, getAgentInvocation as y, createAgentInvocationSchema as z };
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BCIuBe4d.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNK4uJVZ.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.287.0";
2
+ var version = "0.289.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-DBvhk1X9.js";
1
+ export { t as JUNIOR_VERSION } from "./version-Db0MFy61.js";
@@ -1,7 +1,7 @@
1
- import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-BO5zU6Mt.js";
2
- import { E as findActorIdentityId, o as getDb } from "./db-DJ11eZqq.js";
3
- import { M as juniorUsers, j as juniorIdentities } from "./executor-BY9TB31g.js";
4
- import { r as detectImageMediaType } from "./media-Cz1ZiV1U.js";
1
+ import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-CtCJmt9p.js";
2
+ import { E as findActorIdentityId, o as getDb } from "./db-BS2Kql3j.js";
3
+ import { M as juniorUsers, j as juniorIdentities } from "./executor-cc4nH86C.js";
4
+ import { r as detectImageMediaType } from "./media-BepyEUNm.js";
5
5
  import { a as withLock } from "./locks-D-0h111u.js";
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  import { and, asc, eq, inArray, isNotNull } from "drizzle-orm";