@sentry/junior 0.299.0 → 0.300.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 (78) hide show
  1. package/dist/{adapter-AgCNqqsG.js → adapter-S5UkjNK3.js} +5 -4
  2. package/dist/{admin-1VwEXztm.js → admin-UrTniSPO.js} +2 -2
  3. package/dist/{agent-runner-Ciet8_nn.js → agent-runner-bY4_0UPm.js} +508 -203
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +293 -61
  8. package/dist/{app--ky-Eu33.d.ts → app-D-AcIcCV.d.ts} +13 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +57 -219
  11. package/dist/{automation-M3RFJUBf.js → automation-Dw82oQ-h.js} +2 -2
  12. package/dist/{background-compaction-queue-CnimvRdk.js → background-compaction-queue-B6U3060-.js} +8 -4
  13. package/dist/{briefs-CwzvgdCa.js → briefs-DqiwWu-n.js} +3 -3
  14. package/dist/{catalog-runtime-DaBaHY7u.js → catalog-runtime-D1oYNv04.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +5 -5
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +4 -4
  22. package/dist/{config-CAXIpWQb.js → config-9nHoFiJP.js} +39 -8
  23. package/dist/{connections-Dy0hPdUq.js → connections-DZjTN3JC.js} +6 -6
  24. package/dist/{continue-in-slack-DIOjFj76.js → continue-in-slack-Dtv7_U42.js} +6 -6
  25. package/dist/{conversation-fCWD9Az3.js → conversation-Dyjq2CZ8.js} +19 -8
  26. package/dist/{conversation-feed-BPK8vkkZ.js → conversation-feed-CcDxlrlQ.js} +23 -2
  27. package/dist/{conversation-privacy-DUgtRkf8.js → conversation-privacy-D-5HTXjS.js} +1 -1
  28. package/dist/{conversation-turn-DkJB6yMF.js → conversation-turn-Cxl8WZD7.js} +17 -17
  29. package/dist/{credential-sync-RX24Y8aY.js → credential-sync-C49ClwDX.js} +15 -15
  30. package/dist/{db-B07FtU9g.d.ts → db-2resqBh1.d.ts} +1 -1
  31. package/dist/{db-COYOGzYS.js → db-BJNo6fK5.js} +13 -8
  32. package/dist/{executor-BWmAgSyi.js → executor-DBIaOeJ_.js} +9 -4
  33. package/dist/instrumentation.js +14 -5
  34. package/dist/{lineage-D-5jm_oj.js → lineage-0dereG7H.js} +2 -2
  35. package/dist/{logging-DPLEa8Bn.js → logging-BIclibct.js} +1 -1
  36. package/dist/{message-BIHR1yRk.js → message-dkOl-Iii.js} +8 -8
  37. package/dist/{model-input-BPZYH8Nd.js → model-input-CLo9TaUd.js} +4 -4
  38. package/dist/nitro.d.ts +1 -1
  39. package/dist/nitro.js +4 -4
  40. package/dist/{oauth-callback-server-R7qvSzFG.js → oauth-callback-server-WmpjfJgQ.js} +2 -2
  41. package/dist/{plugins-CBW2Prb_.js → plugins-BBX07Jzt.js} +1 -1
  42. package/dist/{projection-DEdP1q6f.js → projection-w_X-zi7v.js} +3742 -3624
  43. package/dist/{prompt-4M98h_tC.js → prompt-B1Xw46-S.js} +4 -4
  44. package/dist/{registry-BTKmKM-r.js → registry-BmP5vnlj.js} +2 -2
  45. package/dist/{resolve-B8hXNVZ3.js → resolve-goo34bJK.js} +3 -3
  46. package/dist/{result-g-XAaOj6.js → result-PVBeU0Wf.js} +9 -9
  47. package/dist/{runner-BlPSA5A8.js → runner-DKrfvNV6.js} +9 -9
  48. package/dist/{sandbox-egress-signals-Pai-MzEY.js → sandbox-egress-signals-DsUcqrI0.js} +1 -1
  49. package/dist/{schema-BNnY_trV.js → schema-C9iNFz5n.js} +20 -16
  50. package/dist/{schema-DbuWR-DN.d.ts → schema-Dns-sTas.d.ts} +219 -6
  51. package/dist/{service-account-BYGZ08DQ.js → service-account-CMAAloAL.js} +3 -3
  52. package/dist/{service-account-9OLNQMyz.js → service-account-CmowamcB.js} +4 -4
  53. package/dist/{session-stop-2XJrcNCy.js → session-stop-BcAXze8a.js} +15 -41
  54. package/dist/{skills-DpBQoeHV.js → skills-DfsazET6.js} +2 -2
  55. package/dist/{slack-conversation-unfurl-BcDIWo67.js → slack-conversation-unfurl-CzQonuWz.js} +7 -7
  56. package/dist/{spawn-09GssFod.js → spawn-C7o0FDDp.js} +6 -6
  57. package/dist/{state-Cufq0_rH.js → state-zSilNpbi.js} +2 -2
  58. package/dist/{statuses-B8mUfghF.js → statuses-Hn-HsOph.js} +86 -2
  59. package/dist/{stop-U7iUrR1g.js → stop-CFOujp8C.js} +2938 -76
  60. package/dist/{store-CSgUTMdv.js → store-Dkeis_8o.js} +9 -9
  61. package/dist/{store-BHiaHCQu.js → store-E3x2Fg_F.js} +5 -5
  62. package/dist/{task-queue-bMNq0clp.js → task-queue-D-hCqdZW.js} +3 -3
  63. package/dist/{task-runner-B__rxwxU.js → task-runner-vohUPLHe.js} +8 -8
  64. package/dist/{thread-context-d0ceWbVT.js → thread-context-BzvdkgI9.js} +8 -8
  65. package/dist/{turn-session-routing-BVZHBFCF.js → turn-session-routing-Bo_LxFum.js} +5 -5
  66. package/dist/{turn-user-message-BEw7acTP.js → turn-user-message-D5RnVmxQ.js} +3 -3
  67. package/dist/{users-BK3dbxZL.js → users-2bggndVg.js} +3 -3
  68. package/dist/{validation-BDVJjO2E.js → validation-BbWikeSa.js} +1 -1
  69. package/dist/{version-DQgZoQ3D.js → version-GVBMW2jA.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-CAWfFo29.js → viewer-BpxRliyO.js} +16 -114
  72. package/dist/{warmup-9ySPacF9.js → warmup-BW2qwnal.js} +18 -16
  73. package/dist/{worker-D8jJO-WO.js → worker-Cbd-iuwZ.js} +24 -20
  74. package/migrations/0107_attachment_deferred_download.sql +2 -0
  75. package/migrations/meta/0107_snapshot.json +4617 -0
  76. package/migrations/meta/_journal.json +7 -0
  77. package/package.json +10 -8
  78. package/dist/media-BAHvgkok.js +0 -85
@@ -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-DPLEa8Bn.js";
3
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DUgtRkf8.js";
2
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-BIclibct.js";
3
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-D-5HTXjS.js";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
6
6
  import * as z from "zod";
@@ -33,7 +33,7 @@ function createMemoryAttachmentStorage() {
33
33
  objects,
34
34
  provider: "memory",
35
35
  async put(input) {
36
- objects.set(input.key, Buffer.from(input.body));
36
+ objects.set(input.key, Buffer.from(await new Response(input.body).arrayBuffer()));
37
37
  },
38
38
  async get(key, range) {
39
39
  const body = objects.get(key);
@@ -122,6 +122,13 @@ function createVercelAttachmentStorage() {
122
122
  };
123
123
  }
124
124
  // src/chat/attachments/storage.ts
125
+ /** Stream bytes that are already in memory to `AttachmentStorage.put`. */
126
+ function bufferBody(data) {
127
+ return new ReadableStream({ start(controller) {
128
+ controller.enqueue(data);
129
+ controller.close();
130
+ } });
131
+ }
125
132
  /** Build the HTTP `Range` request header value for one byte range. */
126
133
  function rangeHeader(range) {
127
134
  return `bytes=${range.start}-${range.end}`;
@@ -199,12 +206,23 @@ function createS3AttachmentStorage(config) {
199
206
  secretAccessKey: config.secretAccessKey,
200
207
  service: "s3"
201
208
  });
209
+ const writeClient = new AwsClient({
210
+ accessKeyId: config.accessKeyId,
211
+ region: config.region,
212
+ retries: 0,
213
+ secretAccessKey: config.secretAccessKey,
214
+ service: "s3"
215
+ });
202
216
  return {
203
217
  provider: "s3",
204
218
  async put(input) {
205
- await expectOk(await client.fetch(objectUrl(config, input.key), {
206
- body: new Uint8Array(input.body),
207
- headers: { "content-type": input.contentType },
219
+ await expectOk(await writeClient.fetch(objectUrl(config, input.key), {
220
+ body: input.body,
221
+ headers: {
222
+ "content-length": String(input.bytes),
223
+ "content-type": input.contentType,
224
+ "x-amz-content-sha256": "UNSIGNED-PAYLOAD"
225
+ },
208
226
  method: "PUT"
209
227
  }), "put");
210
228
  },
@@ -1201,6 +1219,10 @@ async function completeText(params) {
1201
1219
  sessionId: params.sessionId,
1202
1220
  onPayload: (payload) => {
1203
1221
  setSpanAttributes(requestPrefixAttributes(payload));
1222
+ },
1223
+ onResponse: (response) => {
1224
+ const vercelId = response.headers["x-vercel-id"];
1225
+ if (vercelId) setSpanAttributes({ "app.ai.gateway.vercel_id": vercelId });
1204
1226
  }
1205
1227
  });
1206
1228
  } catch (error) {
@@ -1221,7 +1243,8 @@ async function completeText(params) {
1221
1243
  ...outputMessagesAttribute ? { "gen_ai.output.messages": outputMessagesAttribute } : void 0,
1222
1244
  ...usageAttributes,
1223
1245
  ...message.stopReason ? { "gen_ai.response.finish_reasons": [normalizeGenAiFinishReason(message.stopReason)] } : void 0,
1224
- ...message.model ? { "gen_ai.response.model": message.model } : void 0
1246
+ ...message.model ? { "gen_ai.response.model": message.model } : void 0,
1247
+ ...message.responseId ? { "gen_ai.response.id": message.responseId } : void 0
1225
1248
  });
1226
1249
  if (message.stopReason === "error") {
1227
1250
  const providerMessage = message.errorMessage?.trim() || "Unknown provider error";
@@ -1540,6 +1563,7 @@ var config_exports = /* @__PURE__ */ __exportAll({
1540
1563
  resetRuntimeConfig: () => resetRuntimeConfig,
1541
1564
  restoreRuntimeConfig: () => restoreRuntimeConfig,
1542
1565
  setBotModelConfig: () => setBotModelConfig,
1566
+ setBotName: () => setBotName,
1543
1567
  setRuntimeLimits: () => setRuntimeLimits,
1544
1568
  setSlackReactionConfig: () => setSlackReactionConfig,
1545
1569
  snapshotRuntimeConfig: () => snapshotRuntimeConfig
@@ -1858,9 +1882,16 @@ function setBotModelConfig(config) {
1858
1882
  if (config.refusalFallbackModelId !== void 0) botConfig.refusalFallbackModelId = requireModelId("refusalFallbackModelId", config.refusalFallbackModelId, validateGatewayModelId);
1859
1883
  if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
1860
1884
  }
1885
+ /** Apply the bot name from createApp(). It overrides `JUNIOR_BOT_NAME`. */
1886
+ function setBotName(name) {
1887
+ if (name === void 0) return;
1888
+ const trimmed = toOptionalTrimmed(name);
1889
+ if (!trimmed) throw new Error("botName must not be empty");
1890
+ botConfig.userName = trimmed;
1891
+ }
1861
1892
  /** Apply Slack reaction emoji overrides from createApp() options, validating names. */
1862
1893
  function setSlackReactionConfig(overrides) {
1863
1894
  if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
1864
1895
  if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
1865
1896
  }
1866
- export { estimateTextTokens as A, createAssistantProviderError as B, completeText as C, requestPrefixAttributes as D, resolveGatewayModel as E, renderCurrentInstruction as F, isProviderRefusal as G, findProviderError as H, unwrapCurrentInstruction as I, resolveGatewayCredential as J, isProviderRetryError as K, escapeXml as L, COMPACTION_SUMMARY_PREFIX as M, hasCompactedConversationContext as N, estimateMessagesTokens as O, isCompactionSummaryText as P, escapeXmlText as R, completeObject as S, rerankTexts as T, getProviderErrorAttributes as U, createProviderError as V, getProviderErrorUserMessage as W, toOptionalTrimmed as X, getAttachmentStorage as Y, toPiReasoningLevel as _, getRuntimeMetadata as a, GEN_AI_SERVER_ADDRESS as b, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, TURN_REASONING_LEVELS as g, snapshotRuntimeConfig as h, getChatConfig as i, textCharsForTokens as j, estimateRequestOverheadTokens as k, getSlackSigningSecret as l, setSlackReactionConfig as m, botConfig as n, getSlackBotToken as o, setRuntimeLimits as p, getGatewayApiKey as q, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v, embedTexts as w, completeDecision as x, GEN_AI_PROVIDER_NAME as y, ProviderError as z };
1897
+ export { estimateRequestOverheadTokens as A, ProviderError as B, completeObject as C, resolveGatewayModel as D, rerankTexts as E, isCompactionSummaryText as F, getProviderErrorUserMessage as G, createProviderError as H, renderCurrentInstruction as I, getGatewayApiKey as J, isProviderRefusal as K, unwrapCurrentInstruction as L, textCharsForTokens as M, COMPACTION_SUMMARY_PREFIX as N, requestPrefixAttributes as O, hasCompactedConversationContext as P, toOptionalTrimmed as Q, escapeXml as R, completeDecision as S, embedTexts as T, findProviderError as U, createAssistantProviderError as V, getProviderErrorAttributes as W, bufferBody as X, resolveGatewayCredential as Y, getAttachmentStorage as Z, TURN_REASONING_LEVELS as _, getRuntimeMetadata as a, GEN_AI_PROVIDER_NAME as b, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, snapshotRuntimeConfig as g, setSlackReactionConfig as h, getChatConfig as i, estimateTextTokens as j, estimateMessagesTokens as k, getSlackSigningSecret as l, setRuntimeLimits as m, botConfig as n, getSlackBotToken as o, setBotName as p, isProviderRetryError as q, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, toPiReasoningLevel as v, completeText as w, GEN_AI_SERVER_ADDRESS as x, normalizeSlackEmojiName as y, escapeXmlText as z };
@@ -1,9 +1,9 @@
1
- import { la as startOAuthFlow } from "./projection-DEdP1q6f.js";
2
- import { n as botConfig } from "./config-CAXIpWQb.js";
3
- import { F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-COYOGzYS.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-BTKmKM-r.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
6
- import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-Ciet8_nn.js";
1
+ import { ua as startOAuthFlow } from "./projection-w_X-zi7v.js";
2
+ import { n as botConfig } from "./config-9nHoFiJP.js";
3
+ import { F as deleteProviderIdentityForSlackUser, I as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-BJNo6fK5.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-BmP5vnlj.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D1oYNv04.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-bY4_0UPm.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. */
@@ -1,10 +1,10 @@
1
- import { Lt as moveIdleConversationDestination, Oi as getDashboardConversationLink, Vo as readLatestConversationBrief, ba as getSlackMessagePermalink, da as escapeSlackMrkdwnText, fa as formatSlackLink, wa as postSlackMessage, ya as deleteSlackMessage } from "./projection-DEdP1q6f.js";
1
+ import { Lt as moveIdleConversationDestination, Oi as getDashboardConversationLink, Oo as readLatestConversationBrief, Ta as postSlackMessage, ba as deleteSlackMessage, fa as escapeSlackMrkdwnText, pa as formatSlackLink, xa as getSlackMessagePermalink } from "./projection-w_X-zi7v.js";
2
2
  import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
3
- import { G as claimProviderConversation, K as getConversationIdByProviderConversation, a as getConversationStore, k as setFirstConversationLocation, o as getDb, s as getSqlExecutor, x as withConversationMutationLock } from "./db-COYOGzYS.js";
4
- import { P as juniorDestinations } from "./executor-BWmAgSyi.js";
5
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
6
- import "./store-BHiaHCQu.js";
7
- import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-BK3dbxZL.js";
3
+ import { G as claimProviderConversation, K as getConversationIdByProviderConversation, a as getConversationStore, k as setFirstConversationLocation, o as getDb, s as getSqlExecutor, x as withConversationMutationLock } from "./db-BJNo6fK5.js";
4
+ import { P as juniorDestinations } from "./executor-DBIaOeJ_.js";
5
+ import { r as getStateAdapter } from "./adapter-S5UkjNK3.js";
6
+ import "./store-E3x2Fg_F.js";
7
+ import { c as joinPublicChannelForRead, s as checkSlackChannelReadAccess } from "./users-2bggndVg.js";
8
8
  import { and, eq } from "drizzle-orm";
9
9
  // src/chat/slack/continue-in-slack.ts
10
10
  /** Refusal for a move that cannot wait for the active Run. */
@@ -133,27 +133,32 @@ function parseBriefInput(input) {
133
133
  }
134
134
  // src/chat/attachments/input.ts
135
135
  /**
136
- * Largest file that a web Message can carry.
136
+ * Largest file that Junior stores from Slack or the web, or loads into the
137
+ * sandbox.
137
138
  *
138
- * `loadAttachment` reads the whole file into memory before it writes the file
139
- * to the sandbox, and the message request reads each upload once to check it.
140
- * Keep this well below function memory.
139
+ * Every path streams the bytes, so this cap does not depend on function
140
+ * memory. It bounds transfer time and sandbox disk use.
141
141
  */
142
- const MAX_INPUT_ATTACHMENT_BYTES = 26214400;
142
+ const MAX_ATTACHMENT_BYTES = 262144e3;
143
143
  /** Most files on one web Message, as in one Slack message. */
144
144
  const MAX_INPUT_ATTACHMENTS = 10;
145
145
  /** File facts that a browser declares before it uploads the bytes. */
146
146
  const inputFileSchema = z.object({
147
147
  filename: z.string().trim().min(1).max(255),
148
148
  contentType: z.string().trim().toLowerCase().max(127).regex(/^[a-z0-9][\w.+-]*\/[a-z0-9][\w.+-]*$/),
149
- bytes: z.number().int().min(1).max(MAX_INPUT_ATTACHMENT_BYTES)
149
+ bytes: z.number().int().min(1).max(MAX_ATTACHMENT_BYTES)
150
150
  }).strict();
151
151
  /** Safe attachment facts shared by mailbox input and transcript messages. */
152
152
  const messageAttachmentSchema = z.object({
153
153
  id: z.string().min(1),
154
154
  filename: z.string().min(1),
155
155
  contentType: z.string().min(1),
156
- bytes: z.number().int().nonnegative()
156
+ bytes: z.number().int().nonnegative(),
157
+ /**
158
+ * True for a large Slack file that Junior never stores. Each read
159
+ * downloads it from Slack, so it has no preview.
160
+ */
161
+ pending: z.literal(true).optional()
157
162
  }).strict();
158
163
  /** Read attachment metadata without exposing object storage keys or bytes. */
159
164
  function readMessageAttachments(value) {
@@ -359,6 +364,12 @@ const conversationAttachmentParamsSchema = z.object({
359
364
  attachmentId: z.string().min(1),
360
365
  conversationId: z.string().min(1)
361
366
  }).strict();
367
+ const conversationAttachmentQuerySchema = z.object({
368
+ /**
369
+ * Send `Content-Disposition: attachment` even for a type that previews
370
+ * inline, so a same-window download link saves the file.
371
+ */
372
+ download: z.stringbool().optional() }).strict();
362
373
  const conversationDetailQuerySchema = z.object({
363
374
  /** Omit to get the latest three Turns, up to the default page limit. */
364
375
  limit: z.coerce.number().int().min(1).max(1e3).optional(),
@@ -1003,4 +1014,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
1003
1014
  sentryConversationUrl: z.string().optional(),
1004
1015
  sourceTask: conversationSourceTaskSchema.optional()
1005
1016
  }).strict().superRefine(validateConversationEvents);
1006
- export { conversationBriefSchema as $, agentTypeSchema as A, messageCardText as B, createConversationMessageBodySchema as C, conversationChildAgentTotalsSchema as D, idempotencyKeySchema as E, renameConversationResponseSchema as F, MAX_INPUT_ATTACHMENT_BYTES as G, removedCardSchema as H, conversationReadPositionSchema as I, readMessageAttachments as J, inputFileSchema as K, reviewItemChangeRecordSchema as L, CONVERSATION_TITLE_MAX_LENGTH as M, conversationTitleSchema as N, AGENT_TYPES as O, renameConversationBodySchema as P, briefResourceLabel as Q, annotationCard as R, createConversationBodySchema as S, forkConversationResponseSchema as T, resolveMessageCards as U, readMessageCardRefs as V, MAX_INPUT_ATTACHMENTS as W, briefLinkSchema as X, briefCodeChangeSchema as Y, briefOutcomeStatusSchema as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, parseBriefInput as et, conversationEventsQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, formatAgentTypes as j, agentTypeInstructions as k, conversationDetailReportSchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, messageAttachmentSchema as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseStoredBrief as tt, conversationEventHistorySchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, messageCardRef as z };
1017
+ export { briefResourceLabel as $, agentTypeInstructions as A, messageCardRef as B, createConversationBodySchema as C, idempotencyKeySchema as D, forkConversationResponseSchema as E, renameConversationBodySchema as F, MAX_ATTACHMENT_BYTES as G, readMessageCardRefs as H, renameConversationResponseSchema as I, messageAttachmentSchema as J, MAX_INPUT_ATTACHMENTS as K, conversationReadPositionSchema as L, formatAgentTypes as M, CONVERSATION_TITLE_MAX_LENGTH as N, conversationChildAgentTotalsSchema as O, conversationTitleSchema as P, briefOutcomeStatusSchema as Q, reviewItemChangeRecordSchema as R, conversationUsageSchema as S, forkConversationBodySchema as T, removedCardSchema as U, messageCardText as V, resolveMessageCards as W, briefCodeChangeSchema as X, readMessageAttachments as Y, briefLinkSchema as Z, conversationReportEventSchema as _, conversationActivityPreviewSchema as a, conversationSummaryReportSchema as b, conversationAuxiliaryCostsSchema as c, conversationEventHistorySchema as d, conversationBriefSchema as et, conversationEventPageSchema as f, conversationReportEventDataSchema as g, conversationParamsSchema as h, actorIdentitySchema as i, agentTypeSchema as j, AGENT_TYPES as k, conversationDetailQuerySchema as l, conversationFeedQuerySchema as m, CONVERSATION_VERSION_HEADER as n, parseStoredBrief as nt, conversationAttachmentParamsSchema as o, conversationEventsQuerySchema as p, inputFileSchema as q, acceptedConversationMessageSchema as r, conversationAttachmentQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, parseBriefInput as tt, conversationDetailReportSchema as u, conversationReportMessageEventSchema as v, createConversationMessageBodySchema as w, conversationSurfaceSchema as x, conversationReportStatusSchema as y, annotationCard as z };
@@ -1,4 +1,4 @@
1
- import { L as reviewItemChangeRecordSchema, Z as briefOutcomeStatusSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, q as messageAttachmentSchema, y as conversationSummaryReportSchema } from "./conversation-fCWD9Az3.js";
1
+ import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-Dyjq2CZ8.js";
2
2
  import * as z from "zod";
3
3
  // src/api/objects/cards.ts
4
4
  const MAX_LABEL_CHARS = 256;
@@ -83,6 +83,27 @@ function messageObjectCard(args) {
83
83
  }
84
84
  };
85
85
  }
86
+ /**
87
+ * Build the card of one public web page from its oEmbed fields or meta
88
+ * tags. `thumbnailUrl` must be a Junior image path.
89
+ */
90
+ function webPageObjectCard(args) {
91
+ return {
92
+ kind: "object",
93
+ objectType: "web_page",
94
+ key: args.url.slice(0, 256),
95
+ label: truncate(args.title, MAX_LABEL_CHARS),
96
+ title: truncate(args.title, 512),
97
+ url: args.url,
98
+ ...args.description ? { description: truncate(args.description, MAX_SNIPPET_CHARS) } : void 0,
99
+ facts: {
100
+ type: "web_page",
101
+ ...args.siteName ? { siteName: truncate(args.siteName, MAX_FACT_CHARS) } : void 0,
102
+ ...args.author ? { author: truncate(args.author, MAX_FACT_CHARS) } : void 0,
103
+ ...args.thumbnailUrl ? { thumbnailUrl: args.thumbnailUrl } : void 0
104
+ }
105
+ };
106
+ }
86
107
  // src/reporting-schema.ts
87
108
  const healthReportSchema = z.object({
88
109
  status: z.literal("ok"),
@@ -288,4 +309,4 @@ const conversationFeedSchema = z.object({
288
309
  /** Present when older conversations follow this page. */
289
310
  nextCursor: z.string().optional()
290
311
  }).strict();
291
- export { skillReportsSchema as C, personObjectCard as E, skillReportSchema as S, messageObjectCard as T, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, conversationObjectCard as w, skillDetailReportSchema as x, pluginsSchema as y };
312
+ export { skillReportsSchema as C, webPageObjectCard as D, personObjectCard as E, skillReportSchema as S, messageObjectCard as T, pluginPackageContentReportSchema as _, conversationDetailWithMailboxReportSchema as a, runtimeInfoReportSchema as b, conversationPendingMessageSchema as c, steerConversationPendingMessagesBodySchema as d, steerConversationPendingMessagesResponseSchema as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, cancelConversationPendingMessagesResponseSchema as i, conversationPendingMessagesReportSchema as l, pluginOperationalReportFeedSchema as m, conversationFeedSchema as n, conversationPendingAuthorizationSchema as o, healthReportSchema as p, cancelConversationPendingMessagesBodySchema as r, conversationPendingMessageDeliverySchema as s, conversationFeedBriefSchema as t, conversationUnchangedDetailWithMailboxSchema as u, pluginSchema as v, conversationObjectCard as w, skillDetailReportSchema as x, pluginsSchema as y };
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-DPLEa8Bn.js";
1
+ import { h as logWarn } from "./logging-BIclibct.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,22 +1,22 @@
1
1
  import { i as getActiveSpan, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { A as latestConversationMessageSeq, Ei as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-DEdP1q6f.js";
3
- import { n as botConfig } from "./config-CAXIpWQb.js";
4
- import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-DPLEa8Bn.js";
5
- import { C as isPersonInput, E as turnBehavior, a as getConversationStore, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-COYOGzYS.js";
6
- import { j as juniorConversations } from "./executor-BWmAgSyi.js";
2
+ import { A as latestConversationMessageSeq, Ei as verifyTimerWatchCredentialSubject, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-w_X-zi7v.js";
3
+ import { n as botConfig } from "./config-9nHoFiJP.js";
4
+ import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-BIclibct.js";
5
+ import { C as isPersonInput, E as turnBehavior, a as getConversationStore, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-BJNo6fK5.js";
6
+ import { j as juniorConversations } from "./executor-DBIaOeJ_.js";
7
7
  import { p as instructionProvenanceFor } from "./history-IjdmO_r6.js";
8
- import { f as credentialContextForActor } from "./registry-BTKmKM-r.js";
9
- import { i as measureTurnCompactionWait, lt as resolveConversationDestination } from "./agent-runner-Ciet8_nn.js";
10
- import { o as isEventConversationMessage } from "./prompt-4M98h_tC.js";
11
- import { J as readMessageAttachments } from "./conversation-fCWD9Az3.js";
12
- import { A as turnInputFactsFromConversationMessage, F as isEventMailboxMetadata, I as renderEventBatchInputs, L as timerWatchCredentialSubject, P as eventBatchMessageMeta, X as maybePostAutomatedTurnLimitNotice, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as legacyWebMailboxMetadataSchema, k as sourceFromTurnInput, m as instructionForInputs, nt as recordFinishedTurnForAutomatedLimit, p as instructionActorFor, s as eventReviewItemInputs, w as getEventBatchDelayMs } from "./session-stop-2XJrcNCy.js";
13
- import { Et as executeTurn, L as readParentMessage, M as childAgentTurnOptions, N as isParentMessageMeta, St as createWebAuthorization, Tt as AgentRunError, Y as completeCancelledConversationTurn, dt as supersedeOpenMailboxTurns } from "./warmup-9ySPacF9.js";
14
- import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-BEw7acTP.js";
15
- import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-BVZHBFCF.js";
16
- import { H as blockEventAutomation, M as blockScheduledAutomation, c as getDispatchRecord, o as getDispatchIdForConversation, v as notifyAutomationBlocked, x as readAutomationExecutionByConversationId } from "./store-CSgUTMdv.js";
17
- import { t as readConversationLineage } from "./lineage-D-5jm_oj.js";
18
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-d0ceWbVT.js";
19
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-B__rxwxU.js";
8
+ import { f as credentialContextForActor } from "./registry-BmP5vnlj.js";
9
+ import { dt as resolveConversationDestination, i as measureTurnCompactionWait } from "./agent-runner-bY4_0UPm.js";
10
+ import { o as isEventConversationMessage } from "./prompt-B1Xw46-S.js";
11
+ import { Y as readMessageAttachments } from "./conversation-Dyjq2CZ8.js";
12
+ import { A as turnInputFactsFromConversationMessage, F as isEventMailboxMetadata, I as renderEventBatchInputs, L as timerWatchCredentialSubject, P as eventBatchMessageMeta, X as maybePostAutomatedTurnLimitNotice, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as legacyWebMailboxMetadataSchema, k as sourceFromTurnInput, m as instructionForInputs, nt as recordFinishedTurnForAutomatedLimit, p as instructionActorFor, s as eventReviewItemInputs, w as getEventBatchDelayMs } from "./session-stop-BcAXze8a.js";
13
+ import { Et as executeTurn, L as readParentMessage, M as childAgentTurnOptions, N as isParentMessageMeta, St as createWebAuthorization, Tt as AgentRunError, Y as completeCancelledConversationTurn, dt as supersedeOpenMailboxTurns } from "./warmup-BW2qwnal.js";
14
+ import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-D5RnVmxQ.js";
15
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-Bo_LxFum.js";
16
+ import { H as blockEventAutomation, M as blockScheduledAutomation, c as getDispatchRecord, o as getDispatchIdForConversation, v as notifyAutomationBlocked, x as readAutomationExecutionByConversationId } from "./store-Dkeis_8o.js";
17
+ import { t as readConversationLineage } from "./lineage-0dereG7H.js";
18
+ import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BzvdkgI9.js";
19
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-vohUPLHe.js";
20
20
  import { isDeepStrictEqual } from "node:util";
21
21
  import { createHash } from "node:crypto";
22
22
  import { and, eq, isNotNull, isNull } from "drizzle-orm";
@@ -1,21 +1,21 @@
1
- import { Fa as getSlackClient, Z as getConversationPendingAuth, Zn as createUserTokenStore, ca as resolveBaseUrl, d as recordAuthorizationCompleted, oa as formatProviderLabel, sa as parseOAuthStatePayload, st as getTurnRecord, tr as resolvePluginOAuthAccount, u as recordAuthenticationLinked, wa as postSlackMessage } from "./projection-DEdP1q6f.js";
2
- import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-CAXIpWQb.js";
3
- import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-DPLEa8Bn.js";
1
+ import { Jo as getSlackClient, Ta as postSlackMessage, Z as getConversationPendingAuth, Zn as createUserTokenStore, ca as parseOAuthStatePayload, d as recordAuthorizationCompleted, la as resolveBaseUrl, sa as formatProviderLabel, st as getTurnRecord, tr as resolvePluginOAuthAccount, u as recordAuthenticationLinked } from "./projection-w_X-zi7v.js";
2
+ import { R as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-9nHoFiJP.js";
3
+ import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BIclibct.js";
4
4
  import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
5
- import { L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, s as getSqlExecutor } from "./db-COYOGzYS.js";
6
- import { r as getStateAdapter, s as acquireActiveLock } from "./adapter-AgCNqqsG.js";
5
+ import { L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, s as getSqlExecutor } from "./db-BJNo6fK5.js";
6
+ import { r as getStateAdapter, s as acquireActiveLock } from "./adapter-S5UkjNK3.js";
7
7
  import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BTKmKM-r.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
10
- import { t as discoverSkills } from "./skills-DpBQoeHV.js";
11
- import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession } from "./agent-runner-Ciet8_nn.js";
12
- import { o as readIdentityById } from "./viewer-CAWfFo29.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BmP5vnlj.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D1oYNv04.js";
10
+ import { t as discoverSkills } from "./skills-DfsazET6.js";
11
+ import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession } from "./agent-runner-bY4_0UPm.js";
12
+ import { o as readIdentityById } from "./viewer-BpxRliyO.js";
13
13
  import { t as readJuniorSecret } from "./secrets-DebYU866.js";
14
- import { Ct as deleteWebAuthorization, gt as wakePausedTurn, ht as wakeAuthorizedTurn } from "./warmup-9ySPacF9.js";
15
- import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-BVZHBFCF.js";
16
- import { _ as getMcpProviderErrorAttributes } from "./service-account-9OLNQMyz.js";
17
- import { r as lookupSlackUserProfile } from "./users-BK3dbxZL.js";
18
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-Dy0hPdUq.js";
14
+ import { Ct as deleteWebAuthorization, gt as wakePausedTurn, ht as wakeAuthorizedTurn } from "./warmup-BW2qwnal.js";
15
+ import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-Bo_LxFum.js";
16
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-CmowamcB.js";
17
+ import { r as lookupSlackUserProfile } from "./users-2bggndVg.js";
18
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-DZjTN3JC.js";
19
19
  import { n as relayLocalOAuthCallback } from "./oauth-relay-DRzq73b6.js";
20
20
  import * as z from "zod";
21
21
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import "./schema-DbuWR-DN.js";
1
+ import "./schema-Dns-sTas.js";
2
2
  import * as z from "zod";
3
3
  import "drizzle-orm";
4
4
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
@@ -1,10 +1,10 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { i as getChatConfig } from "./config-CAXIpWQb.js";
3
- import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-DPLEa8Bn.js";
2
+ import { i as getChatConfig } from "./config-9nHoFiJP.js";
3
+ import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-BIclibct.js";
4
4
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-D2iXzvlN.js";
5
- import { C as isUserInstruction, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, S as juniorConversationMetrics, j as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-BWmAgSyi.js";
5
+ import { C as isUserInstruction, E as juniorConversationAnnotations, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, S as juniorConversationMetrics, j as juniorConversations, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-DBIaOeJ_.js";
6
6
  import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-IjdmO_r6.js";
7
- import { l as withLock, r as getStateAdapter } from "./adapter-AgCNqqsG.js";
7
+ import { l as withLock, r as getStateAdapter } from "./adapter-S5UkjNK3.js";
8
8
  import * as z from "zod";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -400,6 +400,10 @@ async function bindProviderConversation(executor, args) {
400
400
  // src/chat/state/cache.ts
401
401
  const MAX_CACHE_KEY_LENGTH = 512;
402
402
  const LOAD_WAIT_MS = 1e4;
403
+ /** The prefix of every state key of one cache namespace. */
404
+ function cacheKeyPrefix(namespace) {
405
+ return `junior:cache:${namespace}:`;
406
+ }
403
407
  /**
404
408
  * Create a cache in the state adapter under `junior:cache:{namespace}:`.
405
409
  * Entries are wrapped, so `null` and `false` values are cache hits.
@@ -408,7 +412,7 @@ function createCache(state, namespace) {
408
412
  return { async getOrLoad(key, load, options) {
409
413
  if (!key.trim()) throw new Error("Cache key is required");
410
414
  if (key.length > MAX_CACHE_KEY_LENGTH) throw new Error("Cache key exceeds the maximum length");
411
- const cacheKey = `junior:cache:${namespace}:${key}`;
415
+ const cacheKey = `${cacheKeyPrefix(namespace)}${key}`;
412
416
  const cached = async () => options?.refresh ? void 0 : await state.get(cacheKey) ?? void 0;
413
417
  await state.connect();
414
418
  const hit = await cached();
@@ -443,7 +447,8 @@ function createCache(state, namespace) {
443
447
  const USER_TTL_MS = 864e5;
444
448
  const MISSING_TTL_MS = 6e4;
445
449
  const SETTLE_MS = 1e4;
446
- const CACHE_NAMESPACE = "identities";
450
+ /** The cache namespace of every key in this cache. */
451
+ const USER_CACHE_NAMESPACE = "identities";
447
452
  const cachedUserSchema = z.object({
448
453
  identities: z.array(z.object({
449
454
  avatarUrl: z.string().nullable(),
@@ -467,10 +472,10 @@ const versionSchema = z.object({
467
472
  writtenAtMs: z.number()
468
473
  });
469
474
  function versionKey(userId) {
470
- return `junior:cache:${CACHE_NAMESPACE}:version:${userId}`;
475
+ return `${cacheKeyPrefix(USER_CACHE_NAMESPACE)}version:${userId}`;
471
476
  }
472
477
  function cache() {
473
- return createCache(getStateAdapter(), CACHE_NAMESPACE);
478
+ return createCache(getStateAdapter(), USER_CACHE_NAMESPACE);
474
479
  }
475
480
  async function readVersion(userId) {
476
481
  const state = getStateAdapter();
@@ -1,6 +1,6 @@
1
1
  import { _ as withScope } from "./sentry-BRTJqumy.js";
2
- import "./config-CAXIpWQb.js";
3
- import { h as logWarn, p as logException } from "./logging-DPLEa8Bn.js";
2
+ import "./config-9nHoFiJP.js";
3
+ import { h as logWarn, p as logException } from "./logging-BIclibct.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";
@@ -163,7 +163,11 @@ const juniorAttachments = pgTable("junior_attachments", {
163
163
  conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
164
164
  /** Service that stores the file bytes. */
165
165
  storageProvider: text("storage_provider").notNull(),
166
- storageKey: text("storage_key").notNull(),
166
+ /**
167
+ * Object key of the stored bytes. Null for a file that Junior records
168
+ * without storing, such as a large Slack file.
169
+ */
170
+ storageKey: text("storage_key"),
167
171
  /** Provider that supplied the file. */
168
172
  provider: text("provider"),
169
173
  /** File id assigned by the source provider. */
@@ -171,7 +175,8 @@ const juniorAttachments = pgTable("junior_attachments", {
171
175
  filename: text("filename").notNull(),
172
176
  contentType: text("content_type").notNull(),
173
177
  bytes: integer("bytes").notNull(),
174
- sha256: text("sha256").notNull(),
178
+ /** Digest of the stored bytes. Null when `storage_key` is null. */
179
+ sha256: text("sha256"),
175
180
  visionSummary: text("vision_summary"),
176
181
  createdAt: timestamptz("created_at").notNull(),
177
182
  /** Set when conversation purge marks the attachment unavailable. */
@@ -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-DPLEa8Bn.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DUgtRkf8.js";
2
+ import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-BIclibct.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D-5HTXjS.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";
@@ -162,7 +162,7 @@ const SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
162
162
  "x-slack-signature"
163
163
  ]);
164
164
  const SDK_REQUEST_HEADER_PREFIX = "http.request.header.";
165
- const URL_SPAN_NAME = /^([A-Z]+ )((?:https?:\/\/|\/)\S*)$/;
165
+ const SPAN_METHOD = /^[A-Z]+$/;
166
166
  /**
167
167
  * Drop the query and fragment, hide the sandbox egress credential token, and
168
168
  * keep only the host of a push endpoint.
@@ -174,8 +174,17 @@ function scrubUrl(value) {
174
174
  return redactSandboxEgressProxyPath(url);
175
175
  }
176
176
  function scrubSpanName(name) {
177
- const match = URL_SPAN_NAME.exec(name);
178
- return match ? `${match[1]}${scrubUrl(match[2] ?? "")}` : name;
177
+ const space = name.indexOf(" ");
178
+ if (space < 1) return name;
179
+ const method = name.slice(0, space);
180
+ const target = name.slice(space + 1);
181
+ const isUrl = [
182
+ "https://",
183
+ "http://",
184
+ "/"
185
+ ].some((prefix) => target.startsWith(prefix));
186
+ if (!SPAN_METHOD.test(method) || !isUrl || /\s/.test(target)) return name;
187
+ return `${method} ${scrubUrl(target)}`;
179
188
  }
180
189
  function isSecretHeaderAttribute(key) {
181
190
  const lowerKey = key.toLowerCase();
@@ -1,5 +1,5 @@
1
- import { D as conversationKindFromRow, o as getDb } from "./db-COYOGzYS.js";
2
- import { j as juniorConversations } from "./executor-BWmAgSyi.js";
1
+ import { D as conversationKindFromRow, o as getDb } from "./db-BJNo6fK5.js";
2
+ import { j as juniorConversations } from "./executor-DBIaOeJ_.js";
3
3
  import { desc, eq, sql } from "drizzle-orm";
4
4
  // src/chat/conversations/lineage.ts
5
5
  /**
@@ -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-DQgZoQ3D.js";
2
+ import { t as JUNIOR_VERSION } from "./version-GVBMW2jA.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,12 +1,12 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Jn as renderUntrustedTag, Mo as readConversationAccessFromSql, ko as canAccessConversation } from "./projection-DEdP1q6f.js";
3
- import { n as botConfig } from "./config-CAXIpWQb.js";
4
- import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-COYOGzYS.js";
5
- import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Ciet8_nn.js";
6
- import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation, tt as admitAutomatedTurn } from "./session-stop-2XJrcNCy.js";
7
- import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-9ySPacF9.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-BHiaHCQu.js";
9
- import { a as enqueueAgentMessageToParent } from "./result-g-XAaOj6.js";
2
+ import { Jn as renderUntrustedTag, go as canAccessConversation, yo as readConversationAccessFromSql } from "./projection-w_X-zi7v.js";
3
+ import { n as botConfig } from "./config-9nHoFiJP.js";
4
+ import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-BJNo6fK5.js";
5
+ import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-bY4_0UPm.js";
6
+ import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation, tt as admitAutomatedTurn } from "./session-stop-BcAXze8a.js";
7
+ import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-BW2qwnal.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-E3x2Fg_F.js";
9
+ import { a as enqueueAgentMessageToParent } from "./result-PVBeU0Wf.js";
10
10
  // src/chat/agent-invocations/top-level-message.ts
11
11
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
12
12
  /** Event type of a message from another top-level agent. */
@@ -1,7 +1,7 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { s as getSqlExecutor } from "./db-COYOGzYS.js";
3
- import { gt as readLiveAttachment } from "./agent-runner-Ciet8_nn.js";
4
- import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BAHvgkok.js";
2
+ import { s as getSqlExecutor } from "./db-BJNo6fK5.js";
3
+ import { vt as readLiveAttachment } from "./agent-runner-bY4_0UPm.js";
4
+ import { m as isVisionImageMediaType, p as detectImageMediaType } from "./statuses-Hn-HsOph.js";
5
5
  // src/chat/attachments/model-input.ts
6
6
  var model_input_exports = /* @__PURE__ */ __exportAll({
7
7
  MAX_MODEL_ATTACHMENTS: () => 3,
@@ -28,7 +28,7 @@ async function readStoredBytes(args) {
28
28
  conversationId: args.conversationId,
29
29
  db: getSqlExecutor()
30
30
  });
31
- if (!record || record.storageProvider !== args.storage.provider) throw new Error("Input attachment is no longer available.");
31
+ if (!record || record.storageProvider !== args.storage.provider || record.storageKey === null) throw new Error("Input attachment is no longer available.");
32
32
  const body = await args.storage.get(record.storageKey);
33
33
  if (!body) throw new Error("Input attachment contents are unavailable.");
34
34
  const data = Buffer.from(await new Response(body).arrayBuffer());
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app--ky-Eu33.js";
1
+ import { i as JuniorDashboardOptions } from "./app-D-AcIcCV.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.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,8 +1,8 @@
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-DPLEa8Bn.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-BIclibct.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, h as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CnimvRdk.js";
4
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-bMNq0clp.js";
5
- import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-CBW2Prb_.js";
3
+ import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, g as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-B6U3060-.js";
4
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-D-hCqdZW.js";
5
+ import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-BBX07Jzt.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { Zn as createUserTokenStore } from "./projection-DEdP1q6f.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-RX24Y8aY.js";
1
+ import { Zn as createUserTokenStore } from "./projection-w_X-zi7v.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-C49ClwDX.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;
@@ -89,7 +89,7 @@ function pluginCatalogConfigFromEnv(env = process.env) {
89
89
  }
90
90
  /** Return registrations that expose in-process runtime code. */
91
91
  function pluginRuntimeRegistrationsFromPluginSet(pluginSet) {
92
- return pluginSet?.registrations.filter((plugin) => plugin.hooks || plugin.tasks || plugin.userPages?.length || plugin.objectLinks?.length) ?? [];
92
+ return pluginSet?.registrations.filter((plugin) => plugin.hooks || plugin.images || plugin.tasks || plugin.userPages?.length || plugin.objectLinks?.length) ?? [];
93
93
  }
94
94
  /** Return registrations that expose host CLI commands. */
95
95
  function pluginCliRegistrationsFromPluginSet(pluginSet) {