@sentry/junior 0.117.0 → 0.118.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/{agent-hooks-5IK4LPLP.js → agent-hooks-J2FB7XD6.js} +8 -10
  2. package/dist/api/schema/stats.d.ts +22 -0
  3. package/dist/api/schema.d.ts +2 -0
  4. package/dist/api/schema.js +7 -3
  5. package/dist/api/stats.d.ts +16 -0
  6. package/dist/api/user-pages/routes.d.ts +4 -0
  7. package/dist/api.js +179 -18
  8. package/dist/app.js +40 -35
  9. package/dist/{catalog-runtime-MTUYW3AA.js → catalog-runtime-UHHLU53I.js} +5 -5
  10. package/dist/chat/agent/prompt.d.ts +4 -2
  11. package/dist/chat/plugins/user-pages.d.ts +15 -0
  12. package/dist/chat/plugins/viewer-actors.d.ts +6 -0
  13. package/dist/chat/prompt.d.ts +1 -2
  14. package/dist/chat/sandbox/paths.d.ts +2 -0
  15. package/dist/chat/sandbox/sandbox.d.ts +3 -1
  16. package/dist/chat/sandbox/workspace.d.ts +1 -0
  17. package/dist/chat/skills.d.ts +1 -2
  18. package/dist/chat/tools/index.d.ts +4 -1
  19. package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
  20. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  21. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  22. package/dist/{chunk-5O3JDQDG.js → chunk-3LGCVRBQ.js} +1 -1
  23. package/dist/{chunk-WEK3V5RI.js → chunk-3MUSSFMP.js} +17 -19
  24. package/dist/{chunk-KU6ALEJC.js → chunk-3N3FMCKN.js} +30 -2
  25. package/dist/{chunk-FAWBONPC.js → chunk-4LPPH7Y6.js} +5 -7
  26. package/dist/{chunk-W5JEQQEA.js → chunk-4SOQPUF4.js} +1 -1
  27. package/dist/{chunk-LN765Y4N.js → chunk-6BGUAOYP.js} +8 -8
  28. package/dist/{chunk-NHZEUHKH.js → chunk-6K2QE2UI.js} +231 -94
  29. package/dist/{chunk-AKG4TZNH.js → chunk-7GADTCNS.js} +30 -9
  30. package/dist/{chunk-BFIRIZPH.js → chunk-7SM3P4XR.js} +19 -1
  31. package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
  32. package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
  33. package/dist/{chunk-STUI6NIL.js → chunk-GT2ZUALJ.js} +511 -14
  34. package/dist/{chunk-LUMEBOWC.js → chunk-HN6LFYG3.js} +1 -1
  35. package/dist/{chunk-3GE3F4LT.js → chunk-HWUBBHLK.js} +1 -1
  36. package/dist/{chunk-ZRQUQJUV.js → chunk-KC5EE27Y.js} +3 -3
  37. package/dist/chunk-L72GDKSN.js +37 -0
  38. package/dist/{chunk-72Z3HNTQ.js → chunk-MLZFK4KP.js} +1 -1
  39. package/dist/{chunk-27KWTFP6.js → chunk-PJPKHGLG.js} +5 -7
  40. package/dist/{chunk-DS27ZBSP.js → chunk-PWRFTDTY.js} +1 -1
  41. package/dist/{chunk-WUNPRM76.js → chunk-QWCF4RAC.js} +1 -1
  42. package/dist/{chunk-6G45D3YG.js → chunk-S6R23MFB.js} +12 -16
  43. package/dist/{chunk-CU7HTGNI.js → chunk-UXLYAVYL.js} +1 -1
  44. package/dist/cli/chat.js +23 -24
  45. package/dist/cli/check.js +6 -6
  46. package/dist/cli/plugins.js +12 -14
  47. package/dist/cli/snapshot-create.js +8 -9
  48. package/dist/cli/upgrade.js +7 -7
  49. package/dist/db/schema/stats.d.ts +93 -0
  50. package/dist/db/schema.d.ts +94 -1
  51. package/dist/{db-J2ITKS63.js → db-PMRHFSYL.js} +6 -6
  52. package/dist/instrumentation.js +2 -2
  53. package/dist/nitro.js +3 -3
  54. package/dist/{oauth-callback-server-NQYKBT24.js → oauth-callback-server-QJUC7S4X.js} +15 -17
  55. package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
  56. package/dist/{runner-53V5GIQM.js → runner-PZMV6JQW.js} +10 -12
  57. package/dist/{skills-BU3ZMLVB.js → skills-W4JETYSV.js} +6 -6
  58. package/dist/stats.d.ts +18 -0
  59. package/dist/{validation-74EIKKE6.js → validation-IJLNHZSU.js} +6 -6
  60. package/dist/version.js +1 -1
  61. package/migrations/0011_sour_golden_guardian.sql +8 -0
  62. package/migrations/meta/0011_snapshot.json +1195 -0
  63. package/migrations/meta/_journal.json +8 -1
  64. package/package.json +5 -5
  65. package/dist/chunk-4ZNGQH7C.js +0 -25
  66. package/dist/chunk-YRWJ3KEU.js +0 -517
