@sentry/junior 0.299.0 → 0.301.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-CNjGEJO9.js} +5 -4
  2. package/dist/{admin-1VwEXztm.js → admin-CRJHvCGg.js} +2 -2
  3. package/dist/{agent-runner-Ciet8_nn.js → agent-runner-H4YhvNBj.js} +514 -270
  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 +327 -61
  8. package/dist/{app--ky-Eu33.d.ts → app-HDZglaIu.d.ts} +14 -3
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +60 -220
  11. package/dist/{automation-M3RFJUBf.js → automation-Cva5ZOwW.js} +2 -2
  12. package/dist/{background-compaction-queue-CnimvRdk.js → background-compaction-queue-CNrZ3QcU.js} +8 -4
  13. package/dist/{briefs-CwzvgdCa.js → briefs-x6Mzwxmg.js} +3 -3
  14. package/dist/{catalog-runtime-DaBaHY7u.js → catalog-runtime-BEY6EGRi.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-CmjhyqgB.js} +39 -8
  23. package/dist/{connections-Dy0hPdUq.js → connections-CfIRm0xv.js} +6 -6
  24. package/dist/{continue-in-slack-DIOjFj76.js → continue-in-slack-DPoABVkB.js} +6 -6
  25. package/dist/{conversation-fCWD9Az3.js → conversation-BNXfq6Lb.js} +30 -9
  26. package/dist/{conversation-feed-BPK8vkkZ.js → conversation-feed-CfpyFMHP.js} +23 -2
  27. package/dist/{conversation-privacy-DUgtRkf8.js → conversation-privacy-0CM0V2qK.js} +1 -1
  28. package/dist/{conversation-turn-DkJB6yMF.js → conversation-turn-C0sxyvS-.js} +17 -17
  29. package/dist/{credential-sync-RX24Y8aY.js → credential-sync-tEMKZ_8M.js} +15 -15
  30. package/dist/{db-B07FtU9g.d.ts → db-BdUHQhrC.d.ts} +1 -1
  31. package/dist/{db-COYOGzYS.js → db-Czra10QW.js} +13 -8
  32. package/dist/{executor-BWmAgSyi.js → executor-D_023K0H.js} +9 -4
  33. package/dist/instrumentation.js +14 -5
  34. package/dist/{lineage-D-5jm_oj.js → lineage-DmMIE0VL.js} +2 -2
  35. package/dist/{logging-DPLEa8Bn.js → logging-DcjLDDqi.js} +1 -1
  36. package/dist/{message-BIHR1yRk.js → message-C0JY9RJP.js} +8 -8
  37. package/dist/{model-input-BPZYH8Nd.js → model-input-CBp-p24N.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-BRq9QNhU.js} +2 -2
  41. package/dist/{plugins-CBW2Prb_.js → plugins-BBX07Jzt.js} +1 -1
  42. package/dist/{projection-DEdP1q6f.js → projection-CQNDOi82.js} +911 -671
  43. package/dist/{prompt-4M98h_tC.js → prompt-DLUB5m72.js} +4 -4
  44. package/dist/{registry-BTKmKM-r.js → registry-Dj377ADs.js} +2 -2
  45. package/dist/{resolve-B8hXNVZ3.js → resolve-DJkh9Fky.js} +3 -3
  46. package/dist/{result-g-XAaOj6.js → result-C8iIpDl1.js} +9 -9
  47. package/dist/{runner-BlPSA5A8.js → runner-DZqrOy8C.js} +9 -9
  48. package/dist/{sandbox-egress-signals-Pai-MzEY.js → sandbox-egress-signals-CGwH86S9.js} +1 -1
  49. package/dist/{schema-DbuWR-DN.d.ts → schema-CdZFn7Qd.d.ts} +248 -6
  50. package/dist/{schema-BNnY_trV.js → schema-DyHXiQKI.js} +28 -16
  51. package/dist/{service-account-BYGZ08DQ.js → service-account-D6jGR4a1.js} +3 -3
  52. package/dist/{service-account-9OLNQMyz.js → service-account-suY004dx.js} +4 -4
  53. package/dist/{session-stop-2XJrcNCy.js → session-stop-BLmfFI3d.js} +121 -46
  54. package/dist/{skills-DpBQoeHV.js → skills-CmNG0dHb.js} +2 -2
  55. package/dist/{slack-conversation-unfurl-BcDIWo67.js → slack-conversation-unfurl-Bty-DlHe.js} +7 -7
  56. package/dist/{spawn-09GssFod.js → spawn-CNjkpXpk.js} +6 -6
  57. package/dist/{state-Cufq0_rH.js → state-CEbZuZD6.js} +2 -2
  58. package/dist/{statuses-B8mUfghF.js → statuses-Hn-HsOph.js} +86 -2
  59. package/dist/{stop-U7iUrR1g.js → stop-Bjy2-K4H.js} +967 -93
  60. package/dist/{store-BHiaHCQu.js → store-DmV4CoNr.js} +5 -5
  61. package/dist/{store-CSgUTMdv.js → store-Epv6t4vV.js} +9 -9
  62. package/dist/{task-queue-bMNq0clp.js → task-queue-AhG1tSXR.js} +3 -3
  63. package/dist/{task-runner-B__rxwxU.js → task-runner-BMxZI3o7.js} +8 -8
  64. package/dist/{thread-context-d0ceWbVT.js → thread-context-CXLnbg7g.js} +8 -8
  65. package/dist/{turn-session-routing-BVZHBFCF.js → turn-session-routing-BD3-jJl7.js} +5 -5
  66. package/dist/{turn-user-message-BEw7acTP.js → turn-user-message-DsUZi9gn.js} +3 -3
  67. package/dist/{users-BK3dbxZL.js → users-BxvYclQg.js} +3 -3
  68. package/dist/{validation-BDVJjO2E.js → validation-DOz8X9BU.js} +1 -1
  69. package/dist/{version-DQgZoQ3D.js → version-CGMRmMPK.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-CAWfFo29.js → viewer-H3EsMWtJ.js} +16 -114
  72. package/dist/{warmup-9ySPacF9.js → warmup-CdU5hR49.js} +51 -27
  73. package/dist/{worker-D8jJO-WO.js → worker-ClphajjD.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,9 +1,9 @@
1
1
  import { r as notificationScheduleSchema } from "./schedule-cP0AACm1.js";
2
- import { D as conversationChildAgentTotalsSchema, E as idempotencyKeySchema, K as inputFileSchema, i as actorIdentitySchema, s as conversationAuxiliaryCostsSchema, x as conversationUsageSchema, y as conversationSummaryReportSchema } from "./conversation-fCWD9Az3.js";
3
- import { r as AGENT_INVOCATION_STATUSES, u as userInputRequestSchema } from "./statuses-B8mUfghF.js";
2
+ import { D as idempotencyKeySchema, O as conversationChildAgentTotalsSchema, S as conversationUsageSchema, b as conversationSummaryReportSchema, c as conversationAuxiliaryCostsSchema, i as actorIdentitySchema, q as inputFileSchema } from "./conversation-BNXfq6Lb.js";
3
+ import { r as AGENT_INVOCATION_STATUSES, u as userInputRequestSchema } from "./statuses-Hn-HsOph.js";
4
4
  import { i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours } from "./reporting-window-DopzcOHh.js";
5
- import "./automation-M3RFJUBf.js";
6
- import "./conversation-feed-BPK8vkkZ.js";
5
+ import "./automation-Cva5ZOwW.js";
6
+ import "./conversation-feed-CfpyFMHP.js";
7
7
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
8
8
  import * as z from "zod";
9
9
  import { codeChangeStateSchema, eventMatchSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
@@ -195,6 +195,21 @@ const stopConversationTurnResponseSchema = z.object({
195
195
  stoppedInboundMessageIds: z.array(z.string().min(1)),
196
196
  stoppedMessages: z.array(stoppedConversationMessageSchema)
197
197
  }).strict();
198
+ // src/api/schema/object-link.ts
199
+ /** The most links that one object request may resolve. */
200
+ const MAX_OBJECT_LINKS = 20;
201
+ const objectLinkUrlSchema = z.string().trim().min(1).max(2048);
202
+ /** One or more `url` query values. */
203
+ const objectLinksQuerySchema = z.object({ url: z.preprocess((value) => typeof value === "string" ? [value] : value, z.array(objectLinkUrlSchema).min(1).max(20)) }).strict();
204
+ /** The object cards of the links that resolved for the viewer. */
205
+ const objectLinksReportSchema = z.object({ objects: z.array(z.object({
206
+ object: ownedObjectAnnotationSchema,
207
+ url: objectLinkUrlSchema
208
+ }).strict()).max(20) }).strict();
209
+ /** A participant asks to attach one linked object to a Conversation. */
210
+ const attachObjectLinkBodySchema = z.object({ url: objectLinkUrlSchema }).strict();
211
+ /** `unchanged` when the Conversation already has the object. */
212
+ const attachObjectLinkResponseSchema = z.object({ status: z.enum(["attached", "unchanged"]) }).strict();
198
213
  // src/api/schema/conversation-continue-in-slack.ts
199
214
  /** Public Slack channel Location that a dashboard Conversation moves to. */
200
215
  const continueConversationInSlackBodySchema = z.object({ locationId: z.string().min(1) }).strict();
@@ -430,17 +445,6 @@ const pushSubscriptionBodySchema = z.object({
430
445
  }).strict();
431
446
  const pushSubscriptionDeleteBodySchema = z.object({ endpoint: z.string().url().max(2048) }).strict();
432
447
  const testNotificationResponseSchema = z.object({ delivered: z.number().int().nonnegative() }).strict();
433
- // src/api/schema/object-link.ts
434
- /** The most links that one object request may resolve. */
435
- const MAX_OBJECT_LINKS = 20;
436
- const objectLinkUrlSchema = z.string().trim().min(1).max(2048);
437
- /** One or more `url` query values. */
438
- const objectLinksQuerySchema = z.object({ url: z.preprocess((value) => typeof value === "string" ? [value] : value, z.array(objectLinkUrlSchema).min(1).max(20)) }).strict();
439
- /** The object cards of the links that resolved for the viewer. */
440
- const objectLinksReportSchema = z.object({ objects: z.array(z.object({
441
- object: ownedObjectAnnotationSchema,
442
- url: objectLinkUrlSchema
443
- }).strict()).max(20) }).strict();
444
448
  // src/api/activity.ts
445
449
  const dailyConversationActivitySchema = z.object({
446
450
  active: z.number(),
@@ -660,6 +664,14 @@ const serviceAccountListSchema = z.object({ serviceAccounts: z.array(serviceAcco
660
664
  const serviceAccountParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
661
665
  const startServiceAccountSignInResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
662
666
  const disconnectServiceAccountResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
667
+ // src/api/schema/cache-warming.ts
668
+ const cacheWarmingBreakerSchema = z.object({
669
+ provider: z.string(),
670
+ open: z.boolean()
671
+ }).strict();
672
+ const cacheWarmingBreakerListSchema = z.object({ breakers: z.array(cacheWarmingBreakerSchema) }).strict();
673
+ const cacheWarmingBreakerParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
674
+ const closeCacheWarmingBreakerResponseSchema = z.object({ closed: z.literal(true) }).strict();
663
675
  // src/api/schema/review-item.ts
664
676
  const answerSchema = z.object({
665
677
  other: z.string().max(4e3).optional(),
@@ -884,4 +896,4 @@ const versionsSchema = z.object({
884
896
  /** The viewer's rolling model spend. */
885
897
  spend: z.string().min(1)
886
898
  }).strict();
887
- export { connectionSchema as $, revokePersonalTokenResponseSchema as A, reorderPinnedConversationsBodySchema as At, activityDays as B, serviceAccountSchema as C, conversationAutoArchiveSchema as Ct, personalTokenListSchema as D, conversationDeliveryResponseSchema as Dt, createdPersonalTokenSchema as E, conversationDeliveryBodySchema as Et, personalSpendReportSchema as F, attachmentUploadSchema as Ft, objectLinksQuerySchema as G, activitySixHours as H, locationActivityDayReportSchema as I, createAttachmentUploadBodySchema as It, pushSubscriptionBodySchema as J, objectLinksReportSchema as K, locationDetailReportSchema as L, actorProfileReportSchema as M, conversationCatchUpBodySchema as Mt, avatarParamsSchema as N, conversationCatchUpSchema as Nt, personalTokenMetadataSchema as O, pinConversationBodySchema as Ot, personParamsSchema as P, attachmentUploadParamsSchema as Pt, connectionParamsSchema as Q, locationDirectoryReportSchema as R, serviceAccountParamsSchema as S, archiveDoneConversationsResponseSchema as St, createPersonalTokenBodySchema as T, conversationSubscriptionResponseSchema as Tt, dailyConversationActivitySchema as U, activityHours as V, MAX_OBJECT_LINKS as W, testNotificationResponseSchema as X, pushSubscriptionDeleteBodySchema as Y, connectionListSchema as Z, reviewItemParamsSchema as _, conversationStatsReportSchema as _t, replyTimeSegmentsReportSchema as a, codeOverviewReportSchema as at, disconnectServiceAccountResponseSchema as b, archiveConversationBodySchema as bt, workspaceBodySchema as c, codeRepositoryReportSchema as ct, workspaceRepoSchema as d, conversationWatchesReportSchema as dt, disconnectConnectionResponseSchema as et, workspaceSchema as f, conversationChildAgentSchema as ft, reviewItemListSchema as g, stopConversationTurnResponseSchema as gt, reviewItemListQuerySchema as h, continueConversationInSlackResponseSchema as ht, statsReportSchema as i, codeChangeSummarySchema as it, actorDirectoryReportSchema as j, reorderPinnedConversationsResponseSchema as jt, personalTokenParamsSchema as k, pinConversationResponseSchema as kt, workspaceListSchema as l, codeRepositorySummarySchema as lt, reviewItemCountSchema as m, continueConversationInSlackBodySchema as mt, versionsSchema as n, codeActivityDaySchema as nt, baselineSnapshotSchema as o, codePersonReportSchema as ot, reviewItemActionSchema as p, conversationChildAgentsReportSchema as pt, notificationSettingsSchema as q, statSchema as r, codeChangeSummaryReportSchema as rt, deleteWorkspaceResponseSchema as s, codeRepositoryParamsSchema as st, versionsQuerySchema as t, startConnectionResponseSchema as tt, workspaceParamsSchema as u, conversationWatchSchema as ut, reviewItemSchema as v, CONVERSATION_OUTLINE_TEXT_LENGTH as vt, startServiceAccountSignInResponseSchema as w, conversationSubscriptionBodySchema as wt, serviceAccountListSchema as x, archiveConversationResponseSchema as xt, reviewItemWaitingConversationsSchema as y, conversationOutlineSchema as yt, locationParamsSchema as z };
899
+ export { connectionSchema as $, personalTokenListSchema as A, conversationSubscriptionResponseSchema as At, locationDetailReportSchema as B, attachmentUploadSchema as Bt, disconnectServiceAccountResponseSchema as C, CONVERSATION_OUTLINE_TEXT_LENGTH as Ct, startServiceAccountSignInResponseSchema as D, archiveDoneConversationsResponseSchema as Dt, serviceAccountSchema as E, archiveConversationResponseSchema as Et, actorProfileReportSchema as F, reorderPinnedConversationsBodySchema as Ft, activitySixHours as G, locationParamsSchema as H, avatarParamsSchema as I, reorderPinnedConversationsResponseSchema as It, pushSubscriptionBodySchema as J, dailyConversationActivitySchema as K, personParamsSchema as L, conversationCatchUpBodySchema as Lt, personalTokenParamsSchema as M, conversationDeliveryResponseSchema as Mt, revokePersonalTokenResponseSchema as N, pinConversationBodySchema as Nt, createPersonalTokenBodySchema as O, conversationAutoArchiveSchema as Ot, actorDirectoryReportSchema as P, pinConversationResponseSchema as Pt, connectionParamsSchema as Q, personalSpendReportSchema as R, conversationCatchUpSchema as Rt, closeCacheWarmingBreakerResponseSchema as S, conversationStatsReportSchema as St, serviceAccountParamsSchema as T, archiveConversationBodySchema as Tt, activityDays as U, locationDirectoryReportSchema as V, createAttachmentUploadBodySchema as Vt, activityHours as W, testNotificationResponseSchema as X, pushSubscriptionDeleteBodySchema as Y, connectionListSchema as Z, reviewItemParamsSchema as _, attachObjectLinkBodySchema as _t, replyTimeSegmentsReportSchema as a, codeOverviewReportSchema as at, cacheWarmingBreakerListSchema as b, objectLinksReportSchema as bt, workspaceBodySchema as c, codeRepositoryReportSchema as ct, workspaceRepoSchema as d, conversationWatchesReportSchema as dt, disconnectConnectionResponseSchema as et, workspaceSchema as f, conversationChildAgentSchema as ft, reviewItemListSchema as g, MAX_OBJECT_LINKS as gt, reviewItemListQuerySchema as h, continueConversationInSlackResponseSchema as ht, statsReportSchema as i, codeChangeSummarySchema as it, personalTokenMetadataSchema as j, conversationDeliveryBodySchema as jt, createdPersonalTokenSchema as k, conversationSubscriptionBodySchema as kt, workspaceListSchema as l, codeRepositorySummarySchema as lt, reviewItemCountSchema as m, continueConversationInSlackBodySchema as mt, versionsSchema as n, codeActivityDaySchema as nt, baselineSnapshotSchema as o, codePersonReportSchema as ot, reviewItemActionSchema as p, conversationChildAgentsReportSchema as pt, notificationSettingsSchema as q, statSchema as r, codeChangeSummaryReportSchema as rt, deleteWorkspaceResponseSchema as s, codeRepositoryParamsSchema as st, versionsQuerySchema as t, startConnectionResponseSchema as tt, workspaceParamsSchema as u, conversationWatchSchema as ut, reviewItemSchema as v, attachObjectLinkResponseSchema as vt, serviceAccountListSchema as w, conversationOutlineSchema as wt, cacheWarmingBreakerParamsSchema as x, stopConversationTurnResponseSchema as xt, reviewItemWaitingConversationsSchema as y, objectLinksQuerySchema as yt, locationActivityDayReportSchema as z, attachmentUploadParamsSchema as zt };
@@ -1,6 +1,6 @@
1
- import { t as disconnectStateAdapter } from "./adapter-AgCNqqsG.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
3
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-9OLNQMyz.js";
1
+ import { t as disconnectStateAdapter } from "./adapter-CNjGEJO9.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BEY6EGRi.js";
3
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-suY004dx.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -1,7 +1,7 @@
1
- import { G as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-DPLEa8Bn.js";
2
- import { c as fenceLock, l as withLock, o as MUTATION_LOCK_TTL_MS, r as getStateAdapter } from "./adapter-AgCNqqsG.js";
3
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-BTKmKM-r.js";
4
- import { n as readEncryptedState, t as createEncryptedState } from "./state-Cufq0_rH.js";
1
+ import { G as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-DcjLDDqi.js";
2
+ import { c as fenceLock, l as withLock, o as MUTATION_LOCK_TTL_MS, r as getStateAdapter } from "./adapter-CNjGEJO9.js";
3
+ import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-Dj377ADs.js";
4
+ import { n as readEncryptedState, t as createEncryptedState } from "./state-CEbZuZD6.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,25 +1,25 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ai as getDashboardObjectIconLink, Bn as SCRIPT_TOOLS_SECTION_TAG, Co as sandboxSkillPathResolution, Di as JUNIOR_THREAD_STATE_TTL_MS, Ei as verifyTimerWatchCredentialSubject, Fn as retainRuntimeTurnContext, Hn as TURN_CONTEXT_TAG, In as stripRuntimeTurnContext, Jn as renderUntrustedTag, Kn as renderChildTag, M as normalizeConversationText, Mr as getReviewItem, Nn as latestTurnContextSection, Oi as getDashboardConversationLink, Rn as CAPABILITY_SECTION_TAG, So as sandboxSkillFile, Tn as hasRuntimeTurnContext, Un as escapeClosingTags, Vn as SESSION_CONTEXT_SECTION_TAG, Wi as listWorkspaces, Wn as escapeTagText, Yn as tagJson, _o as SANDBOX_DATA_ROOT, bo as SANDBOX_WORKSPACE_ROOT, cr as getPluginSystemPromptContributions, ct as listTurnSummaries, da as escapeSlackMrkdwnText, do as ToolInputError, dr as getPlugins, fa as formatSlackLink, fn as NO_REPLY_TOOL_NAME, in as REPLY_TOOL_NAME, ot as getStoredTurnFields, pa as normalizeSlackReplyMarkdown, qn as renderTag$1, qo as buildSentryConversationUrl, sr as getPluginSlackConversationLink, st as getTurnRecord, ui as cancelSubscriptions, ur as getPluginUserPromptContributions, vn as REPORT_BLOCKED_TOOL_NAME, vo as SANDBOX_REPOS_ROOT, wa as postSlackMessage, x as toStoredConversationMessage, xo as sandboxSkillDir, zn as REQUEST_CONTEXT_SECTION_TAG } from "./projection-DEdP1q6f.js";
3
- import { F as renderCurrentInstruction, L as escapeXml, R as escapeXmlText, n as botConfig } from "./config-CAXIpWQb.js";
4
- import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-DPLEa8Bn.js";
2
+ import { Bn as SCRIPT_TOOLS_SECTION_TAG, Da as postSlackMessage, Di as verifyTimerWatchCredentialSubject, Fn as retainRuntimeTurnContext, Hn as TURN_CONTEXT_TAG, In as stripRuntimeTurnContext, Io as buildSentryConversationUrl, Jn as renderUntrustedTag, Ki as listWorkspaces, Kn as renderChildTag, M as normalizeConversationText, Nn as latestTurnContextSection, Nr as getReviewItem, Oi as JUNIOR_THREAD_STATE_TTL_MS, Rn as CAPABILITY_SECTION_TAG, Tn as hasRuntimeTurnContext, Un as escapeClosingTags, Vn as SESSION_CONTEXT_SECTION_TAG, Wn as escapeTagText, Yn as tagJson, _a as slackMention, cr as getPluginSlackConversationLink, ct as listTurnSummaries, di as cancelSubscriptions, do as sandboxSkillFile, dr as getPluginUserPromptContributions, eo as ToolInputError, fn as NO_REPLY_TOOL_NAME, fo as sandboxSkillPathResolution, fr as getPlugins, ha as normalizeSlackReplyMarkdown, in as REPLY_TOOL_NAME, ji as getDashboardObjectIconLink, ki as getDashboardConversationLink, lo as SANDBOX_WORKSPACE_ROOT, lr as getPluginSystemPromptContributions, ma as formatSlackLink, oo as SANDBOX_DATA_ROOT, ot as getStoredTurnFields, pa as escapeSlackMrkdwnText, qn as renderTag$1, so as SANDBOX_REPOS_ROOT, st as getTurnRecord, uo as sandboxSkillDir, vn as REPORT_BLOCKED_TOOL_NAME, x as toStoredConversationMessage, zn as REQUEST_CONTEXT_SECTION_TAG } from "./projection-CQNDOi82.js";
3
+ import { I as renderCurrentInstruction, R as escapeXml, n as botConfig, z as escapeXmlText } from "./config-CmjhyqgB.js";
4
+ import { W as normalizeIdentityEmail, h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-DcjLDDqi.js";
5
5
  import { o as isUserActor, t as createActor } from "./actor-D2iXzvlN.js";
6
- import { C as isPersonInput, a as getConversationStore, j as SYSTEM_IDENTITY_ID, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-COYOGzYS.js";
7
- import { N as juniorUsers, j as juniorConversations } from "./executor-BWmAgSyi.js";
8
- import { r as getStateAdapter } from "./adapter-AgCNqqsG.js";
6
+ import { C as isPersonInput, a as getConversationStore, j as SYSTEM_IDENTITY_ID, nt as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor } from "./db-Czra10QW.js";
7
+ import { M as juniorIdentities, N as juniorUsers, j as juniorConversations } from "./executor-D_023K0H.js";
8
+ import { r as getStateAdapter } from "./adapter-CNjGEJO9.js";
9
9
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJhGdS4c.js";
10
- import { h as credentialSubjectSchema } from "./registry-BTKmKM-r.js";
11
- import { i as parseSkillFile } from "./skills-DpBQoeHV.js";
12
- import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-4M98h_tC.js";
13
- import { i as isVisionImageMediaType } from "./media-BAHvgkok.js";
14
- import { r as appendAndEnqueueInboundMessage } from "./store-BHiaHCQu.js";
15
- import { f as eventCatalogEntry, l as CORE_EVENT_NAMESPACE, p as eventGuidance } from "./turn-session-routing-BVZHBFCF.js";
16
- import { p as userCustomizationTextSchema, s as formatUserInputAnswer } from "./statuses-B8mUfghF.js";
10
+ import { h as credentialSubjectSchema } from "./registry-Dj377ADs.js";
11
+ import { i as parseSkillFile } from "./skills-CmNG0dHb.js";
12
+ import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-DLUB5m72.js";
13
+ import { r as appendAndEnqueueInboundMessage } from "./store-DmV4CoNr.js";
14
+ import { f as eventCatalogEntry, l as CORE_EVENT_NAMESPACE, p as eventGuidance } from "./turn-session-routing-BD3-jJl7.js";
15
+ import { _ as userCustomizationTextSchema, m as isVisionImageMediaType, s as formatUserInputAnswer } from "./statuses-Hn-HsOph.js";
17
16
  import * as z from "zod";
18
17
  import path from "node:path";
19
18
  import { isDeepStrictEqual } from "node:util";
20
19
  import { createHash } from "node:crypto";
21
20
  import { and, eq, inArray, isNull, lt, lte, or, sql } from "drizzle-orm";
22
21
  import { agentEventKeys, createEventSource, createLocalSource, createWebSource, eventMatchFieldsSchema, objectFactFields, objectPresentation, objectTypeSchema } from "@sentry/junior-plugin-api";
22
+ import { alias } from "drizzle-orm/pg-core";
23
23
  import fs from "node:fs";
24
24
  import pLimit from "p-limit";
25
25
  // src/chat/repository-instructions.ts
@@ -550,7 +550,8 @@ const TOOL_POLICY_RULES = [
550
550
  "- Resolve provider action targets before calls: explicit target wins; ambient `<configuration>` fills omitted targets. Treat non-target links/references as context.",
551
551
  "- When a tool result includes a subscription, those events are already watched; do not call watchEvents for them. When a tool result includes a subscribable resource with suggested_events, use watchEvents only for those remaining events that serve the current intent. If suggested_events is empty or omitted, do not invent a watch. Do not create scheduled polling tasks for events a watch can deliver. Write a concise intent summary. Stop only the requested watch by id unless the user explicitly asks to stop every watch in the thread.",
552
552
  "- New scheduled and event automations run on your own credentials by default. Make the creator's connected credentials available only when the creator asks for that. Do not decide from the tools, access, or connections in this turn whether an automation's runs can do the work; each run loads its own tools. Do not ask for credential confirmation, access, or a connection before you create one.",
553
- "- Before loading a skill or starting substantial work, decide whether `spawnAgent` fits better than inline work."
553
+ "- Before loading a skill or starting substantial work, decide whether `spawnAgent` fits better than inline work.",
554
+ "- When several tool calls need no judgment from you between them, such as the same lookup for many items, results you only filter, count, or combine, or independent calls to different tools, make them in one `codemode` script instead of separate or parallel direct calls. Call tools directly when one call is enough or when you must read a result to decide what to do next."
554
555
  ];
555
556
  /** Block 5, `<skill-policy>`: when to load a skill and how to use one. */
556
557
  const SKILL_POLICY_RULES = [
@@ -1535,6 +1536,91 @@ function buildSlackReplyBlocks(text, footer) {
1535
1536
  }
1536
1537
  return blocks.length ? blocks : void 0;
1537
1538
  }
1539
+ // src/chat/events/people.ts
1540
+ const linkedSlackIdentity = alias(juniorIdentities, "event_people_slack");
1541
+ function personKey(person) {
1542
+ return "email" in person ? `email:${normalizeIdentityEmail(person.email)}` : `${person.provider}:${person.handle.toLowerCase()}`;
1543
+ }
1544
+ function personCondition(person) {
1545
+ if ("email" in person) return and(eq(juniorIdentities.emailVerified, true), eq(juniorIdentities.emailNormalized, normalizeIdentityEmail(person.email)));
1546
+ return and(eq(juniorIdentities.provider, person.provider), sql`lower(${juniorIdentities.handle}) = lower(${person.handle})`);
1547
+ }
1548
+ /**
1549
+ * Read the Slack users in one workspace whose linked User has an identity that
1550
+ * matches `condition`, by person key. A key with more than one Slack user is
1551
+ * ambiguous, so callers must not mention it.
1552
+ */
1553
+ async function readLinkedSlackUsers(condition, slackTeamId) {
1554
+ const rows = await getSqlExecutor().db().select({
1555
+ emailNormalized: juniorIdentities.emailNormalized,
1556
+ emailVerified: juniorIdentities.emailVerified,
1557
+ handle: juniorIdentities.handle,
1558
+ provider: juniorIdentities.provider,
1559
+ slackUserId: linkedSlackIdentity.providerSubjectId
1560
+ }).from(juniorIdentities).innerJoin(linkedSlackIdentity, and(eq(linkedSlackIdentity.userId, juniorIdentities.userId), eq(linkedSlackIdentity.kind, "user"), eq(linkedSlackIdentity.provider, "slack"), eq(linkedSlackIdentity.providerTenantId, slackTeamId))).where(and(eq(juniorIdentities.kind, "user"), condition));
1561
+ const slackUsersByKey = /* @__PURE__ */ new Map();
1562
+ const add = (key, slackUserId) => {
1563
+ const users = slackUsersByKey.get(key) ?? /* @__PURE__ */ new Set();
1564
+ users.add(slackUserId);
1565
+ slackUsersByKey.set(key, users);
1566
+ };
1567
+ for (const row of rows) {
1568
+ if (row.handle) add(`${row.provider}:${row.handle.toLowerCase()}`, row.slackUserId);
1569
+ if (row.emailVerified && row.emailNormalized) add(`email:${row.emailNormalized}`, row.slackUserId);
1570
+ }
1571
+ return slackUsersByKey;
1572
+ }
1573
+ function soleMention(users) {
1574
+ return users?.size === 1 ? slackMention([...users][0]) : void 0;
1575
+ }
1576
+ const HANDLE_MENTION_PATTERN = /(?<![\w.@/-])@([A-Za-z0-9][A-Za-z0-9_.-]*[A-Za-z0-9]|[A-Za-z0-9])/g;
1577
+ const MAX_REPLY_HANDLES = 50;
1578
+ /**
1579
+ * Resolve the `@handle` words in reply text to Slack mentions of known people
1580
+ * in one Slack workspace, by `provider:handle` key in lowercase. A handle
1581
+ * resolves only when exactly one linked Slack user has it for that provider.
1582
+ * Plugins pick the provider when they format the reply.
1583
+ */
1584
+ async function resolveHandleMentions(text, slackTeamId) {
1585
+ const handles = [...new Set([...text.matchAll(HANDLE_MENTION_PATTERN)].map((match) => match[1].toLowerCase()))].slice(0, MAX_REPLY_HANDLES);
1586
+ if (handles.length === 0) return /* @__PURE__ */ new Map();
1587
+ const slackUsersByKey = await readLinkedSlackUsers(inArray(sql`lower(${juniorIdentities.handle})`, handles), slackTeamId);
1588
+ const mentions = /* @__PURE__ */ new Map();
1589
+ for (const [key, users] of slackUsersByKey) {
1590
+ const mention = soleMention(users);
1591
+ if (mention && !key.startsWith("email:")) mentions.set(key, mention);
1592
+ }
1593
+ return mentions;
1594
+ }
1595
+ /**
1596
+ * Resolve the Event people and the Event doer to Slack mentions through
1597
+ * linked user identities in one Slack workspace, with one query.
1598
+ *
1599
+ * A person resolves only when exactly one linked Slack user in that workspace
1600
+ * matches. Core drops unlinked and ambiguous people, so a provider value never
1601
+ * guesses a mention.
1602
+ */
1603
+ async function resolveEventMentions(event, slackTeamId) {
1604
+ const people = event.people ?? [];
1605
+ const lookup = event.doneBy ? [...people, event.doneBy] : people;
1606
+ if (lookup.length === 0) return { people: [] };
1607
+ const slackUsersByKey = await readLinkedSlackUsers(or(...lookup.map(personCondition)), slackTeamId);
1608
+ const mentionOf = (person) => soleMention(slackUsersByKey.get(personKey(person)));
1609
+ const mentions = [];
1610
+ for (const person of people) {
1611
+ const mention = mentionOf(person);
1612
+ if (mention && !mentions.includes(mention)) mentions.push(mention);
1613
+ }
1614
+ const doneByMention = event.doneBy ? mentionOf(event.doneBy) : void 0;
1615
+ if (!doneByMention || !event.doneBy) return { people: mentions };
1616
+ return {
1617
+ people: mentions,
1618
+ doneBy: {
1619
+ mention: doneByMention,
1620
+ ..."handle" in event.doneBy ? { handle: event.doneBy.handle } : void 0
1621
+ }
1622
+ };
1623
+ }
1538
1624
  // src/chat/slack/output.ts
1539
1625
  const MAX_INLINE_CHARS = 4e3;
1540
1626
  function getFenceContinuation(text) {
@@ -1593,9 +1679,9 @@ function takeChunk(text) {
1593
1679
  };
1594
1680
  }
1595
1681
  /** Split a normalized Slack reply into thread posts that fit Slack limits. */
1596
- function splitSlackReplyText(text) {
1682
+ function splitSlackReplyText(text, format) {
1597
1683
  const chunks = [];
1598
- let remaining = normalizeSlackReplyMarkdown(text);
1684
+ let remaining = normalizeSlackReplyMarkdown(text, format);
1599
1685
  while (remaining.length > MAX_INLINE_CHARS) {
1600
1686
  const { chunk, rest } = takeChunk(remaining);
1601
1687
  chunks.push(chunk);
@@ -1624,14 +1710,29 @@ function resolveSlackReplyTarget(args) {
1624
1710
  ...threadTs ? { threadTs } : void 0
1625
1711
  };
1626
1712
  }
1713
+ /** Resolve known people for plugin formatting. Fails open, like the hooks. */
1714
+ async function resolveReplyMentions(text, teamId) {
1715
+ try {
1716
+ return await resolveHandleMentions(text, teamId);
1717
+ } catch (error) {
1718
+ logWarn("slack.reply.mentions.failed", { "exception.message": error instanceof Error ? error.message : String(error) });
1719
+ return;
1720
+ }
1721
+ }
1627
1722
  /**
1628
1723
  * Send one destination-visible Slack reply.
1629
1724
  *
1630
1725
  * Chunks oversized text, builds compact attribution and conversation footer
1631
- * context, and posts through the shared Slack outbound boundary.
1726
+ * context, and posts through the shared Slack outbound boundary. Pass
1727
+ * `formatting` for agent replies so plugin formatting can use Location
1728
+ * defaults, such as a default repository, and mention known people.
1632
1729
  */
1633
1730
  async function sendSlackReply(args) {
1634
- const posts = splitSlackReplyText(args.text).map((text) => ({
1731
+ const format = args.formatting && {
1732
+ configuration: args.formatting.configuration,
1733
+ mentions: await resolveReplyMentions(args.text, args.formatting.teamId)
1734
+ };
1735
+ const posts = splitSlackReplyText(args.text, format).map((text) => ({
1635
1736
  text,
1636
1737
  cards: []
1637
1738
  }));
@@ -2749,7 +2850,6 @@ async function saveUserCustomization(userId, customization) {
2749
2850
  * contributions, bootstrap turn context, resume-safe history trimming, and
2750
2851
  * the optional canonical telemetry view of public input messages.
2751
2852
  */
2752
- const MAX_INLINE_ATTACHMENT_BASE64_CHARS = 12e4;
2753
2853
  /**
2754
2854
  * Keep host-owned thread history as one evidence-only block.
2755
2855
  *
@@ -2811,23 +2911,6 @@ function renderExplicitSkillInstructions(skill) {
2811
2911
  "</skill>"
2812
2912
  ].join("\n");
2813
2913
  }
2814
- /** Encode a non-image attachment as base64 XML for the prompt. */
2815
- function encodeNonImageAttachmentForPrompt(attachment) {
2816
- const base64 = attachment.data.toString("base64");
2817
- const wasTruncated = base64.length > MAX_INLINE_ATTACHMENT_BASE64_CHARS;
2818
- const encodedPayload = wasTruncated ? `${base64.slice(0, MAX_INLINE_ATTACHMENT_BASE64_CHARS)}...` : base64;
2819
- return [
2820
- "<attachment>",
2821
- `filename: ${attachment.filename ?? "unnamed"}`,
2822
- `media_type: ${attachment.mediaType}`,
2823
- "encoding: base64",
2824
- `truncated: ${wasTruncated ? "true" : "false"}`,
2825
- "<data_base64>",
2826
- encodedPayload,
2827
- "</data_base64>",
2828
- "</attachment>"
2829
- ].join("\n");
2830
- }
2831
2914
  /** Redact image data from prompt content parts for observability. */
2832
2915
  function toObservablePromptPart(part) {
2833
2916
  if (part.type === "text") return {
@@ -2887,15 +2970,7 @@ function buildUserTurnInput(args) {
2887
2970
  });
2888
2971
  continue;
2889
2972
  }
2890
- if (!attachment.data) throw new Error("Attachment is missing attachment data");
2891
- userContentParts.push({
2892
- type: "text",
2893
- text: encodeNonImageAttachmentForPrompt({
2894
- data: attachment.data,
2895
- mediaType: attachment.mediaType,
2896
- filename: attachment.filename
2897
- })
2898
- });
2973
+ throw new Error("Non-image attachment is missing its prompt text");
2899
2974
  }
2900
2975
  return {
2901
2976
  contextContentParts: [],
@@ -3353,4 +3428,4 @@ async function saveStoppedConversationEvents(conversationId, messages) {
3353
3428
  }
3354
3429
  }]);
3355
3430
  }
3356
- export { sendSlackReply as $, turnInputFactsFromConversationMessage as A, requireSlackChannelMessageScope as B, getAuthPausedConversationTurnId as C, parseEventMessages as D, listActiveMailboxTurns as E, isEventMailboxMetadata as F, WORKSPACE_SNAPSHOT_FAILED_EVENT as G, slackChannelMessageReplyThreadTs as H, renderEventBatchInputs as I, workspaceSnapshotWatch as J, WORKSPACE_SNAPSHOT_READY_EVENT as K, timerWatchCredentialSubject as L, EVENT_WAIT_MS as M, enqueueEventNotification as N, resolveMailboxTurnWork as O, eventBatchMessageMeta as P, resolveSlackReplyTarget as Q, getEventCatalog as R, addConversationNote as S, listActiveMailboxTurnSources as T, slackChannelMessageRunsAutomation as U, slackChannelMessageEvent as V, slackChannelMessageTrigger as W, maybePostAutomatedTurnLimitNotice as X, renderTaskInput as Y, postAutomatedTurnLimitNoticeForConversation as Z, readUserCustomization as _, session_stop_exports as a, conversationSubtreeColumns as at, isExperimentalFeatureEnabled as b, loadReviewItemInput as c, JUNIOR_PERSONALITY as ct, buildPromptInput as d, buildAgentsInstructionsMessage as dt, renderSlackObjectCard as et, buildSteeringPiMessage as f, findVisibleAgentsInstructions as ft, withoutSavedSteeringMessages as g, loadPromptTurnContext as h, showsAgentsInstructions as ht, resumeStoppedConversationTree as i, conversationSubtree as it, legacyWebMailboxMetadataSchema as j, sourceFromTurnInput as k, savedInputInstruction as l, AGENTS_REMOVAL_NOTICE as lt, instructionForInputs as m, renderAgentsInstructions as mt, isSkippedAfterConversationStop as n, recordFinishedTurnForAutomatedLimit as nt, skipInputAfterConversationStop as o, buildDeploymentSystemPrompt as ot, instructionActorFor as p, readRepositoryInstructions as pt, workspaceSnapshotFinishedEvent as q, markConversationsStopped as r, resetAutomatedTurnLimit as rt, eventReviewItemInputs as s, systemPromptHash as st, getConversationStoppedAtMs as t, admitAutomatedTurn as tt, assemblePrompt as u, AGENTS_REPLACEMENT_NOTICE as ut, saveUserCustomization as v, getEventBatchDelayMs as w, setExperimentalFeatures as x, getExperimentalFeatures as y, SLACK_EVENT_NAMESPACE as z };
3431
+ export { sendSlackReply as $, turnInputFactsFromConversationMessage as A, requireSlackChannelMessageScope as B, getAuthPausedConversationTurnId as C, parseEventMessages as D, listActiveMailboxTurns as E, isEventMailboxMetadata as F, WORKSPACE_SNAPSHOT_FAILED_EVENT as G, slackChannelMessageReplyThreadTs as H, renderEventBatchInputs as I, workspaceSnapshotWatch as J, WORKSPACE_SNAPSHOT_READY_EVENT as K, timerWatchCredentialSubject as L, EVENT_WAIT_MS as M, enqueueEventNotification as N, resolveMailboxTurnWork as O, eventBatchMessageMeta as P, resolveSlackReplyTarget as Q, getEventCatalog as R, addConversationNote as S, listActiveMailboxTurnSources as T, slackChannelMessageRunsAutomation as U, slackChannelMessageEvent as V, slackChannelMessageTrigger as W, maybePostAutomatedTurnLimitNotice as X, renderTaskInput as Y, postAutomatedTurnLimitNoticeForConversation as Z, readUserCustomization as _, session_stop_exports as a, conversationSubtree as at, isExperimentalFeatureEnabled as b, loadReviewItemInput as c, systemPromptHash as ct, buildPromptInput as d, AGENTS_REPLACEMENT_NOTICE as dt, resolveEventMentions as et, buildSteeringPiMessage as f, buildAgentsInstructionsMessage as ft, withoutSavedSteeringMessages as g, showsAgentsInstructions as gt, loadPromptTurnContext as h, renderAgentsInstructions as ht, resumeStoppedConversationTree as i, resetAutomatedTurnLimit as it, legacyWebMailboxMetadataSchema as j, sourceFromTurnInput as k, savedInputInstruction as l, JUNIOR_PERSONALITY as lt, instructionForInputs as m, readRepositoryInstructions as mt, isSkippedAfterConversationStop as n, admitAutomatedTurn as nt, skipInputAfterConversationStop as o, conversationSubtreeColumns as ot, instructionActorFor as p, findVisibleAgentsInstructions as pt, workspaceSnapshotFinishedEvent as q, markConversationsStopped as r, recordFinishedTurnForAutomatedLimit as rt, eventReviewItemInputs as s, buildDeploymentSystemPrompt as st, getConversationStoppedAtMs as t, renderSlackObjectCard as tt, assemblePrompt as u, AGENTS_REMOVAL_NOTICE as ut, saveUserCustomization as v, getEventBatchDelayMs as w, setExperimentalFeatures as x, getExperimentalFeatures as y, SLACK_EVENT_NAMESPACE as z };
@@ -1,7 +1,7 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { h as logWarn } from "./logging-DPLEa8Bn.js";
2
+ import { h as logWarn } from "./logging-DcjLDDqi.js";
3
3
  import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DaBaHY7u.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BEY6EGRi.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import fs from "node:fs/promises";
@@ -1,12 +1,12 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ca as postSlackEphemeralMessage, Ea as unfurlSlackLinks, Fi as parseDashboardConversationLink, Ha as getWorkspaceTeamId, Mo as readConversationAccessFromSql, Tt as deferConversationMove, Vo as readLatestConversationBrief, da as escapeSlackMrkdwnText, fa as formatSlackLink } from "./projection-DEdP1q6f.js";
3
- import { E as withSpan } from "./logging-DPLEa8Bn.js";
2
+ import { Ao as readLatestConversationBrief, Ea as postSlackEphemeralMessage, Li as parseDashboardConversationLink, Tt as deferConversationMove, as as getWorkspaceTeamId, ka as unfurlSlackLinks, ma as formatSlackLink, pa as escapeSlackMrkdwnText, xo as readConversationAccessFromSql } from "./projection-CQNDOi82.js";
3
+ import { E as withSpan } from "./logging-DcjLDDqi.js";
4
4
  import { _ as slackUserIdSchema, b as slackMessageTsSchema, f as parseSlackTeamId, g as slackTeamIdSchema, h as slackChannelIdSchema, m as slackBotIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-D2iXzvlN.js";
5
- import { K as getConversationIdByProviderConversation, W as createCache, a as getConversationStore, o as getDb, s as getSqlExecutor } from "./db-COYOGzYS.js";
6
- import { i as readActorIdentity } from "./viewer-CAWfFo29.js";
7
- import "./store-BHiaHCQu.js";
8
- import { a as runWithSlackInstallation, r as lookupSlackUserProfile, s as checkSlackChannelReadAccess, t as lookupSlackBot } from "./users-BK3dbxZL.js";
9
- import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-DIOjFj76.js";
5
+ import { K as getConversationIdByProviderConversation, W as createCache, a as getConversationStore, o as getDb, s as getSqlExecutor } from "./db-Czra10QW.js";
6
+ import { i as readActorIdentity } from "./viewer-H3EsMWtJ.js";
7
+ import "./store-DmV4CoNr.js";
8
+ import { a as runWithSlackInstallation, r as lookupSlackUserProfile, s as checkSlackChannelReadAccess, t as lookupSlackBot } from "./users-BxvYclQg.js";
9
+ import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-DPoABVkB.js";
10
10
  import * as z from "zod";
11
11
  // src/chat/ingress/workspace-membership.ts
12
12
  const MEMBER_TTL_MS = 3e5;
@@ -1,10 +1,10 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { n as botConfig } from "./config-CAXIpWQb.js";
3
- import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Ciet8_nn.js";
4
- import { $ as AgentDepthLimitError, _ as getAgentInvocation, ot as getAgentBinding, z as createAndEnqueueAgentInvocation } from "./warmup-9ySPacF9.js";
5
- import { I as getUnnamedAgentConversationId, T as getAgentInvocationId, k as getAgentInvocationMessageId } from "./turn-user-message-BEw7acTP.js";
6
- import { _ as getConversationWorkState } from "./store-BHiaHCQu.js";
7
- import { t as readConversationLineage } from "./lineage-D-5jm_oj.js";
2
+ import { n as botConfig } from "./config-CmjhyqgB.js";
3
+ import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-H4YhvNBj.js";
4
+ import { $ as AgentDepthLimitError, _ as getAgentInvocation, ot as getAgentBinding, z as createAndEnqueueAgentInvocation } from "./warmup-CdU5hR49.js";
5
+ import { I as getUnnamedAgentConversationId, T as getAgentInvocationId, k as getAgentInvocationMessageId } from "./turn-user-message-DsUZi9gn.js";
6
+ import { _ as getConversationWorkState } from "./store-DmV4CoNr.js";
7
+ import { t as readConversationLineage } from "./lineage-DmMIE0VL.js";
8
8
  // src/chat/agent-invocations/spawn.ts
9
9
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
10
10
  /**
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-CAXIpWQb.js";
2
- import { h as logWarn } from "./logging-DPLEa8Bn.js";
1
+ import { i as getChatConfig } from "./config-CmjhyqgB.js";
2
+ import { h as logWarn } from "./logging-DcjLDDqi.js";
3
3
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
4
4
  // src/chat/encryption/secret.ts
5
5
  /**
@@ -27,6 +27,90 @@ const USER_CUSTOMIZATION_MAX_CHARS = 1e3;
27
27
  const userCustomizationTextSchema = z.string().trim().max(USER_CUSTOMIZATION_MAX_CHARS);
28
28
  /** Request and response body for the viewer's customization. */
29
29
  const userCustomizationSchema = z.object({ customization: userCustomizationTextSchema }).strict();
30
+ // src/chat/attachments/media.ts
31
+ const INPUT_IMAGE_TYPES = [
32
+ "image/png",
33
+ "image/jpeg",
34
+ "image/gif",
35
+ "image/webp"
36
+ ];
37
+ /** Video types that browsers play in a `<video>` element. */
38
+ const INLINE_VIDEO_TYPES = ["video/mp4", "video/webm"];
39
+ /** Leading bytes of each accepted image type. `null` matches any byte. */
40
+ const IMAGE_SIGNATURES = [
41
+ {
42
+ mediaType: "image/png",
43
+ bytes: [
44
+ 137,
45
+ 80,
46
+ 78,
47
+ 71,
48
+ 13,
49
+ 10,
50
+ 26,
51
+ 10
52
+ ]
53
+ },
54
+ {
55
+ mediaType: "image/jpeg",
56
+ bytes: [
57
+ 255,
58
+ 216,
59
+ 255
60
+ ]
61
+ },
62
+ {
63
+ mediaType: "image/gif",
64
+ bytes: [
65
+ 71,
66
+ 73,
67
+ 70,
68
+ 56,
69
+ 55,
70
+ 97
71
+ ]
72
+ },
73
+ {
74
+ mediaType: "image/gif",
75
+ bytes: [
76
+ 71,
77
+ 73,
78
+ 70,
79
+ 56,
80
+ 57,
81
+ 97
82
+ ]
83
+ },
84
+ {
85
+ mediaType: "image/webp",
86
+ bytes: [
87
+ 82,
88
+ 73,
89
+ 70,
90
+ 70,
91
+ null,
92
+ null,
93
+ null,
94
+ null,
95
+ 87,
96
+ 69,
97
+ 66,
98
+ 80
99
+ ]
100
+ }
101
+ ];
102
+ /**
103
+ * Detect an accepted image type from file bytes. Use this instead of a file
104
+ * name or declared content type, which can be wrong.
105
+ */
106
+ function detectImageMediaType(data) {
107
+ return IMAGE_SIGNATURES.find(({ bytes }) => data.length >= bytes.length && bytes.every((byte, index) => byte === null || data[index] === byte))?.mediaType;
108
+ }
109
+ /** Report whether a media type is a raster image accepted by vision models. */
110
+ function isVisionImageMediaType(mediaType) {
111
+ const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
112
+ return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
113
+ }
30
114
  // src/chat/tools/runtime/user-input-request.ts
31
115
  const USER_INPUT_LIMITS = {
32
116
  maxButtonOptions: 5,
@@ -43,7 +127,7 @@ const descriptionSchema = z.string().trim().min(1).max(USER_INPUT_LIMITS.maxDesc
43
127
  const optionSchema = z.object({
44
128
  label: labelSchema.describe("Short choice text, such as `Accept` or `Decline`. The answer uses this exact text."),
45
129
  description: descriptionSchema.describe("Optional short note about what this choice does."),
46
- recommended: z.boolean().optional().describe("Set true on the choice that you recommend, and say why in its description. A `choice` field can recommend one option.")
130
+ recommended: z.boolean().optional().describe("Set true on the choice that you recommend, put that choice first, and say why in its description. A `choice` field can recommend one option.")
47
131
  });
48
132
  const fieldBase = {
49
133
  id: z.string().regex(/^[a-z][a-z0-9_]{0,31}$/).describe("Stable key for this field, such as `approach`."),
@@ -181,4 +265,4 @@ const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
181
265
  "skipped",
182
266
  "steered"
183
267
  ];
184
- export { AGENT_REPLY_EVENT_TYPE as _, USER_INPUT_NOTE as a, isEmptyUserInputAnswer as c, USER_CUSTOMIZATION_MAX_CHARS as d, userCustomizationSchema as f, AGENT_PARENT_MESSAGE_EVENT_TYPE as g, AGENT_MESSAGE_EVENT_TYPE as h, USER_INPUT_LIMITS as i, normalizeUserInputAnswer as l, AGENT_INVOCATION_EVENT_NAMESPACE as m, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, buttonUserInputField as o, userCustomizationTextSchema as p, AGENT_INVOCATION_STATUSES as r, formatUserInputAnswer as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, userInputRequestSchema as u, agentInvocationResultEventType as v, isAgentInvocationResultEventType as y };
268
+ export { isAgentInvocationResultEventType as C, agentInvocationResultEventType as S, userCustomizationTextSchema as _, USER_INPUT_NOTE as a, AGENT_PARENT_MESSAGE_EVENT_TYPE as b, isEmptyUserInputAnswer as c, INLINE_VIDEO_TYPES as d, INPUT_IMAGE_TYPES as f, userCustomizationSchema as g, USER_CUSTOMIZATION_MAX_CHARS as h, USER_INPUT_LIMITS as i, normalizeUserInputAnswer as l, isVisionImageMediaType as m, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, buttonUserInputField as o, detectImageMediaType as p, AGENT_INVOCATION_STATUSES as r, formatUserInputAnswer as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, userInputRequestSchema as u, AGENT_INVOCATION_EVENT_NAMESPACE as v, AGENT_REPLY_EVENT_TYPE as x, AGENT_MESSAGE_EVENT_TYPE as y };