@sentry/junior 0.207.0 → 0.209.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 (49) hide show
  1. package/dist/{agent-CmQlX68D.js → agent-B_tHeZp6.js} +17 -17
  2. package/dist/{agent-hooks-BBX9p6aG.js → agent-hooks-DDJGkqlR.js} +129 -7
  3. package/dist/{agent-runner-CQD4HKK2.js → agent-runner-CPBSl1Xv.js} +5 -5
  4. package/dist/api.js +15 -15
  5. package/dist/app.js +29 -29
  6. package/dist/{auth-pause-state-uv8on6cT.js → auth-pause-state-BZqtr-GX.js} +6 -6
  7. package/dist/{briefs-BXEmjD9D.js → briefs-ZLRkWQQn.js} +2 -2
  8. package/dist/{catalog-runtime-1BZEOR8J.js → catalog-runtime-D89PJa84.js} +1 -1
  9. package/dist/{checkpoint-B-JO5F3c.js → checkpoint-DBX1KyOb.js} +6 -6
  10. package/dist/cli/chat.js +13 -13
  11. package/dist/cli/check.js +3 -3
  12. package/dist/cli/main.js +1 -1
  13. package/dist/cli/plugins.js +3 -3
  14. package/dist/cli/snapshot-create.js +3 -3
  15. package/dist/cli/upgrade.js +3 -3
  16. package/dist/{client-Bp297GA0.js → client-7_NmRtoz.js} +54 -6
  17. package/dist/{config-G2gv97R1.js → config-BPGL4uP-.js} +5 -5
  18. package/dist/{conversation-privacy-BUfel19D.js → conversation-privacy-CgtRvwq8.js} +1 -1
  19. package/dist/{credential-sync-D04NWqMR.js → credential-sync-DCYT7j8m.js} +20 -20
  20. package/dist/{execution-stats-Ds4bSvam.js → execution-stats-CyehCrCF.js} +4 -4
  21. package/dist/{executor-BZu1Ta06.js → executor-ctvBB7kO.js} +32 -3
  22. package/dist/instrumentation.js +2 -2
  23. package/dist/{job-queue-rnAPfUhP.js → job-queue-C1lIZ7DE.js} +1 -1
  24. package/dist/{logging-Dx0S5k2z.js → logging-CHzH6JFD.js} +1 -1
  25. package/dist/nitro.js +3 -3
  26. package/dist/{oauth-callback-server-xGpwURIj.js → oauth-callback-server-DQvCkP93.js} +2 -2
  27. package/dist/{pending-auth-DIZ4iZjS.js → pending-auth-D6c_jWmW.js} +2 -2
  28. package/dist/{profile-d-fKypxo.js → profile-DPAFjrER.js} +4 -4
  29. package/dist/{registry-CWKdLCTG.js → registry-vUqDWPNS.js} +1 -1
  30. package/dist/{resolve-BhRB1s2A.js → resolve-CToO52ls.js} +2 -2
  31. package/dist/{runner-DNml3owD.js → runner-D3KdCdDY.js} +9 -9
  32. package/dist/{sandbox-egress-signals-DUIl3-gW.js → sandbox-egress-signals-C_zy8cZG.js} +1 -1
  33. package/dist/{skills-D9WesdJJ.js → skills-BszTHE4F.js} +2 -2
  34. package/dist/{spawn-Eh_3-s0M.js → spawn-v7JJowIu.js} +2 -2
  35. package/dist/{stats-CFlUGqVA.js → stats-t0wuykQW.js} +39 -31
  36. package/dist/{task-queue-D8I1_5wP.js → task-queue-TyHaXCpO.js} +3 -3
  37. package/dist/{task-runner-DO79gdho.js → task-runner-DVDa7fAI.js} +7 -7
  38. package/dist/{thread-state-DD6BA4xz.js → thread-state-DB_913ic.js} +5 -5
  39. package/dist/{turn-execution-BSIHxmQJ.js → turn-execution-BRd4mQlB.js} +3 -3
  40. package/dist/{turn-lifecycle-DSBK4Ars.js → turn-lifecycle-CoNJoE-n.js} +1 -1
  41. package/dist/{usage-WRXkNOHp.js → usage-D5t1yT3R.js} +2 -2
  42. package/dist/{validation-BbHZ4r4S.js → validation-sI1EnNoM.js} +1 -1
  43. package/dist/{version-C71UcRWw.js → version-BrgX_LoI.js} +1 -1
  44. package/dist/version.js +1 -1
  45. package/dist/{web-authorization-C73gJV7l.js → web-authorization-BNCTTM5f.js} +1 -1
  46. package/dist/{web-input-Ce1FcNIM.js → web-input-NEbUfS0Q.js} +5 -107
  47. package/dist/{work-BEzDU_2x.js → work-Dv5SHQ4C.js} +9 -9
  48. package/dist/{worker-MK2ubOv-.js → worker-1GzySfPG.js} +15 -10
  49. package/package.json +6 -6
