@sentry/junior 0.75.0 → 0.76.1

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 (101) hide show
  1. package/README.md +1 -1
  2. package/bin/junior.mjs +4 -66
  3. package/dist/agent-hooks-ZOE7RIED.js +37 -0
  4. package/dist/api-reference.d.ts +2 -0
  5. package/dist/app.js +364 -135
  6. package/dist/build/virtual-config.d.ts +2 -2
  7. package/dist/chat/agent-dispatch/runner.d.ts +2 -0
  8. package/dist/chat/config.d.ts +1 -0
  9. package/dist/chat/credentials/state-adapter-token-store.d.ts +2 -0
  10. package/dist/chat/credentials/user-token-store.d.ts +17 -12
  11. package/dist/chat/db.d.ts +8 -0
  12. package/dist/chat/mcp/auth-store.d.ts +2 -1
  13. package/dist/chat/mcp/oauth.d.ts +2 -1
  14. package/dist/chat/oauth-flow.d.ts +3 -1
  15. package/dist/chat/pi/client.d.ts +15 -7
  16. package/dist/chat/plugins/agent-hooks.d.ts +7 -0
  17. package/dist/chat/plugins/auth/oauth-request.d.ts +11 -7
  18. package/dist/chat/plugins/model.d.ts +9 -0
  19. package/dist/chat/plugins/prompt.d.ts +5 -0
  20. package/dist/chat/plugins/task-callback.d.ts +5 -0
  21. package/dist/chat/plugins/task-message.d.ts +23 -0
  22. package/dist/chat/plugins/task-queue.d.ts +5 -0
  23. package/dist/chat/plugins/task-runner.d.ts +12 -0
  24. package/dist/chat/plugins/task-signing.d.ts +31 -0
  25. package/dist/chat/prompt.d.ts +4 -0
  26. package/dist/chat/requester.d.ts +6 -5
  27. package/dist/chat/respond-helpers.d.ts +2 -0
  28. package/dist/chat/respond.d.ts +4 -2
  29. package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
  30. package/dist/chat/runtime/reply-executor.d.ts +5 -1
  31. package/dist/chat/runtime/slack-resume.d.ts +10 -2
  32. package/dist/chat/sentry.d.ts +1 -0
  33. package/dist/chat/services/mcp-auth-orchestration.d.ts +2 -1
  34. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
  35. package/dist/chat/services/subscribed-decision.d.ts +2 -2
  36. package/dist/chat/services/turn-session-record.d.ts +11 -7
  37. package/dist/chat/slack/footer.d.ts +1 -1
  38. package/dist/chat/state/turn-session.d.ts +8 -5
  39. package/dist/chat/tools/agent-tools.d.ts +8 -1
  40. package/dist/chat/tools/slack/context.d.ts +2 -2
  41. package/dist/chat/tools/types.d.ts +4 -4
  42. package/dist/chat/vercel-queue-client.d.ts +3 -0
  43. package/dist/{chunk-C3AM4Z4J.js → chunk-2ECJXSVQ.js} +5 -5
  44. package/dist/{chunk-OJODNL2P.js → chunk-4SCWV7TJ.js} +2 -2
  45. package/dist/chunk-4UO6FK4G.js +64 -0
  46. package/dist/{chunk-BNJIEFQC.js → chunk-56TBVRJG.js} +2 -2
  47. package/dist/{chunk-OK4KKR7B.js → chunk-EJN6G5A2.js} +28 -12
  48. package/dist/{chunk-TQ74BATR.js → chunk-FFGXUXMD.js} +435 -111
  49. package/dist/{chunk-XJHDZUGD.js → chunk-JBASI5VV.js} +4 -4
  50. package/dist/chunk-KNFROR7R.js +127 -0
  51. package/dist/{chunk-VNTLUFTY.js → chunk-KOIMO7S3.js} +126 -87
  52. package/dist/chunk-MLKGABMK.js +9 -0
  53. package/dist/{chunk-NPVUAXUE.js → chunk-NFTMTIP3.js} +303 -33
  54. package/dist/chunk-NYKJ3KON.js +1082 -0
  55. package/dist/{chunk-SJHUF3DP.js → chunk-OJ53FYVG.js} +2 -10
  56. package/dist/{chunk-62FUNJYS.js → chunk-Q6XFTRV5.js} +54 -3
  57. package/dist/{chunk-UJ7OTHPO.js → chunk-R6Z5XWY3.js} +12 -670
  58. package/dist/chunk-RV5RYIJW.js +56 -0
  59. package/dist/{chunk-EE6PJWY4.js → chunk-SG5WAA7H.js} +7 -5
  60. package/dist/chunk-ST6YNAXG.js +54 -0
  61. package/dist/{chunk-FCZO7LAR.js → chunk-T77LUIX3.js} +139 -153
  62. package/dist/{chunk-EIYL7I4S.js → chunk-VALUBQ7R.js} +22 -30
  63. package/dist/{chunk-OZSPLAQ4.js → chunk-XBBC6W45.js} +1 -1
  64. package/dist/{chunk-ZNNTSPNF.js → chunk-Y5OFBCBZ.js} +1 -1
  65. package/dist/{chunk-74HO27II.js → chunk-Z4CIQ3EB.js} +5 -1
  66. package/dist/{chunk-2RWFUS5F.js → chunk-ZLMBNBUG.js} +101 -44
  67. package/dist/{chunk-JEELK46E.js → chunk-ZQB37HUX.js} +11 -11
  68. package/dist/cli/chat.js +52 -23
  69. package/dist/cli/check.js +7 -7
  70. package/dist/cli/env.js +4 -53
  71. package/dist/cli/init.js +6 -1
  72. package/dist/cli/main.js +84 -0
  73. package/dist/cli/plugins.js +244 -0
  74. package/dist/cli/run.js +5 -52
  75. package/dist/cli/snapshot-warmup.js +9 -9
  76. package/dist/cli/upgrade.js +167 -48
  77. package/dist/db-7A7PFRGL.js +17 -0
  78. package/dist/deployment.d.ts +1 -0
  79. package/dist/instrumentation.js +14 -18
  80. package/dist/nitro.d.ts +1 -1
  81. package/dist/nitro.js +43 -22
  82. package/dist/plugins-PZMDS7AT.js +15 -0
  83. package/dist/plugins.d.ts +4 -2
  84. package/dist/{registry-NLZFIW23.js → registry-OIPAJU2O.js} +6 -6
  85. package/dist/reporting.js +34 -26
  86. package/dist/{runner-LUQZ5G67.js → runner-7Z4D6AKV.js} +76 -23
  87. package/dist/sentry-4CP5NNQ5.js +31 -0
  88. package/dist/validation-SLA6IGF7.js +15 -0
  89. package/dist/vercel.js +1 -1
  90. package/package.json +8 -7
  91. package/dist/agent-hooks-2HEB4C3Q.js +0 -33
  92. package/dist/chat/conversations/configured.d.ts +0 -7
  93. package/dist/chat/conversations/state.d.ts +0 -4
  94. package/dist/chat/plugins/db.d.ts +0 -31
  95. package/dist/chunk-2KG3PWR4.js +0 -17
  96. package/dist/chunk-D7NFH5GD.js +0 -570
  97. package/dist/chunk-MCMROINU.js +0 -12
  98. package/dist/chunk-WBZ4M5N5.js +0 -59
  99. package/dist/db-A3ILH67H.js +0 -20
  100. package/dist/plugins-OMJKLRJ2.js +0 -13
  101. package/dist/validation-VMCPP3YO.js +0 -15
