@sentry/junior 0.277.0 → 0.278.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 (73) hide show
  1. package/dist/{adapter-BtfBHVM5.js → adapter-BXosqTMx.js} +1 -1
  2. package/dist/{admin-DzAKbZsm.js → admin-Thn7NfOi.js} +1 -1
  3. package/dist/{agent-invocations-Crs3XHhg.js → agent-invocations-D7c4BQGc.js} +1 -1
  4. package/dist/{agent-runner-BsYAbniN.js → agent-runner-DE-43MPb.js} +268 -835
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +5 -5
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +38 -76
  9. package/dist/{app-BjEQwNVP.d.ts → app-CHNS-AX2.d.ts} +5 -26
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +30 -31
  12. package/dist/{assistant-reply-NebRGG4G.js → assistant-reply-pauL6qyn.js} +28 -6
  13. package/dist/{automation-Cql9h2vO.js → automation-DphoTRYl.js} +1 -1
  14. package/dist/{background-compaction-queue-hh18yCeU.js → background-compaction-queue-CAL4A2y7.js} +2 -2
  15. package/dist/{briefs-BBo0Eimi.js → briefs-4fyPJJEu.js} +5 -6
  16. package/dist/{catalog-runtime-DE-F4Awo.js → catalog-runtime-BoOb5oUv.js} +1 -1
  17. package/dist/cli/chat.js +14 -14
  18. package/dist/cli/check.js +3 -3
  19. package/dist/cli/init.js +0 -2
  20. package/dist/cli/main.js +3 -3
  21. package/dist/cli/plugins.js +4 -4
  22. package/dist/cli/snapshot-create.js +4 -4
  23. package/dist/cli/upgrade.d.ts +1 -1
  24. package/dist/cli/upgrade.js +3 -3
  25. package/dist/{client-DZ8HTnYH.js → client-v_OVYuHZ.js} +3 -3
  26. package/dist/{config-D5uUtrCP.js → config-o2jLRY5J.js} +24 -99
  27. package/dist/{connections-Do24CGP5.js → connections-RC4NXAx8.js} +10 -10
  28. package/dist/{conversation-SsASlWL7.js → conversation-CZfyQvdm.js} +51 -104
  29. package/dist/{conversation-privacy-VuylvlKr.js → conversation-privacy-C23M8KaD.js} +1 -1
  30. package/dist/{credential-sync-BGQK3pOa.js → credential-sync-Dd0WyNfF.js} +13 -13
  31. package/dist/{db-DEiwO5Sh.d.ts → db-BjLzDJCt.d.ts} +1 -1
  32. package/dist/{executor-hPfFTH0C.js → executor-CJfsD0VX.js} +3 -3
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{logging-cI3T1dNc.js → logging-dFaXvBRK.js} +1 -1
  35. package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
  36. package/dist/{message-DBwsAl7O.js → message-DSwxIZet.js} +22 -28
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +3 -3
  39. package/dist/{oauth-callback-server-DXrnbplb.js → oauth-callback-server-CDcuCp27.js} +2 -2
  40. package/dist/{projection-7EFIqzuj.js → projection-BTge9wrH.js} +106 -108
  41. package/dist/{prompt-oRfGsxd3.js → prompt-DDtCnlHP.js} +1 -1
  42. package/dist/{registry-Bzefs7kT.js → registry-Cp6CNmtP.js} +1 -1
  43. package/dist/{resolve-CuiEY_2u.js → resolve-B_7h2cXx.js} +3 -3
  44. package/dist/{result-DrcUtFaD.js → result-5LBEfnLX.js} +9 -9
  45. package/dist/{runner-CDE4CZ52.js → runner-C5-S4oq-.js} +11 -11
  46. package/dist/{sandbox-egress-signals-0tcmGd13.js → sandbox-egress-signals-B4GehT1L.js} +1 -1
  47. package/dist/{schema-Dzi3lkdP.js → schema-B5fpczDw.js} +67 -4
  48. package/dist/{schema-B6N2nc6v.d.ts → schema-Tr484cCC.d.ts} +909 -687
  49. package/dist/{service-account-DIyz_9Uh.js → service-account-BkEv20zf.js} +3 -3
  50. package/dist/{service-account-BOz9pqOE.js → service-account-Cq_dLrZJ.js} +3 -3
  51. package/dist/{session-stop-0juF_BP0.js → session-stop-BsS4qFS2.js} +22 -15
  52. package/dist/{skills-CU5Is147.js → skills-M0BA0_s6.js} +2 -2
  53. package/dist/{spawn-6C9jHH4b.js → spawn-BO3y7H4d.js} +2 -3
  54. package/dist/{stop-6FVG1c-r.js → stop-D5R82Wla.js} +255 -64
  55. package/dist/{store-DtHZviJ1.js → store-BGBzQWNf.js} +9 -16
  56. package/dist/{store-DKs1WwdB.js → store-CGJZTEVz.js} +3 -3
  57. package/dist/{task-queue-CcvFQE_p.js → task-queue-UD27ei2U.js} +3 -3
  58. package/dist/{task-runner-DBkNejLl.js → task-runner-noxjOjkM.js} +7 -7
  59. package/dist/{thread-state-4hjEIkIq.js → thread-state-BSu6rM6p.js} +4 -4
  60. package/dist/{turn-failure-response-BZNLydC3.js → turn-failure-response-wahwyPrZ.js} +7 -7
  61. package/dist/{turn-lifecycle-BhqYjaa4.js → turn-lifecycle-Bo4Trccw.js} +1 -1
  62. package/dist/{turn-session-routing-jnLOfBHJ.js → turn-session-routing-DnSaaEpn.js} +10 -10
  63. package/dist/{validation-BUFmsnKs.js → validation-B9-8iKyw.js} +1 -1
  64. package/dist/{version-DJTk0ZCE.js → version-C7HejFP2.js} +1 -1
  65. package/dist/version.js +1 -1
  66. package/dist/{viewer-WY0RYE4E.js → viewer-DLXajQZE.js} +52 -21
  67. package/dist/{work-C5AKvXJV.js → work-DRGSlfia.js} +12 -17
  68. package/dist/{worker-BcYVDVUy.js → worker-BGh5Dwc6.js} +6 -6
  69. package/migrations/meta/0075_snapshot.json +98 -314
  70. package/migrations/meta/0076_snapshot.json +98 -314
  71. package/migrations/meta/_journal.json +1 -1
  72. package/package.json +4 -4
  73. package/dist/model-profile-B998sjVd.js +0 -67
