@sentry/junior-plugin-api 0.80.1 → 0.82.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.
@@ -101,6 +101,12 @@ export declare class EgressAuthRequired extends Error {
101
101
  cause?: unknown;
102
102
  });
103
103
  }
104
+ /** Deny provider egress before Junior issues credentials for a disallowed operation. */
105
+ export declare class EgressPolicyDenied extends Error {
106
+ constructor(message: string, options?: {
107
+ cause?: unknown;
108
+ });
109
+ }
104
110
  /** Provider account identity resolved by a plugin OAuth hook. */
105
111
  export type PluginProviderAccount = z.output<typeof pluginProviderAccountSchema>;
106
112
  /** Plugin-defined grant required before Junior can forward one outbound request. */
@@ -110,6 +116,8 @@ export interface PluginEgressRequest {
110
116
  /** Capped request body text when the host exposes it for provider-specific grant classification. */
111
117
  bodyText?: string;
112
118
  method: string;
119
+ /** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
120
+ operation?: string;
113
121
  url: string;
114
122
  }
115
123
  export interface EgressHookContext extends PluginContext {
package/dist/index.js CHANGED
@@ -262,6 +262,12 @@ var EgressAuthRequired = class extends Error {
262
262
  this.authorization = options?.authorization;
263
263
  }
264
264
  };
265
+ var EgressPolicyDenied = class extends Error {
266
+ constructor(message, options) {
267
+ super(message, { cause: options?.cause });
268
+ this.name = "EgressPolicyDenied";
269
+ }
270
+ };
265
271
 
266
272
  // src/registration.ts
267
273
  var PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
@@ -305,6 +311,7 @@ function defineJuniorPlugin(plugin) {
305
311
  }
306
312
  export {
307
313
  EgressAuthRequired,
314
+ EgressPolicyDenied,
308
315
  PluginToolInputError,
309
316
  createLocalSource,
310
317
  createSlackSource,
package/dist/tools.d.ts CHANGED
@@ -36,6 +36,20 @@ export interface PluginSandbox {
36
36
  path: string;
37
37
  }): Promise<void>;
38
38
  }
39
+ export interface PluginEgress {
40
+ /**
41
+ * Fetch a provider URL with host-owned credentials.
42
+ *
43
+ * The runtime selects and injects credentials for `provider`; plugin code
44
+ * owns the request shape and response handling. `operation` names the
45
+ * provider action for grant selection and diagnostics.
46
+ */
47
+ fetch(input: {
48
+ operation: string;
49
+ provider: string;
50
+ request: Request;
51
+ }): Promise<Response>;
52
+ }
39
53
  export interface SandboxPrepareHookContext extends PluginContext {
40
54
  requester?: Requester;
41
55
  sandbox: PluginSandbox;
@@ -102,6 +116,7 @@ interface BaseToolRegistrationHookContext extends PluginContext {
102
116
  */
103
117
  conversationId?: string;
104
118
  embedder: PluginEmbedder;
119
+ egress: PluginEgress;
105
120
  model: PluginModel;
106
121
  state: PluginState;
107
122
  userText?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.80.1",
3
+ "version": "0.82.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -118,6 +118,14 @@ export class EgressAuthRequired extends Error {
118
118
  }
119
119
  }
120
120
 
121
+ /** Deny provider egress before Junior issues credentials for a disallowed operation. */
122
+ export class EgressPolicyDenied extends Error {
123
+ constructor(message: string, options?: { cause?: unknown }) {
124
+ super(message, { cause: options?.cause });
125
+ this.name = "EgressPolicyDenied";
126
+ }
127
+ }
128
+
121
129
  /** Provider account identity resolved by a plugin OAuth hook. */
122
130
  export type PluginProviderAccount = z.output<
123
131
  typeof pluginProviderAccountSchema
@@ -131,6 +139,8 @@ export interface PluginEgressRequest {
131
139
  /** Capped request body text when the host exposes it for provider-specific grant classification. */
132
140
  bodyText?: string;
133
141
  method: string;
142
+ /** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
143
+ operation?: string;
134
144
  url: string;
135
145
  }
136
146
 
package/src/tools.ts CHANGED
@@ -49,6 +49,21 @@ export interface PluginSandbox {
49
49
  }): Promise<void>;
50
50
  }
51
51
 
52
+ export interface PluginEgress {
53
+ /**
54
+ * Fetch a provider URL with host-owned credentials.
55
+ *
56
+ * The runtime selects and injects credentials for `provider`; plugin code
57
+ * owns the request shape and response handling. `operation` names the
58
+ * provider action for grant selection and diagnostics.
59
+ */
60
+ fetch(input: {
61
+ operation: string;
62
+ provider: string;
63
+ request: Request;
64
+ }): Promise<Response>;
65
+ }
66
+
52
67
  export interface SandboxPrepareHookContext extends PluginContext {
53
68
  requester?: Requester;
54
69
  sandbox: PluginSandbox;
@@ -124,6 +139,7 @@ interface BaseToolRegistrationHookContext extends PluginContext {
124
139
  */
125
140
  conversationId?: string;
126
141
  embedder: PluginEmbedder;
142
+ egress: PluginEgress;
127
143
  model: PluginModel;
128
144
  state: PluginState;
129
145
  userText?: string;