@sentry/junior 0.74.1 → 0.76.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 (121) 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 +3 -1
  5. package/dist/app.js +5516 -5422
  6. package/dist/build/copy-build-content.d.ts +1 -1
  7. package/dist/build/virtual-config.d.ts +2 -2
  8. package/dist/chat/agent-dispatch/context.d.ts +2 -3
  9. package/dist/chat/agent-dispatch/runner.d.ts +2 -0
  10. package/dist/chat/agent-dispatch/types.d.ts +2 -1
  11. package/dist/chat/config.d.ts +3 -0
  12. package/dist/chat/credentials/state-adapter-token-store.d.ts +2 -0
  13. package/dist/chat/credentials/subject.d.ts +3 -3
  14. package/dist/chat/credentials/user-token-store.d.ts +17 -12
  15. package/dist/chat/db.d.ts +8 -0
  16. package/dist/chat/mcp/auth-store.d.ts +2 -1
  17. package/dist/chat/mcp/oauth.d.ts +2 -1
  18. package/dist/chat/oauth-flow.d.ts +3 -1
  19. package/dist/chat/pi/client.d.ts +15 -7
  20. package/dist/chat/plugins/agent-hooks.d.ts +20 -13
  21. package/dist/chat/plugins/auth/oauth-request.d.ts +11 -7
  22. package/dist/chat/plugins/credential-hooks.d.ts +6 -6
  23. package/dist/chat/plugins/logging.d.ts +2 -2
  24. package/dist/chat/plugins/model.d.ts +9 -0
  25. package/dist/chat/plugins/package-discovery.d.ts +2 -1
  26. package/dist/chat/plugins/prompt.d.ts +5 -0
  27. package/dist/chat/plugins/registry.d.ts +4 -0
  28. package/dist/chat/plugins/state.d.ts +3 -5
  29. package/dist/chat/plugins/task-callback.d.ts +5 -0
  30. package/dist/chat/plugins/task-message.d.ts +23 -0
  31. package/dist/chat/plugins/task-queue.d.ts +5 -0
  32. package/dist/chat/plugins/task-runner.d.ts +12 -0
  33. package/dist/chat/plugins/task-signing.d.ts +31 -0
  34. package/dist/chat/plugins/types.d.ts +1 -0
  35. package/dist/chat/plugins/validation.d.ts +5 -0
  36. package/dist/chat/prompt.d.ts +15 -1
  37. package/dist/chat/requester.d.ts +6 -5
  38. package/dist/chat/respond-helpers.d.ts +2 -0
  39. package/dist/chat/respond.d.ts +13 -2
  40. package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
  41. package/dist/chat/runtime/reply-executor.d.ts +5 -1
  42. package/dist/chat/runtime/slack-resume.d.ts +10 -2
  43. package/dist/chat/runtime/slack-runtime.d.ts +6 -1
  44. package/dist/chat/sandbox/egress-credentials.d.ts +8 -8
  45. package/dist/chat/sandbox/sandbox.d.ts +2 -2
  46. package/dist/chat/sentry.d.ts +1 -0
  47. package/dist/chat/services/mcp-auth-orchestration.d.ts +2 -1
  48. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
  49. package/dist/chat/services/subscribed-decision.d.ts +2 -2
  50. package/dist/chat/services/turn-session-record.d.ts +11 -7
  51. package/dist/chat/sql/db.d.ts +3 -0
  52. package/dist/chat/sql/executor.d.ts +7 -0
  53. package/dist/chat/sql/neon.d.ts +2 -4
  54. package/dist/chat/sql/postgres.d.ts +6 -0
  55. package/dist/chat/state/turn-session.d.ts +8 -5
  56. package/dist/chat/task-execution/state.d.ts +7 -2
  57. package/dist/chat/task-execution/worker.d.ts +1 -1
  58. package/dist/chat/tools/agent-tools.d.ts +9 -2
  59. package/dist/chat/tools/slack/context.d.ts +2 -2
  60. package/dist/chat/tools/types.d.ts +7 -4
  61. package/dist/chat/vercel-queue-client.d.ts +3 -0
  62. package/dist/{chunk-YOHFWWBV.js → chunk-2ECJXSVQ.js} +5 -107
  63. package/dist/{chunk-OR6NQJ5E.js → chunk-4SCWV7TJ.js} +3 -3
  64. package/dist/chunk-4UO6FK4G.js +64 -0
  65. package/dist/chunk-56TBVRJG.js +115 -0
  66. package/dist/{chunk-3BYAPS6B.js → chunk-EJN6G5A2.js} +17 -11
  67. package/dist/{chunk-SQGMG7OD.js → chunk-HHDUKWVG.js} +508 -149
  68. package/dist/{chunk-6UP2Z2RZ.js → chunk-JBASI5VV.js} +7 -7
  69. package/dist/chunk-KNFROR7R.js +127 -0
  70. package/dist/{chunk-HYHKTFG2.js → chunk-KOIMO7S3.js} +186 -910
  71. package/dist/chunk-MLKGABMK.js +9 -0
  72. package/dist/chunk-NFTMTIP3.js +964 -0
  73. package/dist/chunk-NYKJ3KON.js +1082 -0
  74. package/dist/{chunk-SJHUF3DP.js → chunk-OJ53FYVG.js} +2 -10
  75. package/dist/{chunk-KVZL5NZS.js → chunk-Q3XNY442.js} +17 -7
  76. package/dist/{chunk-YRDS7VKO.js → chunk-Q6XFTRV5.js} +2 -2
  77. package/dist/chunk-R6Z5XWY3.js +1076 -0
  78. package/dist/chunk-RV5RYIJW.js +56 -0
  79. package/dist/chunk-SG5WAA7H.js +132 -0
  80. package/dist/chunk-ST6YNAXG.js +54 -0
  81. package/dist/{chunk-GM7HTXYC.js → chunk-T77LUIX3.js} +148 -151
  82. package/dist/{chunk-CYUI7JU5.js → chunk-VALUBQ7R.js} +22 -30
  83. package/dist/chunk-XBBC6W45.js +71 -0
  84. package/dist/chunk-Y2CM7HXH.js +111 -0
  85. package/dist/{chunk-F6HWCPOC.js → chunk-Y5OFBCBZ.js} +1 -1
  86. package/dist/{chunk-M4FLLXXD.js → chunk-Z4CIQ3EB.js} +5 -1
  87. package/dist/{chunk-7Q5YOUUT.js → chunk-ZLMBNBUG.js} +146 -52
  88. package/dist/{chunk-2LUZA3LY.js → chunk-ZQB37HUX.js} +11 -11
  89. package/dist/cli/chat.js +87 -8
  90. package/dist/cli/check.js +8 -7
  91. package/dist/cli/env.js +4 -53
  92. package/dist/cli/init.js +6 -1
  93. package/dist/cli/main.js +84 -0
  94. package/dist/cli/plugins.js +244 -0
  95. package/dist/cli/run.js +5 -52
  96. package/dist/cli/snapshot-warmup.js +12 -11
  97. package/dist/cli/upgrade.js +385 -26
  98. package/dist/db-7A7PFRGL.js +17 -0
  99. package/dist/deployment.d.ts +1 -0
  100. package/dist/handlers/sandbox-egress-route.d.ts +4 -0
  101. package/dist/handlers/slack-webhook.d.ts +4 -0
  102. package/dist/handlers/webhooks.d.ts +6 -13
  103. package/dist/instrumentation.js +14 -18
  104. package/dist/nitro.d.ts +1 -1
  105. package/dist/nitro.js +67 -101
  106. package/dist/plugin-module.d.ts +21 -0
  107. package/dist/plugins-PZMDS7AT.js +15 -0
  108. package/dist/plugins.d.ts +9 -5
  109. package/dist/registry-OIPAJU2O.js +46 -0
  110. package/dist/reporting/conversations.d.ts +3 -3
  111. package/dist/reporting.d.ts +6 -5
  112. package/dist/reporting.js +42 -28
  113. package/dist/{runner-27NP2TEO.js → runner-KPLNHDCV.js} +77 -19
  114. package/dist/sentry-4CP5NNQ5.js +31 -0
  115. package/dist/validation-SLA6IGF7.js +15 -0
  116. package/dist/vercel.js +1 -1
  117. package/package.json +14 -11
  118. package/dist/chat/conversations/configured.d.ts +0 -5
  119. package/dist/chat/conversations/state.d.ts +0 -4
  120. package/dist/chunk-2KG3PWR4.js +0 -17
  121. package/dist/chunk-JL2SLRAT.js +0 -1970
