@sentry/junior 0.53.0 → 0.55.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 (239) hide show
  1. package/README.md +4 -3
  2. package/dist/api-reference.d.ts +7 -0
  3. package/dist/app.d.ts +14 -12
  4. package/dist/app.js +12977 -10333
  5. package/dist/build/copy-build-content.d.ts +4 -0
  6. package/dist/build/glob-to-regex.d.ts +2 -0
  7. package/dist/build/rolldown-workarounds.d.ts +14 -0
  8. package/dist/build/virtual-config.d.ts +4 -0
  9. package/dist/chat/agent-dispatch/context.d.ts +6 -0
  10. package/dist/chat/agent-dispatch/heartbeat.d.ts +14 -0
  11. package/dist/chat/agent-dispatch/runner.d.ts +9 -0
  12. package/dist/chat/agent-dispatch/signing.d.ts +5 -0
  13. package/dist/chat/agent-dispatch/store.d.ts +29 -0
  14. package/dist/chat/agent-dispatch/types.d.ts +57 -0
  15. package/dist/chat/agent-dispatch/validation.d.ts +3 -0
  16. package/dist/chat/app/factory.d.ts +10 -0
  17. package/dist/chat/app/production.d.ts +6 -0
  18. package/dist/chat/app/services.d.ts +17 -0
  19. package/dist/chat/capabilities/catalog.d.ts +16 -0
  20. package/dist/chat/capabilities/factory.d.ts +10 -0
  21. package/dist/chat/capabilities/jr-rpc-command.d.ts +26 -0
  22. package/dist/chat/capabilities/router.d.ts +19 -0
  23. package/dist/chat/coerce.d.ts +6 -0
  24. package/dist/chat/config.d.ts +47 -0
  25. package/dist/chat/configuration/defaults.d.ts +4 -0
  26. package/dist/chat/configuration/service.d.ts +2 -0
  27. package/dist/chat/configuration/types.d.ts +37 -0
  28. package/dist/chat/configuration/validation.d.ts +2 -0
  29. package/dist/chat/credentials/broker.d.ts +22 -0
  30. package/dist/chat/credentials/header-transforms.d.ts +3 -0
  31. package/dist/chat/credentials/oauth-scope.d.ts +4 -0
  32. package/dist/chat/credentials/state-adapter-token-store.d.ts +9 -0
  33. package/dist/chat/credentials/unlink-provider.d.ts +2 -0
  34. package/dist/chat/credentials/user-token-store.d.ts +11 -0
  35. package/dist/chat/discovery.d.ts +47 -0
  36. package/dist/chat/ingress/junior-chat.d.ts +26 -0
  37. package/dist/chat/ingress/message-changed.d.ts +50 -0
  38. package/dist/chat/ingress/message-router.d.ts +9 -0
  39. package/dist/chat/ingress/slash-command.d.ts +3 -0
  40. package/dist/chat/ingress/workspace-membership.d.ts +9 -0
  41. package/dist/chat/interruption-marker.d.ts +2 -0
  42. package/dist/chat/logging.d.ts +90 -0
  43. package/dist/chat/mcp/auth-store.d.ts +41 -0
  44. package/dist/chat/mcp/client.d.ts +34 -0
  45. package/dist/chat/mcp/errors.d.ts +8 -0
  46. package/dist/chat/mcp/oauth-provider.d.ts +27 -0
  47. package/dist/chat/mcp/oauth.d.ts +17 -0
  48. package/dist/chat/mcp/tool-manager.d.ts +60 -0
  49. package/dist/chat/oauth-flow.d.ts +45 -0
  50. package/dist/chat/optional-string.d.ts +5 -0
  51. package/dist/chat/pi/client.d.ts +49 -0
  52. package/dist/chat/pi/messages.d.ts +3 -0
  53. package/dist/chat/pi/traced-stream.d.ts +9 -0
  54. package/dist/chat/plugins/agent-hooks.d.ts +32 -0
  55. package/dist/chat/plugins/auth/api-headers-broker.d.ts +6 -0
  56. package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +3 -0
  57. package/dist/chat/plugins/auth/github-app-broker.d.ts +4 -0
  58. package/dist/chat/plugins/auth/oauth-bearer-broker.d.ts +6 -0
  59. package/dist/chat/plugins/auth/oauth-request.d.ts +18 -0
  60. package/dist/chat/plugins/command-env.d.ts +3 -0
  61. package/dist/chat/plugins/logging.d.ts +3 -0
  62. package/dist/chat/plugins/manifest.d.ts +3 -0
  63. package/dist/chat/plugins/package-discovery.d.ts +14 -0
  64. package/dist/chat/plugins/registry.d.ts +23 -0
  65. package/dist/chat/plugins/state.d.ts +3 -0
  66. package/dist/chat/plugins/types.d.ts +146 -0
  67. package/dist/chat/prompt.d.ts +39 -0
  68. package/dist/chat/queue/thread-message-dispatcher.d.ts +33 -0
  69. package/dist/chat/respond-helpers.d.ts +77 -0
  70. package/dist/chat/respond.d.ts +75 -0
  71. package/dist/chat/runtime/auth-pause-state.d.ts +11 -0
  72. package/dist/chat/runtime/delivered-turn-state.d.ts +15 -0
  73. package/dist/chat/runtime/dev-agent-trace.d.ts +1 -0
  74. package/dist/chat/runtime/processing-reaction.d.ts +25 -0
  75. package/dist/chat/runtime/reply-executor.d.ts +56 -0
  76. package/dist/chat/runtime/report-progress.d.ts +3 -0
  77. package/dist/chat/runtime/slack-resume.d.ts +50 -0
  78. package/dist/chat/runtime/slack-runtime.d.ts +100 -0
  79. package/dist/chat/runtime/thread-context.d.ts +24 -0
  80. package/dist/chat/runtime/thread-state.d.ts +28 -0
  81. package/dist/chat/runtime/turn-preparation.d.ts +43 -0
  82. package/dist/chat/runtime/turn-user-message.d.ts +12 -0
  83. package/dist/chat/runtime/turn.d.ts +69 -0
  84. package/dist/chat/sandbox/credentials.d.ts +11 -0
  85. package/dist/chat/sandbox/egress-oidc.d.ts +3 -0
  86. package/dist/chat/sandbox/egress-policy.d.ts +11 -0
  87. package/dist/chat/sandbox/egress-proxy.d.ts +17 -0
  88. package/dist/chat/sandbox/egress-session.d.ts +27 -0
  89. package/dist/chat/sandbox/errors.d.ts +12 -0
  90. package/dist/chat/sandbox/http-error-details.d.ts +18 -0
  91. package/dist/chat/sandbox/noninteractive-command.d.ts +17 -0
  92. package/dist/chat/sandbox/paths.d.ts +5 -0
  93. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +20 -0
  94. package/dist/chat/sandbox/sandbox.d.ts +54 -0
  95. package/dist/chat/sandbox/session.d.ts +54 -0
  96. package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
  97. package/dist/chat/sandbox/skill-sync.d.ts +16 -0
  98. package/dist/chat/sandbox/workspace.d.ts +55 -0
  99. package/dist/chat/scheduler/cadence.d.ts +24 -0
  100. package/dist/chat/scheduler/plugin.d.ts +2 -0
  101. package/dist/chat/scheduler/prompt.d.ts +7 -0
  102. package/dist/chat/scheduler/store.d.ts +49 -0
  103. package/dist/chat/scheduler/types.d.ts +86 -0
  104. package/dist/chat/sentry.d.ts +2 -0
  105. package/dist/chat/services/attachment-claims.d.ts +2 -0
  106. package/dist/chat/services/auth-pause-response.d.ts +2 -0
  107. package/dist/chat/services/auth-pause.d.ts +19 -0
  108. package/dist/chat/services/channel-intent.d.ts +2 -0
  109. package/dist/chat/services/conversation-memory.d.ts +33 -0
  110. package/dist/chat/services/mcp-auth-orchestration.d.ts +30 -0
  111. package/dist/chat/services/pending-auth.d.ts +27 -0
  112. package/dist/chat/services/plugin-auth-orchestration.d.ts +37 -0
  113. package/dist/chat/services/provider-default-config.d.ts +9 -0
  114. package/dist/chat/services/provider-retry.d.ts +6 -0
  115. package/dist/chat/services/reply-delivery-plan.d.ts +17 -0
  116. package/dist/chat/services/subscribed-decision.d.ts +63 -0
  117. package/dist/chat/services/subscribed-reply-policy.d.ts +23 -0
  118. package/dist/chat/services/timeout-resume.d.ts +17 -0
  119. package/dist/chat/services/turn-checkpoint.d.ts +74 -0
  120. package/dist/chat/services/turn-continuation-response.d.ts +2 -0
  121. package/dist/chat/services/turn-failure-response.d.ts +15 -0
  122. package/dist/chat/services/turn-result.d.ts +55 -0
  123. package/dist/chat/services/turn-thinking-level.d.ts +49 -0
  124. package/dist/chat/services/vision-context.d.ts +61 -0
  125. package/dist/chat/skills.d.ts +48 -0
  126. package/dist/chat/slack/adapter.d.ts +9 -0
  127. package/dist/chat/slack/app-home.d.ts +11 -0
  128. package/dist/chat/slack/assistant-thread/lifecycle.d.ts +13 -0
  129. package/dist/chat/slack/assistant-thread/status-render.d.ts +28 -0
  130. package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +23 -0
  131. package/dist/chat/slack/assistant-thread/status-send.d.ts +31 -0
  132. package/dist/chat/slack/assistant-thread/status.d.ts +36 -0
  133. package/dist/chat/slack/assistant-thread/title.d.ts +28 -0
  134. package/dist/chat/slack/canvas-references.d.ts +2 -0
  135. package/dist/chat/slack/channel.d.ts +48 -0
  136. package/dist/chat/slack/client.d.ts +52 -0
  137. package/dist/chat/slack/context.d.ts +9 -0
  138. package/dist/chat/slack/emoji.d.ts +1 -0
  139. package/dist/chat/slack/errors.d.ts +6 -0
  140. package/dist/chat/slack/footer.d.ts +42 -0
  141. package/dist/chat/slack/ids.d.ts +4 -0
  142. package/dist/chat/slack/legacy-attachments.d.ts +4 -0
  143. package/dist/chat/slack/message.d.ts +6 -0
  144. package/dist/chat/slack/mrkdwn.d.ts +12 -0
  145. package/dist/chat/slack/outbound.d.ts +57 -0
  146. package/dist/chat/slack/output.d.ts +54 -0
  147. package/dist/chat/slack/reply.d.ts +33 -0
  148. package/dist/chat/slack/status-format.d.ts +2 -0
  149. package/dist/chat/slack/turn-continuation-notice.d.ts +8 -0
  150. package/dist/chat/slack/user.d.ts +8 -0
  151. package/dist/chat/slack/users.d.ts +39 -0
  152. package/dist/chat/slack/workspace-context.d.ts +4 -0
  153. package/dist/chat/state/adapter.d.ts +9 -0
  154. package/dist/chat/state/artifacts.d.ts +29 -0
  155. package/dist/chat/state/conversation.d.ts +81 -0
  156. package/dist/chat/state/pi-session-message-store.d.ts +15 -0
  157. package/dist/chat/state/turn-id.d.ts +2 -0
  158. package/dist/chat/state/turn-session-store.d.ts +49 -0
  159. package/dist/chat/tools/advisor/session-store.d.ts +9 -0
  160. package/dist/chat/tools/advisor/tool.d.ts +33 -0
  161. package/dist/chat/tools/agent-tools.d.ts +10 -0
  162. package/dist/chat/tools/channel-capabilities.d.ts +11 -0
  163. package/dist/chat/tools/definition.d.ts +17 -0
  164. package/dist/chat/tools/execution/build-sandbox-input.d.ts +2 -0
  165. package/dist/chat/tools/execution/normalize-result.d.ts +6 -0
  166. package/dist/chat/tools/execution/tool-error-handler.d.ts +3 -0
  167. package/dist/chat/tools/execution/tool-input-error.d.ts +6 -0
  168. package/dist/chat/tools/idempotency.d.ts +1 -0
  169. package/dist/chat/tools/index.d.ts +5 -0
  170. package/dist/chat/tools/runtime/report-progress.d.ts +4 -0
  171. package/dist/chat/tools/sandbox/attach-file.d.ts +7 -0
  172. package/dist/chat/tools/sandbox/bash.d.ts +5 -0
  173. package/dist/chat/tools/sandbox/edit-file.d.ts +37 -0
  174. package/dist/chat/tools/sandbox/file-utils.d.ts +52 -0
  175. package/dist/chat/tools/sandbox/find-files.d.ts +24 -0
  176. package/dist/chat/tools/sandbox/grep.d.ts +33 -0
  177. package/dist/chat/tools/sandbox/list-dir.d.ts +22 -0
  178. package/dist/chat/tools/sandbox/read-file.d.ts +32 -0
  179. package/dist/chat/tools/sandbox/text-edits.d.ts +28 -0
  180. package/dist/chat/tools/sandbox/write-file.d.ts +5 -0
  181. package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -0
  182. package/dist/chat/tools/skill/load-skill.d.ts +22 -0
  183. package/dist/chat/tools/skill/mcp-tool-summary.d.ts +31 -0
  184. package/dist/chat/tools/skill/search-mcp-tools.d.ts +8 -0
  185. package/dist/chat/tools/slack/canvas-tools.d.ts +29 -0
  186. package/dist/chat/tools/slack/canvases.d.ts +45 -0
  187. package/dist/chat/tools/slack/channel-list-messages.d.ts +9 -0
  188. package/dist/chat/tools/slack/channel-post-message.d.ts +4 -0
  189. package/dist/chat/tools/slack/list-tools.d.ts +21 -0
  190. package/dist/chat/tools/slack/lists.d.ts +42 -0
  191. package/dist/chat/tools/slack/message-add-reaction.d.ts +4 -0
  192. package/dist/chat/tools/slack/schedule-tools.d.ts +29 -0
  193. package/dist/chat/tools/slack/slack-message-url.d.ts +18 -0
  194. package/dist/chat/tools/slack/thread-read.d.ts +9 -0
  195. package/dist/chat/tools/slack/user-lookup.d.ts +8 -0
  196. package/dist/chat/tools/system-time.d.ts +1 -0
  197. package/dist/chat/tools/types.d.ts +61 -0
  198. package/dist/chat/tools/web/constants.d.ts +6 -0
  199. package/dist/chat/tools/web/fetch-content.d.ts +23 -0
  200. package/dist/chat/tools/web/fetch-tool.d.ts +5 -0
  201. package/dist/chat/tools/web/image-generate.d.ts +4 -0
  202. package/dist/chat/tools/web/network.d.ts +6 -0
  203. package/dist/chat/tools/web/search.d.ts +5 -0
  204. package/dist/chat/turn-context-tag.d.ts +6 -0
  205. package/dist/chat/usage.d.ts +24 -0
  206. package/dist/chat/xml.d.ts +1 -0
  207. package/dist/{chunk-XPXD3FCE.js → chunk-5LUISFEY.js} +189 -35
  208. package/dist/{chunk-ZNFNY53B.js → chunk-D3G3YOU4.js} +2 -2
  209. package/dist/chunk-SCQPBJAU.js +21 -0
  210. package/dist/{chunk-Q3FDONU7.js → chunk-TTUY467K.js} +47 -37
  211. package/dist/{chunk-KCOKQLBF.js → chunk-XI3CFWTA.js} +168 -15
  212. package/dist/cli/check.js +3 -3
  213. package/dist/cli/init.js +6 -1
  214. package/dist/cli/snapshot-warmup.js +3 -3
  215. package/dist/handlers/agent-dispatch.d.ts +3 -0
  216. package/dist/handlers/diagnostics-dashboard.d.ts +2 -0
  217. package/dist/handlers/diagnostics.d.ts +2 -0
  218. package/dist/handlers/health.d.ts +4 -0
  219. package/dist/handlers/heartbeat.d.ts +3 -0
  220. package/dist/handlers/mcp-oauth-callback.d.ts +2 -0
  221. package/dist/handlers/oauth-callback.d.ts +2 -0
  222. package/dist/handlers/oauth-html.d.ts +2 -0
  223. package/dist/handlers/sandbox-egress-proxy.d.ts +9 -0
  224. package/dist/handlers/turn-resume.d.ts +3 -0
  225. package/dist/handlers/types.d.ts +2 -0
  226. package/dist/handlers/webhooks.d.ts +15 -0
  227. package/dist/instrumentation.d.ts +1 -3
  228. package/dist/nitro.d.ts +4 -7
  229. package/dist/nitro.js +112 -54
  230. package/dist/package-resolution.d.ts +13 -0
  231. package/dist/vercel.d.ts +2 -4
  232. package/dist/vercel.js +3 -12
  233. package/package.json +32 -26
  234. package/dist/cli/check.d.ts +0 -8
  235. package/dist/cli/env.d.ts +0 -7
  236. package/dist/cli/init.d.ts +0 -3
  237. package/dist/cli/run.d.ts +0 -12
  238. package/dist/cli/snapshot-warmup.d.ts +0 -3
  239. package/dist/types-X_iCClPb.d.ts +0 -75
