@sentry/junior 0.67.3 → 0.69.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 (66) hide show
  1. package/dist/app.js +1465 -814
  2. package/dist/build/virtual-config.d.ts +2 -2
  3. package/dist/chat/agent-dispatch/heartbeat.d.ts +2 -2
  4. package/dist/chat/agent-dispatch/store.d.ts +4 -1
  5. package/dist/chat/agent-dispatch/types.d.ts +2 -4
  6. package/dist/chat/agent-dispatch/validation.d.ts +3 -2
  7. package/dist/chat/credentials/context.d.ts +49 -24
  8. package/dist/chat/credentials/user-token-store.d.ts +6 -0
  9. package/dist/chat/destination.d.ts +12 -0
  10. package/dist/chat/ingress/message-router.d.ts +1 -1
  11. package/dist/chat/mcp/auth-store.d.ts +2 -0
  12. package/dist/chat/mcp/oauth.d.ts +2 -0
  13. package/dist/chat/oauth-flow.d.ts +7 -0
  14. package/dist/chat/plugins/agent-hooks.d.ts +9 -9
  15. package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +2 -2
  16. package/dist/chat/plugins/auth/oauth-request.d.ts +3 -1
  17. package/dist/chat/plugins/credential-hooks.d.ts +34 -0
  18. package/dist/chat/plugins/logging.d.ts +1 -1
  19. package/dist/chat/plugins/state.d.ts +1 -1
  20. package/dist/chat/plugins/types.d.ts +19 -23
  21. package/dist/chat/respond.d.ts +2 -0
  22. package/dist/chat/runtime/reply-executor.d.ts +3 -1
  23. package/dist/chat/runtime/slack-runtime.d.ts +8 -3
  24. package/dist/chat/sandbox/egress-credentials.d.ts +33 -0
  25. package/dist/chat/sandbox/egress-schemas.d.ts +105 -0
  26. package/dist/chat/sandbox/egress-session.d.ts +17 -17
  27. package/dist/chat/sandbox/sandbox.d.ts +3 -0
  28. package/dist/chat/sandbox/session.d.ts +1 -0
  29. package/dist/chat/services/mcp-auth-orchestration.d.ts +2 -0
  30. package/dist/chat/services/pending-auth.d.ts +2 -0
  31. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -0
  32. package/dist/chat/services/provider-retry.d.ts +13 -4
  33. package/dist/chat/services/timeout-resume.d.ts +2 -0
  34. package/dist/chat/services/turn-session-record.d.ts +6 -0
  35. package/dist/chat/slack/attachment-fetchers.d.ts +11 -0
  36. package/dist/chat/slack/footer.d.ts +2 -7
  37. package/dist/chat/state/conversation.d.ts +1 -0
  38. package/dist/chat/state/turn-session.d.ts +4 -0
  39. package/dist/chat/task-execution/queue.d.ts +2 -0
  40. package/dist/chat/task-execution/store.d.ts +5 -0
  41. package/dist/chat/task-execution/vercel-callback.d.ts +4 -0
  42. package/dist/chat/task-execution/vercel-queue.d.ts +2 -0
  43. package/dist/chat/task-execution/worker.d.ts +4 -2
  44. package/dist/chat/tools/slack/context.d.ts +3 -0
  45. package/dist/chat/tools/types.d.ts +21 -2
  46. package/dist/chunk-76YMBKW7.js +326 -0
  47. package/dist/{chunk-PIVOJIUD.js → chunk-B5HKWWQB.js} +9 -5
  48. package/dist/chunk-BBXYXOJW.js +1858 -0
  49. package/dist/{chunk-V47RLIO2.js → chunk-GT67ZWZQ.js} +4 -4
  50. package/dist/{chunk-75UZ4JLC.js → chunk-IGLNC5H6.js} +21 -9
  51. package/dist/{chunk-EBVQXCD2.js → chunk-JS4HURDT.js} +362 -280
  52. package/dist/{chunk-UQQSW7QB.js → chunk-N3MORKTH.js} +74 -331
  53. package/dist/chunk-R62YWUNO.js +264 -0
  54. package/dist/{chunk-OIIXZOOC.js → chunk-UXG6TU2U.js} +311 -2015
  55. package/dist/cli/check.js +4 -4
  56. package/dist/cli/snapshot-warmup.js +5 -4
  57. package/dist/nitro.d.ts +1 -1
  58. package/dist/nitro.js +21 -19
  59. package/dist/plugins.d.ts +2 -2
  60. package/dist/reporting.d.ts +2 -2
  61. package/dist/reporting.js +13 -11
  62. package/package.json +6 -4
  63. package/dist/chat/plugins/auth/github-app-broker.d.ts +0 -4
  64. package/dist/chat/plugins/github-permissions.d.ts +0 -11
  65. package/dist/chat/queue/thread-message-dispatcher.d.ts +0 -33
  66. package/dist/chunk-KVZL5NZS.js +0 -519
