@sentry/junior 0.276.0 → 0.278.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 (80) hide show
  1. package/dist/{adapter-DoPR2jS-.js → adapter-BXosqTMx.js} +1 -1
  2. package/dist/{admin-BJTT-kXb.js → admin-Thn7NfOi.js} +1 -1
  3. package/dist/{agent-invocations-CUWrrzkc.js → agent-invocations-D7c4BQGc.js} +6 -2
  4. package/dist/{agent-runner-sMpA5qGM.js → agent-runner-DE-43MPb.js} +396 -877
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +13 -2
  8. package/dist/api.js +132 -61
  9. package/dist/{app-DTj-yAQt.d.ts → app-CHNS-AX2.d.ts} +6 -27
  10. package/dist/app.d.ts +3 -3
  11. package/dist/app.js +65 -57
  12. package/dist/{assistant-reply-DbxKnBQF.js → assistant-reply-pauL6qyn.js} +28 -6
  13. package/dist/{automation-B8_mC68r.js → automation-DphoTRYl.js} +1 -1
  14. package/dist/{background-compaction-queue-Bywqo1WJ.js → background-compaction-queue-CAL4A2y7.js} +2 -2
  15. package/dist/{briefs-IL7QnCCR.js → briefs-4fyPJJEu.js} +5 -6
  16. package/dist/{catalog-runtime--sC2CYLQ.js → catalog-runtime-BoOb5oUv.js} +1 -1
  17. package/dist/cli/chat.d.ts +1 -1
  18. package/dist/cli/chat.js +14 -14
  19. package/dist/cli/check.js +3 -3
  20. package/dist/cli/init.js +0 -2
  21. package/dist/cli/main.js +3 -3
  22. package/dist/cli/plugins.d.ts +1 -1
  23. package/dist/cli/plugins.js +4 -4
  24. package/dist/cli/snapshot-create.js +4 -4
  25. package/dist/cli/upgrade.d.ts +2 -2
  26. package/dist/cli/upgrade.js +3 -3
  27. package/dist/{client-7diKvInp.js → client-v_OVYuHZ.js} +3 -3
  28. package/dist/{config-Cb--cuv-.js → config-o2jLRY5J.js} +24 -99
  29. package/dist/{connections-C4-4fxaE.js → connections-RC4NXAx8.js} +10 -10
  30. package/dist/{conversation-DppJ83Hw.js → conversation-CZfyQvdm.js} +54 -109
  31. package/dist/{conversation-privacy-DTwdT3Pi.js → conversation-privacy-C23M8KaD.js} +1 -1
  32. package/dist/{credential-sync-Sl5RQCkS.js → credential-sync-Dd0WyNfF.js} +13 -13
  33. package/dist/{db-Ck6TXQIx.d.ts → db-BjLzDJCt.d.ts} +1 -1
  34. package/dist/{executor-BFKmqxYe.js → executor-CJfsD0VX.js} +13 -5
  35. package/dist/instrumentation.js +2 -2
  36. package/dist/{logging-B04X_eCB.js → logging-dFaXvBRK.js} +4 -2
  37. package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
  38. package/dist/{message-DQMFyyE-.js → message-DSwxIZet.js} +22 -28
  39. package/dist/nitro.d.ts +2 -2
  40. package/dist/nitro.js +7 -3
  41. package/dist/{oauth-callback-server-BGq0_vQI.js → oauth-callback-server-CDcuCp27.js} +2 -2
  42. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-DtmjkTza.d.ts} +1 -0
  43. package/dist/{projection-6dXaN0n-.js → projection-BTge9wrH.js} +5426 -5300
  44. package/dist/{prompt-B4fQKGZR.js → prompt-DDtCnlHP.js} +1 -1
  45. package/dist/{registry-CEqKR_ld.js → registry-Cp6CNmtP.js} +24 -8
  46. package/dist/{resolve-8I5DkrfI.js → resolve-B_7h2cXx.js} +3 -3
  47. package/dist/{result-BgAW90IM.js → result-5LBEfnLX.js} +9 -9
  48. package/dist/{runner-CSKDr_19.js → runner-C5-S4oq-.js} +11 -11
  49. package/dist/{sandbox-egress-signals-BxAT276e.js → sandbox-egress-signals-B4GehT1L.js} +1 -1
  50. package/dist/{schema-Cal-EFdi.js → schema-B5fpczDw.js} +82 -4
  51. package/dist/{schema-CaUWl2EV.d.ts → schema-Tr484cCC.d.ts} +935 -688
  52. package/dist/{service-account-CUuVJCKT.js → service-account-BkEv20zf.js} +3 -3
  53. package/dist/{service-account-CtOab1Xz.js → service-account-Cq_dLrZJ.js} +3 -3
  54. package/dist/{session-stop-DK8LuPZW.js → session-stop-BsS4qFS2.js} +26 -16
  55. package/dist/{skills-Bc0D7BGy.js → skills-M0BA0_s6.js} +2 -2
  56. package/dist/{spawn-DF_GUcd8.js → spawn-BO3y7H4d.js} +2 -3
  57. package/dist/{stop-DthSy-z8.js → stop-D5R82Wla.js} +612 -186
  58. package/dist/{store-C5uVTx2G.js → store-BGBzQWNf.js} +9 -16
  59. package/dist/{store-BgH2P3X9.js → store-CGJZTEVz.js} +3 -3
  60. package/dist/{task-queue-C6ROM_XJ.js → task-queue-UD27ei2U.js} +3 -3
  61. package/dist/{task-runner-BwAkjjVE.js → task-runner-noxjOjkM.js} +7 -7
  62. package/dist/{thread-state-BXjgk1pW.js → thread-state-BSu6rM6p.js} +4 -4
  63. package/dist/{turn-failure-response-CVI57qKL.js → turn-failure-response-wahwyPrZ.js} +7 -7
  64. package/dist/{turn-lifecycle-CF6ibonp.js → turn-lifecycle-Bo4Trccw.js} +1 -1
  65. package/dist/{turn-session-routing-DddybdNu.js → turn-session-routing-DnSaaEpn.js} +10 -10
  66. package/dist/{validation-BxF1nQbC.js → validation-B9-8iKyw.js} +1 -1
  67. package/dist/{version-CTzSbCmR.js → version-C7HejFP2.js} +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/{viewer-CQwBszc7.js → viewer-DLXajQZE.js} +94 -28
  70. package/dist/{work-BHlShEQ6.js → work-DRGSlfia.js} +12 -17
  71. package/dist/{worker-DhY9MnsH.js → worker-BGh5Dwc6.js} +6 -6
  72. package/migrations/0074_conversation_participant_pins.sql +1 -0
  73. package/migrations/0075_conversation_detail_version.sql +1 -0
  74. package/migrations/0076_conversation_auto_archive.sql +5 -0
  75. package/migrations/meta/0074_snapshot.json +4076 -0
  76. package/migrations/meta/0075_snapshot.json +4083 -0
  77. package/migrations/meta/0076_snapshot.json +4147 -0
  78. package/migrations/meta/_journal.json +21 -0
  79. package/package.json +5 -5
  80. package/dist/model-profile-B998sjVd.js +0 -67
@@ -1,8 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { C as toOptionalTrimmed, c as resolveGatewayModel } from "./client-7diKvInp.js";
3
- import { h as logWarn } from "./logging-B04X_eCB.js";
4
- import { c as modelProfileSchema, d as parseTurnReasoningLevel, t as DEFAULT_MODEL_PROFILES, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
2
+ import { C as toOptionalTrimmed, c as resolveGatewayModel } from "./client-v_OVYuHZ.js";
5
3
  import { AwsClient } from "aws4fetch";
4
+ import { z } from "zod";
6
5
  // src/chat/attachments/s3.ts
7
6
  function readRequiredSetting(env, name) {
8
7
  const value = toOptionalTrimmed(env[name]);
@@ -133,6 +132,22 @@ function normalizeSlackEmojiName(value) {
133
132
  const normalized = trimmed.startsWith(":") && trimmed.endsWith(":") ? trimmed.slice(1, -1) : trimmed;
134
133
  return SLACK_EMOJI_NAME_RE.test(normalized) ? normalized : null;
135
134
  }
135
+ // src/chat/reasoning-level.ts
136
+ const TURN_REASONING_LEVELS = [
137
+ "none",
138
+ "low",
139
+ "medium",
140
+ "high",
141
+ "xhigh"
142
+ ];
143
+ /** Validate a configured main-agent reasoning level. */
144
+ function parseTurnReasoningLevel(value) {
145
+ return z.enum(TURN_REASONING_LEVELS).parse(value);
146
+ }
147
+ /** Convert a reasoning level into the Pi Agent setting for a main Turn. */
148
+ function toPiReasoningLevel(level) {
149
+ return level === "none" ? "off" : level;
150
+ }
136
151
  // src/chat/config.ts
137
152
  var config_exports = /* @__PURE__ */ __exportAll({
138
153
  CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS: () => 40,
@@ -149,7 +164,6 @@ var config_exports = /* @__PURE__ */ __exportAll({
149
164
  resetRuntimeConfig: () => resetRuntimeConfig,
150
165
  restoreRuntimeConfig: () => restoreRuntimeConfig,
151
166
  setBotModelConfig: () => setBotModelConfig,
152
- setProfiles: () => setProfiles,
153
167
  setRuntimeLimits: () => setRuntimeLimits,
154
168
  setSlackReactionConfig: () => setSlackReactionConfig,
155
169
  snapshotRuntimeConfig: () => snapshotRuntimeConfig
@@ -251,10 +265,10 @@ function parseConversationWorkEnabled(rawValue) {
251
265
  if (value === "false") return false;
252
266
  throw new Error("JUNIOR_CONVERSATION_WORK_ENABLED must be true or false");
253
267
  }
254
- const DEFAULT_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.standard.modelId).id;
268
+ const DEFAULT_MODEL_ID = resolveGatewayModel("anthropic/claude-opus-5.5").id;
269
+ const DEFAULT_REASONING_LEVEL = "high";
255
270
  const DEFAULT_FAST_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
256
271
  const DEFAULT_GUARDIAN_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
257
- const DEFAULT_HANDOFF_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.handoff.modelId).id;
258
272
  const DEFAULT_WEB_SEARCH_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
259
273
  const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
260
274
  const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
@@ -275,73 +289,6 @@ function requireModelId(configName, raw, validate) {
275
289
  if (!modelId) throw new Error(`${configName} must not be empty`);
276
290
  return modelId;
277
291
  }
278
- function parseOptionalProfileDescription(rawDescription, configName, profile) {
279
- if (rawDescription === void 0) return;
280
- if (typeof rawDescription !== "string") throw new Error(`${configName}.${profile}.description must be a string when set`);
281
- const description = toOptionalTrimmed(rawDescription);
282
- if (!description) throw new Error(`${configName}.${profile}.description must not be empty when set`);
283
- return description;
284
- }
285
- function parseOptionalProfileReasoningLevel(rawReasoningLevel, configName, profile) {
286
- if (rawReasoningLevel === void 0) return;
287
- try {
288
- return parseTurnReasoningLevel(rawReasoningLevel);
289
- } catch {
290
- throw new Error(`${configName}.${profile}.reasoningLevel must be one of ${TURN_REASONING_LEVELS.join(", ")}`);
291
- }
292
- }
293
- function parseProfileConfig(rawProfile, configName, profile) {
294
- if (typeof rawProfile === "string") {
295
- const modelId = validateGatewayModelId(rawProfile);
296
- if (!modelId) throw new Error(`${configName}.${profile} must not be empty`);
297
- return { modelId };
298
- }
299
- if (!rawProfile || typeof rawProfile !== "object" || Array.isArray(rawProfile)) throw new Error(`${configName}.${profile} must be a model id string or an object with modelId`);
300
- const rawModelId = rawProfile.modelId;
301
- if (typeof rawModelId !== "string") throw new Error(`${configName}.${profile}.modelId must be a model id string`);
302
- const modelId = validateGatewayModelId(rawModelId);
303
- if (!modelId) throw new Error(`${configName}.${profile}.modelId must not be empty`);
304
- const description = parseOptionalProfileDescription(rawProfile.description, configName, profile);
305
- const reasoningLevel = parseOptionalProfileReasoningLevel(rawProfile.reasoningLevel, configName, profile);
306
- return {
307
- modelId,
308
- ...description ? { description } : void 0,
309
- ...reasoningLevel ? { reasoningLevel } : void 0
310
- };
311
- }
312
- function parseProfileMap(rawProfiles, configName) {
313
- if (!rawProfiles || typeof rawProfiles !== "object" || Array.isArray(rawProfiles)) throw new Error(`${configName} must be ${configName === "AI_MODEL_PROFILES" ? "a JSON object" : "an object"}`);
314
- const profiles = {};
315
- for (const [profile, rawProfile] of Object.entries(rawProfiles)) {
316
- if (!modelProfileSchema.safeParse(profile).success) throw new Error(`${configName} profile "${profile}" must match ^[a-z][a-z0-9_-]*$`);
317
- profiles[profile] = parseProfileConfig(rawProfile, configName, profile);
318
- }
319
- return profiles;
320
- }
321
- function parseProfiles(rawValue, standardModelId, handoffModelId) {
322
- const profiles = {
323
- standard: {
324
- ...DEFAULT_MODEL_PROFILES.standard,
325
- modelId: standardModelId
326
- },
327
- handoff: {
328
- ...DEFAULT_MODEL_PROFILES.handoff,
329
- modelId: handoffModelId
330
- }
331
- };
332
- const trimmed = toOptionalTrimmed(rawValue);
333
- if (trimmed === void 0) return profiles;
334
- let parsed;
335
- try {
336
- parsed = JSON.parse(trimmed);
337
- } catch {
338
- throw new Error("AI_MODEL_PROFILES must be a JSON object");
339
- }
340
- return {
341
- ...profiles,
342
- ...parseProfileMap(parsed, "AI_MODEL_PROFILES")
343
- };
344
- }
345
292
  function parseReactionEmoji(envName, rawValue, defaultEmoji) {
346
293
  const trimmed = toOptionalTrimmed(rawValue);
347
294
  if (trimmed === void 0) return defaultEmoji;
@@ -349,29 +296,17 @@ function parseReactionEmoji(envName, rawValue, defaultEmoji) {
349
296
  if (!normalized) throw new Error(`${envName} must be a valid Slack emoji name (for example "eyes" or ":white_check_mark:")`);
350
297
  return normalized;
351
298
  }
352
- function warnDeprecatedProfileEnv(env) {
353
- for (const envName of [
354
- "AI_MODEL",
355
- "AI_HANDOFF_MODEL",
356
- "AI_MODEL_PROFILES"
357
- ]) if (toOptionalTrimmed(env[envName]) !== void 0) logWarn("config.profile_env.deprecated", {
358
- "app.config.env_name": envName,
359
- "app.config.replacement": "createApp({ defaultProfile, profiles })"
360
- });
361
- }
362
299
  function readBotConfig(env, functionMaxDurationSeconds) {
363
300
  const maxTurnTimeoutMs = resolveMaxTurnTimeoutMs(functionMaxDurationSeconds);
364
301
  const modelId = validateGatewayModelId(env.AI_MODEL) ?? DEFAULT_MODEL_ID;
365
302
  const reasoningLevel = toOptionalTrimmed(env.AI_REASONING_LEVEL);
366
303
  const fastModelId = validateGatewayModelId(env.AI_FAST_MODEL ?? env.AI_MODEL) ?? DEFAULT_FAST_MODEL_ID;
367
304
  const guardianModelId = validateGatewayModelId(env.AI_GUARDIAN_MODEL) ?? DEFAULT_GUARDIAN_MODEL_ID;
368
- const handoffModelId = validateGatewayModelId(env.AI_HANDOFF_MODEL) ?? DEFAULT_HANDOFF_MODEL_ID;
369
305
  return {
370
306
  userName: toOptionalTrimmed(env.JUNIOR_BOT_NAME) ?? "junior",
371
- defaultProfile: "standard",
372
- profiles: parseProfiles(env.AI_MODEL_PROFILES, modelId, handoffModelId),
307
+ modelId,
373
308
  contextWindowTokens: parseOptionalPositiveInteger("AI_MODEL_CONTEXT_WINDOW_TOKENS", env.AI_MODEL_CONTEXT_WINDOW_TOKENS) ?? DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS,
374
- reasoningLevel: reasoningLevel === void 0 ? void 0 : parseTurnReasoningLevel(reasoningLevel),
309
+ reasoningLevel: reasoningLevel === void 0 ? DEFAULT_REASONING_LEVEL : parseTurnReasoningLevel(reasoningLevel),
375
310
  decisionModelId: toOptionalTrimmed(env.AI_DECISION_MODEL) ?? DEFAULT_DECISION_MODEL_ID,
376
311
  fastModelId,
377
312
  guardianModelId,
@@ -423,7 +358,6 @@ function readSqlStatementTimeoutMs(env) {
423
358
  /** Parse all chat configuration from environment variables. */
424
359
  function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_FUNCTION_MAX_DURATION_SECONDS) {
425
360
  const databaseUrl = readDatabaseUrl(env);
426
- warnDeprecatedProfileEnv(env);
427
361
  const resolvedFunctionMaxDurationSeconds = resolveFunctionMaxDurationSeconds(functionMaxDurationSeconds);
428
362
  return {
429
363
  attachmentStorage: readAttachmentStorageConfig(env),
@@ -534,6 +468,7 @@ function getRuntimeMetadata() {
534
468
  }
535
469
  /** Apply model overrides from createApp(). */
536
470
  function setBotModelConfig(config) {
471
+ if (config.modelId !== void 0) botConfig.modelId = requireModelId("modelId", config.modelId, validateGatewayModelId);
537
472
  if (config.decisionModelId !== void 0) botConfig.decisionModelId = requireModelId("decisionModelId", config.decisionModelId, toOptionalTrimmed);
538
473
  if (config.embeddingModelId !== void 0) botConfig.embeddingModelId = requireModelId("embeddingModelId", config.embeddingModelId, validateEmbeddingModelId);
539
474
  if (config.fastModelId !== void 0) botConfig.fastModelId = requireModelId("fastModelId", config.fastModelId, validateGatewayModelId);
@@ -543,19 +478,9 @@ function setBotModelConfig(config) {
543
478
  if (config.visionModelId !== void 0) botConfig.visionModelId = requireModelId("visionModelId", config.visionModelId, validateGatewayModelId);
544
479
  if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
545
480
  }
546
- /** Apply profiles from createApp(). */
547
- function setProfiles(profiles, defaultProfile) {
548
- if (!profiles || !defaultProfile) throw new Error("profiles and defaultProfile must be configured together");
549
- const configuredProfiles = parseProfileMap(profiles, "profiles");
550
- const selectedDefault = defaultProfile;
551
- if (!modelProfileSchema.safeParse(selectedDefault).success) throw new Error(`defaultProfile "${selectedDefault}" must match ^[a-z][a-z0-9_-]*$`);
552
- if (!Object.hasOwn(configuredProfiles, selectedDefault)) throw new Error(`defaultProfile "${selectedDefault}" is not configured`);
553
- botConfig.profiles = configuredProfiles;
554
- botConfig.defaultProfile = selectedDefault;
555
- }
556
481
  /** Apply Slack reaction emoji overrides from createApp() options, validating names. */
557
482
  function setSlackReactionConfig(overrides) {
558
483
  if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
559
484
  if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
560
485
  }
561
- export { normalizeSlackEmojiName as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, snapshotRuntimeConfig as g, setSlackReactionConfig as h, getChatConfig as i, getSlackSigningSecret as l, setRuntimeLimits as m, botConfig as n, getSlackBotToken as o, setProfiles as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, createS3AttachmentStorage as v };
486
+ export { toPiReasoningLevel as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, TURN_REASONING_LEVELS as g, snapshotRuntimeConfig as h, getChatConfig as i, getSlackSigningSecret as l, setSlackReactionConfig as m, botConfig as n, getSlackBotToken as o, setRuntimeLimits as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v, createS3AttachmentStorage as y };
@@ -1,13 +1,13 @@
1
- import { $ as loadTurnCheckpoint, Br as startOAuthFlow, it as getTurnRecord, rt as failTurnRecord } from "./projection-6dXaN0n-.js";
2
- import { n as botConfig } from "./config-Cb--cuv-.js";
3
- import { C as getSqlExecutor, F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, y as getConversationEventStore } from "./viewer-CQwBszc7.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-CEqKR_ld.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime--sC2CYLQ.js";
6
- import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-sMpA5qGM.js";
7
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
8
- import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-Bywqo1WJ.js";
9
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-BgH2P3X9.js";
10
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-DddybdNu.js";
1
+ import { X as loadTurnCheckpoint, et as failTurnRecord, gi as startOAuthFlow, tt as getTurnRecord } from "./projection-BTge9wrH.js";
2
+ import { n as botConfig } from "./config-o2jLRY5J.js";
3
+ import { C as getSqlExecutor, R as deleteProviderIdentityForSlackUser, y as getConversationEventStore, z as deleteProviderIdentityForUser } from "./viewer-DLXajQZE.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-Cp6CNmtP.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-DE-43MPb.js";
7
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
8
+ import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-CAL4A2y7.js";
9
+ import { m as ensureConversationWake, w as requestConversationWork } from "./store-CGJZTEVz.js";
10
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-DnSaaEpn.js";
11
11
  import { randomBytes, randomUUID } from "node:crypto";
12
12
  import { z } from "zod";
13
13
  // src/chat/task-execution/authorized-turn.ts
@@ -1,4 +1,4 @@
1
- import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-DstkkoNP.js";
1
+ import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-DTAA8Qs_.js";
2
2
  import { z } from "zod";
3
3
  import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
4
4
  // src/chat/briefs/schema.ts
@@ -284,22 +284,36 @@ const conversationAttachmentParamsSchema = z.object({
284
284
  attachmentId: z.string().min(1),
285
285
  conversationId: z.string().min(1)
286
286
  }).strict();
287
- const conversationDetailQuerySchema = z.object({ limit: z.coerce.number().int().min(1).max(1e3).default(500) }).strict();
288
- const conversationEventsQuerySchema = z.object({
289
- before: z.string().min(1),
290
- limit: z.coerce.number().int().min(1).max(1e3).default(500)
287
+ const conversationDetailQuerySchema = z.object({
288
+ limit: z.coerce.number().int().min(1).max(1e3).default(500),
289
+ /** Also return `unreadPage` when the detail has an `unreadCursor`. */
290
+ unreadPage: z.stringbool().optional()
291
291
  }).strict();
292
+ const conversationEventsLimitSchema = z.coerce.number().int().min(1).max(1e3).default(500);
293
+ /**
294
+ * Page toward the start with `before`, toward the latest with `after`, or
295
+ * both ways from one event with `around`.
296
+ */
297
+ const conversationEventsQuerySchema = z.union([
298
+ z.object({
299
+ before: z.string().min(1),
300
+ limit: conversationEventsLimitSchema
301
+ }).strict(),
302
+ z.object({
303
+ after: z.string().min(1),
304
+ limit: conversationEventsLimitSchema
305
+ }).strict(),
306
+ z.object({
307
+ around: z.string().min(1),
308
+ limit: conversationEventsLimitSchema
309
+ }).strict()
310
+ ]);
292
311
  const conversationFeedQuerySchema = z.object({
293
312
  actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
294
313
  codeRepositoryId: z.string().uuid().optional(),
295
314
  q: z.string().trim().max(200).optional(),
296
315
  status: z.enum(["active", "archived"]).default("active")
297
316
  }).strict();
298
- const archiveConversationBodySchema = z.object({
299
- archived: z.boolean(),
300
- lastSeenAt: z.string().datetime()
301
- }).strict();
302
- const archiveConversationResponseSchema = z.object({ archivedAt: z.string().datetime().nullable() }).strict();
303
317
  const createConversationMessageBodySchema = z.object({
304
318
  idempotencyKey: z.string().trim().min(1).max(200),
305
319
  message: z.string().trim().max(32e3),
@@ -324,68 +338,6 @@ const actorIdentitySchema = z.object({
324
338
  slackUserId: z.string().optional(),
325
339
  slackUserName: z.string().optional()
326
340
  }).strict();
327
- /** Mailbox delivery mode for one accepted inbound message. */
328
- const conversationPendingMessageDeliverySchema = z.enum(["defer", "interrupt"]);
329
- /** One accepted mailbox message that has not reached durable history yet. */
330
- const conversationPendingMessageSchema = z.object({
331
- actorIdentity: actorIdentitySchema.optional(),
332
- /** Identity id of the author. Detail `authors` maps it to the person. */
333
- actorIdentityId: z.string().min(1).optional(),
334
- createdAt: z.string().datetime(),
335
- delivery: conversationPendingMessageDeliverySchema,
336
- inboundMessageId: z.string().min(1),
337
- messageId: z.string().min(1),
338
- receivedAt: z.string().datetime(),
339
- role: z.literal("user"),
340
- source: z.enum(["slack", "web"]),
341
- text: z.string().optional(),
342
- /** People mentioned in the text, resolved at read time. */
343
- mentions: z.array(actorIdentitySchema).optional(),
344
- attachments: z.array(messageAttachmentSchema).optional(),
345
- /** Review item change that this Message records. */
346
- reviewItemChange: reviewItemChangeRecordSchema.optional(),
347
- redacted: z.literal(true).optional()
348
- }).strict().superRefine((data, context) => {
349
- if (data.text === void 0 === (data.redacted !== true)) context.addIssue({
350
- code: "custom",
351
- message: "pending message content must be text or explicitly redacted"
352
- });
353
- if (data.redacted && (data.actorIdentity || data.attachments || data.mentions || data.reviewItemChange)) context.addIssue({
354
- code: "custom",
355
- message: "redacted pending messages must not expose actor identity, attachments, mentions, or a review item"
356
- });
357
- });
358
- /** Participant-only authorization prompt for a parked web turn. */
359
- const conversationPendingAuthorizationSchema = z.object({
360
- authorizationUrl: z.string().url(),
361
- completionText: z.string().min(1),
362
- label: z.string().min(1)
363
- }).strict();
364
- /** Bounded mailbox snapshot for one conversation transcript. */
365
- const conversationPendingMessagesReportSchema = z.object({
366
- authorization: conversationPendingAuthorizationSchema.optional(),
367
- conversationId: z.string().min(1),
368
- generatedAt: z.string().datetime(),
369
- messages: z.array(conversationPendingMessageSchema)
370
- }).strict();
371
- /** Optional filters for cancelling accepted mailbox rows. */
372
- const cancelConversationPendingMessagesBodySchema = z.object({
373
- inboundMessageIds: z.array(z.string().min(1)).min(1).optional(),
374
- receivedBefore: z.string().datetime().optional()
375
- }).strict();
376
- /** Result of cancelling accepted human-facing mailbox rows. */
377
- const cancelConversationPendingMessagesResponseSchema = z.object({
378
- cancelledCount: z.number().int().nonnegative(),
379
- cancelledInboundMessageIds: z.array(z.string().min(1)),
380
- conversationId: z.string().min(1)
381
- }).strict();
382
- /** Queued web messages that the viewer wants Junior to read now. */
383
- const steerConversationPendingMessagesBodySchema = z.object({ inboundMessageIds: z.array(z.string().min(1)).min(1) }).strict();
384
- /** Result of steering queued web messages into the conversation. */
385
- const steerConversationPendingMessagesResponseSchema = z.object({
386
- conversationId: z.string().min(1),
387
- steeredInboundMessageIds: z.array(z.string().min(1))
388
- }).strict();
389
341
  const conversationAuxiliaryCostsSchema = z.object({
390
342
  costUsd: z.number().finite().nonnegative(),
391
343
  operations: z.array(z.object({
@@ -444,6 +396,7 @@ const conversationSummaryReportSchema = z.object({
444
396
  actorIdentity: actorIdentitySchema.optional(),
445
397
  participants: z.array(actorIdentitySchema).optional(),
446
398
  archivedAt: z.string().datetime().nullable().optional(),
399
+ pinnedAt: z.string().datetime().nullable().optional(),
447
400
  channel: z.string().optional(),
448
401
  channelName: z.string().optional(),
449
402
  channelNameRedacted: z.boolean().optional(),
@@ -497,6 +450,7 @@ const conversationReportMessageEventDataSchema = z.object({
497
450
  eventType: z.string().min(1).optional(),
498
451
  eventObjectType: objectTypeSchema.optional(),
499
452
  explicitMention: z.boolean().optional(),
453
+ quiet: z.literal(true).optional(),
500
454
  trustedSummary: z.string().min(1).optional(),
501
455
  /**
502
456
  * The Watch Events when several arrived together. A message that also
@@ -606,20 +560,6 @@ const conversationReportTurnLifecycleEventDataSchema = z.discriminatedUnion("sta
606
560
  sentryEventUrl: z.string().url().optional()
607
561
  }).strict()
608
562
  ]);
609
- const conversationReportTurnRoutedEventDataSchema = z.object({
610
- type: z.literal("turn_routed"),
611
- turnId: z.string().min(1),
612
- modelProfile: z.string().min(1),
613
- modelId: z.string().min(1),
614
- costUsd: z.number().finite().nonnegative().optional(),
615
- reasoningLevel: z.string().min(1),
616
- confidence: z.number().min(0).max(1).optional(),
617
- source: z.enum([
618
- "configured",
619
- "inherited",
620
- "router"
621
- ])
622
- }).strict();
623
563
  const conversationReportGuardianActionReviewedEventDataSchema = z.object({
624
564
  type: z.literal("guardian_action_reviewed"),
625
565
  turnId: z.string().min(1),
@@ -665,7 +605,6 @@ const conversationReportAttachmentsDeliveredEventDataSchema = z.object({
665
605
  }).strict();
666
606
  const conversationReportCompactionEventDataSchema = z.object({
667
607
  type: z.literal("compaction"),
668
- modelProfile: z.string().min(1).optional(),
669
608
  modelId: z.string().min(1).optional(),
670
609
  summary: z.string().min(1).optional(),
671
610
  details: z.object({
@@ -679,14 +618,6 @@ const conversationReportCompactionEventDataSchema = z.object({
679
618
  summaryChars: z.number().int().nonnegative()
680
619
  }).strict().optional()
681
620
  }).strict();
682
- const conversationReportHandoffEventDataSchema = z.object({
683
- type: z.literal("handoff"),
684
- modelProfile: z.string().min(1),
685
- modelId: z.string().min(1),
686
- reasoningLevel: z.string().min(1).optional(),
687
- triggeringToolCallId: z.string().min(1).optional(),
688
- summary: z.string().min(1).optional()
689
- }).strict();
690
621
  const conversationReportSubagentEventDataSchema = z.object({
691
622
  type: z.literal("subagent"),
692
623
  startedSeq: z.number().int().nonnegative(),
@@ -715,10 +646,8 @@ const conversationReportEventDataSchema = z.discriminatedUnion("type", [
715
646
  conversationReportTurnContextEventDataSchema,
716
647
  conversationReportStructuredEventDataSchema,
717
648
  conversationReportAttachmentsDeliveredEventDataSchema,
718
- conversationReportTurnRoutedEventDataSchema,
719
649
  conversationReportGuardianActionReviewedEventDataSchema,
720
650
  conversationReportCompactionEventDataSchema,
721
- conversationReportHandoffEventDataSchema,
722
651
  conversationReportSubagentEventDataSchema
723
652
  ]);
724
653
  /** One ordered, privacy-safe canonical event projected for API consumers. */
@@ -728,11 +657,7 @@ const conversationReportEventSchema = z.object({
728
657
  data: conversationReportEventDataSchema,
729
658
  /** People mentioned in the event text, resolved at read time. */
730
659
  mentions: z.array(actorIdentitySchema).optional(),
731
- model: z.object({
732
- modelId: z.string().min(1),
733
- modelProfile: z.string().min(1).optional(),
734
- reasoningLevel: z.string().min(1).optional()
735
- }).strict().optional(),
660
+ model: z.object({ modelId: z.string().min(1) }).strict().optional(),
736
661
  modelCall: z.object({
737
662
  provider: z.string().min(1).optional(),
738
663
  api: z.string().min(1).optional(),
@@ -845,16 +770,42 @@ const conversationAgentTreeNodeSchema = z.object({
845
770
  conversationId: z.string().min(1),
846
771
  label: z.string().min(1)
847
772
  }).strict();
773
+ const conversationEventPageSchema = z.object({
774
+ events: z.array(conversationReportEventSchema),
775
+ eventHistory: conversationEventHistorySchema,
776
+ previousCursor: z.string().min(1).optional(),
777
+ /** Present on `after` and `around` pages when newer events follow. */
778
+ nextCursor: z.string().min(1).optional(),
779
+ generatedAt: z.string()
780
+ }).strict().superRefine(validateConversationEvents);
781
+ /**
782
+ * Carries the detail version token in both directions. A custom header, not
783
+ * `ETag` / `If-None-Match`: in production the Vercel CDN answered standard
784
+ * validators itself, after the function had already built the full report.
785
+ */
786
+ const CONVERSATION_DETAIL_VERSION_HEADER = "x-junior-detail-version";
848
787
  const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
849
788
  /**
850
789
  * The parent chain of a child Conversation, root first, with this
851
790
  * Conversation last. Root Conversations omit it.
852
791
  */
853
792
  agentTree: z.array(conversationAgentTreeNodeSchema).min(2).optional(),
793
+ /** The viewer's effective auto-archive choice. Participants only. */
794
+ autoArchive: z.boolean().optional(),
854
795
  /** The viewer can fork this conversation from an assistant reply. */
855
796
  canFork: z.boolean().optional(),
856
797
  /** How far the signed-in viewer has read. Absent until they read. */
857
798
  readPosition: conversationReadPositionSchema.optional(),
799
+ /**
800
+ * Pass as `after` to the events API to read from the read position.
801
+ * Present only when unread events start before `events`.
802
+ */
803
+ unreadCursor: z.string().min(1).optional(),
804
+ /**
805
+ * The `around` page of `unreadCursor`, when the request asks for it. A
806
+ * reader who opens at the read position needs no second request.
807
+ */
808
+ unreadPage: conversationEventPageSchema.optional(),
858
809
  forkedFromConversationId: z.string().optional(),
859
810
  /** Title of the fork source, when the viewer can open it. */
860
811
  forkedFromTitle: z.string().optional(),
@@ -880,15 +831,9 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
880
831
  sentryConversationUrl: z.string().optional(),
881
832
  sourceTask: conversationSourceTaskSchema.optional()
882
833
  }).strict().superRefine(validateConversationEvents);
883
- const conversationEventPageSchema = z.object({
884
- events: z.array(conversationReportEventSchema),
885
- eventHistory: conversationEventHistorySchema,
886
- previousCursor: z.string().min(1).optional(),
887
- generatedAt: z.string()
888
- }).strict().superRefine(validateConversationEvents);
889
834
  const conversationFeedSchema = z.object({
890
835
  conversations: z.array(conversationSummaryReportSchema),
891
836
  source: z.literal("conversation_index"),
892
837
  generatedAt: z.string()
893
838
  }).strict();
894
- export { createConversationMessageBodySchema as A, messageCardText as B, conversationReportEventSchema as C, conversationSurfaceSchema as D, conversationSummaryReportSchema as E, conversationChildAgentTotalsSchema as F, MAX_INPUT_IMAGE_BYTES as G, removedCardSchema as H, conversationReadPositionSchema as I, briefLinkSchema as J, readMessageAttachments as K, reviewItemChangeRecordSchema as L, forkConversationResponseSchema as M, steerConversationPendingMessagesBodySchema as N, conversationUsageSchema as O, steerConversationPendingMessagesResponseSchema as P, annotationCard as R, conversationReportEventDataSchema as S, conversationReportStatusSchema as T, resolveMessageCards as U, readMessageCardRefs as V, MAX_INPUT_IMAGES as W, conversationBriefSchema as X, briefOutcomeStatusSchema as Y, parseBriefInput as Z, 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, briefCodeChangeSchema 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, messageCardRef as z };
839
+ export { messageCardRef as A, briefLinkSchema as B, createConversationMessageBodySchema as C, conversationReadPositionSchema as D, conversationChildAgentTotalsSchema as E, MAX_INPUT_IMAGES as F, conversationBriefSchema as H, MAX_INPUT_IMAGE_BYTES as I, messageAttachmentSchema as L, readMessageCardRefs as M, removedCardSchema as N, reviewItemChangeRecordSchema as O, resolveMessageCards as P, readMessageAttachments as R, createConversationBodySchema as S, forkConversationResponseSchema as T, parseBriefInput as U, briefOutcomeStatusSchema as V, conversationReportMessageEventSchema as _, conversationAttachmentParamsSchema as a, conversationSurfaceSchema as b, conversationDetailReportSchema as c, conversationEventsQuerySchema as d, conversationFeedQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, conversationActivityPreviewSchema as i, messageCardText as j, annotationCard as k, conversationEventHistorySchema as l, conversationParamsSchema as m, acceptedConversationMessageSchema as n, conversationAuxiliaryCostsSchema as o, conversationFeedSchema as p, actorIdentitySchema as r, conversationDetailQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventPageSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, briefCodeChangeSchema as z };
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-B04X_eCB.js";
1
+ import { h as logWarn } from "./logging-dFaXvBRK.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,19 +1,19 @@
1
- import { $r as postSlackMessage, Dn as createUserTokenStore, Lr as formatProviderLabel, Qi as getSlackClient, Rr as parseOAuthStatePayload, X as getConversationPendingAuth, f as recordAuthenticationLinked, it as getTurnRecord, jn as resolvePluginOAuthAccount, p as recordAuthorizationCompleted, zr as resolveBaseUrl } from "./projection-6dXaN0n-.js";
2
- import { m as escapeXml } from "./client-7diKvInp.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-Cb--cuv-.js";
4
- import { B as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-B04X_eCB.js";
1
+ import { On as resolvePluginOAuthAccount, d as recordAuthorizationCompleted, hi as resolveBaseUrl, ki as postSlackMessage, mi as parseOAuthStatePayload, pi as formatProviderLabel, q as getConversationPendingAuth, tt as getTurnRecord, u as recordAuthenticationLinked, wn as createUserTokenStore, zi as getSlackClient } from "./projection-BTge9wrH.js";
2
+ import { m as escapeXml } from "./client-v_OVYuHZ.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-o2jLRY5J.js";
4
+ import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-dFaXvBRK.js";
5
5
  import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
6
- import { C as getSqlExecutor, L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, o as readIdentityById } from "./viewer-CQwBszc7.js";
6
+ import { B as findUserByVerifiedEmails, C as getSqlExecutor, I as resolveActorIdentityId, W as upsertLinkedIdentity, o as readIdentityById } from "./viewer-DLXajQZE.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-CEqKR_ld.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime--sC2CYLQ.js";
10
- import { t as discoverSkills } from "./skills-Bc0D7BGy.js";
11
- import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-sMpA5qGM.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-Cp6CNmtP.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
10
+ import { t as discoverSkills } from "./skills-M0BA0_s6.js";
11
+ import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DE-43MPb.js";
12
12
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { r as getStateAdapter } from "./adapter-DoPR2jS-.js";
14
- import { _ as getMcpProviderErrorAttributes } from "./service-account-CUuVJCKT.js";
15
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BXjgk1pW.js";
16
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-C4-4fxaE.js";
13
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
14
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-BkEv20zf.js";
15
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
16
+ import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-RC4NXAx8.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-C6ZAyJgf.js";
18
18
  import path from "node:path";
19
19
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./schema-CaUWl2EV.js";
1
+ import "./schema-Tr484cCC.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";
@@ -1,6 +1,6 @@
1
- import "./config-Cb--cuv-.js";
2
- import { p as logException } from "./logging-B04X_eCB.js";
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-CUWrrzkc.js";
1
+ import "./config-o2jLRY5J.js";
2
+ import { p as logException } from "./logging-dFaXvBRK.js";
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-D7c4BQGc.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
6
6
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -246,14 +246,22 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
246
246
  userId: text("user_id").notNull().references(() => juniorUsers.id),
247
247
  rootConversationId: text("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
248
248
  lastMessageAt: timestamptz("last_message_at").notNull(),
249
- archivedAt: timestamptz("archived_at")
249
+ archivedAt: timestamptz("archived_at"),
250
+ pinnedAt: timestamptz("pinned_at"),
251
+ /**
252
+ * Per-conversation auto-archive choice for this user. Null uses the
253
+ * user's `autoArchiveDefault`.
254
+ */
255
+ autoArchive: boolean("auto_archive")
250
256
  }, (table) => [
251
257
  primaryKey({
252
258
  name: "junior_conversation_participants_user_root_pk",
253
259
  columns: [table.userId, table.rootConversationId]
254
260
  }),
255
261
  index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
256
- index("junior_conversation_participants_root_idx").on(table.rootConversationId)
262
+ index("junior_conversation_participants_root_idx").on(table.rootConversationId),
263
+ index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive} and ${table.archivedAt} is null`),
264
+ index("junior_conversation_participants_unarchived_activity_idx").on(table.userId, table.lastMessageAt, table.rootConversationId).where(sql`${table.archivedAt} is null`)
257
265
  ]);
258
266
  // src/db/schema/conversation-read-positions.ts
259
267
  /**
@@ -1,6 +1,6 @@
1
- import { I as getDeploymentServiceVersion, L as getDeploymentTelemetryAttributes } from "./logging-B04X_eCB.js";
1
+ import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-dFaXvBRK.js";
2
2
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-MDkYAVPV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DTwdT3Pi.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C23M8KaD.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
5
5
  import { performance } from "node:perf_hooks";
6
6
  import { subscribe, unsubscribe } from "node:diagnostics_channel";
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-MDkYAVPV.js";
2
- import { t as JUNIOR_VERSION } from "./version-CTzSbCmR.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C7HejFP2.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -112,6 +112,8 @@ const JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
112
112
  const JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
113
113
  const JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
114
114
  const JUNIOR_RETENTION_CRON_SCHEDULE = "0 4 * * *";
115
+ const JUNIOR_AUTO_ARCHIVE_ROUTE = "/api/internal/auto-archive";
116
+ const JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE = "17 * * * *";
115
117
  const JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
116
118
  const JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
117
119
  const JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE = "/api/internal/workspace/snapshots";
@@ -1245,4 +1247,4 @@ function extractGenAiUsageAttributes(...sources) {
1245
1247
  ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
1246
1248
  };
1247
1249
  }
1248
- export { JUNIOR_HEARTBEAT_ROUTE as A, isNativeIdentityProvider as B, summarizeMessageText as C, JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as D, withSpan as E, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as F, isRecord as H, getDeploymentServiceVersion as I, getDeploymentTelemetryAttributes as L, JUNIOR_RETENTION_CRON_SCHEDULE as M, JUNIOR_RETENTION_ROUTE as N, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as O, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as P, runWithLogAttributes as R, setTags as S, withLogContext as T, toOptionalNumber as U, normalizeIdentityEmail as V, toOptionalString as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as j, JUNIOR_HEARTBEAT_CRON_SCHEDULE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, GOOGLE_IDENTITY_PROVIDER as z };
1250
+ export { JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as A, runWithLogAttributes as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_ROUTE as F, toOptionalNumber as G, isNativeIdentityProvider as H, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as I, toOptionalString as K, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as L, JUNIOR_HEARTBEAT_ROUTE as M, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as N, JUNIOR_AUTO_ARCHIVE_ROUTE as O, JUNIOR_RETENTION_CRON_SCHEDULE as P, getDeploymentServiceVersion as R, setTags as S, withLogContext as T, normalizeIdentityEmail as U, GOOGLE_IDENTITY_PROVIDER as V, isRecord as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_HEARTBEAT_CRON_SCHEDULE as j, JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, getDeploymentTelemetryAttributes as z };