@@ -1,6 +1,3 @@
1
- // src/chat/plugins/package-discovery.ts
2
- import path2 from "path";
3
-
4
1
  // src/chat/discovery.ts
5
2
  import fs, { statSync } from "fs";
6
3
  import path from "path";
@@ -220,9 +217,146 @@ function listReferenceFiles() {
220
217
  }
221
218
  }
222
219
 
220
+ // src/package-resolution.ts
221
+ import { statSync as statSync2 } from "fs";
222
+ import { createRequire } from "module";
223
+ import path2 from "path";
224
+ function isDirectory2(targetPath) {
225
+ try {
226
+ return statSync2(targetPath).isDirectory();
227
+ } catch {
228
+ return false;
229
+ }
230
+ }
231
+ function isFile2(targetPath) {
232
+ try {
233
+ return statSync2(targetPath).isFile();
234
+ } catch {
235
+ return false;
236
+ }
237
+ }
238
+ function uniqueResolvedPathsInOrder2(values) {
239
+ const seen = /* @__PURE__ */ new Set();
240
+ const resolved = [];
241
+ for (const value of values) {
242
+ const normalized = path2.resolve(value);
243
+ if (seen.has(normalized)) {
244
+ continue;
245
+ }
246
+ seen.add(normalized);
247
+ resolved.push(normalized);
248
+ }
249
+ return resolved;
250
+ }
251
+ function ancestorNodeModulesDirs(cwd) {
252
+ const dirs = [];
253
+ let current = path2.resolve(cwd);
254
+ while (true) {
255
+ const nodeModulesDir = path2.join(current, "node_modules");
256
+ if (isDirectory2(nodeModulesDir)) {
257
+ dirs.push(nodeModulesDir);
258
+ }
259
+ const parent = path2.dirname(current);
260
+ if (parent === current) {
261
+ break;
262
+ }
263
+ current = parent;
264
+ }
265
+ return dirs;
266
+ }
267
+ function packageDirInNodeModules(nodeModulesDir, packageName) {
268
+ const packageDir = path2.join(nodeModulesDir, ...packageName.split("/"));
269
+ return isDirectory2(packageDir) ? path2.resolve(packageDir) : void 0;
270
+ }
271
+ function isValidPackageSegment(segment) {
272
+ return Boolean(segment) && segment !== "." && segment !== ".." && !segment.startsWith(".") && /^[A-Za-z0-9._~-]+$/.test(segment);
273
+ }
274
+ function isValidPackageName(packageName) {
275
+ if (!packageName || packageName.includes("\\") || path2.isAbsolute(packageName)) {
276
+ return false;
277
+ }
278
+ const parts = packageName.split("/");
279
+ if (parts[0].startsWith("@")) {
280
+ return parts.length === 2 && parts[0].length > 1 && isValidPackageSegment(parts[0].slice(1)) && isValidPackageSegment(parts[1]);
281
+ }
282
+ return parts.length === 1 && isValidPackageSegment(parts[0]);
283
+ }
284
+ function findPackageRoot(entryPath) {
285
+ let dir = path2.dirname(entryPath);
286
+ while (dir !== path2.dirname(dir)) {
287
+ if (isFile2(path2.join(dir, "package.json"))) {
288
+ return path2.resolve(dir);
289
+ }
290
+ dir = path2.dirname(dir);
291
+ }
292
+ return void 0;
293
+ }
294
+ function findPackageNodeModulesDir(packageDir, packageName) {
295
+ const parts = path2.resolve(packageDir).split(path2.sep);
296
+ const packageParts = packageName.split("/");
297
+ for (let index = parts.length - 1; index >= 0; index -= 1) {
298
+ if (parts[index] !== "node_modules") {
299
+ continue;
300
+ }
301
+ const candidatePackageParts = parts.slice(
302
+ index + 1,
303
+ index + 1 + packageParts.length
304
+ );
305
+ if (candidatePackageParts.join("/") !== packageParts.join("/")) {
306
+ continue;
307
+ }
308
+ return path2.resolve(parts.slice(0, index + 1).join(path2.sep) || path2.sep);
309
+ }
310
+ return void 0;
311
+ }
312
+ function resolvePackageWithNode(cwd, packageName) {
313
+ let requireFromCwd;
314
+ try {
315
+ requireFromCwd = createRequire(path2.join(cwd, "package.json"));
316
+ } catch {
317
+ return void 0;
318
+ }
319
+ for (const specifier of [`${packageName}/package.json`, packageName]) {
320
+ try {
321
+ const resolved = requireFromCwd.resolve(specifier);
322
+ const dir = specifier.endsWith("/package.json") ? path2.dirname(resolved) : findPackageRoot(resolved);
323
+ if (!dir) {
324
+ continue;
325
+ }
326
+ const nodeModulesDir = findPackageNodeModulesDir(dir, packageName);
327
+ return {
328
+ dir,
329
+ ...nodeModulesDir ? { nodeModulesDir } : {}
330
+ };
331
+ } catch {
332
+ }
333
+ }
334
+ return void 0;
335
+ }
336
+ function resolvePackageLocation(cwd, packageName, options) {
337
+ if (!isValidPackageName(packageName)) {
338
+ return void 0;
339
+ }
340
+ const nodeModulesDirs = uniqueResolvedPathsInOrder2([
341
+ ...options?.nodeModulesDirs ?? [],
342
+ ...ancestorNodeModulesDirs(cwd)
343
+ ]);
344
+ for (const nodeModulesDir of nodeModulesDirs) {
345
+ const dir = packageDirInNodeModules(nodeModulesDir, packageName);
346
+ if (dir) {
347
+ return { dir, nodeModulesDir };
348
+ }
349
+ }
350
+ return resolvePackageWithNode(cwd, packageName);
351
+ }
352
+ function resolvePackageDir(cwd, packageName) {
353
+ return resolvePackageLocation(cwd, packageName)?.dir;
354
+ }
355
+
223
356
  // src/chat/plugins/package-discovery.ts