package/dist/cli/chat.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as executeAgentRun } from "../agent-CmQlX68D.js";
2
- import { t as createAgentRunner } from "../agent-runner-CQD4HKK2.js";
1
+ import { t as executeAgentRun } from "../agent-B_tHeZp6.js";
2
+ import { t as createAgentRunner } from "../agent-runner-CPBSl1Xv.js";
3
3
  import { t as loadAppPluginSet } from "../plugin-module-BKGOXca2.js";
4
4
  import path from "node:path";
5
5
  import { createHash, randomUUID } from "node:crypto";
@@ -101,10 +101,10 @@ async function loadLocalPluginSet() {
101
101
  async function configureLocalChatPlugins(pluginSet) {
102
102
  const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
103
103
  import("../plugins-egKWjgue.js").then((n) => n.o),
104
- import("../agent-hooks-BBX9p6aG.js").then((n) => n.t),
105
- import("../catalog-runtime-1BZEOR8J.js").then((n) => n.t),
106
- import("../validation-BbHZ4r4S.js").then((n) => n.r),
107
- import("../agent-hooks-BBX9p6aG.js").then((n) => n.Mt)
104
+ import("../agent-hooks-DDJGkqlR.js").then((n) => n.t),
105
+ import("../catalog-runtime-D89PJa84.js").then((n) => n.t),
106
+ import("../validation-sI1EnNoM.js").then((n) => n.r),
107
+ import("../agent-hooks-DDJGkqlR.js").then((n) => n.Vt)
108
108
  ]);
