@sentry/junior 0.296.0 → 0.298.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 (82) hide show
  1. package/dist/{admin-z_lgDi-z.js → admin-BF3DbYGf.js} +2 -2
  2. package/dist/{agent-runner-HoQiUKLL.js → agent-runner-Q9GkoerG.js} +407 -1895
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +7 -7
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +38 -267
  7. package/dist/{app-C75Ft-A_.d.ts → app-DOg_mCtV.d.ts} +7 -2
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +64 -44
  10. package/dist/attempt-selection-ClP3MMPr.js +61 -0
  11. package/dist/{automation-yJX3C7i3.js → automation-Cn8qmbdr.js} +1 -1
  12. package/dist/{background-compaction-queue-Cre1wFt9.js → background-compaction-queue-BZhGFOK6.js} +4 -88
  13. package/dist/{briefs-BXECHduJ.js → briefs-CQrCRF6-.js} +3 -3
  14. package/dist/{catalog-runtime-CpCmlD9L.js → catalog-runtime-DZeD2WbL.js} +1 -1
  15. package/dist/cli/chat.js +19 -15
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{config-CCPHvTqx.js → config-BOByVnxe.js} +2 -2
  23. package/dist/{connections-B5pWh8e2.js → connections-BNN5cJam.js} +6 -6
  24. package/dist/{conversation-CMkSmi02.js → conversation-DCkzvxqB.js} +51 -17
  25. package/dist/{conversation-feed-BVAOga0H.js → conversation-feed-CMA12Rjs.js} +1 -1
  26. package/dist/{conversation-privacy-CZD5soDW.js → conversation-privacy-C0eRxsgb.js} +1 -1
  27. package/dist/conversation-turn-D9qvcDX6.js +805 -0
  28. package/dist/{credential-sync-DwLkIvXI.js → credential-sync-B_iUpxGL.js} +14 -13
  29. package/dist/{db-C1M1y-bh.js → db-CoMNr2Zm.js} +43 -15
  30. package/dist/{db-B3iyr_Or.d.ts → db-DoMcnYol.d.ts} +13 -1
  31. package/dist/{executor-DUSEwXaO.js → executor-C-m8VrzX.js} +14 -6
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-D0svFM8r.js → logging-CJTi5niy.js} +1 -1
  34. package/dist/{message-BFnIwKpx.js → message-Q6_5DAWR.js} +15 -13
  35. package/dist/nitro.d.ts +1 -1
  36. package/dist/nitro.js +3 -2
  37. package/dist/{session-stop-hYNTNpVf.js → notification-Bv25xbj0.js} +11 -930
  38. package/dist/{oauth-callback-server-BXRtD6Fk.js → oauth-callback-server-CH5XAyo-.js} +2 -2
  39. package/dist/{projection-B6VS7kbo.js → projection-BgwEE36_.js} +333 -106
  40. package/dist/{prompt-CD11tfG8.js → prompt-DXc9DYT9.js} +4 -4
  41. package/dist/prompt-input-BUr4J9RO.js +1424 -0
  42. package/dist/{registry-CHewwYEo.js → registry-9XwqSnM-.js} +1 -1
  43. package/dist/reporting-window-DopzcOHh.js +137 -0
  44. package/dist/{resolve-1owMH4qo.js → resolve-DUIAbcRL.js} +3 -3
  45. package/dist/result-C2Vn8QGn.js +463 -0
  46. package/dist/{runner-BtWvJslp.js → runner-CXGtw-Mc.js} +9 -8
  47. package/dist/{sandbox-egress-signals-ByftwJVt.js → sandbox-egress-signals-Di3S_dO7.js} +1 -1
  48. package/dist/{schema-Ct1Zf2xy.d.ts → schema-BnbZ-rKv.d.ts} +14 -107
  49. package/dist/{schema-D2iGyYIp.js → schema-Dyp7racy.js} +11 -48
  50. package/dist/{service-account-BZEuMKdo.js → service-account-DM3KBBeG.js} +3 -3
  51. package/dist/{service-account-DLoeoHww.js → service-account-GzAMUQ8a.js} +3 -3
  52. package/dist/session-stop-D4i7e6iT.js +181 -0
  53. package/dist/{skills-DXgd5Inh.js → skills-DCK9SD_l.js} +2 -2
  54. package/dist/{spawn-YeqlNDv8.js → spawn-6cX6xE9G.js} +6 -5
  55. package/dist/{state-C3CbtD_m.js → state-CSuA2J1V.js} +2 -2
  56. package/dist/{stop-Cze_pEL8.js → stop-Dh2DfwpK.js} +66 -159
  57. package/dist/{store-CZ9vqR4P.js → store-B1zepKG8.js} +11 -4
  58. package/dist/{task-runner-CMiNGsER.js → store-DrA17Fbz.js} +939 -1593
  59. package/dist/task-queue-D1rXWfFN.js +89 -0
  60. package/dist/task-runner-CT4M8oDz.js +291 -0
  61. package/dist/thread-context-DnqUkbzN.js +248 -0
  62. package/dist/turn-cancel-l460pfGW.js +201 -0
  63. package/dist/turn-session-routing-VXDVXLRl.js +380 -0
  64. package/dist/{turn-failure-response-pXhZ2wMK.js → turn-user-message-BSPmkm7X.js} +181 -392
  65. package/dist/turn-wake-DVFVXyhX.js +161 -0
  66. package/dist/{reporting-window-B3Ze-Qnt.js → user-input-request-CXNIov9n.js} +24 -143
  67. package/dist/{validation-Du7NdkOR.js → validation-zxAJBDDy.js} +1 -1
  68. package/dist/{version-EN3Wnq-R.js → version-DcZ40a0g.js} +1 -1
  69. package/dist/version.js +1 -1
  70. package/dist/{viewer-Agxi_o5c.js → viewer-CgiGjW10.js} +3 -3
  71. package/dist/warmup-CwKbxQLl.js +2698 -0
  72. package/dist/{worker-BALVdWbv.js → worker-CbDUzaBA.js} +20 -8
  73. package/migrations/0102_code_change_last_activity.sql +1 -0
  74. package/migrations/0103_agent_invocation_fork.sql +8 -0
  75. package/migrations/meta/0102_snapshot.json +4502 -0
  76. package/migrations/meta/0103_snapshot.json +4509 -0
  77. package/migrations/meta/_journal.json +14 -0
  78. package/package.json +4 -4
  79. package/dist/result-CEqQFrEf.js +0 -305
  80. package/dist/result-event-type-DD6BAgT7.js +0 -11
  81. package/dist/warmup-CY2ArYag.js +0 -2017
  82. package/dist/work-EA98F0ia.js +0 -768
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-CCPHvTqx.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-DUSEwXaO.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-CHewwYEo.js";
1
+ import { i as getChatConfig } from "../config-BOByVnxe.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-C-m8VrzX.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-9XwqSnM-.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-HYh_JOdw.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-D0svFM8r.js";
3
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-CZD5soDW.js";
2
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-CJTi5niy.js";
3
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-C0eRxsgb.js";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import { del, get, put } from "@vercel/blob";
6
6
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
@@ -1,9 +1,9 @@
1
- import { Ii as startOAuthFlow } from "./projection-B6VS7kbo.js";
2
- import { n as botConfig } from "./config-CCPHvTqx.js";
3
- import { I as deleteProviderIdentityForSlackUser, L as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-C1M1y-bh.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-CHewwYEo.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CpCmlD9L.js";
6
- import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-HoQiUKLL.js";
1
+ import { Qi as startOAuthFlow } from "./projection-BgwEE36_.js";
2
+ import { n as botConfig } from "./config-BOByVnxe.js";
3
+ import { I as deleteProviderIdentityForSlackUser, L as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-CoMNr2Zm.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-9XwqSnM-.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DZeD2WbL.js";
6
+ import { c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-Q9GkoerG.js";
7
7
  import { randomBytes } from "node:crypto";
8
8
  // src/handlers/oauth-html.ts
9
9
  /** Build pre-escaped callback HTML with the shared response security policy. */
@@ -264,16 +264,9 @@ const reviewItemChangeRecordSchema = z.object({
264
264
  *
265
265
  * `lastReadSeq` is the event sequence of the last transcript row the viewer
266
266
  * saw. Reports only move it forward: the server keeps the highest value it
267
- * receives. Only Mark as unread moves it back. It is never before the
268
- * viewer's own latest Message.
267
+ * receives. It is never before the viewer's own latest Message.
269
268
  */
270
269
  const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().nonnegative() }).strict();
271
- /**
272
- * The reply to a read report: the stored read position and whether Junior's
273
- * latest visible reply is still after it. The dashboard clears the unread
274
- * flag from this, so it does not refetch the feed after each report.
275
- */
276
- const conversationReadReportSchema = conversationReadPositionSchema.extend({ unreadReply: z.boolean() }).strict();
277
270
  // src/api/schema/conversation-title.ts
278
271
  /** Longest Conversation title that a rename can save. */
279
272
  const CONVERSATION_TITLE_MAX_LENGTH = 200;
@@ -283,6 +276,44 @@ const conversationTitleSchema = z.string().trim().min(1).max(200);
283
276
  const renameConversationBodySchema = z.object({ title: conversationTitleSchema }).strict();
284
277
  /** The stored title after the rename. */
285
278
  const renameConversationResponseSchema = z.object({ title: z.string().min(1) }).strict();
279
+ // src/chat/agent-invocations/agent-types.ts
280
+ /**
281
+ * Child agent types. A type is plain data: when to pick it and what the child
282
+ * reads with its task. Runtime code reads only these fields, never a type
283
+ * name, so types can later come from configuration. Types do not limit tools:
284
+ * Guardian reviews each child action against the root user's messages, as for
285
+ * any child. A child keeps its type for later agent invocations. How a child
286
+ * starts, fresh or forked from its parent's history, is not a type: see
287
+ * `fork` on the agent invocation.
288
+ */
289
+ const AGENT_TYPES = ["explore", "reviewer"];
290
+ /**
291
+ * Stored name of a child agent type. A stored name stays readable after its
292
+ * type is removed; the runtime then treats the child as a
293
+ * child without a type.
294
+ */
295
+ const agentTypeSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
296
+ const AGENT_TYPE_DEFINITIONS = {
297
+ explore: {
298
+ whenToUse: "Investigation across code, docs, logs, telemetry, or the web. Use it when an answer needs reading across many files or sources and you need the conclusion with evidence, not the raw output.",
299
+ instructions: "You are an explore agent. Your job is to investigate and report, so do not change anything outside your sandbox unless the task asks for it. Report what you found with exact evidence, such as paths, lines, links, and ids, and say what you could not verify."
300
+ },
301
+ reviewer: {
302
+ whenToUse: "An independent second opinion on a change, plan, or claim. Give it the evidence to judge, not your conclusion.",
303
+ instructions: "You are a reviewer agent. Give an independent assessment. Do not assume that the parent's framing is correct: verify each claim against the evidence. Do not change anything outside your own sandbox. Report concrete problems ranked by severity, each with its evidence, and say clearly when you found none."
304
+ }
305
+ };
306
+ function agentTypeDefinition(type) {
307
+ return type && Object.hasOwn(AGENT_TYPE_DEFINITIONS, type) ? AGENT_TYPE_DEFINITIONS[type] : void 0;
308
+ }
309
+ /** Model-facing list of child agent types. */
310
+ function formatAgentTypes() {
311
+ return AGENT_TYPES.map((type) => `- "${type}": ${AGENT_TYPE_DEFINITIONS[type].whenToUse}`).join("\n");
312
+ }
313
+ /** Return the instructions that a child of this type reads with its task. */
314
+ function agentTypeInstructions(type) {
315
+ return agentTypeDefinition(type)?.instructions;
316
+ }
286
317
  // src/api/schema/child-agent-totals.ts
287
318
  /**
288
319
  * The part of a Conversation total that its child agents spent, at any depth.
@@ -468,13 +499,6 @@ const conversationSummaryReportSchema = z.object({
468
499
  pinnedAt: z.string().datetime().nullable().optional(),
469
500
  /** The viewer's place in Pinned. Unset until they reorder their pins. */
470
501
  pinPosition: z.number().int().optional(),
471
- /**
472
- * True when the conversation is idle and Junior's latest reply that the
473
- * transcript shows is after the viewer's read position. Quiet replies do
474
- * not count. Opening the conversation does not move the position; reading
475
- * in it, replying, archiving, or Mark as read does.
476
- */
477
- unread: z.boolean().optional(),
478
502
  channel: z.string().optional(),
479
503
  channelName: z.string().optional(),
480
504
  channelNameRedacted: z.boolean().optional(),
@@ -865,7 +889,17 @@ const forkConversationResponseSchema = z.object({ conversationId: z.string() }).
865
889
  const conversationAgentTreeNodeSchema = z.object({
866
890
  conversationId: z.string().min(1),
867
891
  kind: conversationKindSchema,
868
- label: z.string().min(1)
892
+ label: z.string().min(1),
893
+ /**
894
+ * Agent type of a child, such as `explore`. Absent for a root, a child
895
+ * without a type, or a viewer who cannot see private content.
896
+ */
897
+ agentType: agentTypeSchema.optional(),
898
+ /**
899
+ * The child started with its parent's history. Absent like `agentType`,
900
+ * or when the child started fresh.
901
+ */
902
+ fork: z.literal(true).optional()
869
903
  }).strict();
870
904
  const conversationEventPageSchema = z.object({
871
905
  events: z.array(conversationReportEventSchema),
@@ -957,4 +991,4 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
957
991
  sentryConversationUrl: z.string().optional(),
958
992
  sourceTask: conversationSourceTaskSchema.optional()
959
993
  }).strict().superRefine(validateConversationEvents);
960
- export { renameConversationResponseSchema as A, MAX_INPUT_IMAGES as B, createConversationMessageBodySchema as C, CONVERSATION_TITLE_MAX_LENGTH as D, conversationChildAgentTotalsSchema as E, messageCardRef as F, briefLinkSchema as G, messageAttachmentSchema as H, messageCardText as I, conversationBriefSchema as J, briefOutcomeStatusSchema as K, readMessageCardRefs as L, conversationReadReportSchema as M, reviewItemChangeRecordSchema as N, conversationTitleSchema as O, annotationCard as P, removedCardSchema as R, createConversationBodySchema as S, forkConversationResponseSchema as T, readMessageAttachments as U, MAX_INPUT_IMAGE_BYTES as V, briefCodeChangeSchema as W, parseStoredBrief as X, parseBriefInput as Y, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, conversationEventsQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, conversationReadPositionSchema as j, renameConversationBodySchema as k, conversationDetailReportSchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, briefResourceLabel as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventHistorySchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, resolveMessageCards as z };
994
+ export { parseStoredBrief as $, formatAgentTypes as A, readMessageCardRefs as B, createConversationMessageBodySchema as C, AGENT_TYPES as D, conversationChildAgentTotalsSchema as E, conversationReadPositionSchema as F, messageAttachmentSchema as G, resolveMessageCards as H, reviewItemChangeRecordSchema as I, briefLinkSchema as J, readMessageAttachments as K, annotationCard as L, conversationTitleSchema as M, renameConversationBodySchema as N, agentTypeInstructions as O, renameConversationResponseSchema as P, parseBriefInput as Q, messageCardRef as R, createConversationBodySchema as S, forkConversationResponseSchema as T, MAX_INPUT_IMAGES as U, removedCardSchema as V, MAX_INPUT_IMAGE_BYTES as W, briefResourceLabel as X, briefOutcomeStatusSchema as Y, conversationBriefSchema as Z, conversationReportMessageEventSchema as _, conversationActivityPreviewSchema as a, conversationSurfaceSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, conversationEventsQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, actorIdentitySchema as i, CONVERSATION_TITLE_MAX_LENGTH as j, agentTypeSchema as k, conversationDetailReportSchema as l, conversationParamsSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, briefCodeChangeSchema as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventHistorySchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, messageCardText as z };
@@ -1,4 +1,4 @@
1
- import { H as messageAttachmentSchema, K as briefOutcomeStatusSchema, N as reviewItemChangeRecordSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation-CMkSmi02.js";
1
+ import { G as messageAttachmentSchema, I as reviewItemChangeRecordSchema, Y as briefOutcomeStatusSchema, i as actorIdentitySchema, l as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation-DCkzvxqB.js";
2
2
  import * as z from "zod";
3
3
  // src/reporting-schema.ts
4
4
  const healthReportSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-D0svFM8r.js";
1
+ import { h as logWarn } from "./logging-CJTi5niy.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;