@sentry/junior-plugin-api 0.145.0 → 0.147.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.
@@ -10,6 +10,8 @@ export declare const pluginAuthorizationSchema: z.ZodObject<{
10
10
  }, z.core.$strict>;
11
11
  /** Runtime schema for a provider account attached to stored OAuth tokens. */
12
12
  export declare const pluginProviderAccountSchema: z.ZodObject<{
13
+ displayName: z.ZodOptional<z.ZodString>;
14
+ handle: z.ZodOptional<z.ZodString>;
13
15
  id: z.ZodString;
14
16
  label: z.ZodOptional<z.ZodString>;
15
17
  url: z.ZodOptional<z.ZodString>;
@@ -17,6 +19,8 @@ export declare const pluginProviderAccountSchema: z.ZodObject<{
17
19
  /** Runtime schema for OAuth tokens stored by the host for plugin credentials. */
18
20
  export declare const pluginStoredTokensSchema: z.ZodObject<{
19
21
  account: z.ZodOptional<z.ZodObject<{
22
+ displayName: z.ZodOptional<z.ZodString>;
23
+ handle: z.ZodOptional<z.ZodString>;
20
24
  id: z.ZodString;
21
25
  label: z.ZodOptional<z.ZodString>;
22
26
  url: z.ZodOptional<z.ZodString>;
@@ -43,6 +47,8 @@ export declare const pluginCredentialHeaderTransformSchema: z.ZodObject<{
43
47
  /** Runtime schema for a short-lived plugin-issued credential lease. */
44
48
  export declare const pluginCredentialLeaseSchema: z.ZodObject<{
45
49
  account: z.ZodOptional<z.ZodObject<{
50
+ displayName: z.ZodOptional<z.ZodString>;
51
+ handle: z.ZodOptional<z.ZodString>;
46
52
  id: z.ZodString;
47
53
  label: z.ZodOptional<z.ZodString>;
48
54
  url: z.ZodOptional<z.ZodString>;
@@ -62,6 +68,8 @@ export declare const pluginCredentialLeaseSchema: z.ZodObject<{
62
68
  export declare const pluginCredentialResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
69
  lease: z.ZodObject<{
64
70
  account: z.ZodOptional<z.ZodObject<{
71
+ displayName: z.ZodOptional<z.ZodString>;
72
+ handle: z.ZodOptional<z.ZodString>;
65
73
  id: z.ZodString;
66
74
  label: z.ZodOptional<z.ZodString>;
67
75
  url: z.ZodOptional<z.ZodString>;
package/dist/index.js CHANGED
@@ -293,6 +293,24 @@ function definePromptContext(definition) {
293
293
  import { z as z5 } from "zod";
294
294
  var RESOURCE_EVENT_SUMMARY_MAX_LENGTH = 4e3;
295
295
  var RESOURCE_EVENT_TEXT_MAX_LENGTH = 8e3;
296
+ var RESOURCE_EVENT_DATA_MAX_KEYS = 32;
297
+ var RESOURCE_EVENT_DATA_MAX_JSON_BYTES = 4e3;
298
+ var resourceEventDataSchema = z5.record(z5.string(), z5.unknown()).superRefine((value, context) => {
299
+ const keys = Object.keys(value);
300
+ if (keys.length > RESOURCE_EVENT_DATA_MAX_KEYS) {
301
+ context.addIssue({
302
+ code: "custom",
303
+ message: `Resource event data may include at most ${RESOURCE_EVENT_DATA_MAX_KEYS} keys.`
304
+ });
305
+ }
306
+ const jsonBytes = new TextEncoder().encode(JSON.stringify(value)).byteLength;
307
+ if (jsonBytes > RESOURCE_EVENT_DATA_MAX_JSON_BYTES) {
308
+ context.addIssue({
309
+ code: "custom",
310
+ message: `Resource event data may be at most ${RESOURCE_EVENT_DATA_MAX_JSON_BYTES} JSON bytes.`
311
+ });
312
+ }
313
+ });
296
314
  var resourceEventTypeSchema = z5.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
297
315
  "Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."
298
316
  );
@@ -374,6 +392,8 @@ var resourceEventInputSchema = z5.object({
374
392
  occurredAtMs: z5.number().finite(),
375
393
  terminal: z5.boolean().optional(),
376
394
  trustedSummary: z5.string().min(1).transform((value) => value.slice(0, RESOURCE_EVENT_SUMMARY_MAX_LENGTH)),
395
+ /** Trusted structured facts. Prefer ids and urls over long prose. */
396
+ data: resourceEventDataSchema.optional(),
377
397
  untrustedText: z5.string().transform((value) => value.slice(0, RESOURCE_EVENT_TEXT_MAX_LENGTH)).optional()
378
398
  }).strict();
379
399
  var resourceEventSchema = resourceEventInputSchema.extend({
@@ -562,6 +582,8 @@ var pluginAuthorizationSchema = z9.object({
562
582
  type: z9.literal("oauth")
563
583
  }).strict();
564
584
  var pluginProviderAccountSchema = z9.object({
585
+ displayName: nonBlankStringSchema.optional(),
586
+ handle: nonBlankStringSchema.optional(),
565
587
  id: nonBlankStringSchema,
566
588
  label: nonBlankStringSchema.optional(),
567
589
  url: nonBlankStringSchema.optional()
@@ -789,6 +811,8 @@ export {
789
811
  EgressPolicyDenied,
790
812
  PluginToolInputError,
791
813
  REQUIRED_TOOL_ANNOTATION_KEYS,
814
+ RESOURCE_EVENT_DATA_MAX_JSON_BYTES,
815
+ RESOURCE_EVENT_DATA_MAX_KEYS,
792
816
  RESOURCE_EVENT_SUMMARY_MAX_LENGTH,
793
817
  RESOURCE_EVENT_TEXT_MAX_LENGTH,
794
818
  actorSchema,
@@ -839,6 +863,7 @@ export {
839
863
  promptContextSchema,
840
864
  promptMessageSchema,
841
865
  replyAttributionSchema,
866
+ resourceEventDataSchema,
842
867
  resourceEventInputSchema,
843
868
  resourceEventSchema,
844
869
  resourceEventTypeSchema,
@@ -1,6 +1,10 @@
1
1
  import { z } from "zod";
2
2
  export declare const RESOURCE_EVENT_SUMMARY_MAX_LENGTH = 4000;
3
3
  export declare const RESOURCE_EVENT_TEXT_MAX_LENGTH = 8000;
4
+ export declare const RESOURCE_EVENT_DATA_MAX_KEYS = 32;
5
+ export declare const RESOURCE_EVENT_DATA_MAX_JSON_BYTES = 4000;
6
+ /** Small trusted facts from the plugin. The agent should not look these up again. */
7
+ export declare const resourceEventDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4
8
  /** Canonical dotted event type published and selected across plugins. */
5
9
  export declare const resourceEventTypeSchema: z.ZodString;
6
10
  export declare const resourceTypeSchema: z.ZodString;
@@ -38,8 +42,10 @@ export declare const resourceEventInputSchema: z.ZodObject<{
38
42
  occurredAtMs: z.ZodNumber;
39
43
  terminal: z.ZodOptional<z.ZodBoolean>;
40
44
  trustedSummary: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
45
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
41
46
  untrustedText: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
42
47
  }, z.core.$strict>;
48
+ export type ResourceEventData = z.output<typeof resourceEventDataSchema>;
43
49
  export type ResourceEventInput = z.output<typeof resourceEventInputSchema>;
44
50
  export declare const resourceEventSchema: z.ZodObject<{
45
51
  eventKey: z.ZodString;
@@ -48,6 +54,7 @@ export declare const resourceEventSchema: z.ZodObject<{
48
54
  occurredAtMs: z.ZodNumber;
49
55
  terminal: z.ZodOptional<z.ZodBoolean>;
50
56
  trustedSummary: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
57
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
51
58
  untrustedText: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
52
59
  namespace: z.ZodString;
53
60
  }, z.core.$strict>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.145.0",
3
+ "version": "0.147.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,6 +21,8 @@ export const pluginAuthorizationSchema = z
21
21
  /** Runtime schema for a provider account attached to stored OAuth tokens. */
22
22
  export const pluginProviderAccountSchema = z
23
23
  .object({
24
+ displayName: nonBlankStringSchema.optional(),
25
+ handle: nonBlankStringSchema.optional(),
24
26
  id: nonBlankStringSchema,
25
27
  label: nonBlankStringSchema.optional(),
26
28
  url: nonBlankStringSchema.optional(),
@@ -2,6 +2,28 @@ import { z } from "zod";
2
2
 
3
3
  export const RESOURCE_EVENT_SUMMARY_MAX_LENGTH = 4_000;
4
4
  export const RESOURCE_EVENT_TEXT_MAX_LENGTH = 8_000;
5
+ export const RESOURCE_EVENT_DATA_MAX_KEYS = 32;
6
+ export const RESOURCE_EVENT_DATA_MAX_JSON_BYTES = 4_000;
7
+
8
+ /** Small trusted facts from the plugin. The agent should not look these up again. */
9
+ export const resourceEventDataSchema = z
10
+ .record(z.string(), z.unknown())
11
+ .superRefine((value, context) => {
12
+ const keys = Object.keys(value);
13
+ if (keys.length > RESOURCE_EVENT_DATA_MAX_KEYS) {
14
+ context.addIssue({
15
+ code: "custom",
16
+ message: `Resource event data may include at most ${RESOURCE_EVENT_DATA_MAX_KEYS} keys.`,
17
+ });
18
+ }
19
+ const jsonBytes = new TextEncoder().encode(JSON.stringify(value)).byteLength;
20
+ if (jsonBytes > RESOURCE_EVENT_DATA_MAX_JSON_BYTES) {
21
+ context.addIssue({
22
+ code: "custom",
23
+ message: `Resource event data may be at most ${RESOURCE_EVENT_DATA_MAX_JSON_BYTES} JSON bytes.`,
24
+ });
25
+ }
26
+ });
5
27
 
6
28
  /** Canonical dotted event type published and selected across plugins. */
7
29
  export const resourceEventTypeSchema = z
@@ -124,6 +146,8 @@ export const resourceEventInputSchema = z
124
146
  .string()
125
147
  .min(1)
126
148
  .transform((value) => value.slice(0, RESOURCE_EVENT_SUMMARY_MAX_LENGTH)),
149
+ /** Trusted structured facts. Prefer ids and urls over long prose. */
150
+ data: resourceEventDataSchema.optional(),
127
151
  untrustedText: z
128
152
  .string()
129
153
  .transform((value) => value.slice(0, RESOURCE_EVENT_TEXT_MAX_LENGTH))
@@ -131,6 +155,7 @@ export const resourceEventInputSchema = z
131
155
  })
132
156
  .strict();
133
157
 
158
+ export type ResourceEventData = z.output<typeof resourceEventDataSchema>;
134
159
  export type ResourceEventInput = z.output<typeof resourceEventInputSchema>;
135
160
 
136
161
  export const resourceEventSchema = resourceEventInputSchema.extend({