@sentry/junior 0.270.0 → 0.272.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 (75) hide show
  1. package/dist/{actor-CP9K2Idu.js → actor-B4DYygOB.js} +1 -1
  2. package/dist/{adapter-BQNTKVTF.js → adapter-BDYDi1F9.js} +1 -1
  3. package/dist/{admin-CKVEoXa4.js → admin-Dj7EFycG.js} +1 -1
  4. package/dist/{agent-runner-MSQSMFkq.js → agent-runner-Cl6Usx2Y.js} +336 -280
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +81 -37
  9. package/dist/{app-Bz8t4P8p.d.ts → app-DjZblE2J.d.ts} +8 -2
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +74 -40
  12. package/dist/{interruption-marker-CdblrIQK.js → assistant-reply-DN2w6JL_.js} +2 -8
  13. package/dist/{automation-Dwh_xcqM.js → automation-CV7g5h3A.js} +1 -1
  14. package/dist/{briefs-DNFzFFVx.js → briefs-PysAqnjV.js} +4 -4
  15. package/dist/{catalog-runtime-Bdym_wKy.js → catalog-runtime-BNeCWIaF.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/{client-B2MjENki.js → client-FRphcDWW.js} +2 -2
  24. package/dist/{config-Dm3pWRqY.js → config-BUP9wjiR.js} +3 -3
  25. package/dist/{connections-0BBhiD-p.js → connections-CesHau9u.js} +10 -10
  26. package/dist/{conversation-AhOVzN_k.js → conversation-BtQzLoK8.js} +12 -1
  27. package/dist/{conversation-privacy-C1pJ89rs.js → conversation-privacy-DiGvA9a3.js} +1 -1
  28. package/dist/{credential-sync-BRiWYs6_.js → credential-sync-D2odJC30.js} +15 -15
  29. package/dist/{credentialed-BeBaJMZ_.js → credentialed-CgTulRDH.js} +33 -26
  30. package/dist/{db-BYOuu6v2.d.ts → db-BPLmOwXf.d.ts} +11 -1
  31. package/dist/{executor-BB6eJkD4.js → executor-DGDpyegI.js} +30 -7
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{job-queue-DiaXoSDg.js → job-queue-CjB97sii.js} +2 -2
  34. package/dist/{list-BTDRxkOg.js → list-JZUP1yog.js} +37 -53
  35. package/dist/{logging-C6EdT6PP.js → logging-CjkDr-jP.js} +1 -1
  36. package/dist/message-D9y8PKA1.js +186 -0
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +3 -3
  39. package/dist/{oauth-callback-server-CjFFVGqa.js → oauth-callback-server-02Pej6hj.js} +2 -2
  40. package/dist/{prompt-BPSdXYXV.js → prompt-vfceH0c-.js} +1 -1
  41. package/dist/{registry-CndmkP2P.js → registry-7XgwNgQe.js} +2 -2
  42. package/dist/{reporting-window-DRCi1Ls_.js → reporting-window-DgHgwQB3.js} +6 -1
  43. package/dist/{resolve-BkAA1wH7.js → resolve-CuuxNfWG.js} +3 -3
  44. package/dist/{result-9TJTpuYP.js → result-BRhb6iN1.js} +17 -13
  45. package/dist/{runner-BmKLSyJm.js → runner-DaWCofuS.js} +11 -11
  46. package/dist/{sandbox-egress-signals-CjLaogMo.js → sandbox-egress-signals-Bn6FA1UC.js} +1 -1
  47. package/dist/{schema-WayPSHFu.d.ts → schema-CNjAzYOw.d.ts} +28 -5
  48. package/dist/{schema-DNLJ_MzW.js → schema-D5VLF4NT.js} +13 -9
  49. package/dist/{service-account-DlhYl-Mu.js → service-account-D9vrsi8d.js} +3 -3
  50. package/dist/{service-account-D6e9cVmH.js → service-account-H45LIAG2.js} +3 -3
  51. package/dist/{session-stop-MZRgYqYH.js → session-stop-HKl0ECX0.js} +81 -153
  52. package/dist/{skills-BggTR_ue.js → skills-CsiKu3-g.js} +2 -2
  53. package/dist/{spawn-DmtlcAT_.js → spawn-DqjBxqWh.js} +2 -2
  54. package/dist/{store-BeWGgaMA.js → store-CPF2kzbu.js} +3 -3
  55. package/dist/{store-Byarin7b.js → store-DyVKH0QB.js} +47 -30
  56. package/dist/{task-queue-Dt1_ZoI_.js → task-queue-BbQXCcNX.js} +3 -3
  57. package/dist/{task-runner-DyKqAPpm.js → task-runner-ChzW5E7R.js} +7 -7
  58. package/dist/{thread-state-BHBLMvgb.js → thread-state-Ds8JTsX6.js} +5 -5
  59. package/dist/{turn-failure-response-DWXy_0oJ.js → turn-failure-response-DCMvjsA0.js} +15 -10
  60. package/dist/{turn-lifecycle-AiXkVqCB.js → turn-lifecycle-DM_77q33.js} +1 -1
  61. package/dist/{turn-session-routing-B9KLBhaT.js → turn-session-routing-BV_gX7n3.js} +13 -13
  62. package/dist/{validation-BW60Vtx_.js → validation-DcGelbBi.js} +1 -1
  63. package/dist/{version-CivPYmkH.js → version-C48azPKq.js} +1 -1
  64. package/dist/version.js +1 -1
  65. package/dist/{viewer-BTgAfdUg.js → viewer-BCRuO8Wg.js} +26 -10
  66. package/dist/{work-Bjm52fHo.js → work-zxkmbJAp.js} +27 -11
  67. package/dist/{worker-CMbgtHLu.js → worker-CNNxHF1V.js} +6 -6
  68. package/migrations/0071_review_item_turn.sql +1 -0
  69. package/migrations/0072_conversation_read_positions.sql +10 -0
  70. package/migrations/meta/0071_snapshot.json +4003 -0
  71. package/migrations/meta/0072_snapshot.json +4064 -0
  72. package/migrations/meta/_journal.json +14 -0
  73. package/package.json +4 -4
  74. package/dist/message-DsjiWRVg.js +0 -59
  75. package/migrations/AGENTS.md +0 -17
@@ -1,5 +1,5 @@
1
1
  import { a as resolveLocalScheduleAtMs, i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
2
- import { n as actorIdentitySchema } from "./conversation-AhOVzN_k.js";
2
+ import { n as actorIdentitySchema } from "./conversation-BtQzLoK8.js";
3
3
  import { z } from "zod";
4
4
  import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
5
5
  // src/chat/scheduled-automations/schedule-intent.ts
@@ -1,7 +1,7 @@
1
- import { i as completeObject } from "./client-B2MjENki.js";
1
+ import { i as completeObject } from "./client-FRphcDWW.js";
2
2
  import { i as defaultModelId } from "./model-profile-B998sjVd.js";
3
- import { G as briefCodeChangeSchema, Y as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-AhOVzN_k.js";
4
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BPSdXYXV.js";
3
+ import { K as briefCodeChangeSchema, X as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-BtQzLoK8.js";
4
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-vfceH0c-.js";
5
5
  import { CLI_USAGE } from "./cli/run.js";
6
6
  import path from "node:path";
7
7
  import { z } from "zod";
@@ -267,7 +267,7 @@ async function parseRunOptions(argv) {
267
267
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
268
268
  */
269
269
  async function configuredDefaultModelId() {
270
- const { botConfig } = await import("./config-Dm3pWRqY.js").then((n) => n.r);
270
+ const { botConfig } = await import("./config-BUP9wjiR.js").then((n) => n.r);
271
271
  return defaultModelId(botConfig);
272
272
  }
273
273
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-CndmkP2P.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-7XgwNgQe.js";
3
3
  // 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-MSQSMFkq.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-Cl6Usx2Y.js";
2
2
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
99
99
  async function configureLocalChatPlugins(pluginSet) {
100
100
  const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
101
101
  import("../plugins-DOm9Y6qI.js").then((n) => n.o),
102
- import("../credentialed-BeBaJMZ_.js").then((n) => n.a),
103
- import("../catalog-runtime-Bdym_wKy.js").then((n) => n.t),
104
- import("../validation-BW60Vtx_.js").then((n) => n.r),
105
- import("../viewer-BTgAfdUg.js").then((n) => n.v)
102
+ import("../credentialed-CgTulRDH.js").then((n) => n.a),
103
+ import("../catalog-runtime-BNeCWIaF.js").then((n) => n.t),
104
+ import("../validation-DcGelbBi.js").then((n) => n.r),
105
+ import("../viewer-BCRuO8Wg.js").then((n) => n.v)
106
106
  ]);
107
107
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
108
108
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -152,18 +152,18 @@ function localDevServerUrl() {
152
152
  async function prepareLocalChatRun(io, pluginSet) {
153
153
  defaultStateAdapterForLocalChat();
154
154
  await configureLocalChatPlugins(pluginSet);
155
- const { setBriefsConfig } = await import("../credentialed-BeBaJMZ_.js").then((n) => n._);
155
+ const { setBriefsConfig } = await import("../credentialed-CgTulRDH.js").then((n) => n._);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-BmKLSyJm.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CjFFVGqa.js");
157
+ const { runLocalAgentTurn } = await import("../runner-DaWCofuS.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-02Pej6hj.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-CTygMkNx.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CjLaogMo.js");
161
- const { bindSpawnAgent } = await import("../spawn-DmtlcAT_.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-DsjiWRVg.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-9TJTpuYP.js").then((n) => n.i);
164
- const { skipInputBeforeConversationStop } = await import("../session-stop-MZRgYqYH.js").then((n) => n.r);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-Bn6FA1UC.js");
161
+ const { bindSpawnAgent } = await import("../spawn-DqjBxqWh.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-D9y8PKA1.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-BRhb6iN1.js").then((n) => n.i);
164
+ const { skipInputBeforeConversationStop } = await import("../session-stop-HKl0ECX0.js").then((n) => n.r);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-CMbgtHLu.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-CNNxHF1V.js").then((n) => n.n);
167
167
  let agentRunner;
168
168
  const localConversationWork = createLocalConversationWork(async (message) => {
169
169
  if (!agentRunner) throw new Error("Local agent runner is not ready");
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-C6EdT6PP.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-CndmkP2P.js";
3
- import { i as parseSkillFile } from "../skills-BggTR_ue.js";
1
+ import { D as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, P as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, k as JUNIOR_HEARTBEAT_ROUTE } from "../logging-CjkDr-jP.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-7XgwNgQe.js";
3
+ import { i as parseSkillFile } from "../skills-CsiKu3-g.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,13 +25,13 @@ 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-CKVEoXa4.js")).runAdmin(argv);
28
+ return await (await import("../admin-Dj7EFycG.js")).runAdmin(argv);
29
29
  }
30
30
  async function runServiceAccount(argv) {
31
- return await (await import("../service-account-DlhYl-Mu.js")).runServiceAccount(argv);
31
+ return await (await import("../service-account-D9vrsi8d.js")).runServiceAccount(argv);
32
32
  }
33
33
  async function runBriefs(argv) {
34
- return await (await import("../briefs-DNFzFFVx.js")).runBriefs(argv);
34
+ return await (await import("../briefs-PysAqnjV.js")).runBriefs(argv);
35
35
  }
36
36
  function topLevelCommand(argv) {
37
37
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,7 +1,7 @@
1
- import { S as getDb } from "../viewer-BTgAfdUg.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Bdym_wKy.js";
3
- import { ar as createPluginLogger, h as validatePlugins, m as setPlugins } from "../credentialed-BeBaJMZ_.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BW60Vtx_.js";
1
+ import { S as getDb } from "../viewer-BCRuO8Wg.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-BNeCWIaF.js";
3
+ import { ar as createPluginLogger, h as validatePlugins, m as setPlugins } from "../credentialed-CgTulRDH.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DcGelbBi.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-DOm9Y6qI.js";
6
6
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
7
7
  import { stderr, stdout } from "node:process";
@@ -1,7 +1,7 @@
1
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Bdym_wKy.js";
2
- import { nt as create } from "../credentialed-BeBaJMZ_.js";
3
- import { t as disconnectStateAdapter } from "../adapter-BQNTKVTF.js";
4
- import { n as resolve } from "../resolve-BkAA1wH7.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-BNeCWIaF.js";
2
+ import { nt as create } from "../credentialed-CgTulRDH.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-BDYDi1F9.js";
4
+ import { n as resolve } from "../resolve-CuuxNfWG.js";
5
5
  // src/cli/snapshot-create.ts
6
6
  const DEFAULT_RUNTIME = "node22";
7
7
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,4 +1,4 @@
1
- import "../db-BYOuu6v2.js";
1
+ import "../db-BPLmOwXf.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-B_0Cr0MO.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-Dm3pWRqY.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-BB6eJkD4.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-CndmkP2P.js";
1
+ import { i as getChatConfig } from "../config-BUP9wjiR.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-DGDpyegI.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-7XgwNgQe.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-DOm9Y6qI.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-C6EdT6PP.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-C1pJ89rs.js";
1
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-CjkDr-jP.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DiGvA9a3.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-nwUcYXjP.js";
2
- import { S as toOptionalTrimmed, s as resolveGatewayModel } from "./client-B2MjENki.js";
3
- import { h as logWarn } from "./logging-C6EdT6PP.js";
2
+ import { S as toOptionalTrimmed, s as resolveGatewayModel } from "./client-FRphcDWW.js";
3
+ import { h as logWarn } from "./logging-CjkDr-jP.js";
4
4
  import { c as modelProfileSchema, d as parseTurnReasoningLevel, t as DEFAULT_MODEL_PROFILES, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
5
5
  import { AwsClient } from "aws4fetch";
6
6
  // src/chat/attachments/s3.ts
@@ -264,7 +264,7 @@ const DEFAULT_HANDOFF_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.hand
264
264
  const DEFAULT_WEB_SEARCH_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
265
265
  const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
266
266
  const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
267
- const DEFAULT_IMAGE_GENERATION_MODEL_ID = "google/gemini-3-pro-image";
267
+ const DEFAULT_IMAGE_GENERATION_MODEL_ID = "openai/gpt-image-2";
268
268
  const DEFAULT_VISION_MODEL_ID = resolveGatewayModel("openai/gpt-5.6-sol").id;
269
269
  function validateGatewayModelId(raw) {
270
270
  const trimmed = toOptionalTrimmed(raw);
@@ -1,13 +1,13 @@
1
- import { Cn as loadTurnCheckpoint, Dn as failTurnRecord, On as getTurnRecord, n as resolveTurnSessionRouting } from "./turn-session-routing-B9KLBhaT.js";
2
- import { n as botConfig } from "./config-Dm3pWRqY.js";
3
- import { C as getSqlExecutor, F as deleteProviderIdentityForUser, P as deleteProviderIdentityForSlackUser, y as getConversationEventStore } from "./viewer-BTgAfdUg.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-CndmkP2P.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
6
- import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-MSQSMFkq.js";
7
- import { pt as startOAuthFlow } from "./credentialed-BeBaJMZ_.js";
8
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
9
- import { a as getVercelConversationWorkQueue } from "./job-queue-DiaXoSDg.js";
10
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-BeWGgaMA.js";
1
+ import { Cn as loadTurnCheckpoint, Dn as failTurnRecord, On as getTurnRecord, n as resolveTurnSessionRouting } from "./turn-session-routing-BV_gX7n3.js";
2
+ import { n as botConfig } from "./config-BUP9wjiR.js";
3
+ import { C as getSqlExecutor, F as deleteProviderIdentityForUser, P as deleteProviderIdentityForSlackUser, y as getConversationEventStore } from "./viewer-BCRuO8Wg.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-7XgwNgQe.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
6
+ import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-Cl6Usx2Y.js";
7
+ import { pt as startOAuthFlow } from "./credentialed-CgTulRDH.js";
8
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
9
+ import { a as getVercelConversationWorkQueue } from "./job-queue-CjB97sii.js";
10
+ import { m as ensureConversationWake, w as requestConversationWork } from "./store-CPF2kzbu.js";
11
11
  import { z } from "zod";
12
12
  import { randomBytes, randomUUID } from "node:crypto";
13
13
  // src/chat/task-execution/authorized-turn.ts
@@ -230,6 +230,15 @@ function annotationCard(annotation) {
230
230
  title: value.label
231
231
  };
232
232
  }
233
+ // src/api/schema/conversation-read-position.ts
234
+ /**
235
+ * How far the signed-in viewer has read a Conversation transcript.
236
+ *
237
+ * `lastReadSeq` is the event sequence of the last transcript row the viewer
238
+ * saw. The server keeps the highest value it receives, so it only moves
239
+ * forward.
240
+ */
241
+ const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().nonnegative() }).strict();
233
242
  // src/api/schema/child-agent-totals.ts
234
243
  /**
235
244
  * The part of a Conversation total that its child agents spent, at any depth.
@@ -815,6 +824,8 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
815
824
  agentTree: z.array(conversationAgentTreeNodeSchema).min(2).optional(),
816
825
  /** The viewer can fork this conversation from an assistant reply. */
817
826
  canFork: z.boolean().optional(),
827
+ /** How far the signed-in viewer has read. Absent until they read. */
828
+ readPosition: conversationReadPositionSchema.optional(),
818
829
  forkedFromConversationId: z.string().optional(),
819
830
  /** Title of the fork source, when the viewer can open it. */
820
831
  forkedFromTitle: z.string().optional(),
@@ -845,4 +856,4 @@ const conversationFeedSchema = z.object({
845
856
  source: z.literal("conversation_index"),
846
857
  generatedAt: z.string()
847
858
  }).strict();
848
- export { createConversationMessageBodySchema as A, removedCardSchema as B, conversationReportEventSchema as C, conversationSurfaceSchema as D, conversationSummaryReportSchema as E, conversationChildAgentTotalsSchema as F, briefCodeChangeSchema as G, MAX_INPUT_IMAGES as H, annotationCard as I, conversationBriefSchema as J, briefLinkSchema as K, messageCardRef as L, forkConversationResponseSchema as M, steerConversationPendingMessagesBodySchema as N, conversationUsageSchema as O, steerConversationPendingMessagesResponseSchema as P, messageCardText as R, conversationReportEventDataSchema as S, conversationReportStatusSchema as T, MAX_INPUT_IMAGE_BYTES as U, resolveMessageCards as V, readMessageAttachments as W, parseBriefInput 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, forkConversationBodySchema as j, createConversationBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, briefOutcomeStatusSchema as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationReportMessageEventSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, readMessageCardRefs as z };
859
+ export { createConversationMessageBodySchema as A, readMessageCardRefs as B, conversationReportEventSchema as C, conversationSurfaceSchema as D, conversationSummaryReportSchema as E, conversationChildAgentTotalsSchema as F, readMessageAttachments as G, resolveMessageCards as H, conversationReadPositionSchema as I, briefOutcomeStatusSchema as J, briefCodeChangeSchema as K, annotationCard as L, forkConversationResponseSchema as M, steerConversationPendingMessagesBodySchema as N, conversationUsageSchema as O, steerConversationPendingMessagesResponseSchema as P, messageCardRef as R, conversationReportEventDataSchema as S, conversationReportStatusSchema as T, MAX_INPUT_IMAGES as U, removedCardSchema as V, MAX_INPUT_IMAGE_BYTES as W, parseBriefInput as X, conversationBriefSchema 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, forkConversationBodySchema as j, createConversationBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, briefLinkSchema as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationReportMessageEventSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, messageCardText as z };
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-C6EdT6PP.js";
1
+ import { h as logWarn } from "./logging-CjkDr-jP.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,20 +1,20 @@
1
- import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, On as getTurnRecord, bn as getConversationPendingAuth } from "./turn-session-routing-B9KLBhaT.js";
2
- import { p as escapeXml } from "./client-B2MjENki.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-Dm3pWRqY.js";
4
- import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-C6EdT6PP.js";
5
- import { p as parseSlackUserId } from "./actor-CP9K2Idu.js";
6
- import { B as upsertLinkedIdentity, C as getSqlExecutor, I as findUserByVerifiedEmails, M as resolveActorIdentityId, o as readIdentityById } from "./viewer-BTgAfdUg.js";
1
+ import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, On as getTurnRecord, bn as getConversationPendingAuth } from "./turn-session-routing-BV_gX7n3.js";
2
+ import { p as escapeXml } from "./client-FRphcDWW.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-BUP9wjiR.js";
4
+ import { R as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CjkDr-jP.js";
5
+ import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
6
+ import { B as upsertLinkedIdentity, C as getSqlExecutor, I as findUserByVerifiedEmails, M as resolveActorIdentityId, o as readIdentityById } from "./viewer-BCRuO8Wg.js";
7
7
  import { i as homeDir } from "./package-discovery-DJBompdd.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CndmkP2P.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
10
- import { t as discoverSkills } from "./skills-BggTR_ue.js";
11
- import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-MSQSMFkq.js";
12
- import { Dn as getSlackClient, Et as postSlackMessage, dt as parseOAuthStatePayload, ft as resolveBaseUrl, i as resolvePluginOAuthAccount, n as createUserTokenStore, ut as formatProviderLabel } from "./credentialed-BeBaJMZ_.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-7XgwNgQe.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
10
+ import { t as discoverSkills } from "./skills-CsiKu3-g.js";
11
+ import { a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, v as lookupSlackUserProfile } from "./agent-runner-Cl6Usx2Y.js";
12
+ import { Dn as getSlackClient, Et as postSlackMessage, dt as parseOAuthStatePayload, ft as resolveBaseUrl, i as resolvePluginOAuthAccount, n as createUserTokenStore, ut as formatProviderLabel } from "./credentialed-CgTulRDH.js";
13
13
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
14
- import { r as getStateAdapter } from "./adapter-BQNTKVTF.js";
15
- import { _ as getMcpProviderErrorAttributes } from "./service-account-D6e9cVmH.js";
16
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BHBLMvgb.js";
17
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-0BBhiD-p.js";
14
+ import { r as getStateAdapter } from "./adapter-BDYDi1F9.js";
15
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-H45LIAG2.js";
16
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Ds8JTsX6.js";
17
+ import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-CesHau9u.js";
18
18
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CTygMkNx.js";
19
19
  import path from "node:path";
20
20
  import { z } from "zod";
@@ -1,27 +1,27 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { S as toOptionalTrimmed, i as completeObject, o as embedTexts, t as GEN_AI_PROVIDER_NAME } from "./client-B2MjENki.js";
3
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-Dm3pWRqY.js";
4
- import { B as isRecord$2, E as withSpan, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-C6EdT6PP.js";
2
+ import { S as toOptionalTrimmed, i as completeObject, o as embedTexts, t as GEN_AI_PROVIDER_NAME } from "./client-FRphcDWW.js";
3
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-BUP9wjiR.js";
4
+ import { B as isRecord$2, E as withSpan, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-CjkDr-jP.js";
5
5
  import { a as getClient$1, n as captureMessage, r as continueTrace } from "./sentry-MDkYAVPV.js";
6
- import { t as canExposeConversationPayload } from "./conversation-privacy-C1pJ89rs.js";
6
+ import { t as canExposeConversationPayload } from "./conversation-privacy-DiGvA9a3.js";
7
7
  import { i as defaultModelId } from "./model-profile-B998sjVd.js";
8
- import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, i as isActorUserId, m as parseSlackMessageTs, p as parseSlackUserId, s as parseActorUserId } from "./actor-CP9K2Idu.js";
9
- import { C as getSqlExecutor, D as createSqlStore, L as readUserTimezone, S as getDb, X as parseDestination, g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, q as hasAgentTurnUsage, s as readIdentityByIdFromSql, y as getConversationEventStore, z as saveUserTimezone } from "./viewer-BTgAfdUg.js";
8
+ import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, p as parseSlackUserId, s as parseActorUserId } from "./actor-B4DYygOB.js";
9
+ import { C as getSqlExecutor, D as createSqlStore, L as readUserTimezone, S as getDb, X as parseDestination, g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, q as hasAgentTurnUsage, s as readIdentityByIdFromSql, y as getConversationEventStore, z as saveUserTimezone } from "./viewer-BCRuO8Wg.js";
10
10
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
11
- import { C as juniorCodeRepositories, S as juniorCodeChanges, a as juniorReviewItemAssignees, c as juniorReviewItems, d as juniorAutomations, g as juniorConversationBriefs, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, o as juniorReviewItemConversations, r as juniorWorkspaceRepos, w as juniorAttachments, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-BB6eJkD4.js";
11
+ import { C as juniorCodeChanges, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, a as juniorReviewItemAssignees, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, h as juniorConversationParticipants, i as juniorWorkspaces, n as juniorSnapshots, o as juniorReviewItemConversations, r as juniorWorkspaceRepos, w as juniorCodeRepositories } from "./executor-DGDpyegI.js";
12
12
  import { l as decodeStoredConversationEvent } from "./media-U6Tuz6Mi.js";
13
- import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-CndmkP2P.js";
14
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bdym_wKy.js";
13
+ import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-7XgwNgQe.js";
14
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
15
15
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
16
- import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-BQNTKVTF.js";
16
+ import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-BDYDi1F9.js";
17
17
  import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
18
- import { C as conversationReportEventSchema, J as conversationBriefSchema, W as readMessageAttachments, Y as parseBriefInput, w as conversationReportMessageEventSchema, z as readMessageCardRefs } from "./conversation-AhOVzN_k.js";
19
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BPSdXYXV.js";
18
+ import { B as readMessageCardRefs, C as conversationReportEventSchema, G as readMessageAttachments, X as parseBriefInput, Y as conversationBriefSchema, w as conversationReportMessageEventSchema } from "./conversation-BtQzLoK8.js";
19
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-vfceH0c-.js";
20
20
  import path from "node:path";
21
21
  import { AsyncLocalStorage } from "node:async_hooks";
22
22
  import { z } from "zod";
23
23
  import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
24
- import { and, arrayContains, asc, count, desc, eq, exists, getTableColumns, gte, ilike, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
24
+ import { and, arrayContains, asc, count, desc, eq, exists, getTableColumns, gt, gte, ilike, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
25
25
  import { EgressAuthRequired, EgressPolicyDenied, actorSchema, codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, eventDataSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginEventsSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
26
26
  import { alias, union } from "drizzle-orm/pg-core";
27
27
  import fs from "node:fs/promises";
@@ -7757,6 +7757,7 @@ async function hydrate(db, rows) {
7757
7757
  updatedAt: row.updatedAt,
7758
7758
  visibility: row.visibility,
7759
7759
  ...row.answer ? { answer: row.answer } : void 0,
7760
+ ...row.addedByTurnId ? { addedByTurnId: row.addedByTurnId } : void 0,
7760
7761
  ...row.automationId ? { automationId: row.automationId } : void 0,
7761
7762
  ...row.closeReason ? { closeReason: row.closeReason } : void 0,
7762
7763
  ...row.closedAt ? { closedAt: row.closedAt } : void 0,
@@ -7829,6 +7830,7 @@ async function insertReviewItem(db, input) {
7829
7830
  const inserted = await tx.insert(juniorReviewItems).values({
7830
7831
  ...contentColumns(input),
7831
7832
  addedByConversationId: input.addedByConversationId,
7833
+ addedByTurnId: input.addedByTurnId ?? null,
7832
7834
  automationId: input.automationId ?? null,
7833
7835
  createdAt: now,
7834
7836
  dedupeKey: input.dedupeKey,
@@ -7847,12 +7849,17 @@ async function insertReviewItem(db, input) {
7847
7849
  if (!item) throw new Error(`Review item ${id} is missing after insert`);
7848
7850
  return item;
7849
7851
  }
7850
- /** Replace the content of one open Review item. Return false when closed. */
7852
+ /**
7853
+ * Replace the content of one open Review item. Return false when closed.
7854
+ * `addedByTurnId` moves the Turn pointer to the Turn that added the item
7855
+ * again; omit it to keep the stored Turn.
7856
+ */
7851
7857
  async function updateReviewItemContent(db, input) {
7852
7858
  return await db.transaction(async (tx) => {
7853
7859
  if (!(await tx.update(juniorReviewItems).set({
7854
7860
  ...contentColumns(input),
7855
- updatedAt: new Date(input.nowMs)
7861
+ updatedAt: new Date(input.nowMs),
7862
+ ...input.addedByTurnId ? { addedByTurnId: input.addedByTurnId } : void 0
7856
7863
  }).where(and(eq(juniorReviewItems.id, input.id), eq(juniorReviewItems.status, "open"))).returning({ id: juniorReviewItems.id }))[0]) return false;
7857
7864
  await replaceLinks(tx, input.id, input);
7858
7865
  return true;
@@ -7911,7 +7918,7 @@ async function takeReviewItem(db, input) {
7911
7918
  }
7912
7919
  function searchConditions(reader, filters) {
7913
7920
  const conditions = [reviewItemVisibleTo(reader), inArray(juniorReviewItems.status, [...filters.statuses])];
7914
- if (filters.after) conditions.push(or(lt(juniorReviewItems.updatedAt, filters.after.updatedAt), and(eq(juniorReviewItems.updatedAt, filters.after.updatedAt), lt(juniorReviewItems.id, filters.after.id))));
7921
+ if (filters.after) conditions.push(or(gt(juniorReviewItems.createdAt, filters.after.createdAt), and(eq(juniorReviewItems.createdAt, filters.after.createdAt), gt(juniorReviewItems.id, filters.after.id))));
7915
7922
  if (filters.subjectId) conditions.push(eq(juniorReviewItems.subjectId, filters.subjectId));
7916
7923
  if (filters.automationId) conditions.push(eq(juniorReviewItems.automationId, filters.automationId));
7917
7924
  if (filters.conversationId) conditions.push(reviewItemLinkedTo(filters.conversationId));
@@ -7929,11 +7936,12 @@ async function countReviewItemsNeedingUser(db, userId) {
7929
7936
  /**
7930
7937
  * Find the Review items that a reader can see. Open items come first, so
7931
7938
  * the limit never drops an open item for a closed one. Then the newest
7932
- * change comes first: `updated_at`, then `id`, both descending. `after`
7933
- * pages through that order.
7939
+ * change comes first: `updated_at`, then `id`, both descending. With
7940
+ * `order: "oldest"`, the oldest item comes first: `created_at`, then `id`,
7941
+ * both ascending. `after` pages through that order.
7934
7942
  */
7935
7943
  async function searchReviewItems(db, reader, filters) {
7936
- return await hydrate(db, await db.select().from(juniorReviewItems).where(and(...searchConditions(reader, filters))).orderBy(desc(eq(juniorReviewItems.status, "open")), desc(juniorReviewItems.updatedAt), desc(juniorReviewItems.id)).limit(filters.limit));
7944
+ return await hydrate(db, await db.select().from(juniorReviewItems).where(and(...searchConditions(reader, filters))).orderBy(desc(eq(juniorReviewItems.status, "open")), ...filters.order === "oldest" ? [asc(juniorReviewItems.createdAt), asc(juniorReviewItems.id)] : [desc(juniorReviewItems.updatedAt), desc(juniorReviewItems.id)]).limit(filters.limit));
7937
7945
  }
7938
7946
  /**
7939
7947
  * List the Conversations that wait on a User: each is linked to an open item
@@ -7944,17 +7952,16 @@ async function listWaitingConversationIds(db, userId) {
7944
7952
  }
7945
7953
  // src/chat/review-items/plugin.ts
7946
7954
  /**
7947
- * Resolve the Users to assign. An Identity without a User has no one to
7948
- * assign. A private item goes only to people in its Conversation, the same
7949
- * rule that `requireReviewItemAssignees` applies to agents.
7955
+ * Resolve the Users to assign. A plugin notice goes only to people in its
7956
+ * Conversation, public or private. Junior leaves out an Identity without a
7957
+ * User and a User who is not in the Conversation.
7950
7958
  */
7951
- async function assigneeUserIds(db, identityIds, conversationId, isPrivate) {
7959
+ async function assigneeUserIds(db, identityIds, conversationId) {
7952
7960
  const userIds = [];
7953
7961
  for (const identityId of new Set(identityIds)) {
7954
7962
  const user = (await readIdentityByIdFromSql(db, identityId))?.user;
7955
7963
  if (!user) continue;
7956
- if (isPrivate && !(await readConversationAccessFromSql(db, [conversationId], user)).get(conversationId)?.isParticipant) throw new Error("A private review item can be assigned only to people in its Conversation");
7957
- userIds.push(user.id);
7964
+ if ((await readConversationAccessFromSql(db, [conversationId], user)).get(conversationId)?.isParticipant) userIds.push(user.id);
7958
7965
  }
7959
7966
  return userIds;
7960
7967
  }
@@ -7982,7 +7989,7 @@ function createPluginReviewItems(args) {
7982
7989
  if (existing && isPrivate && existing.addedByConversationId !== conversationId) throw new Error("A private review item links only to the Conversation that added it");
7983
7990
  const content = {
7984
7991
  assignedToEveryone: false,
7985
- assigneeUserIds: await assigneeUserIds(db, notice.assigneeIdentityIds, conversationId, isPrivate),
7992
+ assigneeUserIds: await assigneeUserIds(db, notice.assigneeIdentityIds, conversationId),
7986
7993
  body: notice.body,
7987
7994
  conversationIds: [.../* @__PURE__ */ new Set([conversationId, ...existing?.conversationIds ?? []])],
7988
7995
  kind: "notice",
@@ -1,4 +1,4 @@
1
- import "./schema-WayPSHFu.js";
1
+ import "./schema-CNjAzYOw.js";
2
2
  import { z } from "zod";
3
3
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
4
4
  import "drizzle-orm/pg-core";
@@ -149,6 +149,16 @@ interface ConversationStore {
149
149
  providerDestinationId: string;
150
150
  providerTenantId?: string;
151
151
  }): Promise<ConversationPrivacy | undefined>;
152
+ /**
153
+ * Store live visibility for a Destination that has no Conversation yet,
154
+ * such as a channel that an Automation moves to.
155
+ */
156
+ recordDestinationVisibility(args: {
157
+ channelName?: string;
158
+ destination: Destination;
159
+ nowMs?: number;
160
+ visibility: ConversationPrivacy;
161
+ }): Promise<void>;
152
162
  /**
153
163
  * Resolve one Slack channel id from a known destination display name.
154
164
  *
@@ -1,5 +1,5 @@
1
- import "./config-Dm3pWRqY.js";
2
- import { p as logException } from "./logging-C6EdT6PP.js";
1
+ import "./config-BUP9wjiR.js";
2
+ import { p as logException } from "./logging-CjkDr-jP.js";
3
3
  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-C1RNOCs8.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
@@ -239,8 +239,8 @@ const juniorConversationBindings = pgTable("junior_conversation_bindings", {
239
239
  // src/db/schema/conversation-participants.ts
240
240
  /**
241
241
  * Materialized personal-feed membership for one linked user on one root
242
- * conversation. Rows come from the root actor and from durable human user
243
- * message authors.
242
+ * conversation. Rows come from the root actor and from the authors of Turn
243
+ * input messages. Thread context authors do not get a row.
244
244
  */
245
245
  const juniorConversationParticipants = pgTable("junior_conversation_participants", {
246
246
  userId: text("user_id").notNull().references(() => juniorUsers.id),
@@ -255,6 +255,23 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
255
255
  index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
256
256
  index("junior_conversation_participants_root_idx").on(table.rootConversationId)
257
257
  ]);
258
+ // src/db/schema/conversation-read-positions.ts
259
+ /**
260
+ * How far one signed-in user has read one Conversation transcript.
261
+ *
262
+ * `last_read_seq` is the event sequence of the last transcript row the user
263
+ * saw. It only moves forward, so clients on several devices can write in any
264
+ * order.
265
+ */
266
+ const juniorConversationReadPositions = pgTable("junior_conversation_read_positions", {
267
+ userId: text("user_id").notNull().references(() => juniorUsers.id),
268
+ conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId),
269
+ lastReadSeq: integer("last_read_seq").notNull(),
270
+ updatedAt: timestamptz("updated_at").notNull()
271
+ }, (table) => [primaryKey({
272
+ name: "junior_conversation_read_positions_user_conversation_pk",
273
+ columns: [table.userId, table.conversationId]
274
+ })]);
258
275
  // src/db/schema/location-configurations.ts
259
276
  /** Durable user configuration entries scoped to provider Locations. */
260
277
  const juniorLocationConfigurations = pgTable("junior_location_configurations", {
@@ -384,8 +401,8 @@ const juniorAutomationRuns = pgTable("junior_automation_runs", {
384
401
  ]);
385
402
  // src/db/schema/review-items.ts
386
403
  /**
387
- * One Review item: something that needs a person. See
388
- * `chat/review-items/AGENTS.md`. An action item stores its `request`, and
404
+ * One Review item: something that needs a person. An action item stores its
405
+ * `request`, and
389
406
  * its `answer` after an assignee submits it. `closed_at` is set for `done`
390
407
  * and `dismissed`. `closed_by_user_id` is null when an agent closed it.
391
408
  */
@@ -410,6 +427,11 @@ const juniorReviewItems = pgTable("junior_review_items", {
410
427
  /** Conversation of the agent that added the item. */
411
428
  addedByConversationId: text("added_by_conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
412
429
  /**
430
+ * Turn of the agent that added the item, or that last added it again with
431
+ * its dedupe key. Null for a plugin item, which has no Turn.
432
+ */
433
+ addedByTurnId: text("added_by_turn_id"),
434
+ /**
413
435
  * Provider tenant, such as a Slack workspace, of the Conversation that
414
436
  * added the item. A public item is visible only inside it.
415
437
  */
@@ -521,6 +543,7 @@ const juniorSqlSchema = {
521
543
  juniorConversationBriefs,
522
544
  juniorConversationBindings,
523
545
  juniorConversationParticipants,
546
+ juniorConversationReadPositions,
524
547
  juniorConversations,
525
548
  juniorLocationConfigurations,
526
549
  juniorDestinations,
@@ -783,4 +806,4 @@ function createJuniorSqlExecutor(args) {
783
806
  statementTimeoutMs
784
807
  });
785
808
  }
786
- export { juniorCodeRepositories as C, juniorCodeChanges as S, juniorArtifacts as T, CONVERSATION_METRICS as _, juniorReviewItemAssignees as a, juniorApiTokens as b, juniorReviewItems as c, juniorAutomations as d, juniorStats as f, juniorConversationBriefs as g, juniorConversationBindings as h, juniorWorkspaces as i, juniorAutomationRuns as l, juniorConversationParticipants as m, juniorSnapshots as n, juniorReviewItemConversations as o, juniorLocationConfigurations as p, juniorWorkspaceRepos as r, juniorReviewItemSlackCards as s, createJuniorSqlExecutor as t, juniorAutomationVersions as u, juniorConversationMetrics as v, juniorAttachments as w, juniorConversationAnnotations as x, juniorConversationEvents as y };
809
+ export { juniorCodeChanges as C, juniorArtifacts as E, juniorConversationAnnotations as S, juniorAttachments as T, juniorConversationBriefs as _, juniorReviewItemAssignees as a, juniorConversationEvents as b, juniorReviewItems as c, juniorAutomations as d, juniorStats as f, juniorConversationBindings as g, juniorConversationParticipants as h, juniorWorkspaces as i, juniorAutomationRuns as l, juniorConversationReadPositions as m, juniorSnapshots as n, juniorReviewItemConversations as o, juniorLocationConfigurations as p, juniorWorkspaceRepos as r, juniorReviewItemSlackCards as s, createJuniorSqlExecutor as t, juniorAutomationVersions as u, CONVERSATION_METRICS as v, juniorCodeRepositories as w, juniorApiTokens as x, juniorConversationMetrics as y };
@@ -1,6 +1,6 @@
1
- import { F as getDeploymentServiceVersion, I as getDeploymentTelemetryAttributes } from "./logging-C6EdT6PP.js";
1
+ import { F as getDeploymentServiceVersion, I as getDeploymentTelemetryAttributes } from "./logging-CjkDr-jP.js";
2
2
  import { a as getClient, c as init, o as getGlobalScope } from "./sentry-MDkYAVPV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C1pJ89rs.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DiGvA9a3.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
5
5
  // src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-Dm3pWRqY.js";
2
- import { E as withSpan, m as logInfo, p as logException } from "./logging-C6EdT6PP.js";
1
+ import { i as getChatConfig } from "./config-BUP9wjiR.js";
2
+ import { E as withSpan, m as logInfo, p as logException } from "./logging-CjkDr-jP.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { z } from "zod";
5
5
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";