@sentry/junior 0.289.0 → 0.291.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 (65) hide show
  1. package/bin/junior.mjs +19 -15
  2. package/dist/{adapter-tE1wnl0T.js → adapter-zphAlWE2.js} +1 -1
  3. package/dist/{admin-BmsPbmO_.js → admin-B3WR7Y6e.js} +2 -2
  4. package/dist/{agent-runner-bvl8U5uH.js → agent-runner-ke-hOiuv.js} +23 -23
  5. package/dist/api/schema.d.ts +1 -1
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +26 -26
  9. package/dist/{app-Cu454FXq.d.ts → app-C47PT68y.d.ts} +2 -2
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +29 -29
  12. package/dist/{assistant-reply-1N9oxyyb.js → assistant-reply-BV8SZaVd.js} +1 -1
  13. package/dist/{automation-DWbjJltM.js → automation-CrsYnvdV.js} +1 -1
  14. package/dist/{background-compaction-queue-D36oCldp.js → background-compaction-queue-QDH_JS3D.js} +4 -4
  15. package/dist/{briefs-CV-1qkXa.js → briefs-Bdv9BG5J.js} +3 -3
  16. package/dist/{catalog-runtime-BNK4uJVZ.js → catalog-runtime-yGnL9ywD.js} +1 -1
  17. package/dist/cli/chat.js +14 -14
  18. package/dist/cli/check.js +3 -3
  19. package/dist/cli/main.d.ts +5 -0
  20. package/dist/cli/main.js +25 -6
  21. package/dist/cli/plugins.js +4 -4
  22. package/dist/cli/snapshot-create.js +4 -4
  23. package/dist/cli/upgrade.d.ts +1 -1
  24. package/dist/cli/upgrade.js +4 -4
  25. package/dist/{config-DHAy7XlP.js → config-UsaBOQgC.js} +2 -2
  26. package/dist/{connections-C3VmH3cf.js → connections-CePSRCoR.js} +6 -6
  27. package/dist/{conversation-CwC8K3RZ.js → conversation-CtjR1Zcx.js} +7 -1
  28. package/dist/{conversation-pending-messages-B0cuLReP.js → conversation-pending-messages-Cd7ShwBs.js} +1 -1
  29. package/dist/{conversation-privacy-Bky_veSp.js → conversation-privacy-B3wmawmz.js} +1 -1
  30. package/dist/{credential-sync-dY9o0YSj.js → credential-sync-LNRLXZCn.js} +13 -13
  31. package/dist/{db-BebRmhsH.d.ts → db-7glZCI18.d.ts} +2 -2
  32. package/dist/{db-BS2Kql3j.js → db-c__lw9GH.js} +8 -5
  33. package/dist/{executor-cc4nH86C.js → executor-N8-D5Gvv.js} +58 -6
  34. package/dist/instrumentation.js +2 -2
  35. package/dist/{logging-CtCJmt9p.js → logging-DbXHuhac.js} +1 -1
  36. package/dist/{message-C5VuRcP9.js → message-D1MEh8iR.js} +9 -9
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +2 -2
  39. package/dist/{oauth-callback-server-KRrYUZ35.js → oauth-callback-server-DUtqhYwP.js} +2 -2
  40. package/dist/{projection-BFJG58TG.js → projection-D7XadqRY.js} +11 -11
  41. package/dist/{prompt-D15oftoL.js → prompt-CzEV4BF4.js} +4 -4
  42. package/dist/{registry-C_JrgqUz.js → registry-CTtGtXZP.js} +1 -1
  43. package/dist/{resolve-Cn_7JfP-.js → resolve-nUuQ8yyH.js} +3 -3
  44. package/dist/{result-CIbQFLp6.js → result-Cr9tUdfS.js} +8 -8
  45. package/dist/{runner-BwmaMJVO.js → runner-D7NMbBim.js} +8 -8
  46. package/dist/{sandbox-egress-signals-BOQ8gn7i.js → sandbox-egress-signals-BJAyfzOD.js} +1 -1
  47. package/dist/{schema-DQaFSkZZ.d.ts → schema-CC2RxDAV.d.ts} +5 -0
  48. package/dist/{schema-Bptz19Ja.js → schema-CVV5r-qP.js} +3 -3
  49. package/dist/{service-account-CLZfF8O1.js → service-account-CP1oBWTc.js} +3 -3
  50. package/dist/{service-account-AGw_pANb.js → service-account-_ml5D4Tk.js} +3 -3
  51. package/dist/{session-stop-CbzKf7UI.js → session-stop-BbsyIbK2.js} +11 -11
  52. package/dist/{skills-CcAJBquq.js → skills-CayJ8-Bj.js} +2 -2
  53. package/dist/{spawn-BvAk2vTI.js → spawn-CktAopv_.js} +5 -5
  54. package/dist/{stop-BQU4u7la.js → stop-BUzUJuN_.js} +88 -31
  55. package/dist/{store-DE7NJOvQ.js → store-lotbeXq3.js} +3 -3
  56. package/dist/{task-runner-Q_7duP_T.js → task-runner-BinM1l5g.js} +11 -11
  57. package/dist/{turn-failure-response-aWZLfUM8.js → turn-failure-response-DH5nE6HJ.js} +8 -8
  58. package/dist/{validation-BOoPeIJR.js → validation-I0CqX5NC.js} +1 -1
  59. package/dist/{version-Db0MFy61.js → version-C3sVz3bv.js} +1 -1
  60. package/dist/version.js +1 -1
  61. package/dist/{viewer-FFEFu9In.js → viewer-so1MPU10.js} +3 -3
  62. package/dist/{warmup-DDzrA9Gv.js → warmup-BH9HRBCI.js} +20 -26
  63. package/dist/{work-BBJK458E.js → work-Cw6Fzvfz.js} +11 -11
  64. package/dist/{worker-2iU5RFyq.js → worker-qEykG39-.js} +6 -6
  65. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-DHAy7XlP.js";
