@sentry/junior 0.210.2 → 0.212.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 (64) hide show
  1. package/dist/{agent-DruBLdjK.js → agent-Cgc7jAIH.js} +353 -21
  2. package/dist/{agent-hooks-BYZAFpgB.js → agent-hooks-B2Yt2b88.js} +207 -47
  3. package/dist/{agent-runner-Be5K-k2o.js → agent-runner-CkNX-ynf.js} +5 -5
  4. package/dist/api/schema.js +2 -2
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +72 -33
  7. package/dist/{app-gyu3D9Gn.d.ts → app-D4nNdzPG.d.ts} +1 -1
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +32 -32
  10. package/dist/{auth-pause-state-DedOKgr4.js → auth-pause-state-BbcDkPac.js} +6 -6
  11. package/dist/{briefs-CQDK-Dj2.js → briefs-4-OVELML.js} +4 -4
  12. package/dist/{catalog-runtime-Ddk0rxU3.js → catalog-runtime-BvN_lNVo.js} +1 -1
  13. package/dist/{checkpoint-Cto3lP0d.js → checkpoint-EAQ5Xerb.js} +151 -528
  14. package/dist/cli/chat.js +13 -13
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +1 -1
  17. package/dist/cli/plugins.js +3 -3
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.d.ts +1 -1
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{client-Dstl8V7v.js → client-C1KycWNq.js} +2 -2
  22. package/dist/{config-QWyCRQ8L.js → config-C0-PnQoF.js} +2 -2
  23. package/dist/{conversation-AA4R1VUn.js → conversation-CRWntH-A.js} +19 -19
  24. package/dist/{conversation-privacy-BIClFm9b.js → conversation-privacy-BFzYxnTS.js} +1 -1
  25. package/dist/{credential-sync-MFTk0Zba.js → credential-sync-CZz6Vk6X.js} +20 -20
  26. package/dist/{db-D74z7BZH.d.ts → db-Ca9Nt5ci.d.ts} +1 -1
  27. package/dist/{execution-stats-BEax3h2o.js → execution-stats-CoDjBQbE.js} +3 -4
  28. package/dist/{executor-C5onDgaC.js → executor-CaVeGYeA.js} +39 -2
  29. package/dist/instrumentation.js +2 -2
  30. package/dist/{job-queue-Dpfxr7U6.js → job-queue-BhaNX9DL.js} +1 -1
  31. package/dist/{logging-CKkKExae.js → logging-B5-PLvDo.js} +1 -1
  32. package/dist/nitro.d.ts +1 -1
  33. package/dist/nitro.js +3 -3
  34. package/dist/{oauth-callback-server-W_3TiFJo.js → oauth-callback-server-G5q7i0Qp.js} +2 -2
  35. package/dist/{pending-auth-CUOLqzoR.js → pending-auth-CDndLOLO.js} +2 -2
  36. package/dist/{profile-DU-tdAeS.js → profile-BcZ6EBQ4.js} +4 -4
  37. package/dist/{prompt-C1IA4qkj.js → prompt-kRlibHYT.js} +1 -1
  38. package/dist/{registry-BiaaVqDO.js → registry-BIeo1ST6.js} +1 -1
  39. package/dist/{resolve-B178kFFr.js → resolve-BgAZ4KxF.js} +2 -2
  40. package/dist/{runner-CEw5Bd40.js → runner-Cqd0EG3G.js} +10 -10
  41. package/dist/{sandbox-egress-signals-R9n0mBQr.js → sandbox-egress-signals-DrOoklMj.js} +1 -1
  42. package/dist/{schema-CwTeb-BF.js → schema-xHUgeh46.js} +1 -1
  43. package/dist/short-title-CxQHLU3_.js +65 -0
  44. package/dist/{skills-DNxkkZnA.js → skills-DlrAH1on.js} +2 -2
  45. package/dist/{spawn-D_d9fLq3.js → spawn-BtMqHjwx.js} +2 -2
  46. package/dist/{stats-BvEUKgru.js → stats-D5OWazLs.js} +15 -7
  47. package/dist/{store-Det8MQ9g.d.ts → store-DoewL5mG.d.ts} +3 -2
  48. package/dist/{task-queue-DkaL57J_.js → task-queue-C-o2Q4O-.js} +3 -3
  49. package/dist/{task-runner-DDuflo-o.js → task-runner-Mt_TGUBH.js} +8 -8
  50. package/dist/{thread-state-fcmz8adQ.js → thread-state-C81fvhJu.js} +5 -5
  51. package/dist/{turn-execution-BNKloE6i.js → turn-execution-Ruj9SSJU.js} +3 -3
  52. package/dist/{turn-lifecycle-BEcSsBf7.js → turn-lifecycle-xIZNwgaq.js} +1 -1
  53. package/dist/{validation-CgH5VUx2.js → validation-sgYqCVwr.js} +1 -1
  54. package/dist/{version-CS4pJjG8.js → version-BE7Zf9Wx.js} +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/{web-authorization-D2ts7w_1.js → web-authorization-BXrGezGm.js} +1 -1
  57. package/dist/{web-input-Bxb1i41z.js → web-input-FJ7NNJDx.js} +4 -4
  58. package/dist/{work-HzD-98Ng.js → work-DlYdbVfB.js} +9 -9
  59. package/dist/{worker-DWDTNdyB.js → worker-BfxedsTU.js} +5 -5
  60. package/migrations/0042_conversation_metrics.sql +26 -0
  61. package/migrations/meta/0042_snapshot.json +3610 -0
  62. package/migrations/meta/_journal.json +7 -0
  63. package/package.json +5 -5
  64. package/dist/usage-BU5d5wmV.js +0 -175