109
109
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
110
110
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -156,16 +156,16 @@ async function prepareLocalChatRun(io, pluginSet) {
156
156
  await configureLocalChatPlugins(pluginSet);
157
157
  const { setExperimentalFeatures } = await import("../experimental-CIXf7Uye.js").then((n) => n.t);
158
158
  setExperimentalFeatures({ subagents: true });
159
- const { setBriefsConfig } = await import("../agent-hooks-BBX9p6aG.js").then((n) => n.m);
159
+ const { setBriefsConfig } = await import("../agent-hooks-DDJGkqlR.js").then((n) => n.m);
160
160
  setBriefsConfig({ enabled: true });
161
- const { runLocalAgentTurn } = await import("../runner-DNml3owD.js");
162
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-xGpwURIj.js");
161
+ const { runLocalAgentTurn } = await import("../runner-D3KdCdDY.js");
162
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-DQvCkP93.js");
163
163
  const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
164
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-DUIl3-gW.js");
165
- const { bindSpawnAgent } = await import("../spawn-Eh_3-s0M.js").then((n) => n.n);
166
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-BEzDU_2x.js").then((n) => n.a);
164
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-C_zy8cZG.js");
165
+ const { bindSpawnAgent } = await import("../spawn-v7JJowIu.js").then((n) => n.n);
166
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-Dv5SHQ4C.js").then((n) => n.a);
167
167
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
168
- const { processConversationWork } = await import("../worker-MK2ubOv-.js").then((n) => n.n);
168
+ const { processConversationWork } = await import("../worker-1GzySfPG.js").then((n) => n.n);
169
169
  let agentRunner;
170
170
  const localConversationWork = createLocalConversationWork(async (message) => {
171
171
  if (!agentRunner) throw new Error("Local agent runner is not ready");
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { E as JUNIOR_HEARTBEAT_ROUTE, j as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-Dx0S5k2z.js";
2
- import { d as parseInlinePluginManifest, f as parsePluginManifest } from "../registry-CWKdLCTG.js";
3
- import { i as parseSkillFile } from "../skills-D9WesdJJ.js";
1
+ import { E as JUNIOR_HEARTBEAT_ROUTE, j as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-CHzH6JFD.js";
2
+ import { d as parseInlinePluginManifest, f as parsePluginManifest } from "../registry-vUqDWPNS.js";
3
+ import { i as parseSkillFile } from "../skills-BszTHE4F.js";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import path from "node:path";
6
6
  import fs from "node:fs/promises";
package/dist/cli/main.js CHANGED
@@ -25,7 +25,7 @@ async function runChat(argv, pluginSet) {
25
25
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
26
26
  }
27
27
  async function runBriefs(argv) {
28
- return await (await import("../briefs-BXEmjD9D.js")).runBriefs(argv);
28
+ return await (await import("../briefs-ZLRkWQQn.js")).runBriefs(argv);
29
29
  }
30
30
  function topLevelCommand(argv) {
31
31
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,6 +1,6 @@
1
- import { It as getDb, bt as createPluginLogger, d as setPlugins, f as validatePlugins } from "../agent-hooks-BBX9p6aG.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-1BZEOR8J.js";
3
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BbHZ4r4S.js";
1
+ import { Gt as getDb, bt as createPluginLogger, d as setPlugins, f as validatePlugins } from "../agent-hooks-DDJGkqlR.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-D89PJa84.js";
3
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-sI1EnNoM.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-egKWjgue.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-BKGOXca2.js";
6
6
  import { stderr, stdout } from "node:process";
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "../catalog-runtime-1BZEOR8J.js";
2
- import { S as disconnectStateAdapter, t as create } from "../profile-d-fKypxo.js";
3
- import { r as resolve } from "../resolve-BhRB1s2A.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-D89PJa84.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-DPAFjrER.js";
3
+ import { r as resolve } from "../resolve-CToO52ls.js";
4
4
  //#region src/cli/snapshot-create.ts
5
5
  const DEFAULT_RUNTIME = "node22";
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,6 +1,6 @@
1
- import { a as getChatConfig } from "../config-G2gv97R1.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-BZu1Ta06.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-CWKdLCTG.js";
1
+ import { a as getChatConfig } from "../config-BPGL4uP-.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-ctvBB7kO.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-vUqDWPNS.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-egKWjgue.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-BKGOXca2.js";
6
6
  import { fileURLToPath } from "node:url";
@@ -1,5 +1,5 @@
1
- import { C as withSpan, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, p as normalizeGenAiFinishReason, u as logException } from "./logging-Dx0S5k2z.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BUfel19D.js";
1
+ import { C as withSpan, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, p as normalizeGenAiFinishReason, u as logException } from "./logging-CHzH6JFD.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-CgtRvwq8.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";
@@ -302,6 +302,55 @@ registerApiProvider({
302
302
  streamSimple: streamSimpleAnthropic
303
303
  });
304
304
  const GATEWAY_PROVIDER = "vercel-ai-gateway";
305
+ const GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
306
+ const GATEWAY_MODEL_OVERRIDES = {
307
+ "xai/grok-4.5": {
308
+ id: "xai/grok-4.5",
309
+ name: "Grok 4.5",
310
+ api: "anthropic-messages",
311
+ provider: GATEWAY_PROVIDER,
312
+ baseUrl: GATEWAY_BASE_URL,
313
+ reasoning: true,
314
+ input: ["text", "image"],
315
+ cost: {
316
+ input: 2,
317
+ output: 6,
318
+ cacheRead: .3,
319
+ cacheWrite: 0
320
+ },
321
+ contextWindow: 5e5,
322
+ maxTokens: 5e5
323
+ },
324
+ "openai/gpt-6-astra": {
325
+ id: "openai/gpt-6-astra",
326
+ name: "GPT-6 Astra",
327
+ api: "anthropic-messages",
328
+ provider: GATEWAY_PROVIDER,
329
+ baseUrl: GATEWAY_BASE_URL,
330
+ reasoning: true,
331
+ input: ["text", "image"],
332
+ cost: {
333
+ input: 10,
334
+ output: 50,
335
+ cacheRead: 1,
336
+ cacheWrite: 12.5,
337
+ tiers: [{
338
+ inputTokensAbove: 272e3,
339
+ input: 20,
340
+ output: 75,
341
+ cacheRead: 2,
342
+ cacheWrite: 25
343
+ }]
344
+ },
345
+ contextWindow: 105e4,
346
+ maxTokens: 128e3,
347
+ thinkingLevelMap: {
348
+ xhigh: "xhigh",
349
+ max: "max"
350
+ },
351
+ compat: { supportsTemperature: false }
352
+ }
353
+ };
305
354
  const GEN_AI_PROVIDER_NAME = GATEWAY_PROVIDER;
306
355
  const GEN_AI_SERVER_ADDRESS = "ai-gateway.vercel.sh";
307
356
  const GEN_AI_OPERATION_CHAT = "chat";
@@ -325,12 +374,11 @@ function extractText(message) {
325
374
  return (message.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text ?? "").join("").trim();
326
375
  }
327
376
  /**
328
- * Look up a gateway model by id. Throws `Unknown AI Gateway model id: …` if
329
- * the id is not in pi-ai's registry — callers at the config boundary can use
330
- * this to fail fast at startup instead of mid-turn.
377
+ * Look up a gateway model by id. Junior-owned overrides let new gateway
378
+ * models work before pi-ai publishes an updated bundled catalog.
331
379
  */
332
380
  function resolveGatewayModel(modelId) {
333
- const matched = getModels(GATEWAY_PROVIDER).find((model) => model.id === modelId);
381
+ const matched = GATEWAY_MODEL_OVERRIDES[modelId] ?? getModels(GATEWAY_PROVIDER).find((model) => model.id === modelId);
334
382
  if (!matched) throw new Error(`Unknown AI Gateway model id: ${modelId}`);
335
383
  return matched;
336
384
  }
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { o as resolveGatewayModel, w as toOptionalTrimmed } from "./client-Bp297GA0.js";
3
- import { f as logWarn } from "./logging-Dx0S5k2z.js";
2
+ import { o as resolveGatewayModel, w as toOptionalTrimmed } from "./client-7_NmRtoz.js";
3
+ import { f as logWarn } from "./logging-CHzH6JFD.js";
4
4
  import { c as TURN_REASONING_LEVELS, l as parseTurnReasoningLevel, o as modelProfileSchema } from "./model-profile-CZmVoGdX.js";
5
5
  import { getModel } from "@earendil-works/pi-ai/compat";
6
6
  //#region src/chat/slack/emoji.ts
@@ -125,11 +125,11 @@ function parseCrossActorMidRunMode(rawValue) {
125
125
  if (value === "follow_up" || value === "steer") return value;
126
126
  throw new Error("JUNIOR_CROSS_ACTOR_MID_RUN_MODE must be follow_up or steer");
127
127
  }
128
- const DEFAULT_MODEL_ID = getModel("vercel-ai-gateway", "xai/grok-4.5").id;
129
- const DEFAULT_FAST_MODEL_ID = getModel("vercel-ai-gateway", "anthropic/claude-haiku-4.5").id;
128
+ const DEFAULT_MODEL_ID = "xai/grok-4.5";
129
+ const DEFAULT_FAST_MODEL_ID = getModel("vercel-ai-gateway", "openai/gpt-5.6-luna").id;
130
130
  const DEFAULT_GUARDIAN_MODEL_ID = getModel("vercel-ai-gateway", "openai/gpt-5.6-luna").id;
131
131
  const DEFAULT_HANDOFF_MODEL_ID = getModel("vercel-ai-gateway", "openai/gpt-5.6-sol").id;
132
- const DEFAULT_WEB_SEARCH_MODEL_ID = getModel("vercel-ai-gateway", "openai/gpt-5.4").id;
132
+ const DEFAULT_WEB_SEARCH_MODEL_ID = getModel("vercel-ai-gateway", "openai/gpt-5.6-luna").id;
133
133
  const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
134
134
  const DEFAULT_IMAGE_GENERATION_MODEL_ID = "google/gemini-3-pro-image";
135
135
  function validateGatewayModelId(raw) {
@@ -1,4 +1,4 @@
1
- import { f as logWarn } from "./logging-Dx0S5k2z.js";
1
+ import { f as logWarn } from "./logging-CHzH6JFD.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,28 +1,28 @@
1
- import { N as getMcpProviderErrorAttributes, Y as createUserTokenStore, a as deleteMcpAuthSession, d as putMcpStoredOAuthCredentials, h as resolvePluginOAuthAccount, i as finalizeMcpAuthorization, l as getMcpAuthSession, u as getMcpStoredOAuthCredentials, y as lookupSlackUserProfile } from "./agent-CmQlX68D.js";
2
- import { m as escapeXml } from "./client-Bp297GA0.js";
3
- import { L as toOptionalString, S as withLogContext, d as logInfo, f as logWarn, m as runBestEffort, u as logException, y as setTags } from "./logging-Dx0S5k2z.js";
4
- import { a as getChatConfig, h as normalizeSlackEmojiName, n as botConfig, o as getRuntimeMetadata } from "./config-G2gv97R1.js";
1
+ import { N as getMcpProviderErrorAttributes, Y as createUserTokenStore, a as deleteMcpAuthSession, d as putMcpStoredOAuthCredentials, h as resolvePluginOAuthAccount, i as finalizeMcpAuthorization, l as getMcpAuthSession, u as getMcpStoredOAuthCredentials, y as lookupSlackUserProfile } from "./agent-B_tHeZp6.js";
2
+ import { m as escapeXml } from "./client-7_NmRtoz.js";
3
+ import { L as toOptionalString, S as withLogContext, d as logInfo, f as logWarn, m as runBestEffort, u as logException, y as setTags } from "./logging-CHzH6JFD.js";
4
+ import { a as getChatConfig, h as normalizeSlackEmojiName, n as botConfig, o as getRuntimeMetadata } from "./config-BPGL4uP-.js";
5
5
  import { n as defaultModelId } from "./model-profile-CZmVoGdX.js";
6
6
  import { _ as parseSlackMessageTs, g as parseSlackUserId, l as isUserActor, s as createSlackResumeActor } from "./context-Bplcgypl.js";
7
- import { Ft as getConversationStore, G as isDmChannel, H as getHeaderString, Jt as upsertLinkedIdentity, K as normalizeSlackConversationId, Lt as getSqlExecutor, U as getSlackClient, Zt as requireSlackDestination, mt as getDashboardConversationLink, o as getPluginSlackConversationLink, qt as upsertIdentity, wt as buildSentryConversationUrl, z as SlackActionError } from "./agent-hooks-BBX9p6aG.js";
7
+ import { G as isDmChannel, H as getHeaderString, K as normalizeSlackConversationId, Kt as getSqlExecutor, Nt as buildSentryConversationUrl, U as getSlackClient, Wt as getConversationStore, mt as getDashboardConversationLink, nn as upsertIdentity, o as getPluginSlackConversationLink, on as requireSlackDestination, rn as upsertLinkedIdentity, z as SlackActionError } from "./agent-hooks-DDJGkqlR.js";
8
8
  import { i as homeDir } from "./package-discovery-7a9YqLhE.js";
9
- import { l as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-CWKdLCTG.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-1BZEOR8J.js";
11
- import { t as discoverSkills } from "./skills-D9WesdJJ.js";
12
- import { P as commitAcceptedReply, Q as hydrateConversationMessages, R as loadProjection, U as recordAuthenticationLinked, W as recordAuthorizationCompleted, d as persistWithRetry, dt as recordDeliveredAssistantMessage, ft as turnHasReply, i as abandonTurnRecord, it as buildConversationContext, lt as markConversationMessage, m as buildTurnErrorResponse, n as loadTurnCheckpoint, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, u as recordTurnSummary } from "./checkpoint-B-JO5F3c.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-d-fKypxo.js";
14
- import { Pt as requestConversationWork, c as parseSlackThreadId, d as resolveSlackChannelIdFromThreadId, l as readSlackRawMessageContext, u as resolveSlackChannelIdFromMessage, wt as ensureConversationWake } from "./stats-CFlUGqVA.js";
15
- import { a as isPendingAuthLatestRequest, f as CooperativeTurnYieldError, g as isCooperativeTurnYieldError, i as getConversationPendingAuth, r as clearPendingAuth, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-DIZ4iZjS.js";
16
- import { a as parseOAuthStatePayload, c as escapeSlackMrkdwnText, d as normalizeSlackStatusText, f as truncateStatusText, g as removeReactionFromMessage, h as postSlackMessage, i as formatProviderLabel, l as formatSlackLink, o as resolveBaseUrl, p as addReactionToMessage, u as normalizeSlackReplyMarkdown, v as RetryableDeliveryError } from "./agent-runner-CQD4HKK2.js";
9
+ import { l as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-vUqDWPNS.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D89PJa84.js";
11
+ import { t as discoverSkills } from "./skills-BszTHE4F.js";
12
+ import { P as commitAcceptedReply, Q as hydrateConversationMessages, R as loadProjection, U as recordAuthenticationLinked, W as recordAuthorizationCompleted, d as persistWithRetry, dt as recordDeliveredAssistantMessage, ft as turnHasReply, i as abandonTurnRecord, it as buildConversationContext, lt as markConversationMessage, m as buildTurnErrorResponse, n as loadTurnCheckpoint, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, u as recordTurnSummary } from "./checkpoint-DBX1KyOb.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-DPAFjrER.js";
14
+ import { Pt as requestConversationWork, c as parseSlackThreadId, d as resolveSlackChannelIdFromThreadId, l as readSlackRawMessageContext, u as resolveSlackChannelIdFromMessage, wt as ensureConversationWake } from "./stats-t0wuykQW.js";
15
+ import { a as isPendingAuthLatestRequest, f as CooperativeTurnYieldError, g as isCooperativeTurnYieldError, i as getConversationPendingAuth, r as clearPendingAuth, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-D6c_jWmW.js";
16
+ import { a as parseOAuthStatePayload, c as escapeSlackMrkdwnText, d as normalizeSlackStatusText, f as truncateStatusText, g as removeReactionFromMessage, h as postSlackMessage, i as formatProviderLabel, l as formatSlackLink, o as resolveBaseUrl, p as addReactionToMessage, u as normalizeSlackReplyMarkdown, v as RetryableDeliveryError } from "./agent-runner-CPBSl1Xv.js";
17
17
  import { t as getVercelConversationWorkQueue } from "./vercel-queue-DIkVcfK4.js";
18
- import { a as getTurnRequestDeadline } from "./job-queue-rnAPfUhP.js";
19
- import { i as resolveTurnSessionRouting, n as scheduleSessionCompletedPluginTasks } from "./task-runner-DO79gdho.js";
20
- import { n as getTurnLifecycle } from "./turn-lifecycle-DSBK4Ars.js";
21
- import { n as executeTurn, t as AgentRunError } from "./turn-execution-BSIHxmQJ.js";
22
- import { c as configValueSchema, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-DD6BA4xz.js";
23
- import { a as requireTurnFailureEventId, c as getTurnUserMessageId, d as buildDeliveredTurnStatePatch, l as getTurnUserReplyAttachmentContext, n as persistAuthPauseTurnState, o as getInterruptionMarker, r as finalizeFailedTurnReplyWithEvent, s as getTurnUserMessage, u as getTurnUserSlackMessageTs } from "./auth-pause-state-uv8on6cT.js";
18
+ import { a as getTurnRequestDeadline } from "./job-queue-C1lIZ7DE.js";
19
+ import { i as resolveTurnSessionRouting, n as scheduleSessionCompletedPluginTasks } from "./task-runner-DVDa7fAI.js";
20
+ import { n as getTurnLifecycle } from "./turn-lifecycle-CoNJoE-n.js";
21
+ import { n as executeTurn, t as AgentRunError } from "./turn-execution-BRd4mQlB.js";
22
+ import { c as configValueSchema, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-DB_913ic.js";
23
+ import { a as requireTurnFailureEventId, c as getTurnUserMessageId, d as buildDeliveredTurnStatePatch, l as getTurnUserReplyAttachmentContext, n as persistAuthPauseTurnState, o as getInterruptionMarker, r as finalizeFailedTurnReplyWithEvent, s as getTurnUserMessage, u as getTurnUserSlackMessageTs } from "./auth-pause-state-BZqtr-GX.js";
24
24
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
25
- import { n as deleteWebAuthorization } from "./web-authorization-C73gJV7l.js";
25
+ import { n as deleteWebAuthorization } from "./web-authorization-BNCTTM5f.js";
26
26
  import path from "node:path";
27
27
  import { z } from "zod";
28
28
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,7 +1,7 @@
1
- import { f as logWarn } from "./logging-Dx0S5k2z.js";
2
- import { It as getDb } from "./agent-hooks-BBX9p6aG.js";
3
- import { s as juniorAutomationExecutions, w as juniorConversations } from "./executor-BZu1Ta06.js";
4
- import { n as agentTurnCostUsd, r as agentTurnTotalTokens } from "./usage-WRXkNOHp.js";
1
+ import { f as logWarn } from "./logging-CHzH6JFD.js";
2
+ import { Gt as getDb } from "./agent-hooks-DDJGkqlR.js";
3
+ import { s as juniorAutomationExecutions, w as juniorConversations } from "./executor-ctvBB7kO.js";
4
+ import { n as agentTurnCostUsd, r as agentTurnTotalTokens } from "./usage-D5t1yT3R.js";
5
5
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
6
6
  //#region src/api/conversations/aggregate.ts
7
7
  function usageTokenValue(source, field) {
@@ -1,4 +1,5 @@
1
- import "./config-G2gv97R1.js";
1
+ import { h as startSpan } from "./sentry-CD3SdJl-.js";
2
+ import "./config-BPGL4uP-.js";
2
3
  import { n as juniorDestinations, r as timestamptz } from "./destinations-BeBiJeEM.js";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
4
5
  import { getTableColumns, sql } from "drizzle-orm";
@@ -532,6 +533,34 @@ const juniorSqlSchema = {
532
533
  juniorWorkspaces
533
534
  };
534
535
  //#endregion
536
+ //#region src/db/tracing.ts
537
+ const traced = Symbol("junior.db.traced");
538
+ const SQL_OPERATION = /^[\s;]*(ALTER|CALL|CREATE|DELETE|DROP|INSERT|MERGE|SELECT|TRUNCATE|UPDATE)\b/i;
539
+ function operationFromQuery(query) {
540
+ const text = typeof query === "string" ? query : query && typeof query === "object" && "text" in query ? query.text : void 0;
541
+ return typeof text === "string" ? SQL_OPERATION.exec(text)?.[1]?.toUpperCase() : void 0;
542
+ }
543
+ /** Add safe database spans to an owned PostgreSQL query client. */
544
+ function traceQueries(client, driver) {
545
+ if (client[traced]) return client;
546
+ client[traced] = true;
547
+ const query = client.query.bind(client);
548
+ client.query = ((...args) => {
549
+ const operation = operationFromQuery(args[0]);
550
+ return startSpan({
551
+ name: operation ?? "postgresql",
552
+ op: "db.query",
553
+ onlyIfParent: true,
554
+ attributes: {
555
+ "db.system.name": "postgresql",
556
+ ...operation ? { "db.operation.name": operation } : void 0,
557
+ "app.db.driver": driver
558
+ }
559
+ }, () => query(...args));
560
+ });
561
+ return client;
562
+ }
563
+ //#endregion
535
564
  //#region src/db/neon.ts
536
565
  var NeonExecutor = class {
537
566
  pool;
@@ -619,7 +648,7 @@ var NeonExecutor = class {
619
648
  await this.pool.end();
620
649
  }
621
650
  queryClient() {
622
- return this.transactionClient.getStore() ?? this.pool;
651
+ return traceQueries(this.transactionClient.getStore() ?? this.pool, "neon");
623
652
  }
624
653
  };
625
654
  /** Create the shared Neon-backed Junior SQL executor. */
@@ -719,7 +748,7 @@ var PostgresExecutor = class {
719
748
  await this.pool.end();
720
749
  }
721
750
  queryClient() {
722
- return this.transactionClient.getStore() ?? this.pool;
751
+ return traceQueries(this.transactionClient.getStore() ?? this.pool, "postgres");
723
752
  }
724
753
  };
725
754
  /** Create the shared Node Postgres-backed Junior SQL executor. */
@@ -1,6 +1,6 @@
1
- import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-Dx0S5k2z.js";
1
+ import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-CHzH6JFD.js";
2
2
  import { a as getClient, c as init, g as vercelAIIntegration, o as getGlobalScope, y as withStreamedSpan } from "./sentry-CD3SdJl-.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BUfel19D.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-CgtRvwq8.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
5
  //#region src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { a as getChatConfig } from "./config-G2gv97R1.js";
1
+ import { a as getChatConfig } from "./config-BPGL4uP-.js";
2
2
  import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  import { 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, v as withScope } from "./sentry-CD3SdJl-.js";
2
- import { t as JUNIOR_VERSION } from "./version-C71UcRWw.js";
2
+ import { t as JUNIOR_VERSION } from "./version-BrgX_LoI.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";
package/dist/nitro.js CHANGED
@@ -1,9 +1,9 @@
1
- import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-Dx0S5k2z.js";
1
+ import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-CHzH6JFD.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-7a9YqLhE.js";
3
3
  import { n as resolveConversationWorkQueueTopic } from "./vercel-queue-DIkVcfK4.js";
4
- import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-rnAPfUhP.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-C1lIZ7DE.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
6
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-D8I1_5wP.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-TyHaXCpO.js";
7
7
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-BKGOXca2.js";
8
8
  import path from "node:path";
9
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { Y as createUserTokenStore } from "./agent-CmQlX68D.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-D04NWqMR.js";
1
+ import { Y as createUserTokenStore } from "./agent-B_tHeZp6.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DCYT7j8m.js";
3
3
  import { createServer } from "node:http";
4
4
  //#region src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,5 +1,5 @@
1
- import { i as abandonTurnRecord, yt as extractAssistantText } from "./checkpoint-B-JO5F3c.js";
2
- import { Kt as buildDeterministicTurnId } from "./stats-CFlUGqVA.js";
1
+ import { i as abandonTurnRecord, yt as extractAssistantText } from "./checkpoint-DBX1KyOb.js";
2
+ import { qt as buildDeterministicTurnId } from "./stats-t0wuykQW.js";
3
3
  //#region src/chat/runtime/turn.ts
4
4
  /** Classified Slack turn failure carrying the owning Sentry capture outward. */
5
5
  var ConversationTurnBoundaryError = class extends Error {
@@ -1,7 +1,7 @@
1
- import { w as toOptionalTrimmed } from "./client-Bp297GA0.js";
2
- import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-Dx0S5k2z.js";
3
- import { a as getChatConfig } from "./config-G2gv97R1.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-1BZEOR8J.js";
1
+ import { w as toOptionalTrimmed } from "./client-7_NmRtoz.js";
2
+ import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-CHzH6JFD.js";
3
+ import { a as getChatConfig } from "./config-BPGL4uP-.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D89PJa84.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
7
7
  import { createRedisState } from "@chat-adapter/state-redis";
@@ -1,4 +1,4 @@
1
- import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-Dx0S5k2z.js";
1
+ import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-CHzH6JFD.js";
2
2
  import { i as credentialUserSubjectId } from "./context-Bplcgypl.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-7a9YqLhE.js";
4
4
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { C as withSpan, _ as setSpanAttributes } from "./logging-Dx0S5k2z.js";
2
- import { A as sleep, P as SANDBOX_WORKSPACE_ROOT, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-d-fKypxo.js";
1
+ import { C as withSpan, _ as setSpanAttributes } from "./logging-CHzH6JFD.js";
2
+ import { A as sleep, P as SANDBOX_WORKSPACE_ROOT, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-DPAFjrER.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts
@@ -1,13 +1,13 @@
1
- import { p as authorizationId } from "./agent-CmQlX68D.js";
2
- import { S as withLogContext, u as logException, y as setTags } from "./logging-Dx0S5k2z.js";
1
+ import { p as authorizationId } from "./agent-B_tHeZp6.js";
2
+ import { S as withLogContext, u as logException, y as setTags } from "./logging-CHzH6JFD.js";
3
3
  import { t as credentialContextForActor } from "./context-Bplcgypl.js";
4
- import { Ft as getConversationStore, Nt as getConversationEventStore } from "./agent-hooks-BBX9p6aG.js";
5
- import { $ as persistConversationMessages, P as commitAcceptedReply, Q as hydrateConversationMessages, R as loadProjection, W as recordAuthorizationCompleted, d as persistWithRetry, dt as recordDeliveredAssistantMessage, it as buildConversationContext, jt as stripRuntimeTurnContext, lt as markConversationMessage, pt as upsertConversationMessage, r as saveTurnCheckpoint, ut as normalizeConversationText } from "./checkpoint-B-JO5F3c.js";
6
- import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-DIZ4iZjS.js";
7
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DO79gdho.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DSBK4Ars.js";
9
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DD6BA4xz.js";
10
- import { d as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, t as completeAuthPauseTurn } from "./auth-pause-state-uv8on6cT.js";
4
+ import { Ht as getConversationEventStore, Wt as getConversationStore } from "./agent-hooks-DDJGkqlR.js";
5
+ import { $ as persistConversationMessages, P as commitAcceptedReply, Q as hydrateConversationMessages, R as loadProjection, W as recordAuthorizationCompleted, d as persistWithRetry, dt as recordDeliveredAssistantMessage, it as buildConversationContext, jt as stripRuntimeTurnContext, lt as markConversationMessage, pt as upsertConversationMessage, r as saveTurnCheckpoint, ut as normalizeConversationText } from "./checkpoint-DBX1KyOb.js";
6
+ import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-D6c_jWmW.js";
7
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DVDa7fAI.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-CoNJoE-n.js";
9
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DB_913ic.js";
10
+ import { d as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, t as completeAuthPauseTurn } from "./auth-pause-state-BZqtr-GX.js";
11
11
  import { randomUUID } from "node:crypto";
12
12
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
13
13
  //#region src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { J as sandboxEgressSignalsResponseSchema } from "./agent-CmQlX68D.js";
1
+ import { J as sandboxEgressSignalsResponseSchema } from "./agent-B_tHeZp6.js";
2
2
  //#region src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { f as logWarn } from "./logging-Dx0S5k2z.js";
2
+ import { f as logWarn } from "./logging-CHzH6JFD.js";
3
3
  import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-1BZEOR8J.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D89PJa84.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-CQD4HKK2.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-BEzDU_2x.js";
2
+ import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-CPBSl1Xv.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-Dv5SHQ4C.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */