@sentry/junior-plugin-api 0.262.0 → 0.264.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.
package/dist/index.d.ts CHANGED
@@ -1089,16 +1089,16 @@ export type EventMatchFields = z.output<typeof eventMatchFieldsSchema>;
1089
1089
  export declare function stableEventMatchKey(match: EventMatch | undefined): string;
1090
1090
  /** Return whether trusted event data matches one exact match object. */
1091
1091
  export declare function eventMatches(match: EventMatch | undefined, data: EventData | undefined): boolean;
1092
- /** The identifier shape of one resource type. */
1092
+ /** The identifier shape of one resource type. Plain JSON, so API responses can carry it. */
1093
1093
  export declare const eventIdentifierSchema: z.ZodObject<{
1094
1094
  format: z.ZodString;
1095
- pattern: z.ZodCustom<RegExp, RegExp>;
1095
+ pattern: z.ZodString;
1096
1096
  }, z.core.$strict>;
1097
1097
  export declare const pluginEventTypeSchema: z.ZodObject<{
1098
1098
  type: z.ZodString;
1099
1099
  identifier: z.ZodOptional<z.ZodObject<{
1100
1100
  format: z.ZodString;
1101
- pattern: z.ZodCustom<RegExp, RegExp>;
1101
+ pattern: z.ZodString;
1102
1102
  }, z.core.$strict>>;
1103
1103
  supportedEvents: z.ZodArray<z.ZodString>;
1104
1104
  suggestedEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1118,7 +1118,7 @@ export declare const pluginEventsSchema: z.ZodObject<{
1118
1118
  type: z.ZodString;
1119
1119
  identifier: z.ZodOptional<z.ZodObject<{
1120
1120
  format: z.ZodString;
1121
- pattern: z.ZodCustom<RegExp, RegExp>;
1121
+ pattern: z.ZodString;
1122
1122
  }, z.core.$strict>>;
1123
1123
  supportedEvents: z.ZodArray<z.ZodString>;
1124
1124
  suggestedEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1830,8 +1830,23 @@ export interface PluginEnv {
1830
1830
  get(key: string): string | undefined;
1831
1831
  set(key: string, value: string): void;
1832
1832
  }
1833
+ /**
1834
+ * Decide what happens to one tool call in `beforeToolExecute`.
1835
+ *
1836
+ * `redirect` and `deny` both stop the tool before it runs. Neither ends the
1837
+ * turn: the agent gets the message as the tool result.
1838
+ */
1833
1839
  export interface PluginDecision {
1834
- deny(message: string): void;
1840
+ /**
1841
+ * Block the call as a policy refusal. The agent is told not to retry or
1842
+ * reach the same result another way, and to explain the block.
1843
+ */
1844
+ deny(reason: string): void;
1845
+ /**
1846
+ * Block the call because a different path is correct, such as another
1847
+ * tool. The message tells the agent what to do instead.
1848
+ */
1849
+ redirect(message: string): void;
1835
1850
  replaceInput(input: Record<string, unknown>): void;
1836
1851
  }
1837
1852
  /** Thrown when a plugin tool rejects invalid model or user input. */
package/dist/index.js CHANGED
@@ -738,12 +738,20 @@ function eventMatches(match, data) {
738
738
  }
739
739
  return true;
740
740
  }
741
- /** The identifier shape of one resource type. */
741
+ function isRegExpSource(value) {
742
+ try {
743
+ new RegExp(value);
744
+ return true;
745
+ } catch {
746
+ return false;
747
+ }
748
+ }
749
+ /** The identifier shape of one resource type. Plain JSON, so API responses can carry it. */
742
750
  const eventIdentifierSchema = z.object({
743
751
  /** Shown to the agent, such as "owner/repo#number". */
744
752
  format: z.string().trim().min(1).max(200),
745
- /** Matches a normalized identifier of this resource type. */
746
- pattern: z.instanceof(RegExp)
753
+ /** RegExp source that matches a normalized identifier of this resource type. */
754
+ pattern: z.string().min(1).refine(isRegExpSource, { message: "Identifier pattern must be a valid regular expression." })
747
755
  }).strict();
748
756
  const pluginEventTypeSchema = z.object({
749
757
  type: resourceTypeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.262.0",
3
+ "version": "0.264.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"