package/dist/cli/chat.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as executeAgentRun } from "../agent-DruBLdjK.js";
2
- import { t as createAgentRunner } from "../agent-runner-Be5K-k2o.js";
1
+ import { t as executeAgentRun } from "../agent-Cgc7jAIH.js";
2
+ import { t as createAgentRunner } from "../agent-runner-CkNX-ynf.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-BYZAFpgB.js").then((n) => n.t),
105
- import("../catalog-runtime-Ddk0rxU3.js").then((n) => n.t),
106
- import("../validation-CgH5VUx2.js").then((n) => n.r),
107
- import("../agent-hooks-BYZAFpgB.js").then((n) => n.Vt)
104
+ import("../agent-hooks-B2Yt2b88.js").then((n) => n.t),
105
+ import("../catalog-runtime-BvN_lNVo.js").then((n) => n.t),
106
+ import("../validation-sgYqCVwr.js").then((n) => n.r),
107
+ import("../agent-hooks-B2Yt2b88.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-BYZAFpgB.js").then((n) => n.m);
159
+ const { setBriefsConfig } = await import("../agent-hooks-B2Yt2b88.js").then((n) => n.m);
160
160
  setBriefsConfig({ enabled: true });
161
- const { runLocalAgentTurn } = await import("../runner-CEw5Bd40.js");
162
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-W_3TiFJo.js");
161
+ const { runLocalAgentTurn } = await import("../runner-Cqd0EG3G.js");
162
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-G5q7i0Qp.js");
163
163
  const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