@@ -1,9 +1,14 @@
1
1
  import {
2
2
  getDeploymentServiceVersion,
3
- getDeploymentTelemetryAttributes,
4
- sentry_exports
5
- } from "./chunk-SJHUF3DP.js";
6
- import "./chunk-2KG3PWR4.js";
3
+ getDeploymentTelemetryAttributes
4
+ } from "./chunk-OJ53FYVG.js";
5
+ import {
6
+ getClient,
7
+ getGlobalScope,
8
+ init,
9
+ vercelAIIntegration
10
+ } from "./chunk-ST6YNAXG.js";
11
+ import "./chunk-MLKGABMK.js";
7
12
 
8
13
  // src/instrumentation.ts
9
14
  function getSampleRate(value, fallback) {
@@ -19,40 +24,31 @@ function getBoolean(value, fallback) {
19
24
  return fallback;
20
25
  }
21
26
  function initSentry() {
22
- if (sentry_exports.getClient()) {
27
+ if (getClient()) {
23
28
  return;
24
29
  }
25
30
  const dsn = process.env.SENTRY_DSN;
26
31
  const enableLogs = getBoolean(process.env.SENTRY_ENABLE_LOGS, Boolean(dsn));
27
32
  const serviceVersion = getDeploymentServiceVersion();
28
33
  const deploymentSpanAttributes = getDeploymentTelemetryAttributes();
29
- sentry_exports.init({
34
+ init({
30
35
  dsn,
31
36
  environment: process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV,
32
37
  release: serviceVersion,
33
38
  tracesSampleRate: getSampleRate(process.env.SENTRY_TRACES_SAMPLE_RATE, 1),
39
+ traceLifecycle: "stream",
34
40
  sendDefaultPii: true,
35
41
  enableLogs,
36
42
  registerEsmLoaderHooks: false,
37
43
  streamGenAiSpans: true,
38
- // Keep deployment identity centralized so every emitted Sentry span carries it.
39
- beforeSendSpan(span) {
40
- if (Object.keys(deploymentSpanAttributes).length === 0) {
41
- return span;
42
- }
43
- span.data = {
44
- ...span.data,
45
- ...deploymentSpanAttributes
46
- };
47
- return span;
48
- },
49
44
  integrations: [
50
- sentry_exports.vercelAIIntegration({
45
+ vercelAIIntegration({
51
46
  recordInputs: true,
52
47
  recordOutputs: true
53
48
  })
54
49
  ]
55
50
  });
51
+ getGlobalScope().setAttributes(deploymentSpanAttributes);
56
52
  }
57
53
  export {
58
54
  initSentry
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 runtime hooks. */
14
+ /** Plugin catalog set or runtime-safe plugin module. Direct sets must not include runtime code. */
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,30 +1,33 @@
1
1
  import {
2
2
  resolveConversationWorkQueueTopic
3
- } from "./chunk-C3AM4Z4J.js";
3
+ } from "./chunk-2ECJXSVQ.js";
4
+ import {
5
+ PLUGIN_TASK_QUEUE_TOPIC
6
+ } from "./chunk-KNFROR7R.js";
4
7
  import {
5
8
  pluginCatalogConfigFromPluginSet,
6
- pluginHookRegistrationsFromPluginSet
7
- } from "./chunk-EE6PJWY4.js";
8
- import "./chunk-WBZ4M5N5.js";
9
- import "./chunk-62FUNJYS.js";
9
+ pluginRuntimeRegistrationsFromPluginSet
10
+ } from "./chunk-SG5WAA7H.js";
11
+ import "./chunk-Q6XFTRV5.js";
12
+ import "./chunk-T77LUIX3.js";
10
13
  import {
11
14
  loadPluginSetFromModule,
12
15
  resolvePluginModule
13
16
  } from "./chunk-Y2CM7HXH.js";
14
- import "./chunk-FCZO7LAR.js";
15
17
  import {
16
18
  discoverInstalledPluginPackageContent,
17
19
  isValidPackageName,
18
20
  resolvePackageDir
19
21
  } from "./chunk-Q3XNY442.js";
20
- import "./chunk-MCMROINU.js";
21
- import "./chunk-OK4KKR7B.js";
22
+ import "./chunk-EJN6G5A2.js";
22
23
  import {
23
24
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
24
25
  JUNIOR_HEARTBEAT_CRON_SCHEDULE,
25
- JUNIOR_HEARTBEAT_ROUTE
26
- } from "./chunk-SJHUF3DP.js";
27
- import "./chunk-2KG3PWR4.js";
26
+ JUNIOR_HEARTBEAT_ROUTE,
27
+ JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
28
+ } from "./chunk-OJ53FYVG.js";
29
+ import "./chunk-ST6YNAXG.js";
30
+ import "./chunk-MLKGABMK.js";
28
31
 
29
32
  // src/nitro.ts
30
33
  import path2 from "path";
@@ -209,7 +212,7 @@ function renderVirtualConfig(options) {
209
212
  "export const pluginSet = juniorRuntimePluginSet;"
210
213
  ] : ["export const pluginSet = undefined;"],
211
214
  `export const plugins = ${JSON.stringify(options.plugins ?? { packages: [] })};`,
212
- `export const pluginHookRegistrations = ${JSON.stringify(options.pluginHookRegistrations ?? [])};`
215
+ `export const pluginRuntimeRegistrations = ${JSON.stringify(options.pluginRuntimeRegistrations ?? [])};`
213
216
  ];
214
217
  return lines.join("\n");
215
218
  }
@@ -222,7 +225,7 @@ function injectVirtualConfig(nitro, options = {}) {
222
225
  return renderVirtualConfig({
223
226
  pluginModule: options.pluginModule,
224
227
  plugins: pluginCatalogConfigFromPluginSet(pluginSet),
225
- pluginHookRegistrations: pluginHookRegistrationsFromPluginSet(
228
+ pluginRuntimeRegistrations: pluginRuntimeRegistrationsFromPluginSet(
226
229
  pluginSet
227
230
  ).map((plugin) => plugin.manifest.name)
228
231
  });
@@ -242,14 +245,14 @@ function isPluginSet(value) {
242
245
  return "packageNames" in value && "registrations" in value;
243
246
  }
244
247
  function assertSerializableDirectPluginSet(pluginSet) {
245
- const pluginHookNames = pluginHookRegistrationsFromPluginSet(pluginSet).map(
246
- (plugin) => plugin.manifest.name
247
- );
248
- if (pluginHookNames.length === 0) {
248
+ const pluginRuntimeNames = pluginRuntimeRegistrationsFromPluginSet(
249
+ pluginSet
250
+ ).map((plugin) => plugin.manifest.name);
251
+ if (pluginRuntimeNames.length === 0) {
249
252
  return;
250
253
  }
251
254
  throw new Error(
252
- `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.`
255
+ `juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with runtime plugin registration(s): ${pluginRuntimeNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same registrations at runtime.`
253
256
  );
254
257
  }
255
258
  function runtimeModuleForResolvedPluginModule(moduleRef) {
@@ -303,6 +306,24 @@ function configureVercelDeployment(nitro, options) {
303
306
  }
304
307
  ]
305
308
  };
309
+ const existingPluginTaskRule = nitro.options.vercel.functionRules[JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE] ?? {};
310
+ const existingPluginTaskTriggers = Array.isArray(
311
+ existingPluginTaskRule.experimentalTriggers
312
+ ) ? existingPluginTaskRule.experimentalTriggers : [];
313
+ const otherPluginTaskTriggers = existingPluginTaskTriggers.filter(
314
+ (trigger) => trigger.type !== VERCEL_QUEUE_TRIGGER_TYPE
315
+ );
316
+ nitro.options.vercel.functionRules[JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE] = {
317
+ maxDuration: callbackMaxDuration,
318
+ ...existingPluginTaskRule,
319
+ experimentalTriggers: [
320
+ ...otherPluginTaskTriggers,
321
+ {
322
+ type: VERCEL_QUEUE_TRIGGER_TYPE,
323
+ topic: PLUGIN_TASK_QUEUE_TOPIC
324
+ }
325
+ ]
326
+ };
306
327
  }
307
328
  function juniorNitro(options = {}) {
308
329
  return {
@@ -326,16 +347,16 @@ function juniorNitro(options = {}) {
326
347
  return pluginSetPromise;
327
348
  };
328
349
  const pluginCatalogConfig = pluginCatalogConfigFromPluginSet(directPluginSet);
329
- const pluginHookRegistrations = pluginHookRegistrationsFromPluginSet(
330
- directPluginSet
331
- ).map((plugin) => plugin.manifest.name);
350
+ const pluginRuntimeRegistrations = pluginRuntimeRegistrationsFromPluginSet(directPluginSet).map(
351
+ (plugin) => plugin.manifest.name
352
+ );
332
353
  injectVirtualConfig(nitro, {
333
354
  ...pluginModule ? {
334
355
  loadPluginSet: loadConfiguredPluginSet,
335
356
  pluginModule: runtimeModuleForResolvedPluginModule(pluginModule)
336
357
  } : {},
337
358
  plugins: pluginCatalogConfig,
338
- pluginHookRegistrations
359
+ pluginRuntimeRegistrations
339
360
  });
340
361
  const copyBuildContent = async () => {
341
362
  const pluginSet = await loadConfiguredPluginSet();
@@ -0,0 +1,15 @@
1
+ import {
2
+ defineJuniorPlugins,
3
+ pluginCatalogConfigFromEnv,
4
+ pluginCatalogConfigFromPluginSet,
5
+ pluginCliRegistrationsFromPluginSet,
6
+ pluginRuntimeRegistrationsFromPluginSet
7
+ } from "./chunk-SG5WAA7H.js";
8
+ import "./chunk-MLKGABMK.js";
9
+ export {
10
+ defineJuniorPlugins,
11
+ pluginCatalogConfigFromEnv,
12
+ pluginCatalogConfigFromPluginSet,
13
+ pluginCliRegistrationsFromPluginSet,
14
+ pluginRuntimeRegistrationsFromPluginSet
15
+ };
package/dist/plugins.d.ts CHANGED
@@ -20,5 +20,7 @@ export declare function defineJuniorPlugins(inputs: JuniorPluginInput[], options
20
20
  export declare function pluginCatalogConfigFromPluginSet(pluginSet: JuniorPluginSet | undefined): PluginCatalogConfig | undefined;
21
21
  /** Build the manifest catalog config implied by plugin package env. */
22
22
  export declare function pluginCatalogConfigFromEnv(env?: NodeJS.ProcessEnv): PluginCatalogConfig | undefined;
23
- /** Return registrations that expose in-process runtime hooks. */
24
- export declare function pluginHookRegistrationsFromPluginSet(pluginSet: JuniorPluginSet | undefined): PluginRegistration[];
23
+ /** Return registrations that expose in-process runtime code. */
24
+ export declare function pluginRuntimeRegistrationsFromPluginSet(pluginSet: JuniorPluginSet | undefined): PluginRegistration[];
25
+ /** Return registrations that expose host CLI commands. */
26
+ export declare function pluginCliRegistrationsFromPluginSet(pluginSet: JuniorPluginSet | undefined): PluginRegistration[];
@@ -17,13 +17,13 @@ import {
17
17
  isPluginConfigKey,
18
18
  isPluginProvider,
19
19
  setPluginCatalogConfig
20
- } from "./chunk-2RWFUS5F.js";
20
+ } from "./chunk-ZLMBNBUG.js";
21
+ import "./chunk-VALUBQ7R.js";
21
22
  import "./chunk-Q3XNY442.js";
22
- import "./chunk-EIYL7I4S.js";
23
- import "./chunk-MCMROINU.js";
24
- import "./chunk-OK4KKR7B.js";
25
- import "./chunk-SJHUF3DP.js";
26
- import "./chunk-2KG3PWR4.js";
23
+ import "./chunk-EJN6G5A2.js";
24
+ import "./chunk-OJ53FYVG.js";
25
+ import "./chunk-ST6YNAXG.js";
26
+ import "./chunk-MLKGABMK.js";
27
27
  export {
28
28
  createPluginBroker,
29
29
  getPluginCapabilityProviders,
package/dist/reporting.js CHANGED
@@ -6,45 +6,46 @@ import {
6
6
  getConversationDetails,
7
7
  getConversationDetailsForIds,
8
8
  resolveSlackConversationContextFromThreadId
9
- } from "./chunk-JEELK46E.js";
9
+ } from "./chunk-ZQB37HUX.js";
10
10
  import {
11
11
  buildSystemPrompt,
12
12
  getAgentTurnSessionRecord,
13
- getConfiguredConversationStore,
14
13
  listAgentTurnSessionSummariesForConversation
15
- } from "./chunk-VNTLUFTY.js";
14
+ } from "./chunk-KOIMO7S3.js";
16
15
  import {
17
16
  getPluginOperationalReports
18
- } from "./chunk-NPVUAXUE.js";
17
+ } from "./chunk-NFTMTIP3.js";
18
+ import "./chunk-56TBVRJG.js";
19
19
  import {
20
- discoverSkills
21
- } from "./chunk-OJODNL2P.js";
22
- import "./chunk-UJ7OTHPO.js";
23
- import "./chunk-WBZ4M5N5.js";
24
- import "./chunk-BNJIEFQC.js";
25
- import "./chunk-62FUNJYS.js";
26
- import "./chunk-D7NFH5GD.js";
20
+ getConversationStore
21
+ } from "./chunk-NYKJ3KON.js";
27
22
  import "./chunk-G3E7SCME.js";
28
- import "./chunk-ZNNTSPNF.js";
23
+ import "./chunk-Y5OFBCBZ.js";
24
+ import "./chunk-Q6XFTRV5.js";
29
25
  import {
30
26
  canExposeConversationPayload,
31
27
  parseSlackThreadId,
32
28
  resolveConversationPrivacy
33
- } from "./chunk-FCZO7LAR.js";
29
+ } from "./chunk-T77LUIX3.js";
30
+ import {
31
+ discoverSkills
32
+ } from "./chunk-4SCWV7TJ.js";
34
33
  import {
35
34
  getPluginPackageContent,
36
35
  getPluginProviders
37
- } from "./chunk-2RWFUS5F.js";
36
+ } from "./chunk-ZLMBNBUG.js";
37
+ import {
38
+ toStoredSlackRequester
39
+ } from "./chunk-VALUBQ7R.js";
38
40
  import {
39
41
  homeDir
40
42
  } from "./chunk-Q3XNY442.js";
41
- import "./chunk-EIYL7I4S.js";
42
- import "./chunk-MCMROINU.js";
43
43
  import {
44
44
  isRecord
45
- } from "./chunk-OK4KKR7B.js";
46
- import "./chunk-SJHUF3DP.js";
47
- import "./chunk-2KG3PWR4.js";
45
+ } from "./chunk-EJN6G5A2.js";
46
+ import "./chunk-OJ53FYVG.js";
47
+ import "./chunk-ST6YNAXG.js";
48
+ import "./chunk-MLKGABMK.js";
48
49
 