package/dist/cli/check.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-V47RLIO2.js";
3
+ } from "../chunk-GT67ZWZQ.js";
4
4
  import {
5
5
  parseInlinePluginManifest,
6
6
  parsePluginManifest
7
- } from "../chunk-OIIXZOOC.js";
8
- import "../chunk-Z3YD6NHK.js";
7
+ } from "../chunk-UXG6TU2U.js";
9
8
  import {
10
9
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
11
10
  JUNIOR_HEARTBEAT_ROUTE,
12
11
  LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
13
12
  } from "../chunk-6YY4Q3D4.js";
14
- import "../chunk-KVZL5NZS.js";
13
+ import "../chunk-BBXYXOJW.js";
14
+ import "../chunk-Z3YD6NHK.js";
15
15
  import "../chunk-2KG3PWR4.js";
16
16
 
17
17
  // src/cli/check.ts
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  resolveRuntimeDependencySnapshot
3
- } from "../chunk-PIVOJIUD.js";
3
+ } from "../chunk-B5HKWWQB.js";
4
4
  import {
5
5
  disconnectStateAdapter
6
- } from "../chunk-EBVQXCD2.js";
6
+ } from "../chunk-R62YWUNO.js";
7
7
  import {
8
8
  getPluginProviders,
9
9
  getPluginRuntimeDependencies,
10
10
  getPluginRuntimePostinstall
11
- } from "../chunk-OIIXZOOC.js";
11
+ } from "../chunk-UXG6TU2U.js";
12
+ import "../chunk-JS4HURDT.js";
13
+ import "../chunk-BBXYXOJW.js";
12
14
  import "../chunk-Z3YD6NHK.js";
13
- import "../chunk-KVZL5NZS.js";
14
15
  import "../chunk-2KG3PWR4.js";
15
16
 
16
17
  // src/cli/snapshot-warmup.ts
