@sentry/junior 0.284.0 → 0.285.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/{adapter-CW5UW7vL.js → adapter-DN5AB4VU.js} +37 -3
  2. package/dist/{admin-DUWN8zZX.js → admin-DOITMKnn.js} +1 -1
  3. package/dist/{agent-runner-Cqr21pOU.js → agent-runner-BsWhHe4N.js} +579 -1653
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -6
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +141 -43
  8. package/dist/{app-CvGalMxi.d.ts → app-DyMs9330.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +226 -186
  11. package/dist/{assistant-reply-CFE-OZMS.js → assistant-reply-9Jip5bsr.js} +1 -1
  12. package/dist/{automation-Zvx_I9Z5.js → automation-Mk8aaHzy.js} +1 -1
  13. package/dist/{background-compaction-queue-CHFzrQbS.js → background-compaction-queue-DXkLsWoH.js} +2 -2
  14. package/dist/{briefs-Cx7mkfSk.js → briefs-Cl8-nK9B.js} +5 -5
  15. package/dist/{catalog-runtime-dKOVbR7l.js → catalog-runtime-Bte6jRB2.js} +1 -1
  16. package/dist/cli/chat.js +19 -16
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/init.js +3 -0
  19. package/dist/cli/main.js +3 -3
  20. package/dist/cli/plugins.js +4 -4
  21. package/dist/cli/snapshot-create.js +4 -4
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +12 -17
  24. package/dist/{client-CMyH5rDz.js → client-DDbBucBw.js} +2 -2
  25. package/dist/{config-Dt3CpG17.js → config-DqFnykQT.js} +1 -1
  26. package/dist/{connections-CCHPybZP.js → connections-DA4LT9LL.js} +10 -10
  27. package/dist/{conversation-DdT7SNar.js → conversation-D8kVoCrP.js} +58 -6
  28. package/dist/{conversation-pending-messages-Dct5pheX.js → conversation-pending-messages-BvROq1bq.js} +1 -1
  29. package/dist/{conversation-privacy-BpHHhEVp.js → conversation-privacy-D0j_h70R.js} +1 -1
  30. package/dist/{credential-sync-BBPw8dam.js → credential-sync-hcsYatw-.js} +13 -13
  31. package/dist/{db-D7CCwAo8.d.ts → db-BhHZSuFw.d.ts} +18 -2
  32. package/dist/{executor-CyIwHz9r.js → executor-BLEMIgIZ.js} +11 -3
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{logging-Qo-7xGp1.js → logging-BfORLKoq.js} +1 -1
  35. package/dist/{message-DFbtOWqv.js → message-DqjuKzUx.js} +13 -23
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +3 -3
  38. package/dist/{oauth-callback-server-BB1gixWo.js → oauth-callback-server-CFSRzu1n.js} +2 -2
  39. package/dist/{projection-0UcUeuzn.js → projection-DliWYrnT.js} +280 -71
  40. package/dist/{prompt-CCtaGgbI.js → prompt-BvIUzY4y.js} +8 -6
  41. package/dist/{registry-DOnPkI8g.js → registry-rC7MCxu8.js} +1 -1
  42. package/dist/{reporting-window-B-QP9zX1.js → reporting-window-B4TwyuJo.js} +14 -14
  43. package/dist/{resolve-Di3omymY.js → resolve-Biu8Qw3u.js} +3 -3
  44. package/dist/result-DxJMCX47.js +299 -0
  45. package/dist/result-event-type-DD6BAgT7.js +11 -0
  46. package/dist/{runner-CnX_dTKw.js → runner-BQJSFLKg.js} +11 -11
  47. package/dist/{sandbox-egress-signals-CtxLJmmg.js → sandbox-egress-signals-6aMxJSDn.js} +1 -1
  48. package/dist/{schema-B017enNE.d.ts → schema-BUviRAs8.d.ts} +157 -220
  49. package/dist/{schema-Bn3miEd_.js → schema-BasXTvi2.js} +63 -5
  50. package/dist/{service-account-KhZIqXRi.js → service-account-BI5Wgx22.js} +3 -3
  51. package/dist/{service-account-ewDAx4Mx.js → service-account-CAE-_1dR.js} +3 -3
  52. package/dist/session-stop-CA-jOJ84.js +2924 -0
  53. package/dist/{skills-CKyotM4g.js → skills-B22duVJU.js} +2 -2
  54. package/dist/{spawn-D5D2MQdz.js → spawn-BB2_4VYn.js} +2 -2
  55. package/dist/{stop-BSKRTaRS.js → stop-DioIcEAu.js} +4821 -4199
  56. package/dist/{store-G3S0kWSD.js → store-B26LV6UP.js} +78 -311
  57. package/dist/{store-ymkEUWe4.js → store-Dn4W7qgH.js} +30 -5
  58. package/dist/{task-queue-BcOHzXxe.js → task-queue-Bt0IoR2i.js} +3 -3
  59. package/dist/{task-runner-B65cDumh.js → task-runner-D8lddjzp.js} +7 -7
  60. package/dist/{thread-state-D6rNGQu9.js → thread-state-CrFk3K_7.js} +4 -4
  61. package/dist/{turn-failure-response-BlO4nuDJ.js → turn-failure-response-DaJ04qVj.js} +7 -7
  62. package/dist/{turn-lifecycle-BQ8ETk63.js → turn-lifecycle-C2mXS7AZ.js} +1 -1
  63. package/dist/{turn-session-routing-D_GXfcAG.js → turn-session-routing-CGMKrYOj.js} +10 -10
  64. package/dist/{validation-DJG_wrg2.js → validation-TzhfQABF.js} +1 -1
  65. package/dist/{version-i1An1eTS.js → version-DSk8CFvA.js} +1 -1
  66. package/dist/version.js +1 -1
  67. package/dist/{viewer-BlpnzZZa.js → viewer-1Ea81s0b.js} +190 -53
  68. package/dist/{work-BgCW3FDC.js → work-ybG4_q5C.js} +238 -32
  69. package/dist/{worker-BJz1mwYt.js → worker-ccSyZRNz.js} +6 -6
  70. package/migrations/0083_conversation_kind.sql +11 -0
  71. package/migrations/0084_read_position_backfill.sql +25 -0
  72. package/migrations/0085_child_archived_at.sql +1 -0
  73. package/migrations/meta/0083_snapshot.json +4388 -0
  74. package/migrations/meta/0084_snapshot.json +4388 -0
  75. package/migrations/meta/0085_snapshot.json +4394 -0
  76. package/migrations/meta/_journal.json +21 -0
  77. package/package.json +4 -4
  78. package/dist/result-NvndYzCb.js +0 -483
  79. package/dist/session-stop-D_1SysjC.js +0 -1438
@@ -1,6 +1,6 @@
1
- import { i as completeObject } from "./client-CMyH5rDz.js";
2
- import { U as parseBriefInput, c as conversationDetailReportSchema, u as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-DdT7SNar.js";
3
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CCtaGgbI.js";
1
+ import { i as completeObject } from "./client-DDbBucBw.js";
2
+ import { K as parseBriefInput, V as briefCodeChangeSchema, W as briefResourceLabel, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-D8kVoCrP.js";
3
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BvIUzY4y.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import path from "node:path";
6
6
  import * as z from "zod";
@@ -174,7 +174,7 @@ function briefInputFromSnapshot(snapshot, throughIndex) {
174
174
  return bounded ? [bounded] : [];
175
175
  }),
176
176
  resources: (detail.annotations ?? []).flatMap((annotation) => annotation.url !== null && Date.parse(annotation.createdAt) <= boundaryMs ? [{
177
- label: annotation.label,
177
+ label: briefResourceLabel(annotation),
178
178
  url: annotation.url,
179
179
  ...annotation.status ? { status: annotation.status } : void 0
180
180
  }] : [])
@@ -263,7 +263,7 @@ async function parseRunOptions(argv) {
263
263
  * token.
264
264
  */
265
265
  async function configuredBriefModelId() {
266
- const { botConfig } = await import("./config-Dt3CpG17.js").then((n) => n.r);
266
+ const { botConfig } = await import("./config-DqFnykQT.js").then((n) => n.r);
267
267
  return botConfig.fastModelId;
268
268
  }
269
269
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-DOnPkI8g.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-rC7MCxu8.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-Cqr21pOU.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-BsWhHe4N.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-HYh_JOdw.js").then((n) => n.o),
102
- import("../projection-0UcUeuzn.js").then((n) => n.kn),
103
- import("../catalog-runtime-dKOVbR7l.js").then((n) => n.t),
104
- import("../validation-DJG_wrg2.js").then((n) => n.r),
105
- import("../viewer-BlpnzZZa.js").then((n) => n.v)
102
+ import("../projection-DliWYrnT.js").then((n) => n.zn),
103
+ import("../catalog-runtime-Bte6jRB2.js").then((n) => n.t),
104
+ import("../validation-TzhfQABF.js").then((n) => n.r),
105
+ import("../viewer-1Ea81s0b.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,29 +152,32 @@ function localDevServerUrl() {
152
152
  async function prepareLocalChatRun(io, pluginSet) {
153
153
  defaultStateAdapterForLocalChat();
154
154
  await configureLocalChatPlugins(pluginSet);
155
- const { setBriefsConfig } = await import("../projection-0UcUeuzn.js").then((n) => n.Vn);
155
+ const { setBriefsConfig } = await import("../projection-DliWYrnT.js").then((n) => n.Zn);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-CnX_dTKw.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-BB1gixWo.js");
157
+ const { runLocalAgentTurn } = await import("../runner-BQJSFLKg.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CFSRzu1n.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-D6xxVywK.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CtxLJmmg.js");
161
- const { bindSpawnAgent } = await import("../spawn-D5D2MQdz.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-DFbtOWqv.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-NvndYzCb.js").then((n) => n.i);
164
- const { skipInputBeforeConversationStop } = await import("../session-stop-D_1SysjC.js").then((n) => n.r);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-6aMxJSDn.js");
161
+ const { bindSpawnAgent } = await import("../spawn-BB2_4VYn.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-DqjuKzUx.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-DxJMCX47.js").then((n) => n.i);
164
+ const { skipInputAfterConversationStop } = await import("../session-stop-CA-jOJ84.js").then((n) => n.a);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-BJz1mwYt.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-ccSyZRNz.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");
170
170
  const childWorker = createChildConversationWorker(agentRunner, { queue: localConversationWork.queue });
171
171
  await processConversationWork(message, {
172
172
  queue: localConversationWork.queue,
173
- run: async (context) => await skipInputBeforeConversationStop(context) ?? await childWorker(context)
173
+ run: async (context) => {
174
+ const stopped = await skipInputAfterConversationStop(context);
175
+ return "skipped" in stopped ? stopped.skipped : await childWorker(stopped.context);
176
+ }
174
177
  });
175
178
  });
176
179
  agentRunner = createAgentRunner(executeAgentRun, {
177
- bindMessageAgent: (request) => request.parentConversationId ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
180
+ bindMessageAgent: (request) => request.agentInvocationId ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
178
181
  bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: localConversationWork.queue })
179
182
  });
180
183
  const oauthCallback = await startLocalOAuthCallbackServer();
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, L as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, M as JUNIOR_HEARTBEAT_ROUTE } from "../logging-Qo-7xGp1.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-DOnPkI8g.js";
3
- import { i as parseSkillFile } from "../skills-CKyotM4g.js";
1
+ import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, L as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, M as JUNIOR_HEARTBEAT_ROUTE } from "../logging-BfORLKoq.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-rC7MCxu8.js";
3
+ import { i as parseSkillFile } from "../skills-B22duVJU.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/init.js CHANGED
@@ -96,7 +96,10 @@ jobs:
96
96
  cache: pnpm