2
- import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-CtCJmt9p.js";
1
+ import { i as getChatConfig } from "./config-UsaBOQgC.js";
2
+ import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-DbXHuhac.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
5
5
  import * as z from "zod";
@@ -371,7 +371,7 @@ function cacheWarmupCallback() {
371
371
  maxDeliveries: 1,
372
372
  onRejected: logCacheWarmupRejected,
373
373
  run: async (message) => {
374
- const { runCacheWarmup } = await import("./warmup-DDzrA9Gv.js").then((n) => n.o);
374
+ const { runCacheWarmup } = await import("./warmup-BH9HRBCI.js").then((n) => n.o);
375
375
  await runCacheWarmup(message);
376
376
  },
377
377
  skip: () => !getChatConfig().cacheWarmingEnabled,
@@ -560,7 +560,7 @@ function pluginTaskCallback() {
560
560
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
561
561
  onRejected: logPluginTaskQueueMessageRejected,
562
562
  run: async (message) => {
563
- const { processPluginTask } = await import("./task-runner-Q_7duP_T.js").then((n) => n.r);
563
+ const { processPluginTask } = await import("./task-runner-BinM1l5g.js").then((n) => n.r);
564
564
  await processPluginTask(message);
565
565
  },
566
566
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,5 +1,5 @@
1
- import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-D15oftoL.js";
2
- import { G as briefCodeChangeSchema, J as briefResourceLabel, X as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CwC8K3RZ.js";
1
+ import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CzEV4BF4.js";
2
+ import { G as briefCodeChangeSchema, J as briefResourceLabel, X as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CtjR1Zcx.js";
3
3
  import { CLI_USAGE } from "./cli/run.js";
4
4
  import path from "node:path";
5
5
  import * as z from "zod";
@@ -262,7 +262,7 @@ async function parseRunOptions(argv) {
262
262
  * token.
263
263
  */
264
264
  async function configuredBriefModelId() {
265
- const { botConfig } = await import("./config-DHAy7XlP.js").then((n) => n.r);
265
+ const { botConfig } = await import("./config-UsaBOQgC.js").then((n) => n.r);
266
266
  return botConfig.fastModelId;
267
267
  }
268
268
  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-C_JrgqUz.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-CTtGtXZP.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-bvl8U5uH.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-ke-hOiuv.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-BFJG58TG.js").then((n) => n.jn),
103
- import("../catalog-runtime-BNK4uJVZ.js").then((n) => n.t),
104
- import("../validation-BOoPeIJR.js").then((n) => n.r),
105
- import("../db-BS2Kql3j.js").then((n) => n.n)
102
+ import("../projection-D7XadqRY.js").then((n) => n.jn),
103
+ import("../catalog-runtime-yGnL9ywD.js").then((n) => n.t),
104
+ import("../validation-I0CqX5NC.js").then((n) => n.r),
105
+ import("../db-c__lw9GH.js").then((n) => n.n)
106
106
  ]);
107
107
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
108
108
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -152,18 +152,18 @@ function localDevServerUrl() {
152
152
  async function prepareLocalChatRun(io, pluginSet) {
153
153
  defaultStateAdapterForLocalChat();
154
154
  await configureLocalChatPlugins(pluginSet);
155
- const { setBriefsConfig } = await import("../projection-BFJG58TG.js").then((n) => n.Un);
155
+ const { setBriefsConfig } = await import("../projection-D7XadqRY.js").then((n) => n.Un);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-BwmaMJVO.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-KRrYUZ35.js");
157
+ const { runLocalAgentTurn } = await import("../runner-D7NMbBim.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-DUtqhYwP.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-D6xxVywK.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BOQ8gn7i.js");
161
- const { bindSpawnAgent } = await import("../spawn-BvAk2vTI.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-C5VuRcP9.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-CIbQFLp6.js").then((n) => n.i);
164
- const { skipInputAfterConversationStop } = await import("../session-stop-CbzKf7UI.js").then((n) => n.a);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BJAyfzOD.js");
161
+ const { bindSpawnAgent } = await import("../spawn-CktAopv_.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-D1MEh8iR.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-Cr9tUdfS.js").then((n) => n.i);
164
+ const { skipInputAfterConversationStop } = await import("../session-stop-BbsyIbK2.js").then((n) => n.a);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-2iU5RFyq.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-qEykG39-.js").then((n) => n.n);
167
167
  let agentRunner;
168
168
  const localConversationWork = createLocalConversationWork(async (message) => {
169
169
  if (!agentRunner) throw new Error("Local agent runner is not ready");
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-CtCJmt9p.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-C_JrgqUz.js";
3
- import { i as parseSkillFile } from "../skills-CcAJBquq.js";
1
+ import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DbXHuhac.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-CTtGtXZP.js";
3
+ import { i as parseSkillFile } from "../skills-CayJ8-Bj.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs/promises";
6
6
  import { pathToFileURL } from "node:url";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Format a failed CLI command with its cause chain. Drizzle wraps database
3
+ * errors in "Failed query: ...", so the Postgres reason is only in `cause`.
4
+ */
5
+ export declare function formatCliFailure(error: unknown): string;
1
6
  /** Run the packaged CLI entrypoint with plugin command bootstrap enabled. */
2
7
  export declare function runMain(argv: string[], options?: {
3
8
  instrument?: boolean;
package/dist/cli/main.js CHANGED
@@ -1,6 +1,26 @@
1
1
  import { loadCliEnvFiles } from "./env.js";
2
2
  import { runCli } from "./run.js";
3
3
  import { pathToFileURL } from "node:url";
4
+ // src/cli/failure.ts
5
+ const MAX_CAUSE_DEPTH = 5;
6
+ /**
7
+ * Format a failed CLI command with its cause chain. Drizzle wraps database
8
+ * errors in "Failed query: ...", so the Postgres reason is only in `cause`.
9
+ */
10
+ function formatCliFailure(error) {
11
+ const lines = [];
12
+ let current = error;
13
+ while (current !== void 0 && lines.length < MAX_CAUSE_DEPTH) {
14
+ if (!(current instanceof Error)) {
15
+ lines.push(String(current));
16
+ break;
17
+ }
18
+ const code = "code" in current ? current.code : void 0;
19
+ lines.push(typeof code === "string" && code ? `${current.message.trim()} (${code})` : current.message.trim());
20
+ current = current.cause;
21
+ }
22
+ return lines.join("\ncaused by: ");
23
+ }
4
24
  // src/cli/main.ts
5
25
  const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
6
26
  async function flushSentry() {
@@ -25,13 +45,13 @@ async function runChat(argv, pluginSet) {
25
45
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
26
46
  }
27
47
  async function runAdmin(argv) {
28
- return await (await import("../admin-BmsPbmO_.js")).runAdmin(argv);
48
+ return await (await import("../admin-B3WR7Y6e.js")).runAdmin(argv);
29
49
  }
30
50
  async function runServiceAccount(argv) {
31
- return await (await import("../service-account-CLZfF8O1.js")).runServiceAccount(argv);
51
+ return await (await import("../service-account-CP1oBWTc.js")).runServiceAccount(argv);
32
52
  }
33
53
  async function runBriefs(argv) {
34
- return await (await import("../briefs-CV-1qkXa.js")).runBriefs(argv);
54
+ return await (await import("../briefs-Bdv9BG5J.js")).runBriefs(argv);
35
55
  }
36
56
  function topLevelCommand(argv) {
37
57
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -66,10 +86,9 @@ function isDirectCliEntry() {
66
86
  }
67
87
  if (isDirectCliEntry()) runMain(process.argv.slice(2)).catch((error) => {
68
88
  (async () => {
69
- const message = error instanceof Error ? error.message : String(error);
70
- console.error(`junior command failed: ${message}`);
89
+ console.error(`junior command failed: ${formatCliFailure(error)}`);
71
90
  await flushSentry();
72
91
  process.exit(1);
73
92
  })();
74
93
  });
75
- export { runMain };
94
+ export { formatCliFailure, runMain };
@@ -1,7 +1,7 @@
1
- import { Bn as setPlugins, Vn as validatePlugins, Ya as createPluginLogger } from "../projection-BFJG58TG.js";
2
- import { o as getDb } from "../db-BS2Kql3j.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-BNK4uJVZ.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BOoPeIJR.js";
1
+ import { Bn as setPlugins, Vn as validatePlugins, Ya as createPluginLogger } from "../projection-D7XadqRY.js";
2
+ import { o as getDb } from "../db-c__lw9GH.js";
3
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-yGnL9ywD.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-I0CqX5NC.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 { Aa as SANDBOX_RUNTIME, wi as create } from "../projection-BFJG58TG.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-BNK4uJVZ.js";
3
- import { t as disconnectStateAdapter } from "../adapter-tE1wnl0T.js";
4
- import { n as resolve } from "../resolve-Cn_7JfP-.js";
1
+ import { Aa as SANDBOX_RUNTIME, wi as create } from "../projection-D7XadqRY.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-yGnL9ywD.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-zphAlWE2.js";
4
+ import { n as resolve } from "../resolve-nUuQ8yyH.js";
5
5
  // src/cli/snapshot-create.ts
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
7
7
  function progressMessage(phase) {
@@ -1,4 +1,4 @@
1
- import "../db-BebRmhsH.js";
1
+ import "../db-7glZCI18.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,13 +1,13 @@
1
- import { i as getChatConfig } from "../config-DHAy7XlP.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-cc4nH86C.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-C_JrgqUz.js";
1
+ import { i as getChatConfig } from "../config-UsaBOQgC.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-N8-D5Gvv.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-CTtGtXZP.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";
7
7
  import { createHash } from "node:crypto";
8
+ import { readMigrationFiles } from "drizzle-orm/migrator";
8
9
  import { fileURLToPath } from "node:url";
9
10
  import { createJiti } from "jiti";
10
- import { readMigrationFiles } from "drizzle-orm/migrator";
11
11
  // src/db/concurrent-indexes.ts
12
12
  const CONCURRENT_INDEX_MARKER = "-- junior:concurrent-index";
13
13
  const INDEX_STATEMENT = /^CREATE INDEX "([a-z0-9_]+)" ON "([a-z0-9_]+)" .+;$/;
@@ -1,6 +1,6 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-CtCJmt9p.js";
3
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-Bky_veSp.js";
2
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DbXHuhac.js";
3
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-B3wmawmz.js";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import { del, get, put } from "@vercel/blob";
6
6
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
@@ -1,9 +1,9 @@
1
- import { Fi as startOAuthFlow } from "./projection-BFJG58TG.js";
2
- import { n as botConfig } from "./config-DHAy7XlP.js";
3
- import { A as deleteProviderIdentityForUser, k as deleteProviderIdentityForSlackUser, s as getSqlExecutor } from "./db-BS2Kql3j.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-C_JrgqUz.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BNK4uJVZ.js";
6
- import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-bvl8U5uH.js";
1
+ import { Fi as startOAuthFlow } from "./projection-D7XadqRY.js";
2
+ import { n as botConfig } from "./config-UsaBOQgC.js";
3
+ import { A as deleteProviderIdentityForUser, k as deleteProviderIdentityForSlackUser, s as getSqlExecutor } from "./db-c__lw9GH.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-CTtGtXZP.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-yGnL9ywD.js";
6
+ import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-ke-hOiuv.js";
7
7
  import { randomBytes } from "node:crypto";
8
8
  // src/handlers/oauth-html.ts
9
9
  /** Build pre-escaped callback HTML with the shared response security policy. */
@@ -500,7 +500,13 @@ const conversationSummaryReportSchema = z.object({
500
500
  * - there is no known work and the conversation was last seen within 3 hours
501
501
  */
502
502
  isPriority: z.boolean().optional(),
503
- unfinishedWork: z.boolean().optional()
503
+ unfinishedWork: z.boolean().optional(),
504
+ /**
505
+ * True on the conversation feed when a Turn in the conversation or a
506
+ * child waits on a person to finish an authorization that has not
507
+ * expired.
508
+ */
509
+ awaitingAuthorization: z.boolean().optional()
504
510
  }).strict();
505
511
  /** One Event listed on a message that holds several Events. */
506
512
  const conversationReportMessageEventSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { P as reviewItemChangeRecordSchema, U as messageAttachmentSchema, i as actorIdentitySchema, l as conversationDetailReportSchema } from "./conversation-CwC8K3RZ.js";
1
+ import { P as reviewItemChangeRecordSchema, U as messageAttachmentSchema, i as actorIdentitySchema, l as conversationDetailReportSchema } from "./conversation-CtjR1Zcx.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-CtCJmt9p.js";
1
+ import { h as logWarn } from "./logging-DbXHuhac.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 { An as resolvePluginOAuthAccount, En as createUserTokenStore, Ji as postSlackMessage, Mi as formatProviderLabel, Ni as parseOAuthStatePayload, Pi as resolveBaseUrl, Z as getConversationPendingAuth, aa as getSlackClient, d as recordAuthorizationCompleted, ot as getTurnRecord, u as recordAuthenticationLinked } from "./projection-BFJG58TG.js";
2
- import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-DHAy7XlP.js";
3
- import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CtCJmt9p.js";
1
+ import { An as resolvePluginOAuthAccount, En as createUserTokenStore, Ji as postSlackMessage, Mi as formatProviderLabel, Ni as parseOAuthStatePayload, Pi as resolveBaseUrl, Z as getConversationPendingAuth, aa as getSlackClient, d as recordAuthorizationCompleted, ot as getTurnRecord, u as recordAuthenticationLinked } from "./projection-D7XadqRY.js";
2
+ import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-UsaBOQgC.js";
3
+ import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-DbXHuhac.js";
4
4
  import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
5
- import { D as resolveActorIdentityId, F as upsertLinkedIdentity, j as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-BS2Kql3j.js";
5
+ import { D as resolveActorIdentityId, F as upsertLinkedIdentity, j as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-c__lw9GH.js";
6
6
  import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
7
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-C_JrgqUz.js";
8
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BNK4uJVZ.js";
9
- import { t as discoverSkills } from "./skills-CcAJBquq.js";
10
- import { It as wakeAuthorizedTurn, Lt as wakePausedTurn, Yt as deleteWebAuthorization, a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-bvl8U5uH.js";
7
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CTtGtXZP.js";
8
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-yGnL9ywD.js";
9
+ import { t as discoverSkills } from "./skills-CayJ8-Bj.js";
10
+ import { It as wakeAuthorizedTurn, Lt as wakePausedTurn, Yt as deleteWebAuthorization, a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-ke-hOiuv.js";
11
11
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
12
- import { o as readIdentityById } from "./viewer-FFEFu9In.js";
13
- import { r as getStateAdapter } from "./adapter-tE1wnl0T.js";
14
- import { ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-Q_7duP_T.js";
15
- import { _ as getMcpProviderErrorAttributes } from "./service-account-AGw_pANb.js";
16
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-C3VmH3cf.js";
12
+ import { o as readIdentityById } from "./viewer-so1MPU10.js";
13
+ import { r as getStateAdapter } from "./adapter-zphAlWE2.js";
14
+ import { ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-BinM1l5g.js";
15
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-_ml5D4Tk.js";
16
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-CePSRCoR.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,10 +1,10 @@
1
- import "./schema-DQaFSkZZ.js";
1
+ import "./schema-CC2RxDAV.js";
2
2
  import * as z from "zod";
3
3
  import "drizzle-orm";
4
4
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
5
5
  import "drizzle-orm/pg-core";
6
- import "@earendil-works/pi-ai";
7
6
  import "drizzle-orm/migrator";
7
+ import "@earendil-works/pi-ai";
8
8
  import "drizzle-orm/pg-core/session";
9
9
  type ConversationPrivacy = "public" | "private";
10
10
  /** Validated Location associated with a Conversation. */
@@ -1,8 +1,8 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { i as getChatConfig } from "./config-DHAy7XlP.js";
3
- import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-CtCJmt9p.js";
2
+ import { i as getChatConfig } from "./config-UsaBOQgC.js";
3
+ import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-DbXHuhac.js";
4
4
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
5
- import { A as juniorConversations, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-cc4nH86C.js";
5
+ import { A as juniorConversations, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-N8-D5Gvv.js";
6
6
  import { d as historyReplacementSchema, f as newConversationEventSchema, p as encodeHistoryPayload, s as conversationEventDataSchema, u as decodeStoredConversationEvent, y as usageSchema } from "./media-BepyEUNm.js";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -678,10 +678,13 @@ function systemIdentityFromSource(source) {
678
678
  };
679
679
  }
680
680
  /**
681
- * Save the Identity of a Conversation's actor and return its id. Use the
682
- * legacy source system Identity when the Conversation has no actor.
681
+ * Return the root Actor's Identity id. Save the Identity only when the
682
+ * Conversation has none yet. Use the legacy source system Identity when the
683
+ * Conversation has no actor.
683
684
  */
684
685
  async function resolveConversationActorIdentityId(executor, conversation) {
686
+ const [stored] = await executor.db().select({ actorIdentityId: juniorConversations.actorIdentityId }).from(juniorConversations).where(eq(juniorConversations.conversationId, conversation.conversationId)).limit(1);
687
+ if (stored?.actorIdentityId) return stored.actorIdentityId;
685
688
  const actor = actorFromStoredActor(conversation.actor);
686
689
  if (actor) return await resolveActorIdentityId(executor, actor, conversation.updatedAtMs);
687
690
  const fallback = systemIdentityFromSource(conversation.source);
@@ -1,16 +1,15 @@
1
1
  import { _ as withScope } from "./sentry-BRTJqumy.js";
2
- import "./config-DHAy7XlP.js";
3
- import { p as logException } from "./logging-CtCJmt9p.js";
2
+ import "./config-UsaBOQgC.js";
3
+ import { h as logWarn, p as logException } from "./logging-DbXHuhac.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, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
7
7
  import { Pool, neon } from "@neondatabase/serverless";
8
8
  import { drizzle } from "drizzle-orm/neon-serverless";
9
- import { migrate } from "drizzle-orm/neon-serverless/migrator";
10
9
  import { Agent } from "undici";
10
+ import { readMigrationFiles } from "drizzle-orm/migrator";
11
11
  import pg from "pg";
12
12
  import { drizzle as drizzle$1 } from "drizzle-orm/node-postgres";
13
- import { migrate as migrate$1 } from "drizzle-orm/node-postgres/migrator";
14
13
  // src/db/schema/timestamps.ts
15
14
  const timestamptz = (name) => timestamp(name, { withTimezone: true });
16
15
  // src/db/schema/artifacts.ts
@@ -771,6 +770,59 @@ const juniorSqlSchema = {
771
770
  juniorWorkspaceRepos,
772
771
  juniorWorkspaces
773
772
  };
773
+ // src/db/migrate.ts
774
+ const LOCK_TIMEOUT_MS = 5e3;
775
+ const LOCK_ATTEMPTS = 5;
776
+ const LOCK_RETRY_DELAY_MS = 5e3;
777
+ const LOCK_NOT_AVAILABLE = "55P03";
778
+ function isLockTimeout(error) {
779
+ let current = error;
780
+ for (let depth = 0; current instanceof Error && depth < 5; depth += 1) {
781
+ if ("code" in current && current.code === LOCK_NOT_AVAILABLE) return true;
782
+ current = current.cause;
783
+ }
784
+ return false;
785
+ }
786
+ async function retryOnLockTimeout(tag, apply) {
787
+ for (let attempt = 1;; attempt += 1) try {
788
+ await apply();
789
+ return;
790
+ } catch (error) {
791
+ if (attempt >= LOCK_ATTEMPTS || !isLockTimeout(error)) throw error;
792
+ logWarn("db.migration.lock_timeout", {
793
+ "app.db.migration.tag": tag,
794
+ "app.db.migration.attempt": attempt
795
+ });
796
+ await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_DELAY_MS));
797
+ }
798
+ }
799
+ /**
800
+ * Apply pending Drizzle migrations, each in its own transaction.
801
+ *
802
+ * Drizzle's `migrate()` runs every pending migration in one transaction
803
+ * (drizzle-orm#3249), so locks from earlier migrations stay held while later
804
+ * migrations wait for theirs. That can deadlock with live traffic. This keeps
805
+ * Drizzle's journal table and skip rule, so existing databases are unaffected.
806
+ * A migration that waits too long for a lock rolls back and runs again.
807
+ */
808
+ async function applyMigrations(executor, config) {
809
+ const schema = config.migrationsSchema ?? "drizzle";
810
+ const table = `"${schema}"."${config.migrationsTable ?? "__drizzle_migrations"}"`;
811
+ await executor.execute(`CREATE SCHEMA IF NOT EXISTS "${schema}"`);
812
+ await executor.execute(`CREATE TABLE IF NOT EXISTS ${table} (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at bigint)`);
813
+ const [last] = await executor.query(`SELECT created_at::text AS "createdAt" FROM ${table} ORDER BY created_at DESC LIMIT 1`);
814
+ const appliedAt = Number(last?.createdAt ?? 0);
815
+ for (const migration of readMigrationFiles(config)) {
816
+ if (migration.folderMillis <= appliedAt) continue;
817
+ await retryOnLockTimeout(String(migration.folderMillis), async () => {
818
+ await executor.transaction(async () => {
819
+ await executor.execute(`SET LOCAL lock_timeout = ${LOCK_TIMEOUT_MS}`);
820
+ for (const statement of migration.sql) await executor.execute(statement);
821
+ await executor.execute(`INSERT INTO ${table} (hash, created_at) VALUES ($1, $2)`, [migration.hash, migration.folderMillis]);
822
+ });
823
+ });
824
+ }
825
+ }
774
826
  // src/db/neon.ts
775
827
  const POOL_MAX = 10;
776
828
  /**
@@ -894,7 +946,7 @@ var NeonExecutor = class {
894
946
  }
895
947
  }
896
948
  async migrate(config) {
897
- await migrate(drizzle(this.queryClient(), { schema: juniorSqlSchema }), config);
949
+ await applyMigrations(this, config);
898
950
  }
899
951
  async transaction(callback) {
900
952
  const existingClient = this.transactionClient.getStore();
@@ -1011,7 +1063,7 @@ var PostgresExecutor = class {
1011
1063
  }
1012
1064
  }
1013
1065
  async migrate(config) {
1014
- await migrate$1(drizzle$1(this.queryClient(), { schema: juniorSqlSchema }), config);
1066
+ await applyMigrations(this, config);
1015
1067
  }
1016
1068
  async transaction(callback) {
1017
1069
  const existingClient = this.transactionClient.getStore();
@@ -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 { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-CtCJmt9p.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-Bky_veSp.js";
2
+ import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-DbXHuhac.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-B3wmawmz.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-Db0MFy61.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C3sVz3bv.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";
@@ -1,13 +1,13 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { $a as readConversationAccessFromSql, Cn as renderUntrustedTag, Xa as canAccessConversation } from "./projection-BFJG58TG.js";
3
- import { n as botConfig } from "./config-DHAy7XlP.js";
4
- import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-BS2Kql3j.js";
5
- import { dn as actorFromRun, fn as toolInvocationDestination, in as AgentMessageTargetError, nn as AgentMessagePausedError } from "./agent-runner-bvl8U5uH.js";
6
- import { I as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-aWZLfUM8.js";
7
- import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-CbzKf7UI.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-DE7NJOvQ.js";
9
- import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-BBJK458E.js";
10
- import { r as enqueueAgentMessageToParent } from "./result-CIbQFLp6.js";
2
+ import { $a as readConversationAccessFromSql, Cn as renderUntrustedTag, Xa as canAccessConversation } from "./projection-D7XadqRY.js";
3
+ import { n as botConfig } from "./config-UsaBOQgC.js";
4
+ import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-c__lw9GH.js";
5
+ import { dn as actorFromRun, fn as toolInvocationDestination, in as AgentMessageTargetError, nn as AgentMessagePausedError } from "./agent-runner-ke-hOiuv.js";
6
+ import { I as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-DH5nE6HJ.js";
7
+ import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-BbsyIbK2.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-lotbeXq3.js";
9
+ import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-Cw6Fzvfz.js";
10
+ import { r as enqueueAgentMessageToParent } from "./result-Cr9tUdfS.js";
11
11
  // src/chat/agent-invocations/top-level-message.ts
12
12
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
13
  /** Event type of a message from another top-level agent. */
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-Cu454FXq.js";
1
+ import { i as JuniorDashboardOptions } from "./app-C47PT68y.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-CtCJmt9p.js";
1
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-DbXHuhac.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-D36oCldp.js";
3
+ import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-QDH_JS3D.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
5
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
6
6
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { En as createUserTokenStore } from "./projection-BFJG58TG.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-dY9o0YSj.js";
1
+ import { En as createUserTokenStore } from "./projection-D7XadqRY.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-LNRLXZCn.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,19 +1,19 @@
1
1
  import { a as getClient$1, h as startSpan, n as captureMessage, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { A as estimateTextTokens, E as resolveGatewayModel, I as unwrapCurrentInstruction, J as toOptionalTrimmed, L as escapeXml, S as completeObject, T as rerankTexts, i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName, w as embedTexts, x as completeDecision, y as GEN_AI_PROVIDER_NAME } from "./config-DHAy7XlP.js";
3
- import { E as withSpan, G as isRecord$2, K as toOptionalNumber, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, q as toOptionalString, t as buildTurnFailureResponse, x as setSpanStatus, y as setSentryUser } from "./logging-CtCJmt9p.js";
4
- import { t as canExposeConversationPayload } from "./conversation-privacy-Bky_veSp.js";
2
+ import { A as estimateTextTokens, E as resolveGatewayModel, I as unwrapCurrentInstruction, J as toOptionalTrimmed, L as escapeXml, S as completeObject, T as rerankTexts, i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName, w as embedTexts, x as completeDecision, y as GEN_AI_PROVIDER_NAME } from "./config-UsaBOQgC.js";
3
+ import { E as withSpan, G as isRecord$2, K as toOptionalNumber, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, q as toOptionalString, t as buildTurnFailureResponse, x as setSpanStatus, y as setSentryUser } from "./logging-DbXHuhac.js";
4
+ import { t as canExposeConversationPayload } from "./conversation-privacy-B3wmawmz.js";
5
5
  import { c as parseStoredSlackActor, d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, l as toStoredSlackActor, p as parseSlackUserId, s as parseActorUserId } from "./actor-6jsm_v96.js";
6
- import { $ as sameDestination, B as addAgentTurnUsage, D as resolveActorIdentityId, I as bindProviderConversation, M as readUserTimezone, P as saveUserTimezone, W as hasAgentTurnUsage, Z as parseDestination, a as getConversationStore, d as createSqlConversationEventStore, f as eventFromRow, o as getDb, p as withConversationEventLock, q as conversationDetailTouch, r as getConversationEventStore, s as getSqlExecutor, w as startLocationThread, y as createSqlStore } from "./db-BS2Kql3j.js";
7
- import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, a as juniorPushSubscriptions, b as juniorConversationBriefs, f as juniorAutomations, i as juniorWorkspaces, j as juniorIdentities, k as juniorAttachments, l as juniorReviewItems, m as juniorLocationConfigurations, n as juniorSnapshots, o as juniorReviewItemAssignees, r as juniorWorkspaceRepos, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-cc4nH86C.js";
6
+ import { $ as sameDestination, B as addAgentTurnUsage, D as resolveActorIdentityId, I as bindProviderConversation, M as readUserTimezone, P as saveUserTimezone, W as hasAgentTurnUsage, Z as parseDestination, a as getConversationStore, d as createSqlConversationEventStore, f as eventFromRow, o as getDb, p as withConversationEventLock, q as conversationDetailTouch, r as getConversationEventStore, s as getSqlExecutor, w as startLocationThread, y as createSqlStore } from "./db-c__lw9GH.js";
7
+ import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, a as juniorPushSubscriptions, b as juniorConversationBriefs, f as juniorAutomations, i as juniorWorkspaces, j as juniorIdentities, k as juniorAttachments, l as juniorReviewItems, m as juniorLocationConfigurations, n as juniorSnapshots, o as juniorReviewItemAssignees, r as juniorWorkspaceRepos, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-N8-D5Gvv.js";
8
8
  import { _ as instructionProvenanceFor, g as instructionActors, h as contextProvenance, o as agentHistoryItemSchema } from "./media-BepyEUNm.js";
9
- import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-C_JrgqUz.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BNK4uJVZ.js";
11
- import { d as JUNIOR_NATIVE_EVENT_NAMESPACE, f as agentsInstructionsUpdatedEvent, g as renderJuniorNativeConversationEvent, l as completeObject$1, m as authenticationUnlinkedEvent, n as briefEntriesFromReportEvents, o as isEventConversationMessage, p as authenticationLinkedEvent, s as generateBrief, t as BRIEF_PROMPT, u as completeText } from "./prompt-D15oftoL.js";
9
+ import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-CTtGtXZP.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-yGnL9ywD.js";
11
+ import { d as JUNIOR_NATIVE_EVENT_NAMESPACE, f as agentsInstructionsUpdatedEvent, g as renderJuniorNativeConversationEvent, l as completeObject$1, m as authenticationUnlinkedEvent, n as briefEntriesFromReportEvents, o as isEventConversationMessage, p as authenticationLinkedEvent, s as generateBrief, t as BRIEF_PROMPT, u as completeText } from "./prompt-CzEV4BF4.js";
12
12
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, s as readIdentityByIdFromSql } from "./viewer-FFEFu9In.js";
14
- import { a as setStateValues, i as getStateValues, n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-tE1wnl0T.js";
13
+ import { g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, s as readIdentityByIdFromSql } from "./viewer-so1MPU10.js";
14
+ import { a as setStateValues, i as getStateValues, n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-zphAlWE2.js";
15
15
  import { n as isWithinNotificationSchedule, r as notificationScheduleSchema, s as isValidTimeZone, t as DEFAULT_NOTIFICATION_SCHEDULE } from "./schedule-cP0AACm1.js";
16
- import { I as messageCardRef, J as briefResourceLabel, P as reviewItemChangeRecordSchema, R as readMessageCardRefs, W as readMessageAttachments, X as parseBriefInput, Y as conversationBriefSchema, Z as parseStoredBrief, _ as conversationReportEventSchema, v as conversationReportMessageEventSchema } from "./conversation-CwC8K3RZ.js";
16
+ import { I as messageCardRef, J as briefResourceLabel, P as reviewItemChangeRecordSchema, R as readMessageCardRefs, W as readMessageAttachments, X as parseBriefInput, Y as conversationBriefSchema, Z as parseStoredBrief, _ as conversationReportEventSchema, v as conversationReportMessageEventSchema } from "./conversation-CtjR1Zcx.js";
17
17
  import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
18
18
  import path from "node:path";
19
19
  import { isDeepStrictEqual } from "node:util";
@@ -1,7 +1,7 @@
1
- import { C as completeText$1, S as completeObject$1, x as completeDecision$1 } from "./config-DHAy7XlP.js";
2
- import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-CtCJmt9p.js";
3
- import { V as agentTurnCostUsd, r as getConversationEventStore } from "./db-BS2Kql3j.js";
4
- import { X as parseBriefInput, Y as conversationBriefSchema, q as briefOutcomeStatusSchema } from "./conversation-CwC8K3RZ.js";
1
+ import { C as completeText$1, S as completeObject$1, x as completeDecision$1 } from "./config-UsaBOQgC.js";
2
+ import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-DbXHuhac.js";
3
+ import { V as agentTurnCostUsd, r as getConversationEventStore } from "./db-c__lw9GH.js";
4
+ import { X as parseBriefInput, Y as conversationBriefSchema, q as briefOutcomeStatusSchema } from "./conversation-CtjR1Zcx.js";
5
5
  import * as z from "zod";
6
6
  import { conversationEventPresentationSchema, defineConversationEvent } from "@sentry/junior-plugin-api";
7
7
  // src/chat/conversations/structured-events.ts
@@ -1,4 +1,4 @@
1
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-CtCJmt9p.js";
1
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-DbXHuhac.js";
2
2
  import { o as isUserActor, s as parseActorUserId } from "./actor-6jsm_v96.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJhGdS4c.js";
4
4
  import path from "node:path";