49
50
  // src/reporting.ts
50
51
  import { readFileSync } from "fs";
@@ -58,7 +59,7 @@ var CONVERSATION_FEED_LIMIT = 50;
58
59
  var CONVERSATION_STATS_LIMIT = 5e3;
59
60
  var RECENT_CONVERSATION_STATS_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
60
61
  function conversationStore(options = {}) {
61
- return options.conversationStore ?? getConfiguredConversationStore();
62
+ return options.conversationStore ?? getConversationStore();
62
63
  }
63
64
  function statusFromCheckpoint(summary, nowMs = Date.now()) {
64
65
  const state = summary.state;
@@ -98,6 +99,9 @@ function requesterIdentityReport(requester) {
98
99
  };
99
100
  return Object.keys(identity).length > 0 ? identity : void 0;
100
101
  }
102
+ function sessionRequesterIdentityReport(requester) {
103
+ return requester?.platform === "slack" ? requesterIdentityReport(toStoredSlackRequester(requester)) : void 0;
104
+ }
101
105
  function usageReport(usage) {
102
106
  if (!usage) return void 0;
103
107
  const report = {
@@ -126,12 +130,11 @@ function sessionReportFromSummary(summary, nowMs = Date.now(), details) {
126
130
  channel: slackThread?.channelId,
127
131
  channelName: effectiveChannelName
128
132
  }) ?? surfaceFallbackLabel(effectiveSurface);
129
- const effectiveRequester = details?.originRequester ?? summary.requester;
133
+ const requesterIdentity = requesterIdentityReport(details?.originRequester) ?? sessionRequesterIdentityReport(summary.requester);
130
134
  const sentryConversationUrl = buildSentryConversationUrl(
131
135
  summary.conversationId
132
136
  );
133
137
  const sentryTraceUrl = summary.traceId ? buildSentryTraceUrl(summary.traceId) : void 0;
134
- const requesterIdentity = requesterIdentityReport(effectiveRequester);
135
138
  const cumulativeUsage = usageReport(summary.cumulativeUsage);
136
139
  return {
137
140
  conversationId: summary.conversationId,
@@ -677,10 +680,15 @@ function isConversationMessage(message) {
677
680
  function countConversationMessages(transcript) {
678
681
  return transcript.filter(isConversationMessage).length;
679
682
  }
680
- function systemPromptMessage(destination) {
683
+ function systemPromptMessage(source) {
681
684
  return {
682
685
  role: "system",
683
- parts: [{ type: "text", text: buildSystemPrompt({ source: destination }) }]
686
+ parts: [
687
+ {
688
+ type: "text",
689
+ text: buildSystemPrompt({ source })
690
+ }
691
+ ]
684
692
  };
685
693
  }
686
694
  function turnScopedMessages(messages, turnStartMessageIndex) {
@@ -881,7 +889,7 @@ async function readConversationReport(conversationId, options = {}) {
881
889
  );
882
890
  const transcriptMessageCount = countConversationMessages(normalizedTranscript);
883
891
  const transcript = canExposeTranscript ? [
884
- ...scopedMessages.startsAtRunBoundary && normalizedTranscript.length > 0 && sessionRecord?.destination ? [systemPromptMessage(sessionRecord.destination)] : [],
892
+ ...scopedMessages.startsAtRunBoundary && normalizedTranscript.length > 0 && sessionRecord?.source ? [systemPromptMessage(sessionRecord.source)] : [],
885
893
  ...normalizedTranscript
886
894
  ] : [];
887
895
  const transcriptMetadata = canExposeTranscript ? void 0 : normalizedTranscript.map(redactTranscriptMessage);
@@ -957,7 +965,7 @@ async function readPlugins() {
957
965
  }));
958
966
  }
959
967
  function createJuniorReporting() {
960
- const conversationStore2 = getConfiguredConversationStore();
968
+ const conversationStore2 = getConversationStore();
961
969
  const listRecent = (listOptions) => listRecentConversationSummaries({
962
970
  ...listOptions,
963
971
  conversationStore: conversationStore2
@@ -9,44 +9,48 @@ import {
9
9
  markTurnFailed,
10
10
  normalizeConversationText,
11
11
  persistThreadStateById,
12
+ processPluginTask,
13
+ scheduleSessionCompletedPluginTasks,
12
14
  startActiveTurn,
13
15
  updateConversationStats,
14
16
  upsertConversationMessage
15
- } from "./chunk-TQ74BATR.js";
17
+ } from "./chunk-FFGXUXMD.js";
18
+ import {
19
+ coerceThreadConversationState
20
+ } from "./chunk-Z4CIQ3EB.js";
21
+ import "./chunk-JBASI5VV.js";
22
+ import "./chunk-KNFROR7R.js";
16
23
  import {
17
24
  commitMessages,
18
25
  loadProjection
19
- } from "./chunk-VNTLUFTY.js";
20
- import "./chunk-NPVUAXUE.js";
21
- import "./chunk-OJODNL2P.js";
22
- import {
23
- coerceThreadConversationState
24
- } from "./chunk-74HO27II.js";
25
- import "./chunk-UJ7OTHPO.js";
26
- import "./chunk-WBZ4M5N5.js";
27
- import "./chunk-BNJIEFQC.js";
28
- import "./chunk-62FUNJYS.js";
29
- import "./chunk-D7NFH5GD.js";
30
- import "./chunk-XJHDZUGD.js";
26
+ } from "./chunk-KOIMO7S3.js";
27
+ import "./chunk-NFTMTIP3.js";
28
+ import "./chunk-56TBVRJG.js";
29
+ import "./chunk-NYKJ3KON.js";
31
30
  import "./chunk-G3E7SCME.js";
32
- import "./chunk-ZNNTSPNF.js";
31
+ import "./chunk-Y5OFBCBZ.js";
32
+ import "./chunk-Q6XFTRV5.js";
33
33
  import {
34
34
  stripRuntimeTurnContext,
35
35
  trimTrailingAssistantMessages
36
- } from "./chunk-FCZO7LAR.js";
37
- import "./chunk-2RWFUS5F.js";
36
+ } from "./chunk-T77LUIX3.js";
37
+ import "./chunk-4SCWV7TJ.js";
38
+ import "./chunk-ZLMBNBUG.js";
39
+ import "./chunk-VALUBQ7R.js";
38
40
  import "./chunk-Q3XNY442.js";
39
- import "./chunk-EIYL7I4S.js";
40
- import "./chunk-MCMROINU.js";
41
- import "./chunk-OK4KKR7B.js";
42
- import "./chunk-SJHUF3DP.js";
43
- import "./chunk-2KG3PWR4.js";
41
+ import {
42
+ logException
43
+ } from "./chunk-EJN6G5A2.js";
44
+ import "./chunk-OJ53FYVG.js";
45
+ import "./chunk-ST6YNAXG.js";
46
+ import "./chunk-MLKGABMK.js";
44
47
 
45
48
  // src/chat/local/runner.ts
46
- import { THREAD_STATE_TTL_MS } from "chat";
47
49
  import {
50
+ createLocalSource,
48
51
  localDestinationSchema
49
52
  } from "@sentry/junior-plugin-api";
53
+ import { THREAD_STATE_TTL_MS } from "chat";
50
54
  var DELIVERED_STATE_PERSIST_ATTEMPTS = 3;
51
55
  function localDestination(conversationId) {
52
56
  const parsed = localDestinationSchema.safeParse({
@@ -112,6 +116,7 @@ async function runLocalAgentTurn(input, deps) {
112
116
  throw new Error("Local reply delivery is required");
113
117
  }
114
118
  const destination = localDestination(input.conversationId);
119
+ const source = createLocalSource(destination.conversationId);
115
120
  const generateAssistantReply2 = deps.generateAssistantReply ?? generateAssistantReply;
116
121
  const now = deps.now ?? (() => Date.now());
117
122
  const persisted = await getPersistedThreadState(input.conversationId);
@@ -165,6 +170,7 @@ async function runLocalAgentTurn(input, deps) {
165
170
  actor: { type: "system", id: "local-cli" }
166
171
  },
167
172
  destination,
173
+ source,
168
174
  requester: {
169
175
  fullName: "Local CLI",
170
176
  platform: "local",
@@ -204,7 +210,13 @@ async function runLocalAgentTurn(input, deps) {
204
210
  onStatus: async (status) => {
205
211
  await deps.onStatus?.(status.text);
206
212
  },
207
- onTextDelta: deps.onTextDelta
213
+ onTextDelta: deps.onTextDelta,
214
+ onToolInvocation: async (invocation) => {
215
+ await deps.onToolInvocation?.(invocation);
216
+ },
217
+ onToolResult: async (result) => {
218
+ await deps.onToolResult?.(result);
219
+ }
208
220
  });
209
221
  completedState = buildDeliveredTurnStatePatch({
210
222
  artifacts,
@@ -254,6 +266,47 @@ async function runLocalAgentTurn(input, deps) {
254
266
  ttlMs: THREAD_STATE_TTL_MS
255
267
  });
256
268
  }
269
+ if (reply.diagnostics.outcome === "success") {
270
+ try {
271
+ await scheduleSessionCompletedPluginTasks(
272
+ {
273
+ conversationId: input.conversationId,
274
+ sessionId: turnId
275
+ },
276
+ {
277
+ send: async (message) => {
278
+ try {
279
+ await processPluginTask(message);
280
+ } catch (error) {
281
+ logException(
282
+ error,
283
+ "local_plugin_session_completed_task_failed",
284
+ {},
285
+ {
286
+ conversationId: input.conversationId,
287
+ pluginName: message.plugin,
288
+ taskName: message.name,
289
+ turnId
290
+ },
291
+ "Local plugin session.completed task failed after reply delivery"
292
+ );
293
+ }
294
+ }
295
+ }
296
+ );
297
+ } catch (error) {
298
+ logException(
299
+ error,
300
+ "local_plugin_session_completed_task_failed",
301
+ {},
302
+ {
303
+ conversationId: input.conversationId,
304
+ turnId
305
+ },
306
+ "Local plugin session.completed task failed after reply delivery"
307
+ );
308
+ }
309
+ }
257
310
  return {
258
311
  conversationId: input.conversationId,
259
312
  outcome: reply.diagnostics.outcome
@@ -0,0 +1,31 @@
1
+ import {
2
+ captureException,
3
+ continueTrace,
4
+ flush,
5
+ getClient,
6
+ getGlobalScope,
7
+ init,
8
+ setTag,
9
+ setUser,
10
+ startInactiveSpan,
11
+ startSpan,
12
+ vercelAIIntegration,
13
+ withActiveSpan,
14
+ withScope
15
+ } from "./chunk-ST6YNAXG.js";
16
+ import "./chunk-MLKGABMK.js";
17
+ export {
18
+ captureException,
19
+ continueTrace,
20
+ flush,
21
+ getClient,
22
+ getGlobalScope,
23
+ init,
24
+ setTag,
25
+ setUser,
26
+ startInactiveSpan,
27
+ startSpan,
28
+ vercelAIIntegration,
29
+ withActiveSpan,
30
+ withScope
31
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ validatePluginEgressCredentialHooks,
3
+ validatePluginRegistrations
4
+ } from "./chunk-XBBC6W45.js";
5
+ import "./chunk-ZLMBNBUG.js";
6
+ import "./chunk-VALUBQ7R.js";
7
+ import "./chunk-Q3XNY442.js";
8
+ import "./chunk-EJN6G5A2.js";
9
+ import "./chunk-OJ53FYVG.js";
10
+ import "./chunk-ST6YNAXG.js";
11
+ import "./chunk-MLKGABMK.js";
12
+ export {
13
+ validatePluginEgressCredentialHooks,
14
+ validatePluginRegistrations
15
+ };
package/dist/vercel.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  juniorVercelConfig
3
3
  } from "./chunk-Y7X25LFY.js";
4
- import "./chunk-2KG3PWR4.js";
4
+ import "./chunk-MLKGABMK.js";
5
5
  export {
6
6
  juniorVercelConfig
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.75.0",
3
+ "version": "0.76.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -46,20 +46,21 @@
46
46
  "@chat-adapter/slack": "4.29.0",
47
47
  "@chat-adapter/state-memory": "4.29.0",
48
48
  "@chat-adapter/state-redis": "4.29.0",
49
- "@logtape/logtape": "^2.1.1",
50
49
  "@earendil-works/pi-agent-core": "0.74.2",
51
50
  "@earendil-works/pi-ai": "0.74.2",
51
+ "@logtape/logtape": "^2.1.1",
52
52
  "@modelcontextprotocol/sdk": "1.29.0",
53
53
  "@neondatabase/serverless": "^1.1.0",
54
+ "@sentry/node": "10.59.0",
54
55
  "@sinclair/typebox": "^0.34.49",
55
56
  "@slack/web-api": "^7.16.0",
56
- "@sentry/node": "10.53.1",
57
57
  "@vercel/functions": "^3.6.0",
58
58
  "@vercel/queue": "^0.2.0",
59
59
  "@vercel/sandbox": "2.0.0",
60
60
  "ai": "^6.0.190",
61
61
  "bash-tool": "^1.3.16",
62
62
  "chat": "4.29.0",
63
+ "commander": "^14.0.3",
63
64
  "drizzle-orm": "^0.45.2",
64
65
  "hono": "^4.12.22",
65
66
  "jiti": "^2.7.0",
@@ -69,7 +70,7 @@
69
70
  "pg": "^8.16.3",
70
71
  "yaml": "^2.9.0",
71
72
  "zod": "^4.4.3",
72
- "@sentry/junior-plugin-api": "0.75.0"
73
+ "@sentry/junior-plugin-api": "0.76.1"
73
74
  },
74
75
  "devDependencies": {
75
76
  "@emnapi/core": "^1.10.0",
@@ -85,9 +86,9 @@
85
86
  "typescript": "^6.0.3",
86
87
  "vercel": "^54.4.0",
87
88
  "vitest": "^4.1.7",
88
- "@sentry/junior-scheduler": "0.75.0",
89
- "@sentry/junior-testing": "0.0.0",
90
- "@sentry/junior-test-fixtures": "0.72.0"
89
+ "@sentry/junior-memory": "0.76.1",
90
+ "@sentry/junior-scheduler": "0.76.1",
91
+ "@sentry/junior-testing": "0.0.0"
91
92
  },
92
93
  "scripts": {
93
94
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
@@ -1,33 +0,0 @@
1
- import {
2
- PluginHookDeniedError,
3
- createPluginHookRunner,
4
- getPluginOperationalReports,
5
- getPluginRoutes,
6
- getPluginSlackConversationLink,
7
- getPluginTools,
8
- getPlugins,
9
- setPlugins,
10
- validatePlugins
11
- } from "./chunk-NPVUAXUE.js";
12
- import "./chunk-BNJIEFQC.js";
13
- import "./chunk-62FUNJYS.js";
14
- import "./chunk-D7NFH5GD.js";
15
- import "./chunk-G3E7SCME.js";
16
- import "./chunk-ZNNTSPNF.js";
17
- import "./chunk-FCZO7LAR.js";
18
- import "./chunk-EIYL7I4S.js";
19
- import "./chunk-MCMROINU.js";
20
- import "./chunk-OK4KKR7B.js";
21
- import "./chunk-SJHUF3DP.js";
22
- import "./chunk-2KG3PWR4.js";
23
- export {
24
- PluginHookDeniedError,
25
- createPluginHookRunner,
26
- getPluginOperationalReports,
27
- getPluginRoutes,
28
- getPluginSlackConversationLink,
29
- getPluginTools,
30
- getPlugins,
31
- setPlugins,
32
- validatePlugins
33
- };