@@ -1,4 +1,4 @@
1
- import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-DstkkoNP.js";
1
+ import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-DTAA8Qs_.js";
2
2
  import { z } from "zod";
3
3
  import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
4
4
  // src/chat/briefs/schema.ts
@@ -284,11 +284,30 @@ const conversationAttachmentParamsSchema = z.object({
284
284
  attachmentId: z.string().min(1),
285
285
  conversationId: z.string().min(1)
286
286
  }).strict();
287
- const conversationDetailQuerySchema = z.object({ limit: z.coerce.number().int().min(1).max(1e3).default(500) }).strict();
288
- const conversationEventsQuerySchema = z.object({
289
- before: z.string().min(1),
290
- limit: z.coerce.number().int().min(1).max(1e3).default(500)
287
+ const conversationDetailQuerySchema = z.object({
288
+ limit: z.coerce.number().int().min(1).max(1e3).default(500),
289
+ /** Also return `unreadPage` when the detail has an `unreadCursor`. */
290
+ unreadPage: z.stringbool().optional()
291
291
  }).strict();
292
+ const conversationEventsLimitSchema = z.coerce.number().int().min(1).max(1e3).default(500);
293
+ /**
294
+ * Page toward the start with `before`, toward the latest with `after`, or
295
+ * both ways from one event with `around`.
296
+ */
297
+ const conversationEventsQuerySchema = z.union([
298
+ z.object({
299
+ before: z.string().min(1),
300
+ limit: conversationEventsLimitSchema
301
+ }).strict(),
302
+ z.object({
303
+ after: z.string().min(1),
304
+ limit: conversationEventsLimitSchema
305
+ }).strict(),
306
+ z.object({
307
+ around: z.string().min(1),
308
+ limit: conversationEventsLimitSchema
309
+ }).strict()
310
+ ]);
292
311
  const conversationFeedQuerySchema = z.object({
293
312
  actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
294
313
  codeRepositoryId: z.string().uuid().optional(),
@@ -319,68 +338,6 @@ const actorIdentitySchema = z.object({
319
338
  slackUserId: z.string().optional(),
320
339
  slackUserName: z.string().optional()
321
340
  }).strict();
322
- /** Mailbox delivery mode for one accepted inbound message. */
323
- const conversationPendingMessageDeliverySchema = z.enum(["defer", "interrupt"]);
324
- /** One accepted mailbox message that has not reached durable history yet. */
325
- const conversationPendingMessageSchema = z.object({
326
- actorIdentity: actorIdentitySchema.optional(),
327
- /** Identity id of the author. Detail `authors` maps it to the person. */
328
- actorIdentityId: z.string().min(1).optional(),
329
- createdAt: z.string().datetime(),
330
- delivery: conversationPendingMessageDeliverySchema,
331
- inboundMessageId: z.string().min(1),
332
- messageId: z.string().min(1),
333
- receivedAt: z.string().datetime(),
334
- role: z.literal("user"),
335
- source: z.enum(["slack", "web"]),
336
- text: z.string().optional(),
337
- /** People mentioned in the text, resolved at read time. */
338
- mentions: z.array(actorIdentitySchema).optional(),
339
- attachments: z.array(messageAttachmentSchema).optional(),
340
- /** Review item change that this Message records. */
341
- reviewItemChange: reviewItemChangeRecordSchema.optional(),
342
- redacted: z.literal(true).optional()
343
- }).strict().superRefine((data, context) => {
344
- if (data.text === void 0 === (data.redacted !== true)) context.addIssue({
345
- code: "custom",
346
- message: "pending message content must be text or explicitly redacted"
347
- });
348
- if (data.redacted && (data.actorIdentity || data.attachments || data.mentions || data.reviewItemChange)) context.addIssue({
349
- code: "custom",
350
- message: "redacted pending messages must not expose actor identity, attachments, mentions, or a review item"
351
- });
352
- });
353
- /** Participant-only authorization prompt for a parked web turn. */
354
- const conversationPendingAuthorizationSchema = z.object({
355
- authorizationUrl: z.string().url(),
356
- completionText: z.string().min(1),
357
- label: z.string().min(1)
358
- }).strict();
359
- /** Bounded mailbox snapshot for one conversation transcript. */
360
- const conversationPendingMessagesReportSchema = z.object({
361
- authorization: conversationPendingAuthorizationSchema.optional(),
362
- conversationId: z.string().min(1),
363
- generatedAt: z.string().datetime(),
364
- messages: z.array(conversationPendingMessageSchema)
365
- }).strict();
366
- /** Optional filters for cancelling accepted mailbox rows. */
367
- const cancelConversationPendingMessagesBodySchema = z.object({
368
- inboundMessageIds: z.array(z.string().min(1)).min(1).optional(),
369
- receivedBefore: z.string().datetime().optional()
370
- }).strict();
371
- /** Result of cancelling accepted human-facing mailbox rows. */
372
- const cancelConversationPendingMessagesResponseSchema = z.object({
373
- cancelledCount: z.number().int().nonnegative(),
374
- cancelledInboundMessageIds: z.array(z.string().min(1)),
375
- conversationId: z.string().min(1)
376
- }).strict();
377
- /** Queued web messages that the viewer wants Junior to read now. */
378
- const steerConversationPendingMessagesBodySchema = z.object({ inboundMessageIds: z.array(z.string().min(1)).min(1) }).strict();
379
- /** Result of steering queued web messages into the conversation. */
380
- const steerConversationPendingMessagesResponseSchema = z.object({
381
- conversationId: z.string().min(1),
382
- steeredInboundMessageIds: z.array(z.string().min(1))
383
- }).strict();
384
341
  const conversationAuxiliaryCostsSchema = z.object({
385
342
  costUsd: z.number().finite().nonnegative(),
386
343
  operations: z.array(z.object({
@@ -493,6 +450,7 @@ const conversationReportMessageEventDataSchema = z.object({
493
450
  eventType: z.string().min(1).optional(),
494
451
  eventObjectType: objectTypeSchema.optional(),
495
452
  explicitMention: z.boolean().optional(),
453
+ quiet: z.literal(true).optional(),
496
454
  trustedSummary: z.string().min(1).optional(),
497
455
  /**
498
456
  * The Watch Events when several arrived together. A message that also
@@ -602,20 +560,6 @@ const conversationReportTurnLifecycleEventDataSchema = z.discriminatedUnion("sta
602
560
  sentryEventUrl: z.string().url().optional()
603
561
  }).strict()
604
562
  ]);
605
- const conversationReportTurnRoutedEventDataSchema = z.object({
606
- type: z.literal("turn_routed"),
607
- turnId: z.string().min(1),
608
- modelProfile: z.string().min(1),
609
- modelId: z.string().min(1),
610
- costUsd: z.number().finite().nonnegative().optional(),
611
- reasoningLevel: z.string().min(1),
612
- confidence: z.number().min(0).max(1).optional(),
613
- source: z.enum([
614
- "configured",
615
- "inherited",
616
- "router"
617
- ])
618
- }).strict();
619
563
  const conversationReportGuardianActionReviewedEventDataSchema = z.object({
620
564
  type: z.literal("guardian_action_reviewed"),
621
565
  turnId: z.string().min(1),
@@ -661,7 +605,6 @@ const conversationReportAttachmentsDeliveredEventDataSchema = z.object({
661
605
  }).strict();
662
606
  const conversationReportCompactionEventDataSchema = z.object({
663
607
  type: z.literal("compaction"),
664
- modelProfile: z.string().min(1).optional(),
665
608
  modelId: z.string().min(1).optional(),
666
609
  summary: z.string().min(1).optional(),
667
610
  details: z.object({
@@ -675,14 +618,6 @@ const conversationReportCompactionEventDataSchema = z.object({
675
618
  summaryChars: z.number().int().nonnegative()
676
619
  }).strict().optional()
677
620
  }).strict();
678
- const conversationReportHandoffEventDataSchema = z.object({
679
- type: z.literal("handoff"),
680
- modelProfile: z.string().min(1),
681
- modelId: z.string().min(1),
682
- reasoningLevel: z.string().min(1).optional(),
683
- triggeringToolCallId: z.string().min(1).optional(),
684
- summary: z.string().min(1).optional()
685
- }).strict();
686
621
  const conversationReportSubagentEventDataSchema = z.object({
687
622
  type: z.literal("subagent"),
688
623
  startedSeq: z.number().int().nonnegative(),
@@ -711,10 +646,8 @@ const conversationReportEventDataSchema = z.discriminatedUnion("type", [
711
646
  conversationReportTurnContextEventDataSchema,
712
647
  conversationReportStructuredEventDataSchema,
713
648
  conversationReportAttachmentsDeliveredEventDataSchema,
714
- conversationReportTurnRoutedEventDataSchema,
715
649
  conversationReportGuardianActionReviewedEventDataSchema,
716
650
  conversationReportCompactionEventDataSchema,
717
- conversationReportHandoffEventDataSchema,
718
651
  conversationReportSubagentEventDataSchema
719
652
  ]);
720
653
  /** One ordered, privacy-safe canonical event projected for API consumers. */
@@ -724,11 +657,7 @@ const conversationReportEventSchema = z.object({
724
657
  data: conversationReportEventDataSchema,
725
658
  /** People mentioned in the event text, resolved at read time. */
726
659
  mentions: z.array(actorIdentitySchema).optional(),
727
- model: z.object({
728
- modelId: z.string().min(1),
729
- modelProfile: z.string().min(1).optional(),
730
- reasoningLevel: z.string().min(1).optional()
731
- }).strict().optional(),
660
+ model: z.object({ modelId: z.string().min(1) }).strict().optional(),
732
661
  modelCall: z.object({
733
662
  provider: z.string().min(1).optional(),
734
663
  api: z.string().min(1).optional(),
@@ -841,6 +770,20 @@ const conversationAgentTreeNodeSchema = z.object({
841
770
  conversationId: z.string().min(1),
842
771
  label: z.string().min(1)
843
772
  }).strict();
773
+ const conversationEventPageSchema = z.object({
774
+ events: z.array(conversationReportEventSchema),
775
+ eventHistory: conversationEventHistorySchema,
776
+ previousCursor: z.string().min(1).optional(),
777
+ /** Present on `after` and `around` pages when newer events follow. */
778
+ nextCursor: z.string().min(1).optional(),
779
+ generatedAt: z.string()
780
+ }).strict().superRefine(validateConversationEvents);
781
+ /**
782
+ * Carries the detail version token in both directions. A custom header, not
783
+ * `ETag` / `If-None-Match`: in production the Vercel CDN answered standard
784
+ * validators itself, after the function had already built the full report.
785
+ */
786
+ const CONVERSATION_DETAIL_VERSION_HEADER = "x-junior-detail-version";
844
787
  const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
845
788
  /**
846
789
  * The parent chain of a child Conversation, root first, with this
@@ -853,6 +796,16 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
853
796
  canFork: z.boolean().optional(),
854
797
  /** How far the signed-in viewer has read. Absent until they read. */
855
798
  readPosition: conversationReadPositionSchema.optional(),
799
+ /**
800
+ * Pass as `after` to the events API to read from the read position.
801
+ * Present only when unread events start before `events`.
802
+ */
803
+ unreadCursor: z.string().min(1).optional(),
804
+ /**
805
+ * The `around` page of `unreadCursor`, when the request asks for it. A
806
+ * reader who opens at the read position needs no second request.
807
+ */
808
+ unreadPage: conversationEventPageSchema.optional(),
856
809
  forkedFromConversationId: z.string().optional(),
857
810
  /** Title of the fork source, when the viewer can open it. */
858
811
  forkedFromTitle: z.string().optional(),
@@ -878,15 +831,9 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
878
831
  sentryConversationUrl: z.string().optional(),
879
832
  sourceTask: conversationSourceTaskSchema.optional()
880
833
  }).strict().superRefine(validateConversationEvents);
881
- const conversationEventPageSchema = z.object({
882
- events: z.array(conversationReportEventSchema),
883
- eventHistory: conversationEventHistorySchema,
884
- previousCursor: z.string().min(1).optional(),
885
- generatedAt: z.string()
886
- }).strict().superRefine(validateConversationEvents);
887
834
  const conversationFeedSchema = z.object({
888
835
  conversations: z.array(conversationSummaryReportSchema),
889
836
  source: z.literal("conversation_index"),
890
837
  generatedAt: z.string()
891
838
  }).strict();
892
- export { forkConversationResponseSchema as A, removedCardSchema as B, conversationReportStatusSchema as C, createConversationBodySchema as D, conversationUsageSchema as E, reviewItemChangeRecordSchema as F, briefCodeChangeSchema as G, MAX_INPUT_IMAGES as H, annotationCard as I, conversationBriefSchema as J, briefLinkSchema as K, messageCardRef as L, steerConversationPendingMessagesResponseSchema as M, conversationChildAgentTotalsSchema as N, createConversationMessageBodySchema as O, conversationReadPositionSchema as P, messageCardText as R, conversationReportMessageEventSchema as S, conversationSurfaceSchema as T, MAX_INPUT_IMAGE_BYTES as U, resolveMessageCards as V, readMessageAttachments as W, parseBriefInput as Y, conversationPendingMessageDeliverySchema as _, conversationActivityPreviewSchema as a, conversationReportEventDataSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, conversationEventsQuerySchema as f, conversationPendingAuthorizationSchema as g, conversationParamsSchema as h, cancelConversationPendingMessagesResponseSchema as i, steerConversationPendingMessagesBodySchema as j, forkConversationBodySchema as k, conversationDetailReportSchema as l, conversationFeedSchema as m, actorIdentitySchema as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, briefOutcomeStatusSchema as q, cancelConversationPendingMessagesBodySchema as r, conversationAuxiliaryCostsSchema as s, acceptedConversationMessageSchema as t, conversationEventHistorySchema as u, conversationPendingMessageSchema as v, conversationSummaryReportSchema as w, conversationReportEventSchema as x, conversationPendingMessagesReportSchema as y, readMessageCardRefs as z };
839
+ export { messageCardRef as A, briefLinkSchema as B, createConversationMessageBodySchema as C, conversationReadPositionSchema as D, conversationChildAgentTotalsSchema as E, MAX_INPUT_IMAGES as F, conversationBriefSchema as H, MAX_INPUT_IMAGE_BYTES as I, messageAttachmentSchema as L, readMessageCardRefs as M, removedCardSchema as N, reviewItemChangeRecordSchema as O, resolveMessageCards as P, readMessageAttachments as R, createConversationBodySchema as S, forkConversationResponseSchema as T, parseBriefInput as U, briefOutcomeStatusSchema as V, conversationReportMessageEventSchema as _, conversationAttachmentParamsSchema as a, conversationSurfaceSchema as b, conversationDetailReportSchema as c, conversationEventsQuerySchema as d, conversationFeedQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, conversationActivityPreviewSchema as i, messageCardText as j, annotationCard as k, conversationEventHistorySchema as l, conversationParamsSchema as m, acceptedConversationMessageSchema as n, conversationAuxiliaryCostsSchema as o, conversationFeedSchema as p, actorIdentitySchema as r, conversationDetailQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventPageSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, briefCodeChangeSchema as z };
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-cI3T1dNc.js";
1
+ import { h as logWarn } from "./logging-dFaXvBRK.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,19 +1,19 @@
1
- import { Dn as createUserTokenStore, Hi as getSlackClient, Mi as postSlackMessage, X as getConversationPendingAuth, _i as parseOAuthStatePayload, f as recordAuthenticationLinked, gi as formatProviderLabel, it as getTurnRecord, jn as resolvePluginOAuthAccount, p as recordAuthorizationCompleted, vi as resolveBaseUrl } from "./projection-7EFIqzuj.js";
2
- import { m as escapeXml } from "./client-DZ8HTnYH.js";
3
- import { a as getRuntimeMetadata, n as botConfig } from "./config-D5uUtrCP.js";
4
- import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-cI3T1dNc.js";
1
+ import { On as resolvePluginOAuthAccount, d as recordAuthorizationCompleted, hi as resolveBaseUrl, ki as postSlackMessage, mi as parseOAuthStatePayload, pi as formatProviderLabel, q as getConversationPendingAuth, tt as getTurnRecord, u as recordAuthenticationLinked, wn as createUserTokenStore, zi as getSlackClient } from "./projection-BTge9wrH.js";
2
+ import { m as escapeXml } from "./client-v_OVYuHZ.js";
3
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-o2jLRY5J.js";
4
+ import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-dFaXvBRK.js";
5
5
  import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
6
- import { C as getSqlExecutor, L as findUserByVerifiedEmails, N as resolveActorIdentityId, V as upsertLinkedIdentity, o as readIdentityById } from "./viewer-WY0RYE4E.js";
6
+ import { B as findUserByVerifiedEmails, C as getSqlExecutor, I as resolveActorIdentityId, W as upsertLinkedIdentity, o as readIdentityById } from "./viewer-DLXajQZE.js";
7
7
  import { i as homeDir } from "./package-discovery-DJBompdd.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-Bzefs7kT.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DE-F4Awo.js";
10
- import { t as discoverSkills } from "./skills-CU5Is147.js";
11
- import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-BsYAbniN.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-Cp6CNmtP.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
10
+ import { t as discoverSkills } from "./skills-M0BA0_s6.js";
11
+ import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DE-43MPb.js";
12
12
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { r as getStateAdapter } from "./adapter-BtfBHVM5.js";
14
- import { _ as getMcpProviderErrorAttributes } from "./service-account-DIyz_9Uh.js";
15
- import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-4hjEIkIq.js";
16
- import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-Do24CGP5.js";
13
+ import { r as getStateAdapter } from "./adapter-BXosqTMx.js";
14
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-BkEv20zf.js";
15
+ import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BSu6rM6p.js";
16
+ import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-RC4NXAx8.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-C6ZAyJgf.js";
18
18
  import path from "node:path";
19
19
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./schema-B6N2nc6v.js";
1
+ import "./schema-Tr484cCC.js";
2
2
  import { z } from "zod";
3
3
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
4
4
  import "drizzle-orm/pg-core";
@@ -1,6 +1,6 @@
1
- import "./config-D5uUtrCP.js";
2
- import { p as logException } from "./logging-cI3T1dNc.js";
3
- import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Crs3XHhg.js";
1
+ import "./config-o2jLRY5J.js";
2
+ import { p as logException } from "./logging-dFaXvBRK.js";
3
+ import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-D7c4BQGc.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, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -1,6 +1,6 @@
1
- import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-cI3T1dNc.js";
1
+ import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-dFaXvBRK.js";
2
2
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-MDkYAVPV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-VuylvlKr.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C23M8KaD.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
5
5
  import { performance } from "node:perf_hooks";
6
6
  import { subscribe, unsubscribe } from "node:diagnostics_channel";
@@ -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-MDkYAVPV.js";
2
- import { t as JUNIOR_VERSION } from "./version-DJTk0ZCE.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C7HejFP2.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,4 +1,3 @@
1
- import { c as modelProfileSchema, u as TURN_REASONING_LEVELS } from "./model-profile-B998sjVd.js";
2
1
  import { z } from "zod";
3
2
  import { actorSchema } from "@sentry/junior-plugin-api";
4
3
  // src/usage-schema.ts
@@ -124,8 +123,8 @@ function decodeHistoryPayload(type, payload) {
124
123
  * Durable conversation event history port.
125
124
  *
126
125
  * Events append under the conversation lease in stable sequence order.
127
- * Compaction and handoff replace the active model history without rewriting
128
- * prior events. Unsupported stored events remain readable as opaque facts,
126
+ * Compaction replaces the active model history without rewriting prior
127
+ * events. Unsupported stored events remain readable as opaque facts,
129
128
  * while malformed known events fail loudly. Provider-specific message fields
130
129
  * are validated by the Pi adapter when it restores model context.
131
130
  */
@@ -172,22 +171,24 @@ const compactionDetailsSchema = z.object({
172
171
  retainedMessageCount: z.number().int().nonnegative(),
173
172
  summaryChars: z.number().int().nonnegative()
174
173
  }).strict();
175
- const historyReplacementEventDataSchema = z.discriminatedUnion("type", [z.object({
176
- type: z.literal("handoff"),
177
- modelProfile: modelProfileSchema,
174
+ const legacyModelProfileSchema = z.string().min(1).optional();
175
+ const historyReplacementEventDataSchema = z.object({
176
+ type: z.literal("compaction"),
177
+ modelProfile: legacyModelProfileSchema,
178
178
  modelId: z.string().min(1),
179
- reasoningLevel: z.string().min(1).optional(),
180
- triggeringToolCallId: z.string().min(1).optional(),
179
+ details: compactionDetailsSchema.optional(),
181
180
  summary: z.string().min(1).optional(),
182
181
  replacementHistory: replacementHistorySchema
183
- }).strict(), z.object({
184
- type: z.literal("compaction"),
185
- modelProfile: modelProfileSchema,
182
+ }).strict();
183
+ const legacyHandoffEventDataSchema = z.object({
184
+ type: z.literal("handoff"),
185
+ modelProfile: legacyModelProfileSchema,
186
186
  modelId: z.string().min(1),
187
- details: compactionDetailsSchema.optional(),
187
+ reasoningLevel: z.string().min(1).optional(),
188
+ triggeringToolCallId: z.string().min(1).optional(),
188
189
  summary: z.string().min(1).optional(),
189
190
  replacementHistory: replacementHistorySchema
190
- }).strict()]);
191
+ }).strict();
191
192
  /** Validate an event that intentionally replaces active model history. */
192
193
  const historyReplacementSchema = z.object({
193
194
  data: historyReplacementEventDataSchema,
@@ -316,19 +317,15 @@ const turnStartedEventDataSchema = z.object({
316
317
  inputMessageIds: z.array(z.string().min(1)).min(1),
317
318
  surface: conversationTurnSurfaceSchema
318
319
  }).strict().refine((data) => new Set(data.inputMessageIds).size === data.inputMessageIds.length, "turn input message ids must be unique");
319
- const turnRoutedEventDataSchema = z.object({
320
+ const legacyTurnRoutedEventDataSchema = z.object({
320
321
  type: z.literal("turn_routed"),
321
322
  turnId: z.string().min(1),
322
- modelProfile: modelProfileSchema,
323
+ modelProfile: z.string().min(1),
323
324
  modelId: z.string().min(1),
324
325
  costUsd: z.number().finite().nonnegative().optional(),
325
- reasoningLevel: z.enum(TURN_REASONING_LEVELS),
326
+ reasoningLevel: z.string().min(1),
326
327
  confidence: z.number().min(0).max(1).optional(),
327
- source: z.enum([
328
- "configured",
329
- "inherited",
330
- "router"
331
- ])
328
+ source: z.string().min(1)
332
329
  }).strict();
333
330
  const turnContextEventDataSchema = z.object({
334
331
  type: z.literal("turn_context"),
@@ -404,7 +401,7 @@ const compactionRequestedEventDataSchema = z.object({
404
401
  type: z.literal("compaction_requested"),
405
402
  markSeq: z.number().int().nonnegative(),
406
403
  historyVersion: z.number().int().nonnegative(),
407
- modelProfile: modelProfileSchema,
404
+ modelProfile: legacyModelProfileSchema,
408
405
  modelId: z.string().min(1)
409
406
  }).strict();
410
407
  const compactionPreparedFields = compactionRequestedEventDataSchema.extend({ type: z.literal("compaction_prepared") });
@@ -431,7 +428,6 @@ const appendableConversationEventDataSchema = z.union([
431
428
  turnContextEventDataSchema,
432
429
  structuredConversationEventDataSchema,
433
430
  attachmentsDeliveredEventDataSchema,
434
- turnRoutedEventDataSchema,
435
431
  turnCompletedEventDataSchema,
436
432
  turnFailedEventDataSchema,
437
433
  subagentStartedEventDataSchema,
@@ -443,6 +439,8 @@ const appendableConversationEventDataSchema = z.union([
443
439
  const conversationEventDataSchema = z.union([
444
440
  appendableConversationEventDataSchema,
445
441
  historyReplacementEventDataSchema,
442
+ legacyHandoffEventDataSchema,
443
+ legacyTurnRoutedEventDataSchema,
446
444
  unownedMcpProviderConnectedEventDataSchema
447
445
  ]);
448
446
  /** Event type names recognized by current readers and observational queries. */
@@ -1,25 +1,23 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Na as readConversationAccessFromSql } from "./projection-7EFIqzuj.js";
3
- import { n as botConfig } from "./config-D5uUtrCP.js";
4
- import { M as SYSTEM_IDENTITY_ID, S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-WY0RYE4E.js";
5
- import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-BsYAbniN.js";
6
- import { F as findChildAgentConversationId, L as PARENT_AGENT_TARGET, N as AgentMessageTargetError, a as createAgentInvocationForMessage, j as AgentMessagePausedError, s as getActiveAgentInvocationForConversation } from "./store-DtHZviJ1.js";
7
- import { D as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, j as admitAutomatedTurn } from "./session-stop-0juF_BP0.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-DKs1WwdB.js";
9
- import { r as enqueueAgentMessageToParent } from "./result-DrcUtFaD.js";
10
- import { i as enqueueAgentInvocation } from "./work-C5AKvXJV.js";
2
+ import { Aa as canAccessConversation, ja as readConversationAccessFromSql } from "./projection-BTge9wrH.js";
3
+ import { n as botConfig } from "./config-o2jLRY5J.js";
4
+ import { F as SYSTEM_IDENTITY_ID, S as getDb, x as getConversationStore } from "./viewer-DLXajQZE.js";
5
+ import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-DE-43MPb.js";
6
+ import { F as findChildAgentConversationId, L as PARENT_AGENT_TARGET, N as AgentMessageTargetError, a as createAgentInvocationForMessage, j as AgentMessagePausedError, s as getActiveAgentInvocationForConversation } from "./store-BGBzQWNf.js";
7
+ import { D as postAutomatedTurnLimitNoticeForConversation, a as EVENT_WAIT_MS, j as admitAutomatedTurn } from "./session-stop-BsS4qFS2.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-CGJZTEVz.js";
9
+ import { r as enqueueAgentMessageToParent } from "./result-5LBEfnLX.js";
10
+ import { i as enqueueAgentInvocation } from "./work-DRGSlfia.js";
11
11
  // src/chat/agent-invocations/top-level-message.ts
12
12
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
13
  /** Event type of a message from another top-level agent. */
14
14
  const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
15
15
  /**
16
- * Check that a top-level agent can message another top-level agent. Both
17
- * must be in the same provider tenant and have the same scope: public or
18
- * private. To reach a private agent, the person behind the sender's Actor
19
- * must be a member of the target Conversation. A system Actor has no
20
- * person, so it reaches only public agents. Every target that the Actor
21
- * cannot see gets the same error, so the error does not show that a private
22
- * Conversation exists.
16
+ * Check that a top-level agent can message another top-level agent under
17
+ * `policies/conversation-access.md`. A private Conversation is isolated, so
18
+ * only public agents in the same provider tenant can message each other.
19
+ * Every target that the sender cannot reach gets the same error, so the
20
+ * error does not show that a private Conversation exists.
23
21
  */
24
22
  async function requireTopLevelAgentAccess(args) {
25
23
  const notReachable = new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}", a child agent of this conversation, or a top-level agent that you can message`);
@@ -28,16 +26,14 @@ async function requireTopLevelAgentAccess(args) {
28
26
  const [senderConversation, target] = await Promise.all([conversationStore.get({ conversationId: args.senderConversationId }), conversationStore.get({ conversationId: args.to })]);
29
27
  if (senderConversation?.parentConversationId) throw new AgentMessageTargetError(`"${args.to}" is not "${PARENT_AGENT_TARGET}" or a child agent of this conversation`);
30
28
  if (!target || target.parentConversationId) throw notReachable;
31
- const user = (await readActorIdentity(args.actor))?.user;
32
- const access = await readConversationAccessFromSql(getDb(), [args.senderConversationId, args.to], user);
29
+ const access = await readConversationAccessFromSql(getDb(), [args.senderConversationId, args.to]);
33
30
  const sender = access.get(args.senderConversationId);
34
31
  const receiver = access.get(args.to);
35
- if (!sender?.tenant || !receiver?.tenant || !sender.visibility || !receiver.visibility || sender.visibility === "unknown" || receiver.visibility === "unknown" || sender.tenant.provider !== receiver.tenant.provider || sender.tenant.providerTenantId !== receiver.tenant.providerTenantId) throw notReachable;
36
- const senderScope = sender.visibility === "public" ? "public" : "private";
37
- const targetScope = receiver.visibility === "public" ? "public" : "private";
38
- if (targetScope === "private" && !receiver.isParticipant) throw notReachable;
39
- if (senderScope !== targetScope) throw new AgentMessageTargetError(`"${args.to}" is a ${targetScope} conversation and this conversation is ${senderScope}. A top-level agent can message only top-level agents with the same visibility`);
40
- return targetScope;
32
+ if (!sender || !receiver || !canAccessConversation({
33
+ requester: sender,
34
+ target: receiver
35
+ })) throw notReachable;
36
+ if (sender.visibility !== "public") throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation cannot message another conversation`);
41
37
  }
42
38
  function renderTopLevelMessageInput(args) {
43
39
  return [
@@ -51,7 +47,7 @@ function renderTopLevelMessageInput(args) {
51
47
  "Message:",
52
48
  args.text.trim(),
53
49
  "",
54
- args.scope === "public" ? `To answer the sender, use messageAgent with to set to "${args.senderConversationId}".` : "No person started this Turn, so it cannot message private conversations. Answer in this conversation."
50
+ `To answer the sender, use messageAgent with to set to "${args.senderConversationId}".`
55
51
  ].join("\n");
56
52
  }
57
53
  /**
@@ -61,7 +57,7 @@ function renderTopLevelMessageInput(args) {
61
57
  * other running. Repeat calls with the same `messageKey` are safe.
62
58
  */
63
59
  async function enqueueTopLevelAgentMessage(args) {
64
- const scope = await requireTopLevelAgentAccess(args);
60
+ await requireTopLevelAgentAccess(args);
65
61
  const nowMs = args.nowMs ?? Date.now();
66
62
  const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
67
63
  const decision = await admitAutomatedTurn({
@@ -101,7 +97,6 @@ async function enqueueTopLevelAgentMessage(args) {
101
97
  authorIdentityId: SYSTEM_IDENTITY_ID,
102
98
  metadata,
103
99
  text: renderTopLevelMessageInput({
104
- scope,
105
100
  senderConversationId: args.senderConversationId,
106
101
  summary,
107
102
  text: args.text
@@ -150,7 +145,6 @@ function bindMessageAgent(run, options) {
150
145
  });
151
146
  if (!childConversationId) {
152
147
  await enqueueTopLevelAgentMessage({
153
- actor,
154
148
  messageKey: `${run.turnId}:${call.toolCallId}`,
155
149
  queue,
156
150
  senderConversationId: run.conversationId,
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-BjEQwNVP.js";
1
+ import { i as JuniorDashboardOptions } from "./app-CHNS-AX2.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-cI3T1dNc.js";
1
+ import { A as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_ROUTE, I as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_ROUTE, N as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_RETENTION_CRON_SCHEDULE, R as getDeploymentServiceVersion, j as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE } from "./logging-dFaXvBRK.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJBompdd.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-hh18yCeU.js";
3
+ import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CAL4A2y7.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-DOm9Y6qI.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CcvFQE_p.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-UD27ei2U.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 { Dn as createUserTokenStore } from "./projection-7EFIqzuj.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BGQK3pOa.js";
1
+ import { wn as createUserTokenStore } from "./projection-BTge9wrH.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Dd0WyNfF.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;