164
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-R9n0mBQr.js");
165
- const { bindSpawnAgent } = await import("../spawn-D_d9fLq3.js").then((n) => n.n);
166
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-HzD-98Ng.js").then((n) => n.a);
164
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-DrOoklMj.js");
165
+ const { bindSpawnAgent } = await import("../spawn-BtMqHjwx.js").then((n) => n.n);
166
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-DlYdbVfB.js").then((n) => n.a);
167
167
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
168
- const { processConversationWork } = await import("../worker-DWDTNdyB.js").then((n) => n.n);
168
+ const { processConversationWork } = await import("../worker-BfxedsTU.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-CKkKExae.js";
2
- import { d as parseInlinePluginManifest, f as parsePluginManifest } from "../registry-BiaaVqDO.js";
3
- import { i as parseSkillFile } from "../skills-DNxkkZnA.js";
1
+ import { E as JUNIOR_HEARTBEAT_ROUTE, j as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-B5-PLvDo.js";
2
+ import { d as parseInlinePluginManifest, f as parsePluginManifest } from "../registry-BIeo1ST6.js";
3
+ import { i as parseSkillFile } from "../skills-DlrAH1on.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-CQDK-Dj2.js")).runBriefs(argv);
28
+ return await (await import("../briefs-4-OVELML.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 { Gt as getDb, bt as createPluginLogger, d as setPlugins, f as validatePlugins } from "../agent-hooks-BYZAFpgB.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Ddk0rxU3.js";
3
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-CgH5VUx2.js";
1
+ import { Gt as getDb, bt as createPluginLogger, d as setPlugins, f as validatePlugins } from "../agent-hooks-B2Yt2b88.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-BvN_lNVo.js";
3
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-sgYqCVwr.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-Ddk0rxU3.js";
2
- import { S as disconnectStateAdapter, t as create } from "../profile-DU-tdAeS.js";
3
- import { r as resolve } from "../resolve-B178kFFr.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-BvN_lNVo.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-BcZ6EBQ4.js";
3
+ import { r as resolve } from "../resolve-BgAZ4KxF.js";
4
4
  //#region src/cli/snapshot-create.ts
5
5
  const DEFAULT_RUNTIME = "node22";
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,4 +1,4 @@
1
- import "../db-D74z7BZH.js";
1
+ import "../db-Ca9Nt5ci.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-BI9A1vKA.js";
3
3
  //#region src/cli/upgrade/types.d.ts
4
4
  interface UpgradeIo {
@@ -1,6 +1,6 @@
1
- import { a as getChatConfig } from "../config-QWyCRQ8L.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-C5onDgaC.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-BiaaVqDO.js";
1
+ import { a as getChatConfig } from "../config-C0-PnQoF.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-CaVeGYeA.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-BIeo1ST6.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-CKkKExae.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BIClFm9b.js";
1
+ import { C as withSpan, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, p as normalizeGenAiFinishReason, u as logException } from "./logging-B5-PLvDo.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BFzYxnTS.js";
3
3
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
4
4
  import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
5
5
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { o as resolveGatewayModel, w as toOptionalTrimmed } from "./client-Dstl8V7v.js";
3
- import { f as logWarn } from "./logging-CKkKExae.js";
2
+ import { o as resolveGatewayModel, w as toOptionalTrimmed } from "./client-C1KycWNq.js";
3
+ import { f as logWarn } from "./logging-B5-PLvDo.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
@@ -1,6 +1,24 @@
1
1
  import { c as TURN_REASONING_LEVELS, o as modelProfileSchema } from "./model-profile-CZmVoGdX.js";
2
2
  import { z } from "zod";
3
3
  import { actorSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema } from "@sentry/junior-plugin-api";
4
+ //#region src/usage-schema.ts
5
+ const usageCostSchema = z.object({
6
+ input: z.number().finite().nonnegative().optional(),
7
+ output: z.number().finite().nonnegative().optional(),
8
+ cacheRead: z.number().finite().nonnegative().optional(),
9
+ cacheWrite: z.number().finite().nonnegative().optional(),
10
+ total: z.number().finite().nonnegative().optional()
11
+ }).strict();
12
+ const usageSchema = z.object({
13
+ inputTokens: z.number().int().nonnegative().optional(),
14
+ outputTokens: z.number().int().nonnegative().optional(),
15
+ cachedInputTokens: z.number().int().nonnegative().optional(),
16
+ cacheCreationTokens: z.number().int().nonnegative().optional(),
17
+ reasoningTokens: z.number().int().nonnegative().optional(),
18
+ totalTokens: z.number().int().nonnegative().optional(),
19
+ cost: usageCostSchema.optional()
20
+ }).strict();
21
+ //#endregion
4
22
  //#region src/chat/conversations/provenance.ts
5
23
  /**
6
24
  * Durable message attribution shared by storage and projections.
@@ -438,24 +456,6 @@ const newConversationEventSchema = z.object({
438
456
  createdAtMs: z.number().finite()
439
457
  }).strict();
440
458
  //#endregion
441
- //#region src/usage-schema.ts
442
- const usageCostSchema = z.object({
443
- input: z.number().finite().nonnegative().optional(),
444
- output: z.number().finite().nonnegative().optional(),
445
- cacheRead: z.number().finite().nonnegative().optional(),
446
- cacheWrite: z.number().finite().nonnegative().optional(),
447
- total: z.number().finite().nonnegative().optional()
448
- }).strict();
449
- const usageSchema = z.object({
450
- inputTokens: z.number().int().nonnegative().optional(),
451
- outputTokens: z.number().int().nonnegative().optional(),
452
- cachedInputTokens: z.number().int().nonnegative().optional(),
453
- cacheCreationTokens: z.number().int().nonnegative().optional(),
454
- reasoningTokens: z.number().int().nonnegative().optional(),
455
- totalTokens: z.number().int().nonnegative().optional(),
456
- cost: usageCostSchema.optional()
457
- }).strict();
458
- //#endregion
459
459
  //#region src/chat/briefs/schema.ts
460
460
  /**
461
461
  * Runtime schemas for the Brief record and the generator input. Both cross a
@@ -1159,4 +1159,4 @@ const conversationStatsReportSchema = z.object({
1159
1159
  windowStart: z.string()
1160
1160
  }).strict();
1161
1161
  //#endregion
1162
- export { briefLinkSchema as A, decodeStoredConversationEvent as B, conversationReportEventSchema as C, createConversationBodySchema as D, conversationSummaryReportSchema as E, KNOWN_CONVERSATION_EVENT_TYPES as F, instructionProvenanceFor as G, newConversationEventSchema as H, agentHistoryItemSchema as I, sameActorIdentity as K, conversationEventDataSchema as L, conversationBriefSchema as M, parseBriefInput as N, createConversationMessageBodySchema as O, usageSchema as P, conversationTurnFailureCodeSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, contextProvenance as U, historyReplacementSchema as V, instructionActors as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, briefOutcomeStatusSchema as j, briefCodeChangeSchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, conversationTurnFailureReasonSchema as z };
1162
+ export { briefLinkSchema as A, historyReplacementSchema as B, conversationReportEventSchema as C, createConversationBodySchema as D, conversationSummaryReportSchema as E, agentHistoryItemSchema as F, sameActorIdentity as G, contextProvenance as H, conversationEventDataSchema as I, usageSchema as K, conversationTurnFailureCodeSchema as L, conversationBriefSchema as M, parseBriefInput as N, createConversationMessageBodySchema as O, KNOWN_CONVERSATION_EVENT_TYPES as P, conversationTurnFailureReasonSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, instructionActors as U, newConversationEventSchema as V, instructionProvenanceFor as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, briefOutcomeStatusSchema as j, briefCodeChangeSchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, decodeStoredConversationEvent as z };
@@ -1,4 +1,4 @@
1
- import { f as logWarn } from "./logging-CKkKExae.js";
1
+ import { f as logWarn } from "./logging-B5-PLvDo.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, X 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-DruBLdjK.js";
2
- import { m as escapeXml } from "./client-Dstl8V7v.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-CKkKExae.js";
4
- import { a as getChatConfig, h as normalizeSlackEmojiName, n as botConfig, o as getRuntimeMetadata } from "./config-QWyCRQ8L.js";
1
+ import { N as getMcpProviderErrorAttributes, X 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-Cgc7jAIH.js";
2
+ import { m as escapeXml } from "./client-C1KycWNq.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-B5-PLvDo.js";
4
+ import { a as getChatConfig, h as normalizeSlackEmojiName, n as botConfig, o as getRuntimeMetadata } from "./config-C0-PnQoF.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 { 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-BYZAFpgB.js";
7
+ import { G as isDmChannel, H as getHeaderString, K as normalizeSlackConversationId, Kt as getSqlExecutor, Nt as buildSentryConversationUrl, U as getSlackClient, Wt as getConversationStore, cn as upsertLinkedIdentity, dn as requireSlackDestination, mt as getDashboardConversationLink, o as getPluginSlackConversationLink, sn as upsertIdentity, z as SlackActionError } from "./agent-hooks-B2Yt2b88.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-BiaaVqDO.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Ddk0rxU3.js";
11
- import { t as discoverSkills } from "./skills-DNxkkZnA.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-Cto3lP0d.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-DU-tdAeS.js";
14
- import { Pt as requestConversationWork, c as parseSlackThreadId, d as resolveSlackChannelIdFromThreadId, l as readSlackRawMessageContext, u as resolveSlackChannelIdFromMessage, wt as ensureConversationWake } from "./stats-BvEUKgru.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-CUOLqzoR.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-Be5K-k2o.js";
9
+ import { l as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-BIeo1ST6.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BvN_lNVo.js";
11
+ import { t as discoverSkills } from "./skills-DlrAH1on.js";
12
+ import { B as recordAuthenticationLinked, F as loadProjection, V as recordAuthorizationCompleted, Y as hydrateConversationMessages, ct as recordDeliveredAssistantMessage, d as persistWithRetry, i as abandonTurnRecord, j as commitAcceptedReply, lt as turnHasReply, m as buildTurnErrorResponse, n as loadTurnCheckpoint, o as failTurnRecord, ot as markConversationMessage, r as saveTurnCheckpoint, s as getTurnRecord, tt as buildConversationContext, u as recordTurnSummary } from "./checkpoint-EAQ5Xerb.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-BcZ6EBQ4.js";
14
+ import { Pt as requestConversationWork, c as parseSlackThreadId, d as resolveSlackChannelIdFromThreadId, l as readSlackRawMessageContext, u as resolveSlackChannelIdFromMessage, wt as ensureConversationWake } from "./stats-D5OWazLs.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-CDndLOLO.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-CkNX-ynf.js";
17
17
  import { t as getVercelConversationWorkQueue } from "./vercel-queue-DIkVcfK4.js";
18
- import { a as getTurnRequestDeadline } from "./job-queue-Dpfxr7U6.js";
19
- import { i as resolveTurnSessionRouting, n as scheduleSessionCompletedPluginTasks } from "./task-runner-DDuflo-o.js";
20
- import { n as getTurnLifecycle } from "./turn-lifecycle-BEcSsBf7.js";
21
- import { n as executeTurn, t as AgentRunError } from "./turn-execution-BNKloE6i.js";
22
- import { c as configValueSchema, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-fcmz8adQ.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-DedOKgr4.js";
18
+ import { a as getTurnRequestDeadline } from "./job-queue-BhaNX9DL.js";
19
+ import { i as resolveTurnSessionRouting, n as scheduleSessionCompletedPluginTasks } from "./task-runner-Mt_TGUBH.js";
20
+ import { n as getTurnLifecycle } from "./turn-lifecycle-xIZNwgaq.js";
21
+ import { n as executeTurn, t as AgentRunError } from "./turn-execution-Ruj9SSJU.js";
22
+ import { c as configValueSchema, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-C81fvhJu.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-BbcDkPac.js";
24
24
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
25
- import { n as deleteWebAuthorization } from "./web-authorization-D2ts7w_1.js";
25
+ import { n as deleteWebAuthorization } from "./web-authorization-BXrGezGm.js";
26
26
  import path from "node:path";
27
27
  import { z } from "zod";
28
28
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./store-Det8MQ9g.js";
1
+ import "./store-DoewL5mG.js";
2
2
  import { z } from "zod";
3
3
  import "drizzle-orm/pg-core";
4
4
  import "drizzle-orm/migrator";
@@ -1,7 +1,6 @@
1
- import { f as logWarn } from "./logging-CKkKExae.js";
2
- import { Gt as getDb } from "./agent-hooks-BYZAFpgB.js";
3
- import { s as juniorAutomationExecutions, w as juniorConversations } from "./executor-C5onDgaC.js";
4
- import { n as agentTurnCostUsd, r as agentTurnTotalTokens } from "./usage-BU5d5wmV.js";
1
+ import { f as logWarn } from "./logging-B5-PLvDo.js";
2
+ import { Gt as getDb, nn as agentTurnTotalTokens, tn as agentTurnCostUsd } from "./agent-hooks-B2Yt2b88.js";
3
+ import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor-CaVeGYeA.js";
5
4
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
6
5
  //#region src/api/conversations/aggregate.ts
7
6
  function usageTokenValue(source, field) {
@@ -1,5 +1,5 @@
1
1
  import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
2
- import "./config-QWyCRQ8L.js";
2
+ import "./config-C0-PnQoF.js";
3
3
  import { n as juniorDestinations, r as timestamptz } from "./destinations-BeBiJeEM.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { getTableColumns, sql } from "drizzle-orm";
@@ -249,6 +249,42 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
249
249
  uniqueIndex("junior_conversation_events_idempotency_idx").on(table.conversationId, table.idempotencyKey)
250
250
  ]);
251
251
  //#endregion
252
+ //#region src/db/schema/conversation-metrics.ts
253
+ const CONVERSATION_METRICS = [
254
+ "duration_ms",
255
+ "total_tokens",
256
+ "input_tokens",
257
+ "output_tokens",
258
+ "cached_input_tokens",
259
+ "cache_creation_tokens",
260
+ "reasoning_tokens",
261
+ "cost_usd"
262
+ ];
263
+ /** One metric value for one Conversation Run. */
264
+ const juniorConversationMetrics = pgTable("junior_conversation_metrics", {
265
+ conversationId: text("conversation_id").notNull(),
266
+ runId: text("run_id").notNull(),
267
+ metric: text("metric").$type().notNull(),
268
+ value: doublePrecision("value").notNull(),
269
+ occurredAt: timestamptz("occurred_at").notNull(),
270
+ updatedAt: timestamptz("updated_at").notNull()
271
+ }, (table) => [
272
+ primaryKey({
273
+ name: "junior_conversation_metrics_conversation_id_run_id_metric_pk",
274
+ columns: [
275
+ table.conversationId,
276
+ table.runId,
277
+ table.metric
278
+ ]
279
+ }),
280
+ foreignKey({
281
+ name: "junior_conversation_metrics_conversation_id_junior_conversations_conversation_id_fk",
282
+ columns: [table.conversationId],
283
+ foreignColumns: [juniorConversations.conversationId]
284
+ }),
285
+ index("junior_conversation_metrics_occurred_at_metric_idx").on(table.occurredAt, table.metric)
286
+ ]);
287
+ //#endregion
252
288
  //#region src/db/schema/conversation-briefs.ts
253
289
  /** Append-only Brief versions produced for completed Conversation turns. */
254
290
  const juniorConversationBriefs = pgTable("junior_conversation_briefs", {
@@ -516,6 +552,7 @@ const juniorSqlSchema = {
516
552
  juniorAgentBindings,
517
553
  juniorAgentInvocations,
518
554
  juniorConversationEvents,
555
+ juniorConversationMetrics,
519
556
  juniorConversationBriefs,
520
557
  juniorConversationBindings,
521
558
  juniorConversationParticipants,
@@ -1031,4 +1068,4 @@ function createJuniorSqlExecutor(args) {
1031
1068
  });
1032
1069
  }
1033
1070
  //#endregion
1034
- export { conversationReadColumns as C, juniorArtifacts as D, juniorUsers as E, juniorAttachments as S, juniorIdentities as T, juniorConversationEvents as _, juniorSchedulerRuns as a, juniorCodeChanges as b, juniorStats as c, AGENT_INVOCATION_MAILBOX_STATUSES as d, juniorAgentBindings as f, juniorConversationBriefs as g, juniorConversationBindings as h, juniorWorkspaces as i, juniorEventAutomations as l, juniorConversationParticipants as m, juniorSnapshots as n, juniorSchedulerTasks as o, juniorAgentInvocations as p, juniorWorkspaceRepos as r, juniorAutomationExecutions as s, createJuniorSqlExecutor as t, juniorLocationConfigurations as u, juniorApiTokens as v, juniorConversations as w, juniorCodeRepositories as x, juniorConversationAnnotations as y };
1071
+ export { juniorCodeRepositories as C, juniorIdentities as D, juniorConversations as E, juniorUsers as O, juniorCodeChanges as S, conversationReadColumns as T, CONVERSATION_METRICS as _, juniorSchedulerRuns as a, juniorApiTokens as b, juniorStats as c, AGENT_INVOCATION_MAILBOX_STATUSES as d, juniorAgentBindings as f, juniorConversationBriefs as g, juniorConversationBindings as h, juniorWorkspaces as i, juniorArtifacts as k, juniorEventAutomations as l, juniorConversationParticipants as m, juniorSnapshots as n, juniorSchedulerTasks as o, juniorAgentInvocations as p, juniorWorkspaceRepos as r, juniorAutomationExecutions as s, createJuniorSqlExecutor as t, juniorLocationConfigurations as u, juniorConversationMetrics as v, juniorAttachments as w, juniorConversationAnnotations as x, juniorConversationEvents as y };
@@ -1,6 +1,6 @@
1
- import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-CKkKExae.js";
1
+ import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-B5-PLvDo.js";
2
2
  import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BIClFm9b.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BFzYxnTS.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-QWyCRQ8L.js";
1
+ import { a as getChatConfig } from "./config-C0-PnQoF.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, y as withScope } from "./sentry-CgWZM_kV.js";
2
- import { t as JUNIOR_VERSION } from "./version-CS4pJjG8.js";
2
+ import { t as JUNIOR_VERSION } from "./version-BE7Zf9Wx.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as JuniorDashboardOptions } from "./app-gyu3D9Gn.js";
1
+ import { n as JuniorDashboardOptions } from "./app-D4nNdzPG.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-BI9A1vKA.js";
3
3
  //#region src/nitro.d.ts
4
4
  export type JuniorNitroDashboardOptions = JuniorDashboardOptions;
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-CKkKExae.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-B5-PLvDo.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-Dpfxr7U6.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BhaNX9DL.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-DkaL57J_.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-C-o2Q4O-.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 { X as createUserTokenStore } from "./agent-DruBLdjK.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-MFTk0Zba.js";
1
+ import { X as createUserTokenStore } from "./agent-Cgc7jAIH.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-CZz6Vk6X.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-Cto3lP0d.js";
2
- import { qt as buildDeterministicTurnId } from "./stats-BvEUKgru.js";
1
+ import { g as extractAssistantText, i as abandonTurnRecord } from "./checkpoint-EAQ5Xerb.js";
2
+ import { qt as buildDeterministicTurnId } from "./stats-D5OWazLs.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-Dstl8V7v.js";
2
- import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-CKkKExae.js";
3
- import { a as getChatConfig } from "./config-QWyCRQ8L.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Ddk0rxU3.js";
1
+ import { w as toOptionalTrimmed } from "./client-C1KycWNq.js";
2
+ import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-B5-PLvDo.js";
3
+ import { a as getChatConfig } from "./config-C0-PnQoF.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BvN_lNVo.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 { M as conversationBriefSchema, N as parseBriefInput, j as briefOutcomeStatusSchema } from "./conversation-AA4R1VUn.js";
1
+ import { M as conversationBriefSchema, N as parseBriefInput, j as briefOutcomeStatusSchema } from "./conversation-CRWntH-A.js";
2
2
  import { z } from "zod";
3
3
  //#region src/chat/briefs/generate.ts
4
4
  const MAX_INPUT_CHARS = 6e4;
@@ -1,4 +1,4 @@
1
- import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-CKkKExae.js";
1
+ import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-B5-PLvDo.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-CKkKExae.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-DU-tdAeS.js";
1
+ import { C as withSpan, _ as setSpanAttributes } from "./logging-B5-PLvDo.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-BcZ6EBQ4.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-DruBLdjK.js";
2
- import { S as withLogContext, u as logException, y as setTags } from "./logging-CKkKExae.js";
1
+ import { p as authorizationId } from "./agent-Cgc7jAIH.js";
2
+ import { S as withLogContext, u as logException, y as setTags } from "./logging-B5-PLvDo.js";
3
3
  import { t as credentialContextForActor } from "./context-Bplcgypl.js";
4
- import { Ht as getConversationEventStore, Wt as getConversationStore } from "./agent-hooks-BYZAFpgB.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-Cto3lP0d.js";
6
- import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-CUOLqzoR.js";
7
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DDuflo-o.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BEcSsBf7.js";
9
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-fcmz8adQ.js";
10
- import { d as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, t as completeAuthPauseTurn } from "./auth-pause-state-DedOKgr4.js";
4
+ import { Ht as getConversationEventStore, Wt as getConversationStore } from "./agent-hooks-B2Yt2b88.js";
5
+ import { F as loadProjection, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, ct as recordDeliveredAssistantMessage, d as persistWithRetry, j as commitAcceptedReply, ot as markConversationMessage, r as saveTurnCheckpoint, st as normalizeConversationText, tt as buildConversationContext, ut as upsertConversationMessage } from "./checkpoint-EAQ5Xerb.js";
6
+ import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-CDndLOLO.js";
7
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-Mt_TGUBH.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-xIZNwgaq.js";
9
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-C81fvhJu.js";
10
+ import { d as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, t as completeAuthPauseTurn } from "./auth-pause-state-BbcDkPac.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
@@ -44,7 +44,7 @@ function captureLocalBoundaryFailure(args) {
44
44
  async function loadLocalPiMessages(args) {
45
45
  const projection = await loadProjection({ conversationId: args.conversationId });
46
46
  if (projection.length === 0) return;
47
- return stripRuntimeTurnContext(projection);
47
+ return projection;
48
48
  }
49
49
  /** Run one local CLI message through Junior's shared agent-run boundary. */
50
50
  async function runLocalAgentTurn(input, deps) {
@@ -1,4 +1,4 @@
1
- import { Y as sandboxEgressSignalsResponseSchema } from "./agent-DruBLdjK.js";
1
+ import { Y as sandboxEgressSignalsResponseSchema } from "./agent-Cgc7jAIH.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,5 +1,5 @@
1
1
  import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
2
- import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-AA4R1VUn.js";
2
+ import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-CRWntH-A.js";
3
3
  import "./reporting-schema-DosTN__Q.js";
4
4
  import { z } from "zod";
5
5
  import { codeChangeStateSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
@@ -0,0 +1,65 @@
1
+ import { f as logWarn } from "./logging-B5-PLvDo.js";
2
+ import { n as botConfig } from "./config-C0-PnQoF.js";
3
+ const TITLE_PROMPTS = {
4
+ conversation: [
5
+ "Generate a concise 5-8 word conversation title from the first user message below.",
6
+ "Capture the user's main request.",
7
+ "Reply with ONLY the title, with no quotes or trailing punctuation."
8
+ ],
9
+ task: [
10
+ "Generate a concise 5-8 word task title from the task instruction below.",
11
+ "Capture the task's main purpose.",
12
+ "Reply with ONLY the title, with no quotes or trailing punctuation."
13
+ ]
14
+ };
15
+ /** Collapse whitespace and cap a candidate short title. */
16
+ function normalizeShortTitle(value) {
17
+ return value.replace(/\s+/g, " ").trim().slice(0, 60);
18
+ }
19
+ /**
20
+ * Deterministic display title when no generated title is stored.
21
+ * Uses the first non-empty line of the source text, capped like generated titles.
22
+ */
23
+ function fallbackShortTitle(sourceText, fallback = "Untitled") {
24
+ return normalizeShortTitle(sourceText.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0) ?? "") || fallback;
25
+ }
26
+ /** Generate a short title with the fast model, or return undefined on failure. */
27
+ async function generateShortTitle(args) {
28
+ const sourceText = args.sourceText.trim();
29
+ if (!sourceText) return void 0;
30
+ try {
31
+ return normalizeShortTitle((await args.completeText({
32
+ modelId: botConfig.fastModelId,
33
+ temperature: 0,
34
+ promptName: `junior.${args.kind}_title`,
35
+ messages: [{
36
+ role: "user",
37
+ content: [
38
+ ...TITLE_PROMPTS[args.kind],
39
+ "",
40
+ args.kind === "conversation" ? `First user message: ${sourceText.slice(0, 500)}` : `Task instruction: ${sourceText.slice(0, 500)}`
41
+ ].join("\n"),
42
+ timestamp: Date.now()
43
+ }],
44
+ metadata: { modelId: botConfig.fastModelId }
45
+ })).text) || void 0;
46
+ } catch (error) {
47
+ logWarn(`${args.kind}.title.generation.failed`, { "exception.message": error instanceof Error ? error.message : String(error) });
48
+ return;
49
+ }
50
+ }
51
+ /**
52
+ * Prefer an explicit task title when provided; otherwise generate one from the
53
+ * instruction with the fast model.
54
+ */
55
+ async function resolveTaskTitle(args) {
56
+ const explicit = normalizeShortTitle(args.title ?? "");
57
+ if (explicit) return explicit;
58
+ return generateShortTitle({
59
+ completeText: args.completeText,
60
+ kind: "task",
61
+ sourceText: args.instruction
62
+ });
63
+ }
64
+ //#endregion
65
+ export { generateShortTitle as n, resolveTaskTitle as r, fallbackShortTitle as t };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { f as logWarn } from "./logging-CKkKExae.js";
2
+ import { f as logWarn } from "./logging-B5-PLvDo.js";
3
3
  import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Ddk0rxU3.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BvN_lNVo.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-Be5K-k2o.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-HzD-98Ng.js";
2
+ import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-CkNX-ynf.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-DlYdbVfB.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. */