@sentry/junior 0.62.0 → 0.64.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.
@@ -1,4 +1,20 @@
1
1
  import type { Nitro } from "nitro/types";
2
- import type { PluginConfig } from "@/chat/plugins/types";
2
+ import type { PluginCatalogConfig } from "@/chat/plugins/types";
3
+ import { type JuniorPluginSet } from "@/plugins";
4
+ export interface RuntimePluginModule {
5
+ exportName: string;
6
+ specifier: string;
7
+ }
8
+ /** Render the virtual config module consumed by createApp(). */
9
+ export declare function renderVirtualConfig(options: {
10
+ plugins?: PluginCatalogConfig;
11
+ pluginModule?: RuntimePluginModule;
12
+ trustedPluginRegistrations?: string[];
13
+ }): string;
3
14
  /** Inject a virtual module so createApp() can read the plugin list at runtime. */
4
- export declare function injectVirtualConfig(nitro: Nitro, plugins?: PluginConfig): void;
15
+ export declare function injectVirtualConfig(nitro: Nitro, options?: {
16
+ loadPluginSet?: () => Promise<JuniorPluginSet | undefined>;
17
+ pluginModule?: RuntimePluginModule;
18
+ plugins?: PluginCatalogConfig;
19
+ trustedPluginRegistrations?: string[];
20
+ }): void;
@@ -18,6 +18,7 @@ export interface LogContext {
18
18
  slackThreadId?: string;
19
19
  slackUserId?: string;
20
20
  slackUserName?: string;
21
+ slackUserEmail?: string;
21
22
  slackChannelId?: string;
22
23
  runId?: string;
23
24
  actorType?: string;
@@ -30,6 +31,11 @@ export interface LogContext {
30
31
  urlFull?: string;
31
32
  userAgent?: string;
32
33
  }
34
+ interface SentryUserIdentity {
35
+ id: string | number;
36
+ email?: string;
37
+ username?: string;
38
+ }
33
39
  /** Normalize runtime finish reasons to the telemetry spelling we emit. */
34
40
  export declare function normalizeGenAiFinishReason(reason: string): string;
35
41
  export declare const log: {
@@ -37,7 +43,7 @@ export declare const log: {
37
43
  info(eventName: string, attrs?: Record<string, unknown>, body?: string): void;
38
44
  warn(eventName: string, attrs?: Record<string, unknown>, body?: string): void;
39
45
  error(eventName: string, attrs?: Record<string, unknown>, body?: string): void;
40
- exception(eventName: string, error: unknown, attrs?: Record<string, unknown>, body?: string): string | undefined;
46
+ exception(eventName: string, error: unknown, attrs?: Record<string, unknown>, body?: string, context?: LogContext): string | undefined;
41
47
  };
42
48
  /** Create a Chat SDK logger that routes records through Junior's logging backend. */
43
49
  export declare function createChatSdkLogger(): ChatSdkLogger;
@@ -47,7 +53,11 @@ export declare function getLogContextAttributes(): LogAttributes;
47
53
  export declare function registerLogRecordSink(sink: (record: EmittedLogRecord) => void): () => void;
48
54
  export declare function createLogContextFromRequest(request: Request, context?: Partial<LogContext>): LogContext;
49
55
  export declare function toSpanAttributes(context: LogContext): Record<string, string>;
56
+ /** Attach filterable non-user context tags to Sentry. */
50
57
  export declare function setSentryTagsFromContext(context: LogContext): void;
58
+ /** Bind requester identity to Sentry's native user fields. */
59
+ export declare function setSentryUser(identity: SentryUserIdentity | undefined): void;
60
+ /** Attach scoped Sentry context for isolated exception capture. */
51
61
  export declare function setSentryScopeContext(scope: Sentry.Scope, context: LogContext): void;
52
62
  /** Capture an error to Sentry and emit an error log record. */
53
63
  export declare function captureException(error: unknown, context?: LogContext): void;
@@ -59,7 +69,7 @@ export declare function logWarn(eventName: string, context?: LogContext, attribu
59
69
  export declare function logError(eventName: string, context?: LogContext, attributes?: Record<string, unknown>, body?: string): void;
60
70
  /** Log an error with exception capture; returns the Sentry event ID if available. */
61
71
  export declare function logException(error: unknown, eventName: string, context?: LogContext, attributes?: Record<string, unknown>, body?: string): string | undefined;
62
- /** Set log context and Sentry tags for the current scope. */
72
+ /** Set log context and Sentry scope metadata for the current request. */
63
73
  export declare function setTags(context?: LogContext): void;
64
74
  /** Create a LogContext from an incoming HTTP request. */
65
75
  export declare function createRequestContext(request: Request, context?: Partial<LogContext>): LogContext;
@@ -1,4 +1,4 @@
1
- import type { AgentPluginRequester, JuniorPlugin } from "@sentry/junior-plugin-api";
1
+ import type { AgentPluginRequester, AgentPluginRoute, SlackConversationLink, JuniorPluginRegistration } from "@sentry/junior-plugin-api";
2
2
  import type { ToolDefinition } from "@/chat/tools/definition";
3
3
  import type { ToolRuntimeContext } from "@/chat/tools/types";
4
4
  import type { SandboxInstance } from "@/chat/sandbox/workspace";
@@ -14,18 +14,25 @@ export interface ToolHookResult {
14
14
  env: Record<string, string>;
15
15
  input: Record<string, unknown>;
16
16
  }
17
+ export interface AgentPluginRouteRegistration extends AgentPluginRoute {
18
+ pluginName: string;
19
+ }
17
20
  export interface AgentPluginHookRunner {
18
21
  beforeToolExecute(input: ToolHookInput): Promise<ToolHookResult>;
19
22
  prepareSandbox(sandbox: SandboxInstance): Promise<void>;
20
23
  }
21
24
  /** Validate trusted plugin identity before it can affect process-wide hooks. */
22
- export declare function validateAgentPlugins(plugins: JuniorPlugin[]): void;
25
+ export declare function validateAgentPlugins(plugins: JuniorPluginRegistration[]): void;
23
26
  /** Replace trusted agent plugins and return the previous list for rollback. */
24
- export declare function setAgentPlugins(plugins: JuniorPlugin[]): JuniorPlugin[];
27
+ export declare function setAgentPlugins(plugins: JuniorPluginRegistration[]): JuniorPluginRegistration[];
25
28
  /** Return the current trusted agent plugins without exposing mutable state. */
26
- export declare function getAgentPlugins(): JuniorPlugin[];
29
+ export declare function getAgentPlugins(): JuniorPluginRegistration[];
27
30
  /** Collect turn-scoped tools exposed by trusted plugins. */
28
31
  export declare function getAgentPluginTools(context: ToolRuntimeContext): Record<string, ToolDefinition<any>>;
32
+ /** Collect route handlers exposed by trusted plugins for app-level mounting. */
33
+ export declare function getAgentPluginRoutes(): AgentPluginRouteRegistration[];
34
+ /** Resolve the first trusted plugin conversation URL for finalized Slack footers. */
35
+ export declare function getAgentPluginSlackConversationLink(conversationId: string): SlackConversationLink | undefined;
29
36
  /** Create one runner over trusted agent plugins registered by the app. */
30
37
  export declare function createAgentPluginHookRunner(input?: {
31
38
  requester?: AgentPluginRequester;
@@ -0,0 +1,5 @@
1
+ import type { PluginManifest } from "./types";
2
+ type ManifestSource = Record<string, unknown>;
3
+ /** Convert inline JavaScript plugin manifests to the canonical source shape. */
4
+ export declare function inlineManifestSource(manifest: PluginManifest): ManifestSource;
5
+ export {};
@@ -1,3 +1,5 @@
1
- import type { PluginConfig, PluginManifest } from "./types";
2
- /** Parse one plugin manifest after applying install-level plugin config. */
3
- export declare function parsePluginManifest(raw: string, dir: string, config?: PluginConfig): PluginManifest;
1
+ import type { PluginCatalogConfig, PluginManifest } from "./types";
2
+ /** Parse one plugin.yaml manifest after applying install-level plugin config. */
3
+ export declare function parsePluginManifest(raw: string, dir: string, config?: PluginCatalogConfig): PluginManifest;
4
+ /** Parse one inline JavaScript manifest through the same effective manifest pipeline as plugin.yaml. */
5
+ export declare function parseInlinePluginManifest(manifest: PluginManifest, dir: string, config?: PluginCatalogConfig): PluginManifest;
@@ -1,5 +1,10 @@
1
1
  export interface InstalledPluginPackageContent {
2
2
  packageNames: string[];
3
+ packages: {
4
+ dir: string;
5
+ hasSkillsDir: boolean;
6
+ name: string;
7
+ }[];
3
8
  manifestRoots: string[];
4
9
  skillRoots: string[];
5
10
  tracingIncludes: string[];
@@ -1,9 +1,9 @@
1
1
  import type { CapabilityProviderDefinition } from "@/chat/capabilities/catalog";
2
2
  import type { CredentialBroker } from "@/chat/credentials/broker";
3
3
  import { type InstalledPluginPackageContent } from "./package-discovery";
4
- import type { PluginBrokerDeps, PluginConfig, PluginDefinition, OAuthProviderConfig, PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "./types";
4
+ import type { PluginBrokerDeps, PluginCatalogConfig, PluginDefinition, OAuthProviderConfig, PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "./types";
5
5
  /** Set install-wide plugin configuration and return the previous value for rollback. */
6
- export declare function setPluginConfig(config: PluginConfig | undefined): PluginConfig | undefined;
6
+ export declare function setPluginCatalogConfig(config: PluginCatalogConfig | undefined): PluginCatalogConfig | undefined;
7
7
  /** Return installed plugin package content from the active plugin configuration. */
8
8
  export declare function getPluginPackageContent(): InstalledPluginPackageContent;
9
9
  /** Return the current plugin catalog signature used for cache invalidation. */
@@ -130,8 +130,9 @@ export interface PluginManifestConfig {
130
130
  commandFlags?: string[] | null;
131
131
  } | null;
132
132
  }
133
- /** Install-level plugin package list and manifest configuration. */
134
- export interface PluginConfig {
133
+ /** Install-level plugin package list and manifest override catalog. */
134
+ export interface PluginCatalogConfig {
135
+ inlineManifests?: InlinePluginManifestDefinition[];
135
136
  packages?: string[];
136
137
  manifests?: Record<string, PluginManifestConfig>;
137
138
  }
@@ -141,6 +142,10 @@ export interface PluginBrokerDeps {
141
142
  export interface PluginDefinition {
142
143
  manifest: PluginManifest;
143
144
  dir: string;
144
- skillsDir: string;
145
+ skillsDir?: string;
146
+ }
147
+ export interface InlinePluginManifestDefinition {
148
+ manifest: PluginManifest;
149
+ packageName?: string;
145
150
  }
146
151
  export {};
@@ -15,7 +15,6 @@ type TurnContextPromptInput = {
15
15
  toolGuidance?: ToolPromptContext[];
16
16
  runtime?: {
17
17
  conversationId?: string;
18
- traceId?: string;
19
18
  };
20
19
  invocation: SkillInvocation | null;
21
20
  requester?: {
@@ -13,7 +13,7 @@ export interface AgentTurnSessionRecord {
13
13
  conversationTitle?: string;
14
14
  version: number;
15
15
  conversationId: string;
16
- cumulativeDurationMs?: number;
16
+ cumulativeDurationMs: number;
17
17
  cumulativeUsage?: AgentTurnUsage;
18
18
  errorMessage?: string;
19
19
  lastProgressAtMs: number;