@@ -9,39 +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-SQGMG7OD.js";
17
+ } from "./chunk-HHDUKWVG.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-HYHKTFG2.js";
20
- import "./chunk-OR6NQJ5E.js";
21
- import {
22
- coerceThreadConversationState
23
- } from "./chunk-M4FLLXXD.js";
24
- import "./chunk-JL2SLRAT.js";
25
- import "./chunk-YRDS7VKO.js";
26
- import "./chunk-6UP2Z2RZ.js";
26
+ } from "./chunk-KOIMO7S3.js";
27
+ import "./chunk-NFTMTIP3.js";
28
+ import "./chunk-56TBVRJG.js";
29
+ import "./chunk-NYKJ3KON.js";
27
30
  import "./chunk-G3E7SCME.js";
28
- import "./chunk-7Q5YOUUT.js";
29
- import "./chunk-KVZL5NZS.js";
30
- import "./chunk-F6HWCPOC.js";
31
+ import "./chunk-Y5OFBCBZ.js";
32
+ import "./chunk-Q6XFTRV5.js";
31
33
  import {
32
34
  stripRuntimeTurnContext,
33
35
  trimTrailingAssistantMessages
34
- } from "./chunk-GM7HTXYC.js";
35
- import "./chunk-CYUI7JU5.js";
36
- import "./chunk-3BYAPS6B.js";
37
- import "./chunk-SJHUF3DP.js";
38
- import "./chunk-2KG3PWR4.js";
36
+ } from "./chunk-T77LUIX3.js";
37
+ import "./chunk-4SCWV7TJ.js";
38
+ import "./chunk-ZLMBNBUG.js";
39
+ import "./chunk-VALUBQ7R.js";
40
+ import "./chunk-Q3XNY442.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";
39
47
 