97
97
  - run: pnpm install
98
98
  - run: pnpm check
99
+ # Snapshot warmup needs Vercel OIDC, so the Vercel deploy build runs it.
99
100
  - run: pnpm build
101
+ env:
102
+ JUNIOR_SKIP_SNAPSHOT: "1"
100
103
  `);
101
104
  }
102
105
  async function runInit(dir, log = console.log) {
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-DUWN8zZX.js")).runAdmin(argv);
28
+ return await (await import("../admin-DOITMKnn.js")).runAdmin(argv);
29
29
  }
30
30
  async function runServiceAccount(argv) {
31
- return await (await import("../service-account-ewDAx4Mx.js")).runServiceAccount(argv);
31
+ return await (await import("../service-account-CAE-_1dR.js")).runServiceAccount(argv);
32
32
  }
33
33
  async function runBriefs(argv) {
34
- return await (await import("../briefs-Cx7mkfSk.js")).runBriefs(argv);
34
+ return await (await import("../briefs-Cl8-nK9B.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 { Rn as setPlugins, za as createPluginLogger, zn as validatePlugins } from "../projection-0UcUeuzn.js";
2
- import { S as getDb } from "../viewer-BlpnzZZa.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-dKOVbR7l.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DJG_wrg2.js";
1
+ import { Jn as setPlugins, Ya as createPluginLogger, Yn as validatePlugins } from "../projection-DliWYrnT.js";
2
+ import { S as getDb } from "../viewer-1Ea81s0b.js";
3
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-Bte6jRB2.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-TzhfQABF.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-HYh_JOdw.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 { mi as create } from "../projection-0UcUeuzn.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-dKOVbR7l.js";
3
- import { t as disconnectStateAdapter } from "../adapter-CW5UW7vL.js";
4
- import { n as resolve } from "../resolve-Di3omymY.js";
1
+ import { Ti as create } from "../projection-DliWYrnT.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-Bte6jRB2.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-DN5AB4VU.js";
4
+ import { n as resolve } from "../resolve-Biu8Qw3u.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-D7CCwAo8.js";
1
+ import "../db-BhHZSuFw.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-Dt3CpG17.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-CyIwHz9r.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-DOnPkI8g.js";
1
+ import { i as getChatConfig } from "../config-DqFnykQT.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-BLEMIgIZ.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-rC7MCxu8.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-HYh_JOdw.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -158,17 +158,16 @@ const NEON_POOLER_SUFFIX = "-pooler";
158
158
  * The migration lock is a session advisory lock. A transaction-mode pooler,
159
159
  * such as Neon's `-pooler` endpoint, keeps that lock on its server session
160
160
  * after the client leaves. The next upgrade on another session then waits,
161
- * and one on the same session takes the lock again. For Neon, use
162
- * the direct endpoint: `DATABASE_URL_UNPOOLED` when the Vercel integration
163
- * sets it, else the `DATABASE_URL` host without the `-pooler` suffix.
161
+ * and one on the same session takes the lock again. For Neon, use the
162
+ * `DATABASE_URL` host without the `-pooler` suffix. The direct endpoint takes
163
+ * the same user, password, database, and parameters, so upgrade always
164
+ * migrates the database that `DATABASE_URL` names.
164
165
  */
165
- function readMigrationDatabaseUrl(args) {
166
- if (args.driver !== "neon") return args.databaseUrl;
167
- const unpooledUrl = args.env.DATABASE_URL_UNPOOLED?.trim();
168
- if (unpooledUrl) return unpooledUrl;
169
- const url = new URL(args.databaseUrl);
166
+ function readMigrationDatabaseUrl(databaseUrl) {
167
+ if (!URL.canParse(databaseUrl)) return databaseUrl;
168
+ const url = new URL(databaseUrl);
170
169
  const [endpoint, ...domain] = url.hostname.split(".");
171
- if (!endpoint?.endsWith(NEON_POOLER_SUFFIX) || !url.hostname.endsWith(".neon.tech")) return args.databaseUrl;
170
+ if (!endpoint?.endsWith(NEON_POOLER_SUFFIX) || !url.hostname.endsWith(".neon.tech")) return databaseUrl;
172
171
  url.hostname = [endpoint.slice(0, -7), ...domain].join(".");
173
172
  return url.toString();
174
173
  }
@@ -380,11 +379,7 @@ async function runDatabaseMigrations(context, io) {
380
379
  async function runUpgrade(io = DEFAULT_IO, options = {}) {
381
380
  const { sql } = getChatConfig();
382
381
  const sqlExecutor = createJuniorSqlExecutor({
383
- connectionString: readMigrationDatabaseUrl({
384
- databaseUrl: sql.databaseUrl,
385
- driver: sql.driver,
386
- env: process.env
387
- }),
382
+ connectionString: readMigrationDatabaseUrl(sql.databaseUrl),
388
383
  driver: sql.driver,
389
384
  statementTimeoutMs: false
390
385
  });
@@ -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-Qo-7xGp1.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BpHHhEVp.js";
1
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-BfORLKoq.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-D0j_h70R.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,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { c as resolveGatewayModel, w as toOptionalTrimmed } from "./client-CMyH5rDz.js";
2
+ import { c as resolveGatewayModel, w as toOptionalTrimmed } from "./client-DDbBucBw.js";
3
3
  import { AwsClient } from "aws4fetch";
4
4
  import { del, get, put } from "@vercel/blob";
5
5
  import * as z from "zod";
@@ -1,13 +1,13 @@
1
- import { Ti as startOAuthFlow, X as loadTurnCheckpoint, et as failTurnRecord, tt as getTurnRecord } from "./projection-0UcUeuzn.js";
2
- import { n as botConfig } from "./config-Dt3CpG17.js";
3
- import { C as getSqlExecutor, R as deleteProviderIdentityForSlackUser, y as getConversationEventStore, z as deleteProviderIdentityForUser } from "./viewer-BlpnzZZa.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-DOnPkI8g.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-dKOVbR7l.js";
6
- import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-Cqr21pOU.js";
7
- import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
8
- import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-CHFzrQbS.js";
9
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-ymkEUWe4.js";
10
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-D_GXfcAG.js";
1
+ import { Ii as startOAuthFlow, Z as loadTurnCheckpoint, nt as getTurnRecord, tt as failTurnRecord } from "./projection-DliWYrnT.js";
2
+ import { n as botConfig } from "./config-DqFnykQT.js";
3
+ import { C as getSqlExecutor, G as deleteProviderIdentityForSlackUser, K as deleteProviderIdentityForUser, y as getConversationEventStore } from "./viewer-1Ea81s0b.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-rC7MCxu8.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-BsWhHe4N.js";
7
+ import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
8
+ import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-DXkLsWoH.js";
9
+ import { T as requestConversationWork, h as ensureConversationWake } from "./store-Dn4W7qgH.js";
10
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-CGMKrYOj.js";
11
11
  import { randomBytes, randomUUID } from "node:crypto";
12
12
  import * as z from "zod";
13
13
  // src/chat/task-execution/authorized-turn.ts
@@ -6,7 +6,8 @@ import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationE
6
6
  * Runtime schemas for the Brief record and the generator input. Both cross a
7
7
  * durable or CLI edge, so these schemas own the exported types.
8
8
  */
9
- const lineSchema = z.string().trim().min(1).max(400);
9
+ const LINE_MAX = 400;
10
+ const lineSchema = z.string().trim().min(1).max(LINE_MAX);
10
11
  const urlSchema = z.string().url().max(2048);
11
12
  const timestampSchema = z.string().datetime();
12
13
  const briefLocationSchema = z.object({
@@ -114,6 +115,14 @@ const briefInputSchema = z.object({
114
115
  codeChanges: z.array(briefCodeChangeSchema),
115
116
  resources: z.array(briefResourceSchema)
116
117
  }).strict();
118
+ /**
119
+ * Label an annotation as a Brief resource. An object label is only its id,
120
+ * such as `owner/repo#123`, so keep its title: Brief search matches labels,
121
+ * and a later Conversation must find the object by its topic.
122
+ */
123
+ function briefResourceLabel(annotation) {
124
+ return (annotation.kind === "object" && annotation.title !== annotation.label ? `${annotation.label} · ${annotation.title}` : annotation.label).slice(0, LINE_MAX).trim();
125
+ }
117
126
  /** Parse the provider-neutral input used by every Brief generator adapter. */