357
+ import path3 from "path";
224
358
  function normalizeForGlob(targetPath) {
225
- return targetPath.split(path2.sep).join("/");
359
+ return targetPath.split(path3.sep).join("/");
226
360
  }
227
361
  function uniqueStringsInOrder(values) {
228
362
  const seen = /* @__PURE__ */ new Set();
@@ -237,33 +371,47 @@ function uniqueStringsInOrder(values) {
237
371
  return resolved;
238
372
  }
239
373
  function pathForTracingInclude(cwd, targetPath) {
240
- const relative = path2.relative(cwd, targetPath);
241
- if (!relative || path2.isAbsolute(relative)) {
374
+ const relative = path3.relative(cwd, targetPath);
375
+ if (!relative || path3.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path3.sep}`)) {
242
376
  return null;
243
377
  }
244
378
  const normalized = normalizeForGlob(relative);
245
379
  return normalized.startsWith(".") ? normalized : `./${normalized}`;
246
380
  }
247
- var configuredPluginPackages;
248
- function setPluginPackages(packages) {
249
- configuredPluginPackages = packages;
250
- }
251
- function resolvePackageDirFromName(packageName, candidateNodeModulesDirs) {
252
- for (const nodeModulesDir of candidateNodeModulesDirs) {
253
- const packageDir = path2.join(nodeModulesDir, ...packageName.split("/"));
254
- if (isDirectory(packageDir)) {
255
- return {
256
- dir: path2.resolve(packageDir),
257
- nodeModulesDir: path2.resolve(nodeModulesDir)
258
- };
381
+ function normalizePluginPackageNames(packageNames) {
382
+ if (packageNames === void 0) {
383
+ return [];
384
+ }
385
+ if (!Array.isArray(packageNames)) {
386
+ throw new Error("plugins.packages must be an array of package names");
387
+ }
388
+ const normalized = [];
389
+ const seen = /* @__PURE__ */ new Set();
390
+ for (const packageName of packageNames) {
391
+ const normalizedPackageName = typeof packageName === "string" ? packageName.trim() : "";
392
+ if (!normalizedPackageName || !isValidPackageName(normalizedPackageName)) {
393
+ throw new Error("Plugin package names must be valid npm package names");
394
+ }
395
+ if (seen.has(normalizedPackageName)) {
396
+ continue;
259
397
  }
398
+ seen.add(normalizedPackageName);
399
+ normalized.push(normalizedPackageName);
260
400
  }
261
- return null;
401
+ return normalized;
402
+ }
403
+ function formatNodeModulesDirs(candidateNodeModulesDirs) {
404
+ return candidateNodeModulesDirs.length > 0 ? candidateNodeModulesDirs.join(", ") : "none found";
405
+ }
406
+ function resolvePackageDirFromName(cwd, packageName, candidateNodeModulesDirs) {
407
+ return resolvePackageLocation(cwd, packageName, {
408
+ nodeModulesDirs: candidateNodeModulesDirs
409
+ }) ?? null;
262
410
  }
263
411
  function readPluginPackageFlags(dir) {
264
- const hasRootPluginManifest = isFile(path2.join(dir, "plugin.yaml"));
265
- const hasPluginsDir = isDirectory(path2.join(dir, "plugins"));
266
- const hasSkillsDir = isDirectory(path2.join(dir, "skills"));
412
+ const hasRootPluginManifest = isFile(path3.join(dir, "plugin.yaml"));
413
+ const hasPluginsDir = isDirectory(path3.join(dir, "plugins"));
414
+ const hasSkillsDir = isDirectory(path3.join(dir, "skills"));
267
415
  if (!hasRootPluginManifest && !hasPluginsDir && !hasSkillsDir) {
268
416
  return null;
269
417
  }
@@ -273,26 +421,29 @@ function readPluginPackageFlags(dir) {
273
421
  hasSkillsDir
274
422
  };
275
423
  }
276
- function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs) {
424
+ function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs, cwd) {
277
425
  const discovered = [];
278
- const seenPackageNames = /* @__PURE__ */ new Set();
279
426
  const seenPackageDirs = /* @__PURE__ */ new Set();
280
427
  for (const packageName of packageNames) {
281
428
  const resolved = resolvePackageDirFromName(
429
+ cwd,
282
430
  packageName,
283
431
  candidateNodeModulesDirs
284
432
  );
285
433
  if (!resolved) {
286
- continue;
434
+ throw new Error(
435
+ `Plugin package "${packageName}" was configured but could not be resolved from node_modules or package resolution (${formatNodeModulesDirs(candidateNodeModulesDirs)})`
436
+ );
287
437
  }
288
- if (seenPackageNames.has(packageName) || seenPackageDirs.has(resolved.dir)) {
438
+ if (seenPackageDirs.has(resolved.dir)) {
289
439
  continue;
290
440
  }
291
441
  const pluginFlags = readPluginPackageFlags(resolved.dir);
292
442
  if (!pluginFlags) {
293
- continue;
443
+ throw new Error(
444
+ `Plugin package "${packageName}" was configured but does not contain plugin content; expected plugin.yaml, plugins/, or skills/ in ${resolved.dir}`
445
+ );
294
446
  }
295
- seenPackageNames.add(packageName);
296
447
  seenPackageDirs.add(resolved.dir);
297
448
  discovered.push({
298
449
  name: packageName,
@@ -304,12 +455,13 @@ function discoverDeclaredPackages(packageNames, candidateNodeModulesDirs) {
304
455
  return discovered;
305
456
  }
306
457
  function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
307
- const resolvedCwd = path2.resolve(cwd);
308
- const packageNames = options?.packageNames ?? configuredPluginPackages ?? [];
458
+ const resolvedCwd = path3.resolve(cwd);
459
+ const packageNames = normalizePluginPackageNames(options?.packageNames);
309
460
  const nodeModulesDirs = options?.nodeModulesDirs ?? discoverNodeModulesDirs(resolvedCwd);
310
461
  const discoveredPackages = discoverDeclaredPackages(
311
462
  packageNames,
312
- nodeModulesDirs
463
+ nodeModulesDirs,
464
+ resolvedCwd
313
465
  );
314
466
  const manifestRoots = [];
315
467
  const skillRoots2 = [];
@@ -317,7 +469,7 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
317
469
  for (const pkg of discoveredPackages) {
318
470
  const tracingBasePath = pkg.nodeModulesDir ? pathForTracingInclude(
319
471
  resolvedCwd,
320
- path2.join(pkg.nodeModulesDir, ...pkg.name.split("/"))
472
+ path3.join(pkg.nodeModulesDir, ...pkg.name.split("/"))
321
473
  ) : pathForTracingInclude(resolvedCwd, pkg.dir);
322
474
  if (pkg.hasRootPluginManifest) {
323
475
  manifestRoots.push(pkg.dir);
@@ -326,13 +478,13 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
326
478
  }
327
479
  }
328
480
  if (pkg.hasPluginsDir) {
329
- manifestRoots.push(path2.join(pkg.dir, "plugins"));
481
+ manifestRoots.push(path3.join(pkg.dir, "plugins"));
330
482
  if (tracingBasePath) {
331
483
  tracingIncludes.push(`${tracingBasePath}/plugins/**/*`);
332
484
  }
333
485
  }
334
486
  if (pkg.hasSkillsDir) {
335
- skillRoots2.push(path2.join(pkg.dir, "skills"));
487
+ skillRoots2.push(path3.join(pkg.dir, "skills"));
336
488
  if (tracingBasePath) {
337
489
  tracingIncludes.push(`${tracingBasePath}/skills/**/*`);
338
490
  }
@@ -355,6 +507,8 @@ export {
355
507
  soulPathCandidates,
356
508
  worldPathCandidates,
357
509
  listReferenceFiles,
358
- setPluginPackages,
510
+ isValidPackageName,
511
+ resolvePackageDir,
512
+ normalizePluginPackageNames,
359
513
  discoverInstalledPluginPackageContent
360
514
  };
@@ -2,10 +2,10 @@ import {
2
2
  getPluginForSkillPath,
3
3
  getPluginSkillRoots,
4
4
  logWarn
5
- } from "./chunk-Q3FDONU7.js";
5
+ } from "./chunk-TTUY467K.js";
6
6
  import {
7
7
  skillRoots
8
- } from "./chunk-XPXD3FCE.js";
8
+ } from "./chunk-5LUISFEY.js";
9
9
 
10
10
  // src/chat/skills.ts
11
11
  import fs from "fs/promises";
@@ -0,0 +1,21 @@
1
+ // src/vercel.ts
2
+ function juniorVercelConfig(options = {}) {
3
+ const buildCommand = options.buildCommand === void 0 ? "pnpm build" : options.buildCommand;
4
+ const config = {
5
+ framework: "nitro",
6
+ crons: [
7
+ {
8
+ path: "/api/internal/heartbeat",
9
+ schedule: "* * * * *"
10
+ }
11
+ ]
12
+ };
13
+ if (buildCommand !== null) {
14
+ config.buildCommand = buildCommand;
15
+ }
16
+ return config;
17
+ }
18
+
19
+ export {
20
+ juniorVercelConfig
21
+ };
@@ -3,8 +3,9 @@ import {
3
3
  } from "./chunk-Z3YD6NHK.js";
4
4
  import {
5
5
  discoverInstalledPluginPackageContent,
6
+ normalizePluginPackageNames,
6
7
  pluginRoots
7
- } from "./chunk-XPXD3FCE.js";
8
+ } from "./chunk-5LUISFEY.js";
8
9
 
9
10
  // src/chat/logging.ts
10
11
  import { AsyncLocalStorage } from "async_hooks";
@@ -296,6 +297,8 @@ function contextToAttributes(context) {
296
297
  "enduser.id": context.slackUserId,
297
298
  "enduser.pseudo.id": context.slackUserName,
298
299
  "app.run.id": context.runId,
300
+ "app.actor.type": context.actorType,
301
+ "app.actor.id": context.actorId,
299
302
  "gen_ai.agent.name": context.assistantUserName,
300
303
  "gen_ai.request.model": context.modelId,
301
304
  "app.skill.name": context.skillName,
@@ -591,6 +594,10 @@ function pushPrettyConsoleToken(tokens, token) {
591
594
  function numericConsoleToken(label, value) {
592
595
  return typeof value === "number" ? `${label}=${value}` : void 0;
593
596
  }
597
+ function stringConsoleToken(label, value) {
598
+ const normalized = toOptionalString(value);
599
+ return normalized ? `${label}=${normalized}` : void 0;
600
+ }
594
601
  function booleanConsoleToken(label, value) {
595
602
  return typeof value === "boolean" ? `${label}=${value ? "yes" : "no"}` : void 0;
596
603
  }
@@ -605,7 +612,7 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
605
612
  );
606
613
  pushPrettyConsoleToken(
607
614
  tokens,
608
- toOptionalString(attributes["app.plugin.name"]) ?? void 0
615
+ eventName.startsWith("trusted_plugin_heartbeat") ? stringConsoleToken("plugin", attributes["app.plugin.name"]) : toOptionalString(attributes["app.plugin.name"]) ?? void 0
609
616
  );
610
617
  pushPrettyConsoleToken(
611
618
  tokens,
@@ -623,6 +630,10 @@ function getPrettyConsoleSummaryTokens(level, eventName, attributes) {
623
630
  tokens,
624
631
  numericConsoleToken("plugins", attributes["app.plugin.count"])
625
632
  );
633
+ pushPrettyConsoleToken(
634
+ tokens,
635
+ numericConsoleToken("dispatches", attributes["app.dispatch.count"])
636
+ );
626
637
  pushPrettyConsoleToken(
627
638
  tokens,
628
639
  numericConsoleToken("skills", attributes["app.skill.count"])
@@ -2472,10 +2483,7 @@ function createGitHubAppBroker(manifest, credentials) {
2472
2483
  const normalizedApiDomain = apiDomain.toLowerCase();
2473
2484
  return normalizedDomain === "github.com" || normalizedApiDomain.startsWith("api.") && normalizedDomain === normalizedApiDomain.slice("api.".length);
2474
2485
  }
2475
- const permissions = capabilitiesToPermissions(
2476
- manifest.capabilities,
2477
- provider
2478
- );
2486
+ const permissions = manifest.capabilities?.length ? capabilitiesToPermissions(manifest.capabilities, provider) : void 0;
2479
2487
  function createLease(params) {
2480
2488
  return {
2481
2489
  id: randomUUID2(),
@@ -2515,9 +2523,7 @@ function createGitHubAppBroker(manifest, credentials) {
2515
2523
  return {
2516
2524
  async issue(input) {
2517
2525
  const installationId = resolveInstallationId();
2518
- const tokenRequestBody = {
2519
- permissions
2520
- };
2526
+ const tokenRequestBody = permissions ? { permissions } : {};
2521
2527
  const appId = resolveAppId(appIdEnv);
2522
2528
  const appJwt = createAppJwt(appId, privateKeyEnv);
2523
2529
  const accessTokenResponse = await githubRequest(apiBase, `/app/installations/${installationId}/access_tokens`, {
@@ -2881,33 +2887,9 @@ function normalizePluginRoots(roots) {
2881
2887
  }
2882
2888
  return resolved;
2883
2889
  }
2884
- function getExtraPluginRoots() {
2885
- const raw = process.env.JUNIOR_EXTRA_PLUGIN_ROOTS?.trim();
2886
- if (!raw) {
2887
- return [];
2888
- }
2889
- if (raw.startsWith("[")) {
2890
- try {
2891
- const parsed = JSON.parse(raw);
2892
- if (Array.isArray(parsed)) {
2893
- return normalizePluginRoots(
2894
- parsed.filter((value) => typeof value === "string")
2895
- );
2896
- }
2897
- } catch {
2898
- return [];
2899
- }
2900
- }
2901
- return normalizePluginRoots(
2902
- raw.split(path2.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0)
2903
- );
2904
- }
2905
2890
  function getPluginCatalogSource() {
2906
- const packagedContent = discoverInstalledPluginPackageContent();
2907
- const localRoots = normalizePluginRoots([
2908
- ...pluginRoots(),
2909
- ...getExtraPluginRoots()
2910
- ]);
2891
+ const packagedContent = discoverConfiguredPluginPackageContent();
2892
+ const localRoots = normalizePluginRoots(pluginRoots());
2911
2893
  const manifestRoots = normalizePluginRoots([
2912
2894
  ...localRoots,
2913
2895
  ...packagedContent.manifestRoots
@@ -2924,6 +2906,29 @@ function getPluginCatalogSource() {
2924
2906
  })
2925
2907
  };
2926
2908
  }
2909
+ function normalizePluginConfig(config) {
2910
+ if (!config) {
2911
+ return void 0;
2912
+ }
2913
+ return {
2914
+ packages: normalizePluginPackageNames(config.packages),
2915
+ ...config.manifests ? { manifests: structuredClone(config.manifests) } : {}
2916
+ };
2917
+ }
2918
+ function clonePluginConfig(config) {
2919
+ if (!config) {
2920
+ return void 0;
2921
+ }
2922
+ return {
2923
+ packages: [...config.packages ?? []],
2924
+ ...config.manifests ? { manifests: structuredClone(config.manifests) } : {}
2925
+ };
2926
+ }
2927
+ function discoverConfiguredPluginPackageContent() {
2928
+ return discoverInstalledPluginPackageContent(process.cwd(), {
2929
+ packageNames: pluginConfig?.packages
2930
+ });
2931
+ }
2927
2932
  function buildLoadedPluginState(source) {
2928
2933
  const state = createLoadedPluginState(source.signature);
2929
2934
  for (const skillRoot of source.packagedSkillRoots) {
@@ -3037,7 +3042,12 @@ function ensurePluginsLoaded() {
3037
3042
  return state;
3038
3043
  }
3039
3044
  function setPluginConfig(config) {
3040
- pluginConfig = config;
3045
+ const previousConfig = clonePluginConfig(pluginConfig);
3046
+ pluginConfig = normalizePluginConfig(config);
3047
+ return previousConfig;
3048
+ }
3049
+ function getPluginPackageContent() {
3050
+ return discoverConfiguredPluginPackageContent();
3041
3051
  }
3042
3052
  function getPluginCatalogSignature() {
3043
3053
  return ensurePluginsLoaded().signature;
@@ -3199,7 +3209,6 @@ export {
3199
3209
  serializeGenAiAttribute,
3200
3210
  extractGenAiUsageSummary,
3201
3211
  extractGenAiUsageAttributes,
3202
- mergeHeaderTransforms,
3203
3212
  resolvePluginCommandEnv,
3204
3213
  resolveAuthTokenPlaceholder,
3205
3214
  parsePluginManifest,
@@ -3208,6 +3217,7 @@ export {
3208
3217
  buildOAuthTokenRequest,
3209
3218
  parseOAuthTokenResponse,
3210
3219
  setPluginConfig,
3220
+ getPluginPackageContent,
3211
3221
  getPluginCatalogSignature,
3212
3222
  getPluginCapabilityProviders,
3213
3223
  getPluginProviders,