@sentry/junior-plugin-api 0.298.0 → 0.299.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 +160 -1
- package/dist/index.js +189 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
22
22
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
23
23
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
24
24
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
25
26
|
}, z.core.$strict>, z.ZodObject<{
|
|
26
27
|
type: z.ZodLiteral<"task">;
|
|
27
28
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -40,9 +41,25 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
40
41
|
type: z.ZodLiteral<"calendar_event">;
|
|
41
42
|
when: z.ZodOptional<z.ZodString>;
|
|
42
43
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"conversation">;
|
|
46
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"message">;
|
|
50
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
51
|
+
author: z.ZodOptional<z.ZodString>;
|
|
52
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"person">;
|
|
55
|
+
email: z.ZodOptional<z.ZodString>;
|
|
56
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
57
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
58
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
43
59
|
}, z.core.$strict>], "type">;
|
|
44
60
|
export type ObjectFacts = z.output<typeof objectFactsSchema>;
|
|
45
61
|
type ObjectField = {
|
|
62
|
+
href?: string;
|
|
46
63
|
key: string;
|
|
47
64
|
label: string;
|
|
48
65
|
value: string;
|
|
@@ -54,12 +71,15 @@ export declare const objectTypeSchema: z.ZodEnum<{
|
|
|
54
71
|
automation: "automation";
|
|
55
72
|
calendar_event: "calendar_event";
|
|
56
73
|
code_change: "code_change";
|
|
74
|
+
conversation: "conversation";
|
|
57
75
|
deployment: "deployment";
|
|
58
76
|
item: "item";
|
|
77
|
+
message: "message";
|
|
78
|
+
person: "person";
|
|
59
79
|
task: "task";
|
|
60
80
|
}>;
|
|
61
81
|
export type ObjectType = z.output<typeof objectTypeSchema>;
|
|
62
|
-
declare const objectIconNames: readonly ["issue-opened", "issue-closed", "git-pull-request", "git-pull-request-draft", "git-pull-request-closed", "git-merge", "workflow", "rocket", "calendar", "package"];
|
|
82
|
+
declare const objectIconNames: readonly ["issue-opened", "issue-closed", "git-pull-request", "git-pull-request-draft", "git-pull-request-closed", "git-merge", "workflow", "rocket", "calendar", "comment-discussion", "person", "comment", "package"];
|
|
63
83
|
export type ObjectIconName = (typeof objectIconNames)[number];
|
|
64
84
|
export type ObjectTone = "neutral" | "success" | "danger" | "warning" | "info" | "accent";
|
|
65
85
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -78,6 +98,10 @@ export declare function objectPresentation(object: {
|
|
|
78
98
|
export declare function objectIconPath(icon: ObjectIconName): string;
|
|
79
99
|
/** Return whether facts fit an object type. Deployment facts also fit an item. */
|
|
80
100
|
export declare function objectFactsMatchType(facts: ObjectFacts, objectType: ObjectType): boolean;
|
|
101
|
+
/** The largest size of object facts, in UTF-8 bytes of their JSON. */
|
|
102
|
+
export declare const OBJECT_FACTS_MAX_BYTES = 4096;
|
|
103
|
+
/** Return the size that the object facts limit counts. */
|
|
104
|
+
export declare function objectFactsBytes(facts: ObjectFacts): number;
|
|
81
105
|
/**
|
|
82
106
|
* Verified facts shared by Conversation annotations and Message cards.
|
|
83
107
|
* Plugins select small facts from responses they already have. Each surface owns
|
|
@@ -98,8 +122,11 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
98
122
|
automation: "automation";
|
|
99
123
|
calendar_event: "calendar_event";
|
|
100
124
|
code_change: "code_change";
|
|
125
|
+
conversation: "conversation";
|
|
101
126
|
deployment: "deployment";
|
|
102
127
|
item: "item";
|
|
128
|
+
message: "message";
|
|
129
|
+
person: "person";
|
|
103
130
|
task: "task";
|
|
104
131
|
}>;
|
|
105
132
|
title: z.ZodString;
|
|
@@ -130,6 +157,7 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
130
157
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
131
158
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
132
159
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
133
161
|
}, z.core.$strict>, z.ZodObject<{
|
|
134
162
|
type: z.ZodLiteral<"task">;
|
|
135
163
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -148,6 +176,21 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
148
176
|
type: z.ZodLiteral<"calendar_event">;
|
|
149
177
|
when: z.ZodOptional<z.ZodString>;
|
|
150
178
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
179
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
180
|
+
type: z.ZodLiteral<"conversation">;
|
|
181
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
182
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
183
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"message">;
|
|
185
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
186
|
+
author: z.ZodOptional<z.ZodString>;
|
|
187
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
188
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
189
|
+
type: z.ZodLiteral<"person">;
|
|
190
|
+
email: z.ZodOptional<z.ZodString>;
|
|
191
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
192
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
193
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
151
194
|
}, z.core.$strict>], "type">>;
|
|
152
195
|
}, z.core.$strict>;
|
|
153
196
|
export type ObjectAnnotation = z.output<typeof objectAnnotationSchema>;
|
|
@@ -160,8 +203,11 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
160
203
|
automation: "automation";
|
|
161
204
|
calendar_event: "calendar_event";
|
|
162
205
|
code_change: "code_change";
|
|
206
|
+
conversation: "conversation";
|
|
163
207
|
deployment: "deployment";
|
|
164
208
|
item: "item";
|
|
209
|
+
message: "message";
|
|
210
|
+
person: "person";
|
|
165
211
|
task: "task";
|
|
166
212
|
}>;
|
|
167
213
|
title: z.ZodString;
|
|
@@ -192,6 +238,7 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
192
238
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
193
239
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
194
240
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
195
242
|
}, z.core.$strict>, z.ZodObject<{
|
|
196
243
|
type: z.ZodLiteral<"task">;
|
|
197
244
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -210,6 +257,21 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
210
257
|
type: z.ZodLiteral<"calendar_event">;
|
|
211
258
|
when: z.ZodOptional<z.ZodString>;
|
|
212
259
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
260
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
261
|
+
type: z.ZodLiteral<"conversation">;
|
|
262
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
263
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
264
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"message">;
|
|
266
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
267
|
+
author: z.ZodOptional<z.ZodString>;
|
|
268
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
269
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
270
|
+
type: z.ZodLiteral<"person">;
|
|
271
|
+
email: z.ZodOptional<z.ZodString>;
|
|
272
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
273
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
274
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
213
275
|
}, z.core.$strict>], "type">>;
|
|
214
276
|
plugin: z.ZodString;
|
|
215
277
|
}, z.core.$strict>;
|
|
@@ -225,6 +287,9 @@ export declare const objectIconPaths: {
|
|
|
225
287
|
workflow: string[];
|
|
226
288
|
rocket: string[];
|
|
227
289
|
calendar: string[];
|
|
290
|
+
"comment-discussion": string[];
|
|
291
|
+
person: string[];
|
|
292
|
+
comment: string[];
|
|
228
293
|
package: string[];
|
|
229
294
|
};
|
|
230
295
|
/** Exact non-blank actor user id that rejects the sentinel "unknown". */
|
|
@@ -726,6 +791,42 @@ export declare function isPrivateSource(source: Source): boolean;
|
|
|
726
791
|
export declare function getSourceKey(source: Source): string | undefined;
|
|
727
792
|
/** Narrow a runtime destination to the Slack-specific address shape. */
|
|
728
793
|
export declare function isSlackDestination(destination: Destination | undefined): destination is SlackDestination;
|
|
794
|
+
/** Which URLs a link type claims. Give at most one path field. */
|
|
795
|
+
export declare const objectLinkFilterSchema: z.ZodObject<{
|
|
796
|
+
scheme: z.ZodOptional<z.ZodEnum<{
|
|
797
|
+
http: "http";
|
|
798
|
+
https: "https";
|
|
799
|
+
mailto: "mailto";
|
|
800
|
+
}>>;
|
|
801
|
+
host: z.ZodOptional<z.ZodString>;
|
|
802
|
+
path: z.ZodOptional<z.ZodString>;
|
|
803
|
+
pathPattern: z.ZodOptional<z.ZodString>;
|
|
804
|
+
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
805
|
+
}, z.core.$strict>;
|
|
806
|
+
export type ObjectLinkFilter = z.output<typeof objectLinkFilterSchema>;
|
|
807
|
+
/** Return whether a filter claims a URL. A trailing slash does not count. */
|
|
808
|
+
export declare function objectLinkFilterMatches(filter: ObjectLinkFilter, url: URL): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Rank how specific a filter is. Compare ranks in order: an exact host
|
|
811
|
+
* before a wildcard host, an exact path before a pattern before a prefix,
|
|
812
|
+
* and then the longer match.
|
|
813
|
+
*/
|
|
814
|
+
export declare function objectLinkFilterSpecificity(filter: ObjectLinkFilter): number[];
|
|
815
|
+
/** Trusted host context for one link resolution. */
|
|
816
|
+
export interface ObjectLinkContext extends PluginContext {
|
|
817
|
+
/** The signed-in person who sees the card. */
|
|
818
|
+
viewer: User;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* One link type of a plugin. `resolve` reads the object with the viewer's
|
|
822
|
+
* own access. Return nothing when the viewer cannot read the object, so the
|
|
823
|
+
* card does not show that it exists. Junior does not save the result.
|
|
824
|
+
*/
|
|
825
|
+
export interface PluginObjectLinkDefinition {
|
|
826
|
+
filters: ObjectLinkFilter[];
|
|
827
|
+
objectType: ObjectType;
|
|
828
|
+
resolve(ctx: ObjectLinkContext, url: URL): Promise<ObjectAnnotation | undefined>;
|
|
829
|
+
}
|
|
729
830
|
/**
|
|
730
831
|
* Link an object to a Conversation when the owner has no typed object preview.
|
|
731
832
|
* Keep a stable key, compact label, source URL, and optional short context or
|
|
@@ -738,8 +839,11 @@ export declare const resourceLinkAnnotationSchema: z.ZodObject<{
|
|
|
738
839
|
automation: "automation";
|
|
739
840
|
calendar_event: "calendar_event";
|
|
740
841
|
code_change: "code_change";
|
|
842
|
+
conversation: "conversation";
|
|
741
843
|
deployment: "deployment";
|
|
742
844
|
item: "item";
|
|
845
|
+
message: "message";
|
|
846
|
+
person: "person";
|
|
743
847
|
task: "task";
|
|
744
848
|
}>>;
|
|
745
849
|
key: z.ZodString;
|
|
@@ -761,8 +865,11 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
761
865
|
automation: "automation";
|
|
762
866
|
calendar_event: "calendar_event";
|
|
763
867
|
code_change: "code_change";
|
|
868
|
+
conversation: "conversation";
|
|
764
869
|
deployment: "deployment";
|
|
765
870
|
item: "item";
|
|
871
|
+
message: "message";
|
|
872
|
+
person: "person";
|
|
766
873
|
task: "task";
|
|
767
874
|
}>>;
|
|
768
875
|
key: z.ZodString;
|
|
@@ -784,8 +891,11 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
784
891
|
automation: "automation";
|
|
785
892
|
calendar_event: "calendar_event";
|
|
786
893
|
code_change: "code_change";
|
|
894
|
+
conversation: "conversation";
|
|
787
895
|
deployment: "deployment";
|
|
788
896
|
item: "item";
|
|
897
|
+
message: "message";
|
|
898
|
+
person: "person";
|
|
789
899
|
task: "task";
|
|
790
900
|
}>;
|
|
791
901
|
title: z.ZodString;
|
|
@@ -816,6 +926,7 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
816
926
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
817
927
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
818
928
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
929
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
819
930
|
}, z.core.$strict>, z.ZodObject<{
|
|
820
931
|
type: z.ZodLiteral<"task">;
|
|
821
932
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -834,6 +945,21 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
834
945
|
type: z.ZodLiteral<"calendar_event">;
|
|
835
946
|
when: z.ZodOptional<z.ZodString>;
|
|
836
947
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
948
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
949
|
+
type: z.ZodLiteral<"conversation">;
|
|
950
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
951
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
952
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
953
|
+
type: z.ZodLiteral<"message">;
|
|
954
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
955
|
+
author: z.ZodOptional<z.ZodString>;
|
|
956
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
957
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
958
|
+
type: z.ZodLiteral<"person">;
|
|
959
|
+
email: z.ZodOptional<z.ZodString>;
|
|
960
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
961
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
962
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
837
963
|
}, z.core.$strict>], "type">>;
|
|
838
964
|
}, z.core.$strict>], "kind">;
|
|
839
965
|
export type ConversationAnnotationInput = z.output<typeof conversationAnnotationInputSchema>;
|
|
@@ -871,8 +997,11 @@ export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
|
871
997
|
automation: "automation";
|
|
872
998
|
calendar_event: "calendar_event";
|
|
873
999
|
code_change: "code_change";
|
|
1000
|
+
conversation: "conversation";
|
|
874
1001
|
deployment: "deployment";
|
|
875
1002
|
item: "item";
|
|
1003
|
+
message: "message";
|
|
1004
|
+
person: "person";
|
|
876
1005
|
task: "task";
|
|
877
1006
|
}>>;
|
|
878
1007
|
status: z.ZodOptional<z.ZodString>;
|
|
@@ -898,6 +1027,7 @@ export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
|
898
1027
|
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
899
1028
|
closedAt: z.ZodOptional<z.ZodDate>;
|
|
900
1029
|
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1030
|
+
draft: z.ZodOptional<z.ZodBoolean>;
|
|
901
1031
|
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
902
1032
|
number: z.ZodNumber;
|
|
903
1033
|
openedAt: z.ZodDate;
|
|
@@ -1351,8 +1481,11 @@ export declare const eventInputSchema: z.ZodObject<{
|
|
|
1351
1481
|
automation: "automation";
|
|
1352
1482
|
calendar_event: "calendar_event";
|
|
1353
1483
|
code_change: "code_change";
|
|
1484
|
+
conversation: "conversation";
|
|
1354
1485
|
deployment: "deployment";
|
|
1355
1486
|
item: "item";
|
|
1487
|
+
message: "message";
|
|
1488
|
+
person: "person";
|
|
1356
1489
|
task: "task";
|
|
1357
1490
|
}>>;
|
|
1358
1491
|
eventKey: z.ZodString;
|
|
@@ -1383,8 +1516,11 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1383
1516
|
automation: "automation";
|
|
1384
1517
|
calendar_event: "calendar_event";
|
|
1385
1518
|
code_change: "code_change";
|
|
1519
|
+
conversation: "conversation";
|
|
1386
1520
|
deployment: "deployment";
|
|
1387
1521
|
item: "item";
|
|
1522
|
+
message: "message";
|
|
1523
|
+
person: "person";
|
|
1388
1524
|
task: "task";
|
|
1389
1525
|
}>>;
|
|
1390
1526
|
eventKey: z.ZodString;
|
|
@@ -2328,8 +2464,11 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2328
2464
|
automation: "automation";
|
|
2329
2465
|
calendar_event: "calendar_event";
|
|
2330
2466
|
code_change: "code_change";
|
|
2467
|
+
conversation: "conversation";
|
|
2331
2468
|
deployment: "deployment";
|
|
2332
2469
|
item: "item";
|
|
2470
|
+
message: "message";
|
|
2471
|
+
person: "person";
|
|
2333
2472
|
task: "task";
|
|
2334
2473
|
}>;
|
|
2335
2474
|
title: z.ZodString;
|
|
@@ -2360,6 +2499,7 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2360
2499
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
2361
2500
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
2362
2501
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
2502
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
2363
2503
|
}, z.core.$strict>, z.ZodObject<{
|
|
2364
2504
|
type: z.ZodLiteral<"task">;
|
|
2365
2505
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -2378,6 +2518,21 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2378
2518
|
type: z.ZodLiteral<"calendar_event">;
|
|
2379
2519
|
when: z.ZodOptional<z.ZodString>;
|
|
2380
2520
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2521
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2522
|
+
type: z.ZodLiteral<"conversation">;
|
|
2523
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2524
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2525
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2526
|
+
type: z.ZodLiteral<"message">;
|
|
2527
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
2528
|
+
author: z.ZodOptional<z.ZodString>;
|
|
2529
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2530
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2531
|
+
type: z.ZodLiteral<"person">;
|
|
2532
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2533
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
2534
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
2535
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
2381
2536
|
}, z.core.$strict>], "type">>;
|
|
2382
2537
|
}, z.core.$strict>>>;
|
|
2383
2538
|
reply: z.ZodOptional<z.ZodObject<{
|
|
@@ -2563,6 +2718,8 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
2563
2718
|
conversationLink?: {
|
|
2564
2719
|
url: string;
|
|
2565
2720
|
};
|
|
2721
|
+
/** Decision model for narrow choices, such as checks on text a tool writes. */
|
|
2722
|
+
decider: PluginDecider;
|
|
2566
2723
|
embedder: PluginEmbedder;
|
|
2567
2724
|
egress: PluginEgress;
|
|
2568
2725
|
mcp?: PluginMcp;
|
|
@@ -3198,6 +3355,8 @@ export type PluginRegistrationInput = {
|
|
|
3198
3355
|
hooks?: PluginHooks;
|
|
3199
3356
|
manifest: PluginManifest;
|
|
3200
3357
|
model?: PluginModelConfig;
|
|
3358
|
+
/** URLs that this plugin shows as object cards. */
|
|
3359
|
+
objectLinks?: PluginObjectLinkDefinition[];
|
|
3201
3360
|
packageName?: string;
|
|
3202
3361
|
events?: PluginEvents;
|
|
3203
3362
|
tasks?: PluginTasks;
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,12 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
23
23
|
mergeable: z.boolean().optional(),
|
|
24
24
|
changedFiles: count.optional(),
|
|
25
25
|
additions: count.optional(),
|
|
26
|
-
deletions: count.optional()
|
|
26
|
+
deletions: count.optional(),
|
|
27
|
+
/**
|
|
28
|
+
* Public images from the description that the dashboard can show. The
|
|
29
|
+
* 4 KiB facts limit sets how many fit.
|
|
30
|
+
*/
|
|
31
|
+
previewImageUrls: z.array(z.url({ protocol: /^https?$/ }).max(512)).min(1).optional()
|
|
27
32
|
}),
|
|
28
33
|
z.strictObject({
|
|
29
34
|
type: z.literal("task"),
|
|
@@ -45,6 +50,24 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
45
50
|
type: z.literal("calendar_event"),
|
|
46
51
|
when: text.optional(),
|
|
47
52
|
attendees: z.array(text).max(5).optional()
|
|
53
|
+
}),
|
|
54
|
+
z.strictObject({
|
|
55
|
+
type: z.literal("conversation"),
|
|
56
|
+
participants: z.array(text).max(5).optional(),
|
|
57
|
+
lastActivityAt: z.iso.datetime({ offset: true }).optional()
|
|
58
|
+
}),
|
|
59
|
+
z.strictObject({
|
|
60
|
+
type: z.literal("message"),
|
|
61
|
+
channel: text.optional(),
|
|
62
|
+
author: text.optional(),
|
|
63
|
+
sentAt: z.iso.datetime({ offset: true }).optional()
|
|
64
|
+
}),
|
|
65
|
+
z.strictObject({
|
|
66
|
+
type: z.literal("person"),
|
|
67
|
+
email: text.optional(),
|
|
68
|
+
slackHandle: text.optional(),
|
|
69
|
+
githubHandle: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/).optional(),
|
|
70
|
+
avatarUrl: z.string().max(500).regex(/^\/api\/people\/avatars\/[^/?#]+(\?v=[\w-]+)?$/).optional()
|
|
48
71
|
})
|
|
49
72
|
]);
|
|
50
73
|
/** Show at most four card attributes, in priority order, on every surface. */
|
|
@@ -52,11 +75,12 @@ function objectFactFields(facts) {
|
|
|
52
75
|
if (!facts) return [];
|
|
53
76
|
const fields = [];
|
|
54
77
|
const list = (values) => values?.length ? `${values.join(", ")}${values.length === 5 ? " (up to 5 shown)" : ""}` : void 0;
|
|
55
|
-
function add(key, label, value) {
|
|
78
|
+
function add(key, label, value, href) {
|
|
56
79
|
if (value !== void 0 && value !== "") fields.push({
|
|
57
80
|
key,
|
|
58
81
|
label,
|
|
59
|
-
value: String(value)
|
|
82
|
+
value: String(value),
|
|
83
|
+
...href && { href }
|
|
60
84
|
});
|
|
61
85
|
}
|
|
62
86
|
switch (facts.type) {
|
|
@@ -80,6 +104,26 @@ function objectFactFields(facts) {
|
|
|
80
104
|
case "calendar_event":
|
|
81
105
|
add("when", "When", facts.when);
|
|
82
106
|
add("attendees", "Attendees", list(facts.attendees));
|
|
107
|
+
break;
|
|
108
|
+
case "conversation":
|
|
109
|
+
add("participants", "Participants", list(facts.participants));
|
|
110
|
+
add("lastActivityAt", "Last activity", facts.lastActivityAt && new Date(facts.lastActivityAt).toLocaleString(void 0, {
|
|
111
|
+
dateStyle: "medium",
|
|
112
|
+
timeStyle: "short"
|
|
113
|
+
}));
|
|
114
|
+
break;
|
|
115
|
+
case "message":
|
|
116
|
+
add("channel", "Channel", facts.channel);
|
|
117
|
+
add("author", "Author", facts.author);
|
|
118
|
+
add("sentAt", "Sent", facts.sentAt && new Date(facts.sentAt).toLocaleString(void 0, {
|
|
119
|
+
dateStyle: "medium",
|
|
120
|
+
timeStyle: "short"
|
|
121
|
+
}));
|
|
122
|
+
break;
|
|
123
|
+
case "person":
|
|
124
|
+
add("email", "Email", facts.email);
|
|
125
|
+
add("slackHandle", "Slack", facts.slackHandle && `@${facts.slackHandle}`);
|
|
126
|
+
add("githubHandle", "GitHub", facts.githubHandle && `@${facts.githubHandle}`, facts.githubHandle && `https://github.com/${facts.githubHandle}`);
|
|
83
127
|
}
|
|
84
128
|
return fields.slice(0, 4);
|
|
85
129
|
}
|
|
@@ -91,6 +135,9 @@ const objectTypeSchema = z.enum([
|
|
|
91
135
|
"automation",
|
|
92
136
|
"deployment",
|
|
93
137
|
"calendar_event",
|
|
138
|
+
"conversation",
|
|
139
|
+
"person",
|
|
140
|
+
"message",
|
|
94
141
|
"item"
|
|
95
142
|
]);
|
|
96
143
|
const objectTypeLabels = {
|
|
@@ -99,6 +146,9 @@ const objectTypeLabels = {
|
|
|
99
146
|
automation: "Automation",
|
|
100
147
|
deployment: "Deployment",
|
|
101
148
|
calendar_event: "Calendar event",
|
|
149
|
+
conversation: "Conversation",
|
|
150
|
+
person: "Person",
|
|
151
|
+
message: "Message",
|
|
102
152
|
item: "Item"
|
|
103
153
|
};
|
|
104
154
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -111,6 +161,9 @@ function objectPresentation(object) {
|
|
|
111
161
|
automation: "workflow",
|
|
112
162
|
deployment: "rocket",
|
|
113
163
|
calendar_event: "calendar",
|
|
164
|
+
conversation: "comment-discussion",
|
|
165
|
+
person: "person",
|
|
166
|
+
message: "comment",
|
|
114
167
|
item: "package"
|
|
115
168
|
}[type];
|
|
116
169
|
let tone = type === "automation" ? "info" : "neutral";
|
|
@@ -135,6 +188,9 @@ function objectPresentation(object) {
|
|
|
135
188
|
if (status === "ready" || status === "succeeded") tone = "success";
|
|
136
189
|
if (status === "error" || status === "failed") tone = "danger";
|
|
137
190
|
if (status === "building" || status === "in_progress") tone = "info";
|
|
191
|
+
} else if (type === "conversation") {
|
|
192
|
+
if (status === "running") tone = "info";
|
|
193
|
+
if (status === "failed") tone = "danger";
|
|
138
194
|
}
|
|
139
195
|
if (status === "warning" || status === "blocked") tone = "warning";
|
|
140
196
|
return {
|
|
@@ -152,6 +208,25 @@ function objectIconPath(icon) {
|
|
|
152
208
|
function objectFactsMatchType(facts, objectType) {
|
|
153
209
|
return facts.type === "deployment" ? objectType === "deployment" || objectType === "item" : facts.type === objectType;
|
|
154
210
|
}
|
|
211
|
+
/** The largest size of object facts, in UTF-8 bytes of their JSON. */
|
|
212
|
+
const OBJECT_FACTS_MAX_BYTES = 4096;
|
|
213
|
+
/** Return the size that the object facts limit counts. */
|
|
214
|
+
function objectFactsBytes(facts) {
|
|
215
|
+
return utf8ByteLength(JSON.stringify(facts));
|
|
216
|
+
}
|
|
217
|
+
function utf8ByteLength(text) {
|
|
218
|
+
let bytes = 0;
|
|
219
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
220
|
+
const code = text.charCodeAt(index);
|
|
221
|
+
if (code < 128) bytes += 1;
|
|
222
|
+
else if (code < 2048) bytes += 2;
|
|
223
|
+
else if (code >= 55296 && code <= 56319 && (text.charCodeAt(index + 1) & 64512) === 56320) {
|
|
224
|
+
bytes += 4;
|
|
225
|
+
index += 1;
|
|
226
|
+
} else bytes += 3;
|
|
227
|
+
}
|
|
228
|
+
return bytes;
|
|
229
|
+
}
|
|
155
230
|
/**
|
|
156
231
|
* Verified facts shared by Conversation annotations and Message cards.
|
|
157
232
|
* Plugins select small facts from responses they already have. Each surface owns
|
|
@@ -177,7 +252,7 @@ const objectAnnotationSchema = z.object({
|
|
|
177
252
|
warning: z.string().max(1e3).optional(),
|
|
178
253
|
displayType: z.string().trim().min(1).max(80).optional(),
|
|
179
254
|
sourceUpdatedAt: z.iso.datetime({ offset: true }).optional(),
|
|
180
|
-
facts: objectFactsSchema.refine((facts) =>
|
|
255
|
+
facts: objectFactsSchema.refine((facts) => objectFactsBytes(facts) <= OBJECT_FACTS_MAX_BYTES, "Object facts must not exceed 4 KiB").optional()
|
|
181
256
|
}).strict().refine((annotation) => !annotation.facts || objectFactsMatchType(annotation.facts, annotation.objectType), "Object facts must match the object type");
|
|
182
257
|
/** A saved object snapshot with its trusted owner. */
|
|
183
258
|
const ownedObjectAnnotationSchema = objectAnnotationSchema.safeExtend({ plugin: z.string().min(1) });
|
|
@@ -193,8 +268,100 @@ const objectIconPaths = {
|
|
|
193
268
|
workflow: ["M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"],
|
|
194
269
|
rocket: ["M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"],
|
|
195
270
|
calendar: ["M4.75 0a.75.75 0 0 1 .75.75V2h5V.75a.75.75 0 0 1 1.5 0V2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25V3.75C1 2.784 1.784 2 2.75 2H4V.75A.75.75 0 0 1 4.75 0ZM2.5 7.5v6.75c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V7.5Zm10.75-4H2.75a.25.25 0 0 0-.25.25V6h11V3.75a.25.25 0 0 0-.25-.25Z"],
|
|
271
|
+
"comment-discussion": ["M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"],
|
|
272
|
+
person: ["M10.561 8.073a6.005 6.005 0 0 1 3.432 5.142.75.75 0 1 1-1.498.07 4.5 4.5 0 0 0-8.99 0 .75.75 0 0 1-1.498-.07 6.004 6.004 0 0 1 3.431-5.142 3.999 3.999 0 1 1 5.123 0ZM10.5 5a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"],
|
|
273
|
+
comment: ["M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"],
|
|
196
274
|
package: ["m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"]
|
|
197
275
|
};
|
|
276
|
+
// src/object-links.ts
|
|
277
|
+
/**
|
|
278
|
+
* Link types: URLs that a plugin or core can show as object cards.
|
|
279
|
+
*
|
|
280
|
+
* A link type declares static filters, like an Android `<intent-filter>`.
|
|
281
|
+
* Junior matches a URL against the filters without plugin code, and then
|
|
282
|
+
* calls the `resolve` of the most specific match for the viewer.
|
|
283
|
+
*/
|
|
284
|
+
const hostSchema = z.string().regex(/^(\*\.)?[a-z0-9-]+(\.[a-z0-9-]+)*(:\d+)?$/, "Use a lowercase host, or `*.` and a lowercase domain.");
|
|
285
|
+
const pathSchema = z.string().max(500).startsWith("/");
|
|
286
|
+
const pathPatternSchema = pathSchema.regex(/^(\/([^/*]+|\*))+$/, "Use `/` segments. A `*` segment matches one segment.");
|
|
287
|
+
/** Which URLs a link type claims. Give at most one path field. */
|
|
288
|
+
const objectLinkFilterSchema = z.strictObject({
|
|
289
|
+
/** Defaults to `https`. */
|
|
290
|
+
scheme: z.enum([
|
|
291
|
+
"https",
|
|
292
|
+
"http",
|
|
293
|
+
"mailto"
|
|
294
|
+
]).optional(),
|
|
295
|
+
/** An exact host, or `*.example.com` for its subdomains. */
|
|
296
|
+
host: hostSchema.optional(),
|
|
297
|
+
path: pathSchema.optional(),
|
|
298
|
+
pathPattern: pathPatternSchema.optional(),
|
|
299
|
+
pathPrefix: pathSchema.optional()
|
|
300
|
+
}).refine((filter) => [
|
|
301
|
+
filter.path,
|
|
302
|
+
filter.pathPattern,
|
|
303
|
+
filter.pathPrefix
|
|
304
|
+
].filter((value) => value !== void 0).length <= 1, "Give at most one of path, pathPattern, and pathPrefix.").refine((filter) => filter.scheme === "mailto" ? filter.host === void 0 && !hasPathFilter(filter) : filter.host !== void 0, "An http or https filter needs a host. A mailto filter has no host or path.");
|
|
305
|
+
function hasPathFilter(filter) {
|
|
306
|
+
return filter.path !== void 0 || filter.pathPattern !== void 0 || filter.pathPrefix !== void 0;
|
|
307
|
+
}
|
|
308
|
+
function normalizedPath(url) {
|
|
309
|
+
const path = url.pathname;
|
|
310
|
+
return path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
|
|
311
|
+
}
|
|
312
|
+
/** Return whether a filter claims a URL. A trailing slash does not count. */
|
|
313
|
+
function objectLinkFilterMatches(filter, url) {
|
|
314
|
+
if (url.protocol !== `${filter.scheme ?? "https"}:`) return false;
|
|
315
|
+
if (filter.host !== void 0) {
|
|
316
|
+
const host = url.host.toLowerCase();
|
|
317
|
+
if (!(filter.host.startsWith("*.") ? host.endsWith(filter.host.slice(1)) : host === filter.host)) return false;
|
|
318
|
+
}
|
|
319
|
+
const path = normalizedPath(url);
|
|
320
|
+
if (filter.path !== void 0) return path === filter.path;
|
|
321
|
+
if (filter.pathPrefix !== void 0) return path.startsWith(filter.pathPrefix);
|
|
322
|
+
if (filter.pathPattern !== void 0) {
|
|
323
|
+
const pattern = filter.pathPattern.split("/");
|
|
324
|
+
const segments = path.split("/");
|
|
325
|
+
return pattern.length === segments.length && pattern.every((part, index) => part === "*" ? segments[index] !== "" : part === segments[index]);
|
|
326
|
+
}
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Rank how specific a filter is. Compare ranks in order: an exact host
|
|
331
|
+
* before a wildcard host, an exact path before a pattern before a prefix,
|
|
332
|
+
* and then the longer match.
|
|
333
|
+
*/
|
|
334
|
+
function objectLinkFilterSpecificity(filter) {
|
|
335
|
+
const host = filter.host ?? "";
|
|
336
|
+
const hostRank = !filter.host ? 0 : host.startsWith("*.") ? 1 : 2;
|
|
337
|
+
if (filter.path !== void 0) return [
|
|
338
|
+
hostRank,
|
|
339
|
+
host.length,
|
|
340
|
+
3,
|
|
341
|
+
filter.path.length
|
|
342
|
+
];
|
|
343
|
+
if (filter.pathPattern !== void 0) {
|
|
344
|
+
const literals = filter.pathPattern.split("/").filter((part) => part && part !== "*");
|
|
345
|
+
return [
|
|
346
|
+
hostRank,
|
|
347
|
+
host.length,
|
|
348
|
+
2,
|
|
349
|
+
literals.length
|
|
350
|
+
];
|
|
351
|
+
}
|
|
352
|
+
if (filter.pathPrefix !== void 0) return [
|
|
353
|
+
hostRank,
|
|
354
|
+
host.length,
|
|
355
|
+
1,
|
|
356
|
+
filter.pathPrefix.length
|
|
357
|
+
];
|
|
358
|
+
return [
|
|
359
|
+
hostRank,
|
|
360
|
+
host.length,
|
|
361
|
+
0,
|
|
362
|
+
0
|
|
363
|
+
];
|
|
364
|
+
}
|
|
198
365
|
// src/annotations.ts
|
|
199
366
|
function usesHttpProtocol(value) {
|
|
200
367
|
try {
|
|
@@ -251,6 +418,11 @@ const codeChangeStateSchema = z.enum([
|
|
|
251
418
|
const codeChangeInputSchema = z.object({
|
|
252
419
|
closedAt: z.date().optional(),
|
|
253
420
|
conversationIds: z.array(z.string().min(1)).default([]),
|
|
421
|
+
/**
|
|
422
|
+
* Whether the code change is a draft. When omitted, Junior keeps the
|
|
423
|
+
* stored value; a new code change is not a draft.
|
|
424
|
+
*/
|
|
425
|
+
draft: z.boolean().optional(),
|
|
254
426
|
mergedAt: z.date().optional(),
|
|
255
427
|
number: z.number().int().positive(),
|
|
256
428
|
openedAt: z.date(),
|
|
@@ -1739,6 +1911,7 @@ function defineJuniorPlugin(plugin) {
|
|
|
1739
1911
|
const parsed = pluginEventsSchema.safeParse(plugin.events);
|
|
1740
1912
|
if (!parsed.success) throw new Error(`Junior plugin "${name}" events is invalid.`, { cause: parsed.error });
|
|
1741
1913
|
}
|
|
1914
|
+
validateObjectLinks(name, plugin.objectLinks);
|
|
1742
1915
|
const conversationEventIds = /* @__PURE__ */ new Set();
|
|
1743
1916
|
for (const event of plugin.conversationEvents ?? []) {
|
|
1744
1917
|
if (!event || typeof event !== "object" && typeof event !== "function" || typeof event.parse !== "function" || typeof event.renderEvent !== "function") throw new Error(`Junior plugin "${name}" conversation event definitions must be created with defineConversationEvent().`);
|
|
@@ -1759,6 +1932,17 @@ function defineJuniorPlugin(plugin) {
|
|
|
1759
1932
|
}
|
|
1760
1933
|
return { ...plugin };
|
|
1761
1934
|
}
|
|
1935
|
+
function validateObjectLinks(name, links) {
|
|
1936
|
+
if (links === void 0) return;
|
|
1937
|
+
if (!Array.isArray(links)) throw new Error(`Junior plugin "${name}" objectLinks must be an array.`);
|
|
1938
|
+
for (const link of links) {
|
|
1939
|
+
if (!objectTypeSchema.safeParse(link?.objectType).success || typeof link.resolve !== "function" || !Array.isArray(link.filters) || link.filters.length === 0) throw new Error(`Junior plugin "${name}" object links need an objectType, filters, and a resolve function.`);
|
|
1940
|
+
for (const filter of link.filters) {
|
|
1941
|
+
const parsed = objectLinkFilterSchema.safeParse(filter);
|
|
1942
|
+
if (!parsed.success) throw new Error(`Junior plugin "${name}" has an invalid ${link.objectType} link filter.`, { cause: parsed.error });
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1762
1946
|
// src/user-pages.ts
|
|
1763
1947
|
/**
|
|
1764
1948
|
* Core-rendered plugin user pages.
|
|
@@ -1837,4 +2021,4 @@ const pluginUserPageInputSchema = z.object({
|
|
|
1837
2021
|
limit: z.number().int().min(1).max(50),
|
|
1838
2022
|
query: pluginUserPageQuerySchema
|
|
1839
2023
|
}).strict();
|
|
1840
|
-
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
|
|
2024
|
+
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, OBJECT_FACTS_MAX_BYTES, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsBytes, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectLinkFilterMatches, objectLinkFilterSchema, objectLinkFilterSpecificity, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
|