40
48
  // src/chat/local/runner.ts
41
- import { THREAD_STATE_TTL_MS } from "chat";
42
49
  import {
50
+ createLocalSource,
43
51
  localDestinationSchema
44
52
  } from "@sentry/junior-plugin-api";
53
+ import { THREAD_STATE_TTL_MS } from "chat";
45
54
  var DELIVERED_STATE_PERSIST_ATTEMPTS = 3;
46
55
  function localDestination(conversationId) {
47
56
  const parsed = localDestinationSchema.safeParse({
@@ -107,6 +116,7 @@ async function runLocalAgentTurn(input, deps) {
107
116
  throw new Error("Local reply delivery is required");
108
117
  }
109
118
  const destination = localDestination(input.conversationId);
119
+ const source = createLocalSource(destination.conversationId);
110
120
  const generateAssistantReply2 = deps.generateAssistantReply ?? generateAssistantReply;
111
121
  const now = deps.now ?? (() => Date.now());
112
122
  const persisted = await getPersistedThreadState(input.conversationId);
@@ -160,6 +170,7 @@ async function runLocalAgentTurn(input, deps) {
160
170
  actor: { type: "system", id: "local-cli" }
161
171
  },
162
172
  destination,
173
+ source,
163
174
  requester: {
164
175
  fullName: "Local CLI",
165
176
  platform: "local",
@@ -199,7 +210,13 @@ async function runLocalAgentTurn(input, deps) {
199
210
  onStatus: async (status) => {
200
211
  await deps.onStatus?.(status.text);
201
212
  },
202
- 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
+ }
203
220
  });
204
221
  completedState = buildDeliveredTurnStatePatch({
205
222
  artifacts,
@@ -249,6 +266,47 @@ async function runLocalAgentTurn(input, deps) {
249
266
  ttlMs: THREAD_STATE_TTL_MS
250
267
  });
251
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
+ }
252
310
  return {
253
311
  conversationId: input.conversationId,
254
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.74.1",
3
+ "version": "0.76.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -46,33 +46,37 @@
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",
66
+ "jiti": "^2.7.0",
65
67
  "jose": "^6.2.3",
66
68
  "just-bash": "3.0.1",
67
69
  "node-html-markdown": "^2.0.0",
70
+ "pg": "^8.16.3",
68
71
  "yaml": "^2.9.0",
69
72
  "zod": "^4.4.3",
70
- "@sentry/junior-plugin-api": "0.74.1"
73
+ "@sentry/junior-plugin-api": "0.76.0"
71
74
  },
72
75
  "devDependencies": {
73
76
  "@emnapi/core": "^1.10.0",
74
77
  "@emnapi/runtime": "^1.10.0",
75
78
  "@types/node": "^25.9.1",
79
+ "@types/pg": "^8.15.6",
76
80
  "@vitest/coverage-v8": "4.1.7",
77
81
  "dependency-cruiser": "^17.4.0",
78
82
  "msw": "^2.14.6",
@@ -82,19 +86,18 @@
82
86
  "typescript": "^6.0.3",
83
87
  "vercel": "^54.4.0",
84
88
  "vitest": "^4.1.7",
85
- "@sentry/junior-test-fixtures": "0.72.0",
86
- "@sentry/junior-scheduler": "0.74.1"
89
+ "@sentry/junior-scheduler": "0.76.0",
90
+ "@sentry/junior-testing": "0.0.0",
91
+ "@sentry/junior-memory": "0.76.0"
87
92
  },
88
93
  "scripts": {
89
94
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
90
- "lint": "oxlint --config .oxlintrc.json --deny-warnings src tests scripts bin tsup.config.ts",
95
+ "lint": "oxlint --config .oxlintrc.json --deny-warnings src tests scripts bin tsup.config.ts && depcruise --config .dependency-cruiser.mjs src/chat",
91
96
  "lint:fix": "oxlint --config .oxlintrc.json --deny-warnings --fix src tests scripts bin tsup.config.ts",
92
- "test": "pnpm run test:slack-boundary && pnpm run test:arch-boundary && vitest run --maxWorkers=4",
97
+ "test": "vitest run --maxWorkers=4",
93
98
  "test:watch": "vitest",
94
- "test:slack-boundary": "node scripts/check-slack-test-boundary.mjs",
95
- "test:arch-boundary": "depcruise --config .dependency-cruiser.mjs src/chat",
96
99
  "typecheck": "tsc --noEmit",
97
100
  "skills:check": "node scripts/check-skills.mjs",
98
- "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"
101
+ "test:coverage": "vitest run --maxWorkers=4 --coverage --reporter=default --reporter=junit --outputFile.junit=coverage/results.junit.xml"
99
102
  }
100
103
  }
@@ -1,5 +0,0 @@
1
- import type { ConversationStore } from "./store";
2
- /** Return the process-configured conversation record store. */
3
- export declare function getConfiguredConversationStore(): ConversationStore;
4
- /** Return whether conversation records use the configured SQL store. */
5
- export declare function hasConfiguredSqlConversationStore(): boolean;
@@ -1,4 +0,0 @@
1
- import type { StateAdapter } from "chat";
2
- import type { ConversationStore } from "./store";
3
- /** Create the no-SQL conversation record store backed by task-execution state. */
4
- export declare function createStateConversationStore(state?: StateAdapter): ConversationStore;
@@ -1,17 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
-
15
- export {
16
- __reExport
17
- };