118
127
  function parseBriefInput(input) {
119
128
  const parsed = briefInputSchema.parse(input);
@@ -254,10 +263,17 @@ const reviewItemChangeRecordSchema = z.object({
254
263
  * How far the signed-in viewer has read a Conversation transcript.
255
264
  *
256
265
  * `lastReadSeq` is the event sequence of the last transcript row the viewer
257
- * saw. The server keeps the highest value it receives, so it only moves
258
- * forward. It is never before the viewer's own latest Message.
266
+ * saw. Reports only move it forward: the server keeps the highest value it
267
+ * receives. Only Mark as unread moves it back. It is never before the
268
+ * viewer's own latest Message.
259
269
  */
260
270
  const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().nonnegative() }).strict();
271
+ /**
272
+ * The reply to a read report: the stored read position and whether Junior's
273
+ * latest visible reply is still after it. The dashboard clears the unread
274
+ * flag from this, so it does not refetch the feed after each report.
275
+ */
276
+ const conversationReadReportSchema = conversationReadPositionSchema.extend({ unreadReply: z.boolean() }).strict();
261
277
  // src/api/schema/child-agent-totals.ts
262
278
  /**
263
279
  * The part of a Conversation total that its child agents spent, at any depth.
@@ -274,7 +290,14 @@ const conversationChildAgentTotalsSchema = z.object({
274
290
  const conversationReportStatusSchema = z.enum([
275
291
  "active",
276
292
  "completed",
277
- "failed"
293
+ "failed",
294
+ "stopped"
295
+ ]);
296
+ /** Where a Conversation sits in its tree. See `TERMINOLOGY.md`. */
297
+ const conversationKindSchema = z.enum([
298
+ "root",
299
+ "thread",
300
+ "task"
278
301
  ]);
279
302
  const conversationSurfaceSchema = z.enum([
280
303
  "api",
@@ -411,6 +434,14 @@ const conversationSummaryReportSchema = z.object({
411
434
  auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
412
435
  childAgentTotals: conversationChildAgentTotalsSchema.optional(),
413
436
  conversationId: z.string(),
437
+ kind: conversationKindSchema,
438
+ /** Present on Threads and Tasks. */
439
+ parentConversationId: z.string().min(1).optional(),
440
+ /**
441
+ * Present on Threads and Tasks: when the child was archived for everyone,
442
+ * or null. `archivedAt` stays the viewer's archive of the root.
443
+ */
444
+ childArchivedAt: z.string().datetime().nullable().optional(),
414
445
  isParticipant: z.boolean(),
415
446
  visibility: z.enum(["private", "public"]).optional(),
416
447
  status: conversationReportStatusSchema,
@@ -424,6 +455,13 @@ const conversationSummaryReportSchema = z.object({
424
455
  pinnedAt: z.string().datetime().nullable().optional(),
425
456
  /** The viewer's place in Pinned. Unset until they reorder their pins. */
426
457
  pinPosition: z.number().int().optional(),
458
+ /**
459
+ * True when the conversation is idle and Junior's latest reply that the
460
+ * transcript shows is after the viewer's read position. Quiet replies do
461
+ * not count. Opening the conversation does not move the position; reading
462
+ * in it, replying, archiving, or Mark as read does.
463
+ */
464
+ unread: z.boolean().optional(),
427
465
  channel: z.string().optional(),
428
466
  channelName: z.string().optional(),
429
467
  channelNameRedacted: z.boolean().optional(),
@@ -795,6 +833,7 @@ const forkConversationResponseSchema = z.object({ conversationId: z.string() }).
795
833
  /** One Conversation in the agent tree of a child Conversation. */
796
834
  const conversationAgentTreeNodeSchema = z.object({
797
835
  conversationId: z.string().min(1),
836
+ kind: conversationKindSchema,
798
837
  label: z.string().min(1)
799
838
  }).strict();
800
839
  const conversationEventPageSchema = z.object({
@@ -811,6 +850,12 @@ const conversationEventPageSchema = z.object({
811
850
  * validators itself, after the function had already built the full report.
812
851
  */
813
852
  const CONVERSATION_DETAIL_VERSION_HEADER = "x-junior-detail-version";
853
+ /**
854
+ * Carries the change token of the Conversation tree that a detail report was
855
+ * built from. The dashboard compares it with the token of `GET /api/versions`
856
+ * and asks for the report only when they differ.
857
+ */
858
+ const CONVERSATION_VERSION_HEADER = "x-junior-conversation-version";
814
859
  const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
815
860
  /**
816
861
  * The parent chain of a child Conversation, root first, with this
@@ -821,6 +866,8 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
821
866
  autoArchive: z.boolean().optional(),
822
867
  /** The viewer can fork this conversation from an assistant reply. */
823
868
  canFork: z.boolean().optional(),
869
+ /** The viewer can move this dashboard conversation to a Slack thread. */
870
+ canContinueInSlack: z.literal(true).optional(),
824
871
  /** How far the signed-in viewer has read. Absent until they read. */
825
872
  readPosition: conversationReadPositionSchema.optional(),
826
873
  /**
@@ -869,9 +916,14 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
869
916
  sentryConversationUrl: z.string().optional(),
870
917
  sourceTask: conversationSourceTaskSchema.optional()
871
918
  }).strict().superRefine(validateConversationEvents);
919
+ /**
920
+ * A root in the feed, or one of its visible Threads. A Thread nests under
921
+ * its nearest visible Thread ancestor, or under the root. Tasks never show.
922
+ */
923
+ const conversationFeedItemSchema = conversationSummaryReportSchema.extend({ threads: z.lazy(() => z.array(conversationFeedItemSchema)).optional() });
872
924
  const conversationFeedSchema = z.object({
873
- conversations: z.array(conversationSummaryReportSchema),
925
+ conversations: z.array(conversationFeedItemSchema),
874
926
  source: z.literal("conversation_index"),
875
927
  generatedAt: z.string()
876
928
  }).strict();
877
- 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, parseStoredBrief as W, 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 };
929
+ export { reviewItemChangeRecordSchema as A, readMessageAttachments as B, createConversationBodySchema as C, conversationChildAgentTotalsSchema as D, forkConversationResponseSchema as E, removedCardSchema as F, conversationBriefSchema as G, briefLinkSchema as H, resolveMessageCards as I, parseBriefInput as K, MAX_INPUT_IMAGES as L, messageCardRef as M, messageCardText as N, conversationReadPositionSchema as O, readMessageCardRefs as P, MAX_INPUT_IMAGE_BYTES as R, conversationUsageSchema as S, forkConversationBodySchema as T, briefOutcomeStatusSchema as U, briefCodeChangeSchema as V, briefResourceLabel as W, conversationReportEventSchema as _, conversationActivityPreviewSchema as a, conversationSummaryReportSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, conversationEventsQuerySchema as f, conversationReportEventDataSchema as g, conversationParamsSchema as h, actorIdentitySchema as i, annotationCard as j, conversationReadReportSchema as k, conversationDetailReportSchema as l, conversationFeedSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, parseStoredBrief as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventHistorySchema as u, conversationReportMessageEventSchema as v, createConversationMessageBodySchema as w, conversationSurfaceSchema as x, conversationReportStatusSchema as y, messageAttachmentSchema as z };
@@ -1,4 +1,4 @@
1
- import { L as messageAttachmentSchema, O as reviewItemChangeRecordSchema, c as conversationDetailReportSchema, r as actorIdentitySchema } from "./conversation-DdT7SNar.js";
1
+ import { A as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, z as messageAttachmentSchema } from "./conversation-D8kVoCrP.js";
2
2
  import * as z from "zod";
3
3
  // src/reporting-schema.ts
4
4
  const healthReportSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-Qo-7xGp1.js";
1
+ import { h as logWarn } from "./logging-BfORLKoq.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 { Ci as parseOAuthStatePayload, Ji as getSlackClient, On as resolvePluginOAuthAccount, Ri as postSlackMessage, Si as formatProviderLabel, d as recordAuthorizationCompleted, q as getConversationPendingAuth, tt as getTurnRecord, u as recordAuthenticationLinked, wi as resolveBaseUrl, wn as createUserTokenStore } from "./projection-0UcUeuzn.js";
2
- import { m as escapeXml } from "./client-CMyH5rDz.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-Dt3CpG17.js";
4
- import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-Qo-7xGp1.js";
1
+ import { Fi as resolveBaseUrl, J as getConversationPendingAuth, Ni as formatProviderLabel, Pi as parseOAuthStatePayload, Pn as createUserTokenStore, Rn as resolvePluginOAuthAccount, Yi as postSlackMessage, aa as getSlackClient, d as recordAuthorizationCompleted, nt as getTurnRecord, u as recordAuthenticationLinked } from "./projection-DliWYrnT.js";
2
+ import { m as escapeXml } from "./client-DDbBucBw.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-DqFnykQT.js";
4
+ import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BfORLKoq.js";
5
5
  import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
6
- import { B as findUserByVerifiedEmails, C as getSqlExecutor, I as resolveActorIdentityId, W as upsertLinkedIdentity, o as readIdentityById } from "./viewer-BlpnzZZa.js";
6
+ import { C as getSqlExecutor, U as resolveActorIdentityId, Z as upsertLinkedIdentity, o as readIdentityById, q as findUserByVerifiedEmails } from "./viewer-1Ea81s0b.js";
7
7
  import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DOnPkI8g.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-dKOVbR7l.js";
10
- import { t as discoverSkills } from "./skills-CKyotM4g.js";
11
- import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-Cqr21pOU.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-rC7MCxu8.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Bte6jRB2.js";
10
+ import { t as discoverSkills } from "./skills-B22duVJU.js";
11
+ import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-BsWhHe4N.js";
12
12
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
14
- import { _ as getMcpProviderErrorAttributes } from "./service-account-KhZIqXRi.js";
15
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-D6rNGQu9.js";
16
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-CCHPybZP.js";
13
+ import { r as getStateAdapter } from "./adapter-DN5AB4VU.js";
14
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-BI5Wgx22.js";
15
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-CrFk3K_7.js";
16
+ import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-DA4LT9LL.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-D6xxVywK.js";
18
18
  import path from "node:path";
19
19
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./schema-B017enNE.js";
1
+ import "./schema-BUviRAs8.js";
2
2
  import * as z from "zod";
3
3
  import "drizzle-orm";
4
4
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
@@ -52,6 +52,12 @@ type Usage = z.output<typeof usageSchema>;
52
52
  */
53
53
  type AgentTurnUsage = Usage;
54
54
  type ConversationSource = "api" | "internal" | "local" | "plugin" | "event" | "scheduler" | "slack" | "web";
55
+ /**
56
+ * Where a Conversation sits in its tree. A root has no parent. A Thread is a
57
+ * child that people can message. A Task is a child that only its parent
58
+ * messages. A Conversation never changes kind.
59
+ */
60
+ type ConversationKind = "root" | "thread" | "task";
55
61
  type ConversationStatus = "paused" | "failed" | "idle" | "pending" | "running";
56
62
  /** Cumulative duration and usage that one Run reported. */
57
63
  interface ConversationRunMetrics {
@@ -87,9 +93,16 @@ interface Conversation {
87
93
  executionMetrics?: ConversationRunMetrics & {
88
94
  runId?: string;
89
95
  };
96
+ /** Immutable kind. Set when the Conversation is created. */
97
+ kind: ConversationKind;
90
98
  lastActivityAtMs: number;
91
99
  /** Immutable parent Conversation. */
92
100
  parentConversationId?: string;
101
+ /**
102
+ * When a child Conversation was archived for everyone. Only child archive
103
+ * and a person's message write it; `upsertConversation` does not.
104
+ */
105
+ childArchivedAtMs?: number;
93
106
  /** Optional provider coordinates associated with this Conversation. */
94
107
  location?: Location;
95
108
  actor?: StoredSlackActor;
@@ -109,14 +122,17 @@ interface Conversation {
109
122
  * rather than privacy-redacted (`../../../../../policies/data-redaction.md`).
110
123
  */
111
124
  transcriptPurgedAtMs?: number;
125
+ /** When a person stopped this Conversation. Unset when it is not stopped. */
126
+ stoppedAtMs?: number;
112
127
  /** Confirmed Conversation visibility. Undefined means no confirmation exists. */
113
128
  visibility?: ConversationPrivacy;
114
129
  }
115
130
  /** Persist and read durable conversation metadata for reporting surfaces. */
116
131
  interface ConversationStore {
117
- /** Create one Conversation with an immutable parent. */
132
+ /** Create one Conversation with an immutable parent and kind. */
118
133
  createChild(args: {
119
134
  childConversationId: string;
135
+ kind: Exclude<ConversationKind, "root">;
120
136
  parentConversationId: string;
121
137
  nowMs?: number;
122
138
  source?: ConversationSource;
@@ -1,5 +1,5 @@
1
- import "./config-Dt3CpG17.js";
2
- import { p as logException } from "./logging-Qo-7xGp1.js";
1
+ import "./config-DqFnykQT.js";
2
+ import { p as logException } from "./logging-BfORLKoq.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { getTableColumns, sql } from "drizzle-orm";
5
5
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -114,11 +114,17 @@ const juniorConversations = pgTable("junior_conversations", {
114
114
  lastCheckpointAt: timestamptz("last_checkpoint_at"),
115
115
  lastEnqueuedAt: timestamptz("last_enqueued_at"),
116
116
  parentConversationId: text("parent_conversation_id").references(() => juniorConversations.conversationId),
117
+ kind: text("kind").$type(),
118
+ childArchivedAt: timestamptz("child_archived_at"),
117
119
  forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
118
120
  quickQuestionAt: timestamptz("quick_question_at"),
119
121
  rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
120
122
  transcriptPurgedAt: timestamptz("transcript_purged_at"),
121
- /** Latest session stop. Automated input received before it is dropped. */
123
+ /**
124
+ * Set while the Conversation is stopped. Its Watch Events are then saved
125
+ * as Messages that start no Turn. A person's later input, or new work
126
+ * from its parent, clears it.
127
+ */
122
128
  stoppedAt: timestamptz("stopped_at"),
123
129
  durationMs: integer("duration_ms").notNull().default(0),
124
130
  usage: jsonb("usage_json").$type(),
@@ -128,6 +134,8 @@ const juniorConversations = pgTable("junior_conversations", {
128
134
  detailVersion: integer("detail_version").notNull().default(0),
129
135
  legacyArchivedAt: timestamptz("archived_at")
130
136
  }, (table) => [
137
+ check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'thread', 'task')`),
138
+ check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ((${table.kind} = 'root') = (${table.parentConversationId} is null))`),
131
139
  index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
132
140
  index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
133
141
  index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
@@ -1,6 +1,6 @@
1
1
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
2
- import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-Qo-7xGp1.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BpHHhEVp.js";
2
+ import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-BfORLKoq.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D0j_h70R.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
5
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
6
6
  import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
@@ -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-BRTJqumy.js";
2
- import { t as JUNIOR_VERSION } from "./version-i1An1eTS.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DSk8CFvA.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";