package/dist/nitro.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface JuniorNitroOptions {
11
11
  maxDuration?: number;
12
12
  /** Vercel Queue topic for durable conversation work. Must match the runtime queue producer topic. */
13
13
  conversationWorkQueueTopic?: string;
14
- /** Plugin catalog set or runtime-safe plugin module. Direct sets must not include trusted hooks. */
14
+ /** Plugin catalog set or runtime-safe plugin module. Direct sets must not include runtime hooks. */
15
15
  plugins?: JuniorNitroPluginSource;
16
16
  /**
17
17
  * Extra file patterns to copy into the server output for files that the
package/dist/nitro.js CHANGED
@@ -1,18 +1,21 @@
1
1
  import {
2
- DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC,
3
2
  pluginCatalogConfigFromPluginSet,
4
- trustedPluginRegistrationsFromPluginSet
5
- } from "./chunk-75UZ4JLC.js";
3
+ pluginHookRegistrationsFromPluginSet,
4
+ resolveConversationWorkQueueTopic
5
+ } from "./chunk-IGLNC5H6.js";
6
+ import "./chunk-76YMBKW7.js";
6
7
  import {
7
8
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
8
9
  JUNIOR_HEARTBEAT_CRON_SCHEDULE,
9
10
  JUNIOR_HEARTBEAT_ROUTE
10
11
  } from "./chunk-6YY4Q3D4.js";
12
+ import "./chunk-JS4HURDT.js";
11
13
  import {
12
14
  discoverInstalledPluginPackageContent,
13
15
  isValidPackageName,
14
16
  resolvePackageDir
15
- } from "./chunk-KVZL5NZS.js";
17
+ } from "./chunk-BBXYXOJW.js";
18
+ import "./chunk-Z3YD6NHK.js";
16
19
  import "./chunk-2KG3PWR4.js";
17
20
 
18
21
  // src/nitro.ts
@@ -192,7 +195,7 @@ function renderVirtualConfig(options) {
192
195
  "export const pluginSet = juniorRuntimePluginSet;"
193
196
  ] : ["export const pluginSet = undefined;"],
194
197
  `export const plugins = ${JSON.stringify(options.plugins ?? { packages: [] })};`,
195
- `export const trustedPluginRegistrations = ${JSON.stringify(options.trustedPluginRegistrations ?? [])};`
198
+ `export const pluginHookRegistrations = ${JSON.stringify(options.pluginHookRegistrations ?? [])};`
196
199
  ];
197
200
  return lines.join("\n");
198
201
  }
@@ -205,7 +208,7 @@ function injectVirtualConfig(nitro, options = {}) {
205
208
  return renderVirtualConfig({
206
209
  pluginModule: options.pluginModule,
207
210
  plugins: pluginCatalogConfigFromPluginSet(pluginSet),
208
- trustedPluginRegistrations: trustedPluginRegistrationsFromPluginSet(
211
+ pluginHookRegistrations: pluginHookRegistrationsFromPluginSet(
209
212
  pluginSet
210
213
  ).map((plugin) => plugin.name)
211
214
  });
@@ -300,19 +303,16 @@ async function loadPluginSetFromModule(moduleRef) {
300
303
  );
301
304
  }
302
305
  function assertSerializableDirectPluginSet(pluginSet) {
303
- const trustedPluginNames = trustedPluginRegistrationsFromPluginSet(
304
- pluginSet
305
- ).map((plugin) => plugin.name);
306
- if (trustedPluginNames.length === 0) {
306
+ const pluginHookNames = pluginHookRegistrationsFromPluginSet(pluginSet).map(
307
+ (plugin) => plugin.name
308
+ );
309
+ if (pluginHookNames.length === 0) {
307
310
  return;
308
311
  }
309
312
  throw new Error(
310
- `juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with trusted plugin registration(s): ${trustedPluginNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same hooks at runtime.`
313
+ `juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with runtime hook registration(s): ${pluginHookNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same hooks at runtime.`
311
314
  );
312
315
  }
313
- function resolveConversationWorkQueueTopic(options) {
314
- return options.conversationWorkQueueTopic?.trim() || process.env.JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC?.trim() || DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC;
315
- }
316
316
  function bundleOpenTelemetryLoaderHooks(nitro) {
317
317
  const existing = Array.isArray(nitro.options.noExternals) ? nitro.options.noExternals : [];
318
318
  const additions = ["import-in-the-middle", "require-in-the-middle"].filter(
@@ -324,7 +324,9 @@ function bundleOpenTelemetryLoaderHooks(nitro) {
324
324
  }
325
325
  function configureVercelDeployment(nitro, options) {
326
326
  const defaultMaxDuration = options.maxDuration ?? DEFAULT_FUNCTION_MAX_DURATION_SECONDS;
327
- const queueTopic = resolveConversationWorkQueueTopic(options);
327
+ const queueTopic = resolveConversationWorkQueueTopic({
328
+ topic: options.conversationWorkQueueTopic
329
+ });
328
330
  nitro.options.vercel ??= {};
329
331
  nitro.options.vercel.config ??= { version: 3 };
330
332
  nitro.options.vercel.config.crons ??= [];
@@ -379,16 +381,16 @@ function juniorNitro(options = {}) {
379
381
  return pluginSetPromise;
380
382
  };
381
383
  const pluginCatalogConfig = pluginCatalogConfigFromPluginSet(directPluginSet);
382
- const trustedPluginRegistrations = trustedPluginRegistrationsFromPluginSet(directPluginSet).map(
383
- (plugin) => plugin.name
384
- );
384
+ const pluginHookRegistrations = pluginHookRegistrationsFromPluginSet(
385
+ directPluginSet
386
+ ).map((plugin) => plugin.name);
385
387
  injectVirtualConfig(nitro, {
386
388
  ...pluginModule ? {
387
389
  loadPluginSet: loadConfiguredPluginSet,
388
390
  pluginModule: pluginModule.runtimeModule
389
391
  } : {},
390
392
  plugins: pluginCatalogConfig,
391
- trustedPluginRegistrations
393
+ pluginHookRegistrations
392
394
  });
393
395
  const copyBuildContent = async () => {
394
396
  const pluginSet = await loadConfiguredPluginSet();
package/dist/plugins.d.ts CHANGED
@@ -18,5 +18,5 @@ export interface JuniorPluginSet {
18
18
  export declare function defineJuniorPlugins(inputs: JuniorPluginInput[], options?: JuniorPluginSetOptions): JuniorPluginSet;
19
19
  /** Build the manifest catalog config implied by one plugin set. */
20
20
  export declare function pluginCatalogConfigFromPluginSet(pluginSet: JuniorPluginSet | undefined): PluginCatalogConfig | undefined;
21
- /** Return registrations that expose trusted in-process runtime behavior. */
22
- export declare function trustedPluginRegistrationsFromPluginSet(pluginSet: JuniorPluginSet | undefined): JuniorPluginRegistration[];
21
+ /** Return registrations that expose in-process runtime hooks. */
22
+ export declare function pluginHookRegistrationsFromPluginSet(pluginSet: JuniorPluginSet | undefined): JuniorPluginRegistration[];
@@ -133,7 +133,7 @@ export type { PluginOperationalReport } from "@sentry/junior-plugin-api";
133
133
  export interface PluginOperationalReportFeed {
134
134
  generatedAt: string;
135
135
  reports: PluginOperationalReport[];
136
- source: "trusted_plugins";
136
+ source: "plugins";
137
137
  }
138
138
  export interface JuniorReporting {
139
139
  /** Read the public runtime health snapshot without exposing discovery data. */
@@ -153,7 +153,7 @@ export interface JuniorReporting {
153
153
  getSessions(): Promise<DashboardSessionFeed>;
154
154
  /** Read aggregate conversation stats for authenticated dashboard views. */
155
155
  getConversationStats?(): Promise<DashboardConversationStatsReport>;
156
- /** Read sanitized operational summaries contributed by trusted plugins. */
156
+ /** Read sanitized operational summaries contributed by plugins. */
157
157
  getPluginOperationalReports?(): Promise<PluginOperationalReportFeed>;
158
158
  /**
159
159
  * Read one conversation transcript for the dashboard.
package/dist/reporting.js CHANGED
@@ -9,24 +9,26 @@ import {
9
9
  listAgentTurnSessionSummaries,
10
10
  listAgentTurnSessionSummariesForConversation,
11
11
  resolveSlackConversationContextFromThreadId
12
- } from "./chunk-UQQSW7QB.js";
12
+ } from "./chunk-N3MORKTH.js";
13
13
  import {
14
14
  discoverSkills
15
- } from "./chunk-V47RLIO2.js";
15
+ } from "./chunk-GT67ZWZQ.js";
16
+ import "./chunk-R62YWUNO.js";
17
+ import {
18
+ getPluginPackageContent,
19
+ getPluginProviders
20
+ } from "./chunk-UXG6TU2U.js";
21
+ import "./chunk-76YMBKW7.js";
16
22
  import {
17
23
  canExposeConversationPayload,
18
24
  parseSlackThreadId,
19
25
  resolveConversationPrivacy
20
- } from "./chunk-EBVQXCD2.js";
26
+ } from "./chunk-JS4HURDT.js";
21
27
  import {
22
- getPluginPackageContent,
23
- getPluginProviders,
28
+ homeDir,
24
29
  isRecord
25
- } from "./chunk-OIIXZOOC.js";
30
+ } from "./chunk-BBXYXOJW.js";
26
31
  import "./chunk-Z3YD6NHK.js";
27
- import {
28
- homeDir
29
- } from "./chunk-KVZL5NZS.js";
30
32
  import "./chunk-2KG3PWR4.js";
31
33
 
32
34
  // src/reporting.ts
@@ -263,7 +265,7 @@ function statusSignals(turns) {
263
265
  }
264
266
  function statsItems(map) {
265
267
  return [...map.values()].sort(
266
- (left, right) => right.conversations - left.conversations || right.turns - left.turns || right.durationMs - left.durationMs || left.label.localeCompare(right.label)
268
+ (left, right) => right.conversations - left.conversations || right.durationMs - left.durationMs || left.label.localeCompare(right.label)
267
269
  );
268
270
  }
269
271
  function newestTurn(turns) {
@@ -655,7 +657,7 @@ async function readConversationStats() {
655
657
  async function readPluginOperationalReports() {
656
658
  const nowMs = Date.now();
657
659
  return {
658
- source: "trusted_plugins",
660
+ source: "plugins",
659
661
  generatedAt: new Date(nowMs).toISOString(),
660
662
  reports: await getAgentPluginOperationalReports(nowMs)
661
663
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.67.3",
3
+ "version": "0.69.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -65,10 +65,11 @@
65
65
  "node-html-markdown": "^2.0.0",
66
66
  "yaml": "^2.9.0",
67
67
  "zod": "^4.4.3",
68
- "@sentry/junior-plugin-api": "0.67.3"
68
+ "@sentry/junior-plugin-api": "0.69.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/node": "^25.9.1",
72
+ "@vitest/coverage-v8": "^4.1.7",
72
73
  "dependency-cruiser": "^17.4.0",
73
74
  "msw": "^2.14.6",
74
75
  "nitro": "3.0.260522-beta",
@@ -77,7 +78,7 @@
77
78
  "typescript": "^6.0.3",
78
79
  "vercel": "^54.4.0",
79
80
  "vitest": "^4.1.7",
80
- "@sentry/junior-scheduler": "0.67.3"
81
+ "@sentry/junior-scheduler": "0.69.0"
81
82
  },
82
83
  "scripts": {
83
84
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
@@ -88,6 +89,7 @@
88
89
  "test:slack-boundary": "node scripts/check-slack-test-boundary.mjs",
89
90
  "test:arch-boundary": "depcruise --config .dependency-cruiser.mjs src/chat",
90
91
  "typecheck": "tsc --noEmit",
91
- "skills:check": "node scripts/check-skills.mjs"
92
+ "skills:check": "node scripts/check-skills.mjs",
93
+ "test:coverage": "pnpm run test:slack-boundary && pnpm run test:arch-boundary && vitest run --maxWorkers=4 --coverage --reporter=default --reporter=junit --outputFile.junit=coverage/results.junit.xml"
92
94
  }
93
95
  }
@@ -1,4 +0,0 @@
1
- import type { CredentialBroker } from "@/chat/credentials/broker";
2
- import type { GitHubAppCredentials, PluginManifest } from "../types";
3
- /** Create a broker that keeps GitHub App tokens on the host while authorizing provider traffic. */
4
- export declare function createGitHubAppBroker(manifest: PluginManifest, credentials: GitHubAppCredentials): CredentialBroker;
@@ -1,11 +0,0 @@
1
- type GitHubPermissionRequest = Record<string, "read" | "write">;
2
- export declare const DEFAULT_GITHUB_SYSTEM_READ_SCOPES: Set<string>;
3
- /** Validate and normalize GitHub App read scopes from plugin configuration. */
4
- export declare function normalizeGitHubSystemReadPermissionScopes(scopes: string[], context: string): string[];
5
- /** Convert plugin capabilities into the GitHub App installation permission body. */
6
- export declare function githubCapabilitiesToPermissions(capabilities: string[], pluginName: string): GitHubPermissionRequest;
7
- /** Convert configured system scopes into read-only GitHub App permissions. */
8
- export declare function githubSystemReadPermissionsFromScopes(scopes: string[]): GitHubPermissionRequest;
9
- /** Intersect installation permissions with the allowed system read scope set. */
10
- export declare function githubInstallationReadPermissions(permissions: Record<string, string> | undefined, allowedScopes: Set<string>): GitHubPermissionRequest;
11
- export {};
@@ -1,33 +0,0 @@
1
- import type { Message, Thread } from "chat";
2
- import type { SlackTurnRuntime } from "@/chat/runtime/slack-runtime";
3
- import { downloadPrivateSlackFile as downloadPrivateSlackFileImpl } from "@/chat/slack/client";
4
- export type ThreadMessageKind = "new_mention" | "subscribed_message";
5
- export interface ThreadMessageDispatchArgs {
6
- beforeFirstResponsePost?: () => Promise<void>;
7
- kind: ThreadMessageKind;
8
- message: Message;
9
- thread: Thread;
10
- }
11
- export type ThreadMessageRuntime = Pick<SlackTurnRuntime<unknown>, "handleNewMention" | "handleSubscribedMessage">;
12
- export type ThreadMessageDispatcher = (args: ThreadMessageDispatchArgs) => Promise<void>;
13
- export interface CreateThreadMessageDispatcherOptions {
14
- downloadPrivateSlackFile?: typeof downloadPrivateSlackFileImpl;
15
- runtime: ThreadMessageRuntime;
16
- }
17
- /**
18
- * Attach Slack private-file download functions to deserialized attachments.
19
- *
20
- * The Chat SDK's `concurrency: "queue"` strategy serializes queued messages
21
- * via `Message.toJSON()`, which strips `fetchData` (a function) and `data`
22
- * (a Buffer). When dequeued, attachments have a `url` but no fetcher.
23
- * This re-attaches a bot-token-auth'd download callback.
24
- *
25
- * No-ops when `fetchData` is already present, so safe to call unconditionally.
26
- */
27
- export declare function rehydrateAttachmentFetchers(message: {
28
- attachments: Array<{
29
- fetchData?: unknown;
30
- url?: string;
31
- }>;
32
- }, downloadPrivateSlackFile?: typeof downloadPrivateSlackFileImpl): void;
33
- export declare function createThreadMessageDispatcher(options: CreateThreadMessageDispatcherOptions): ThreadMessageDispatcher;