@@ -0,0 +1,6 @@
1
+ import { type PluginUserPageActor } from "@sentry/junior-plugin-api";
2
+ import type { JuniorDatabase } from "@/db/db";
3
+ /** Resolve runtime-owned actors linked to a viewer email from SQL. */
4
+ export declare function readViewerActorsFromSql(db: JuniorDatabase, email: string): Promise<PluginUserPageActor[]>;
5
+ /** Resolve runtime-owned actors linked to the authenticated viewer. */
6
+ export declare function readViewerActors(email: string): Promise<PluginUserPageActor[]>;
@@ -1,6 +1,6 @@
1
1
  import type { SlackConversationContext } from "@/chat/slack/conversation-context";
2
2
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
3
- import type { SkillMetadata, SkillInvocation } from "@/chat/skills";
3
+ import type { SkillMetadata } from "@/chat/skills";
4
4
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
5
5
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
6
6
  import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
@@ -30,7 +30,6 @@ type TurnContextPromptInput = {
30
30
  plugin?: string;
31
31
  source: Source;
32
32
  };
33
- invocation: SkillInvocation | null;
34
33
  actor?: {
35
34
  userName?: string;
36
35
  fullName?: string;
@@ -3,3 +3,5 @@ export declare const SANDBOX_SKILLS_ROOT: string;
3
3
  export declare const SANDBOX_DATA_ROOT: string;
4
4
  export declare function sandboxSkillDir(skillName: string): string;
5
5
  export declare function sandboxSkillFile(skillName: string): string;
6
+ /** Explain how the agent should resolve files and commands owned by a skill. */
7
+ export declare function sandboxSkillPathResolution(skillName: string): string;
@@ -1,4 +1,4 @@
1
- import { type LogContext } from "@/chat/logging";
1
+ import { type LogContext, type SetSpanAttributes } from "@/chat/logging";
2
2
  import type { SandboxEgressSignalTransport } from "@/chat/sandbox/egress/signals";
3
3
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
4
4
  import type { CredentialContext } from "@/chat/credentials/context";
@@ -9,6 +9,8 @@ export interface SandboxToolCall {
9
9
  toolName: string;
10
10
  input: unknown;
11
11
  signal?: AbortSignal;
12
+ /** Add safe sandbox measurements to the caller-owned tool span. */
13
+ setToolCallSpanAttributes?: SetSpanAttributes;
12
14
  }
13
15
  export interface SandboxTools {
14
16
  supports(toolName: string): boolean;
@@ -11,6 +11,7 @@ export interface SandboxCommandInput {
11
11
  env?: Record<string, string>;
12
12
  signal?: AbortSignal;
13
13
  sudo?: boolean;
14
+ timeoutMs?: number;
14
15
  }
15
16
  export interface SandboxFileStat {
16
17
  isDirectory(): boolean;
@@ -31,7 +31,6 @@ export interface Skill extends SkillMetadata {
31
31
  }
32
32
  export interface SkillInvocation {
33
33
  skillName: string;
34
- args: string;
35
34
  }
36
35
  export interface DiscoverSkillsOptions {
37
36
  additionalRoots?: string[];
@@ -40,7 +39,7 @@ export interface DiscoverSkillsOptions {
40
39
  export declare function resetSkillDiscoveryCache(): void;
41
40
  /** Scan all configured skill roots and return discovered skill metadata, using a cache when roots match. */
42
41
  export declare function discoverSkills(options?: DiscoverSkillsOptions): Promise<SkillMetadata[]>;
43
- /** Extract a skill invocation (name + args) from a user message, or return null if none matches. */
42
+ /** Extract an explicit skill invocation from a user message. */
44
43
  export declare function parseSkillInvocation(messageText: string, availableSkills: SkillMetadata[]): SkillInvocation | null;
45
44
  /** Look up a skill by name from the available set. */
46
45
  export declare function findSkillByName(skillName: string, available: SkillMetadata[]): SkillMetadata | null;
@@ -2,5 +2,8 @@ import type { SkillMetadata } from "@/chat/skills";
2
2
  import type { ToolRegistry } from "@/chat/tools/definition";
3
3
  import type { ToolHooks, ToolRuntimeContext } from "@/chat/tools/types";
4
4
  export type { ToolHooks, ToolRuntimeContext };
5
+ export interface CreateToolsOptions {
6
+ includeLoadSkill?: boolean;
7
+ }
5
8
  /** Build the model-facing tool registry from runtime-owned context and capabilities. */
6
- export declare function createTools(availableSkills: SkillMetadata[], hooks: ToolHooks | undefined, context: ToolRuntimeContext): ToolRegistry;
9
+ export declare function createTools(availableSkills: SkillMetadata[], hooks: ToolHooks | undefined, context: ToolRuntimeContext, options?: CreateToolsOptions): ToolRegistry;
@@ -1,8 +1,19 @@
1
1
  import type { SandboxCommandInput, SandboxCommandResult, SandboxFileSystem } from "@/chat/sandbox/workspace";
2
2
  export type { SandboxFileSystem };
3
3
  export type SandboxCommandRunner = (input: SandboxCommandInput) => Promise<SandboxCommandResult>;
4
+ /** Safe measurements produced by one sandbox-backed search operation. */
5
+ export interface SandboxSearchTelemetry {
6
+ emittedLineCount: number;
7
+ limit: number;
8
+ limitReached: boolean;
9
+ parsedRecordCount: number;
10
+ rawOutputBytes: number;
11
+ resultCount: number;
12
+ resultBytes: number;
13
+ }
4
14
  export declare const MAX_TEXT_CHARS = 60000;
5
15
  export declare const RIPGREP_EXCLUDED_GLOBS: readonly ["!**/.git/**", "!**/node_modules/**"];
16
+ export declare const DEFAULT_SEARCH_COMMAND_TIMEOUT_MS = 30000;
6
17
  export type TextSearchResultDetails = {
7
18
  ok: true;
8
19
  status?: "success";
@@ -1,4 +1,4 @@
1
- import { type SandboxCommandRunner, type SandboxFileSystem, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
1
+ import { type SandboxCommandRunner, type SandboxFileSystem, type SandboxSearchTelemetry, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
2
2
  import { type JuniorToolResultEnvelope } from "@/chat/tool-support/structured-result";
3
3
  interface FindFilesSuccessResult {
4
4
  content: JuniorToolResultEnvelope["content"];
@@ -17,6 +17,7 @@ type FindFilesResult = FindFilesSuccessResult | TextSearchToolResult;
17
17
  export declare function findFiles(params: {
18
18
  fs: SandboxFileSystem;
19
19
  limit?: unknown;
20
+ onTelemetry?: (telemetry: SandboxSearchTelemetry) => void;
20
21
  path?: string;
21
22
  pattern: string;
22
23
  runCommand?: SandboxCommandRunner;
@@ -1,4 +1,4 @@
1
- import { type SandboxCommandRunner, type SandboxFileSystem, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
1
+ import { type SandboxCommandRunner, type SandboxFileSystem, type SandboxSearchTelemetry, type TextSearchResultDetails, type TextSearchToolResult } from "@/chat/tools/sandbox/file-utils";
2
2
  interface GrepResultData {
3
3
  context: number;
4
4
  glob?: string;
@@ -31,6 +31,7 @@ export declare function grepFiles(params: {
31
31
  ignoreCase?: boolean;
32
32
  limit?: unknown;
33
33
  literal?: boolean;
34
+ onTelemetry?: (telemetry: SandboxSearchTelemetry) => void;
34
35
  path?: string;
35
36
  pattern: string;
36
37
  runCommand?: SandboxCommandRunner;
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-72Z3HNTQ.js";
8
+ } from "./chunk-MLZFK4KP.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -12,7 +12,7 @@ import {
12
12
  persistAuthPauseTurnState,
13
13
  requireTurnFailureEventId,
14
14
  scheduleSessionCompletedPluginTasks
15
- } from "./chunk-LN765Y4N.js";
15
+ } from "./chunk-6BGUAOYP.js";
16
16
  import {
17
17
  buildSentryConversationUrl
18
18
  } from "./chunk-4CODA7P5.js";
@@ -39,7 +39,7 @@ import {
39
39
  resolvePluginOAuthAccount,
40
40
  splitSlackReplyText,
41
41
  truncateStatusText
42
- } from "./chunk-6G45D3YG.js";
42
+ } from "./chunk-S6R23MFB.js";
43
43
  import {
44
44
  JUNIOR_THREAD_STATE_TTL_MS,
45
45
  TurnSliceLimitExceededError,
@@ -69,30 +69,28 @@ import {
69
69
  recordDeliveredAssistantMessage,
70
70
  turnHasReply,
71
71
  updateConversationStats
72
- } from "./chunk-27KWTFP6.js";
73
- import {
74
- getDashboardConversationLink,
75
- getPluginSlackConversationLink
76
- } from "./chunk-STUI6NIL.js";
77
- import {
78
- acquireActiveLock,
79
- getDefaultRedisStateAdapterFor,
80
- getStateAdapter
81
- } from "./chunk-KU6ALEJC.js";
72
+ } from "./chunk-PJPKHGLG.js";
82
73
  import {
83
74
  SlackActionError,
75
+ getDashboardConversationLink,
84
76
  getHeaderString,
77
+ getPluginSlackConversationLink,
85
78
  getSlackClient,
86
79
  isDmChannel,
87
80
  normalizeSlackConversationId
88
- } from "./chunk-YRWJ3KEU.js";
81
+ } from "./chunk-GT2ZUALJ.js";
89
82
  import {
90
83
  getConversationEventStore,
91
84
  getConversationStore,
92
85
  parseDestination,
93
86
  requireSlackDestination,
94
87
  sameDestination
95
- } from "./chunk-ZRQUQJUV.js";
88
+ } from "./chunk-KC5EE27Y.js";
89
+ import {
90
+ acquireActiveLock,
91
+ getDefaultRedisStateAdapterFor,
92
+ getStateAdapter
93
+ } from "./chunk-3N3FMCKN.js";
96
94
  import {
97
95
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
98
96
  botConfig,
@@ -101,7 +99,7 @@ import {
101
99
  getRuntimeMetadata,
102
100
  normalizeSlackEmojiName,
103
101
  standardModelId
104
- } from "./chunk-DS27ZBSP.js";
102
+ } from "./chunk-PWRFTDTY.js";
105
103
  import {
106
104
  parseSlackThreadId,
107
105
  readSlackRawMessageContext,
@@ -110,15 +108,15 @@ import {
110
108
  } from "./chunk-FXOYURO4.js";
111
109
  import {
112
110
  discoverSkills
113
- } from "./chunk-AKG4TZNH.js";
111
+ } from "./chunk-7GADTCNS.js";
114
112
  import {
115
113
  pluginCatalogRuntime
116
- } from "./chunk-CU7HTGNI.js";
114
+ } from "./chunk-UXLYAVYL.js";
117
115
  import {
118
116
  buildOAuthTokenRequest,
119
117
  hasRequiredOAuthScope,
120
118
  parseOAuthTokenResponse
121
- } from "./chunk-5O3JDQDG.js";
119
+ } from "./chunk-3LGCVRBQ.js";
122
120
  import {
123
121
  createSlackResumeActor,
124
122
  isUserActor,
@@ -129,7 +127,7 @@ import {
129
127
  logException,
130
128
  logInfo,
131
129
  logWarn
132
- } from "./chunk-72Z3HNTQ.js";
130
+ } from "./chunk-MLZFK4KP.js";
133
131
  import {
134
132
  isRecord,
135
133
  toOptionalNumber,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-DS27ZBSP.js";
3
+ } from "./chunk-PWRFTDTY.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -291,15 +291,43 @@ function sandboxSkillDir(skillName) {
291
291
  function sandboxSkillFile(skillName) {
292
292
  return `${sandboxSkillDir(skillName)}/SKILL.md`;
293
293
  }
294
+ function sandboxSkillPathResolution(skillName) {
295
+ const skillDir = sandboxSkillDir(skillName);
296
+ return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
297
+ }
298
+
299
+ // src/chat/sleep.ts
300
+ function sleep(ms, signal) {
301
+ if (!signal) {
302
+ return new Promise((resolve) => setTimeout(resolve, ms));
303
+ }
304
+ return new Promise((resolve, reject) => {
305
+ if (signal.aborted) {
306
+ reject(signal.reason);
307
+ return;
308
+ }
309
+ const timeoutId = setTimeout(() => {
310
+ signal.removeEventListener("abort", onAbort);
311
+ resolve();
312
+ }, ms);
313
+ const onAbort = () => {
314
+ clearTimeout(timeoutId);
315
+ reject(signal.reason);
316
+ };
317
+ signal.addEventListener("abort", onAbort, { once: true });
318
+ });
319
+ }
294
320
 
295
321
  export {
296
322
  acquireActiveLock,
297
323
  getDefaultRedisStateAdapterFor,
298
324
  getStateAdapter,
299
325
  disconnectStateAdapter,
326
+ sleep,
300
327
  SANDBOX_WORKSPACE_ROOT,
301
328
  SANDBOX_SKILLS_ROOT,
302
329
  SANDBOX_DATA_ROOT,
303
330
  sandboxSkillDir,
304
- sandboxSkillFile
331
+ sandboxSkillFile,
332
+ sandboxSkillPathResolution
305
333
  };
@@ -1,21 +1,19 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
- getStateAdapter
4
- } from "./chunk-KU6ALEJC.js";
5
- import {
3
+ getStateAdapter,
6
4
  sleep
7
- } from "./chunk-4ZNGQH7C.js";
5
+ } from "./chunk-3N3FMCKN.js";
8
6
  import {
9
7
  toOptionalTrimmed
10
- } from "./chunk-DS27ZBSP.js";
8
+ } from "./chunk-PWRFTDTY.js";
11
9
  import {
12
10
  pluginCatalogRuntime
13
- } from "./chunk-CU7HTGNI.js";
11
+ } from "./chunk-UXLYAVYL.js";
14
12
  import {
15
13
  setSpanAttributes,
16
14
  setSpanStatus,
17
15
  withSpan
18
- } from "./chunk-72Z3HNTQ.js";
16
+ } from "./chunk-MLZFK4KP.js";
19
17
 
20
18
  // src/chat/sandbox/snapshot/profile.ts
21
19
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-CU7HTGNI.js";
3
+ } from "./chunk-UXLYAVYL.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -23,28 +23,28 @@ import {
23
23
  persistThreadStateById,
24
24
  stripRuntimeTurnContext,
25
25
  updateConversationStats
26
- } from "./chunk-27KWTFP6.js";
26
+ } from "./chunk-PJPKHGLG.js";
27
27
  import {
28
28
  createPluginEmbedder,
29
29
  createPluginLogger,
30
30
  createPluginModel,
31
31
  createPluginState,
32
32
  getPlugins
33
- } from "./chunk-STUI6NIL.js";
34
- import {
35
- getStateAdapter
36
- } from "./chunk-KU6ALEJC.js";
33
+ } from "./chunk-GT2ZUALJ.js";
37
34
  import {
38
35
  getDb
39
- } from "./chunk-ZRQUQJUV.js";
36
+ } from "./chunk-KC5EE27Y.js";
37
+ import {
38
+ getStateAdapter
39
+ } from "./chunk-3N3FMCKN.js";
40
40
  import {
41
41
  ProviderError,
42
42
  getProviderErrorAttributes,
43
43
  getProviderErrorUserMessage
44
- } from "./chunk-DS27ZBSP.js";
44
+ } from "./chunk-PWRFTDTY.js";
45
45
  import {
46
46
  buildTurnFailureResponse
47
- } from "./chunk-72Z3HNTQ.js";
47
+ } from "./chunk-MLZFK4KP.js";
48
48
  import {
49
49
  parseSlackMessageTs
50
50
  } from "./chunk-F3B2YJ76.js";