@sentry/junior-plugin-api 0.298.0 → 0.300.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 +1822 -1506
- package/dist/index.js +252 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { ZodTypeAny } from "zod";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
+
/** The longest object summary, in UTF-16 code units. */
|
|
5
|
+
export declare const OBJECT_SUMMARY_MAX_LENGTH = 280;
|
|
4
6
|
/** Small, provider-neutral facts. Missing values mean unknown, not success. */
|
|
5
7
|
export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
8
|
type: z.ZodLiteral<"code_change">;
|
|
9
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
7
10
|
author: z.ZodOptional<z.ZodString>;
|
|
8
11
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
9
12
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
@@ -22,8 +25,10 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
22
25
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
23
26
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
24
27
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
25
29
|
}, z.core.$strict>, z.ZodObject<{
|
|
26
30
|
type: z.ZodLiteral<"task">;
|
|
31
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
27
32
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
33
|
priority: z.ZodOptional<z.ZodString>;
|
|
29
34
|
project: z.ZodOptional<z.ZodString>;
|
|
@@ -32,17 +37,54 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
32
37
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
38
|
}, z.core.$strict>, z.ZodObject<{
|
|
34
39
|
type: z.ZodLiteral<"deployment">;
|
|
40
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
35
41
|
project: z.ZodOptional<z.ZodString>;
|
|
36
42
|
environment: z.ZodOptional<z.ZodString>;
|
|
37
43
|
revision: z.ZodOptional<z.ZodString>;
|
|
38
44
|
branch: z.ZodOptional<z.ZodString>;
|
|
39
45
|
}, z.core.$strict>, z.ZodObject<{
|
|
40
46
|
type: z.ZodLiteral<"calendar_event">;
|
|
47
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
41
48
|
when: z.ZodOptional<z.ZodString>;
|
|
42
49
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"conversation">;
|
|
52
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
53
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"document">;
|
|
57
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
58
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
59
|
+
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"message">;
|
|
62
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
63
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
64
|
+
author: z.ZodOptional<z.ZodString>;
|
|
65
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
66
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"web_page">;
|
|
68
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
69
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
70
|
+
author: z.ZodOptional<z.ZodString>;
|
|
71
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"person">;
|
|
74
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
75
|
+
email: z.ZodOptional<z.ZodString>;
|
|
76
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
77
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
78
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
43
79
|
}, z.core.$strict>], "type">;
|
|
44
80
|
export type ObjectFacts = z.output<typeof objectFactsSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* Make an object summary from plain text. Join whitespace and cut overlong
|
|
83
|
+
* text at a word, with an ellipsis. Empty text gives no summary.
|
|
84
|
+
*/
|
|
85
|
+
export declare function objectSummary(text: string): string | undefined;
|
|
45
86
|
type ObjectField = {
|
|
87
|
+
href?: string;
|
|
46
88
|
key: string;
|
|
47
89
|
label: string;
|
|
48
90
|
value: string;
|
|
@@ -54,12 +96,17 @@ export declare const objectTypeSchema: z.ZodEnum<{
|
|
|
54
96
|
automation: "automation";
|
|
55
97
|
calendar_event: "calendar_event";
|
|
56
98
|
code_change: "code_change";
|
|
99
|
+
conversation: "conversation";
|
|
57
100
|
deployment: "deployment";
|
|
101
|
+
document: "document";
|
|
58
102
|
item: "item";
|
|
103
|
+
message: "message";
|
|
104
|
+
person: "person";
|
|
59
105
|
task: "task";
|
|
106
|
+
web_page: "web_page";
|
|
60
107
|
}>;
|
|
61
108
|
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"];
|
|
109
|
+
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", "file", "comment", "globe", "package"];
|
|
63
110
|
export type ObjectIconName = (typeof objectIconNames)[number];
|
|
64
111
|
export type ObjectTone = "neutral" | "success" | "danger" | "warning" | "info" | "accent";
|
|
65
112
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -78,6 +125,10 @@ export declare function objectPresentation(object: {
|
|
|
78
125
|
export declare function objectIconPath(icon: ObjectIconName): string;
|
|
79
126
|
/** Return whether facts fit an object type. Deployment facts also fit an item. */
|
|
80
127
|
export declare function objectFactsMatchType(facts: ObjectFacts, objectType: ObjectType): boolean;
|
|
128
|
+
/** The largest size of object facts, in UTF-8 bytes of their JSON. */
|
|
129
|
+
export declare const OBJECT_FACTS_MAX_BYTES = 4096;
|
|
130
|
+
/** Return the size that the object facts limit counts. */
|
|
131
|
+
export declare function objectFactsBytes(facts: ObjectFacts): number;
|
|
81
132
|
/**
|
|
82
133
|
* Verified facts shared by Conversation annotations and Message cards.
|
|
83
134
|
* Plugins select small facts from responses they already have. Each surface owns
|
|
@@ -98,9 +149,14 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
98
149
|
automation: "automation";
|
|
99
150
|
calendar_event: "calendar_event";
|
|
100
151
|
code_change: "code_change";
|
|
152
|
+
conversation: "conversation";
|
|
101
153
|
deployment: "deployment";
|
|
154
|
+
document: "document";
|
|
102
155
|
item: "item";
|
|
156
|
+
message: "message";
|
|
157
|
+
person: "person";
|
|
103
158
|
task: "task";
|
|
159
|
+
web_page: "web_page";
|
|
104
160
|
}>;
|
|
105
161
|
title: z.ZodString;
|
|
106
162
|
url: z.ZodNullable<z.ZodURL>;
|
|
@@ -112,6 +168,7 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
112
168
|
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
113
169
|
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
114
170
|
type: z.ZodLiteral<"code_change">;
|
|
171
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
115
172
|
author: z.ZodOptional<z.ZodString>;
|
|
116
173
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
117
174
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
@@ -130,8 +187,10 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
130
187
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
131
188
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
132
189
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
133
191
|
}, z.core.$strict>, z.ZodObject<{
|
|
134
192
|
type: z.ZodLiteral<"task">;
|
|
193
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
135
194
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
136
195
|
priority: z.ZodOptional<z.ZodString>;
|
|
137
196
|
project: z.ZodOptional<z.ZodString>;
|
|
@@ -140,14 +199,45 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
140
199
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
200
|
}, z.core.$strict>, z.ZodObject<{
|
|
142
201
|
type: z.ZodLiteral<"deployment">;
|
|
202
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
143
203
|
project: z.ZodOptional<z.ZodString>;
|
|
144
204
|
environment: z.ZodOptional<z.ZodString>;
|
|
145
205
|
revision: z.ZodOptional<z.ZodString>;
|
|
146
206
|
branch: z.ZodOptional<z.ZodString>;
|
|
147
207
|
}, z.core.$strict>, z.ZodObject<{
|
|
148
208
|
type: z.ZodLiteral<"calendar_event">;
|
|
209
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
149
210
|
when: z.ZodOptional<z.ZodString>;
|
|
150
211
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
type: z.ZodLiteral<"conversation">;
|
|
214
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
215
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
217
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
+
type: z.ZodLiteral<"document">;
|
|
219
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
220
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
221
|
+
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
222
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
223
|
+
type: z.ZodLiteral<"message">;
|
|
224
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
225
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
226
|
+
author: z.ZodOptional<z.ZodString>;
|
|
227
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
228
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
229
|
+
type: z.ZodLiteral<"web_page">;
|
|
230
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
231
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
232
|
+
author: z.ZodOptional<z.ZodString>;
|
|
233
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
type: z.ZodLiteral<"person">;
|
|
236
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
237
|
+
email: z.ZodOptional<z.ZodString>;
|
|
238
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
239
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
240
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
151
241
|
}, z.core.$strict>], "type">>;
|
|
152
242
|
}, z.core.$strict>;
|
|
153
243
|
export type ObjectAnnotation = z.output<typeof objectAnnotationSchema>;
|
|
@@ -160,9 +250,14 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
160
250
|
automation: "automation";
|
|
161
251
|
calendar_event: "calendar_event";
|
|
162
252
|
code_change: "code_change";
|
|
253
|
+
conversation: "conversation";
|
|
163
254
|
deployment: "deployment";
|
|
255
|
+
document: "document";
|
|
164
256
|
item: "item";
|
|
257
|
+
message: "message";
|
|
258
|
+
person: "person";
|
|
165
259
|
task: "task";
|
|
260
|
+
web_page: "web_page";
|
|
166
261
|
}>;
|
|
167
262
|
title: z.ZodString;
|
|
168
263
|
url: z.ZodNullable<z.ZodURL>;
|
|
@@ -174,6 +269,7 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
174
269
|
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
175
270
|
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
271
|
type: z.ZodLiteral<"code_change">;
|
|
272
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
177
273
|
author: z.ZodOptional<z.ZodString>;
|
|
178
274
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
179
275
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
@@ -192,8 +288,10 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
192
288
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
193
289
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
194
290
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
291
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
195
292
|
}, z.core.$strict>, z.ZodObject<{
|
|
196
293
|
type: z.ZodLiteral<"task">;
|
|
294
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
197
295
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
198
296
|
priority: z.ZodOptional<z.ZodString>;
|
|
199
297
|
project: z.ZodOptional<z.ZodString>;
|
|
@@ -202,14 +300,45 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
202
300
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
203
301
|
}, z.core.$strict>, z.ZodObject<{
|
|
204
302
|
type: z.ZodLiteral<"deployment">;
|
|
303
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
205
304
|
project: z.ZodOptional<z.ZodString>;
|
|
206
305
|
environment: z.ZodOptional<z.ZodString>;
|
|
207
306
|
revision: z.ZodOptional<z.ZodString>;
|
|
208
307
|
branch: z.ZodOptional<z.ZodString>;
|
|
209
308
|
}, z.core.$strict>, z.ZodObject<{
|
|
210
309
|
type: z.ZodLiteral<"calendar_event">;
|
|
310
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
211
311
|
when: z.ZodOptional<z.ZodString>;
|
|
212
312
|
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
313
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
314
|
+
type: z.ZodLiteral<"conversation">;
|
|
315
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
316
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
317
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
318
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
319
|
+
type: z.ZodLiteral<"document">;
|
|
320
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
321
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
322
|
+
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
323
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
324
|
+
type: z.ZodLiteral<"message">;
|
|
325
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
326
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
327
|
+
author: z.ZodOptional<z.ZodString>;
|
|
328
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
329
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
330
|
+
type: z.ZodLiteral<"web_page">;
|
|
331
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
332
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
333
|
+
author: z.ZodOptional<z.ZodString>;
|
|
334
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
336
|
+
type: z.ZodLiteral<"person">;
|
|
337
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
338
|
+
email: z.ZodOptional<z.ZodString>;
|
|
339
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
340
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
341
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
213
342
|
}, z.core.$strict>], "type">>;
|
|
214
343
|
plugin: z.ZodString;
|
|
215
344
|
}, z.core.$strict>;
|
|
@@ -225,6 +354,11 @@ export declare const objectIconPaths: {
|
|
|
225
354
|
workflow: string[];
|
|
226
355
|
rocket: string[];
|
|
227
356
|
calendar: string[];
|
|
357
|
+
"comment-discussion": string[];
|
|
358
|
+
person: string[];
|
|
359
|
+
file: string[];
|
|
360
|
+
comment: string[];
|
|
361
|
+
globe: string[];
|
|
228
362
|
package: string[];
|
|
229
363
|
};
|
|
230
364
|
/** Exact non-blank actor user id that rejects the sentinel "unknown". */
|
|
@@ -726,473 +860,584 @@ export declare function isPrivateSource(source: Source): boolean;
|
|
|
726
860
|
export declare function getSourceKey(source: Source): string | undefined;
|
|
727
861
|
/** Narrow a runtime destination to the Slack-specific address shape. */
|
|
728
862
|
export declare function isSlackDestination(destination: Destination | undefined): destination is SlackDestination;
|
|
863
|
+
/** How Junior fetches one image. */
|
|
864
|
+
export interface ImageFetch {
|
|
865
|
+
/**
|
|
866
|
+
* Request headers, such as the plugin's credential. Junior sends them only
|
|
867
|
+
* to the origin of `url`, not after a redirect to another origin.
|
|
868
|
+
*/
|
|
869
|
+
headers?: Record<string, string>;
|
|
870
|
+
url: string;
|
|
871
|
+
}
|
|
872
|
+
/** Trusted host context for one image read. */
|
|
873
|
+
export interface ImageSourceContext extends PluginContext {
|
|
874
|
+
/** The signed-in person who sees the image. */
|
|
875
|
+
viewer: User;
|
|
876
|
+
}
|
|
729
877
|
/**
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
878
|
+
* Images that a plugin serves through the Junior image proxy. `resolve`
|
|
879
|
+
* checks that the viewer may see the image and returns how to fetch it.
|
|
880
|
+
* Return nothing when the viewer cannot see it. Junior checks the address,
|
|
881
|
+
* the type, and the size of each image, and caches it for every viewer.
|
|
734
882
|
*/
|
|
735
|
-
export
|
|
736
|
-
|
|
737
|
-
objectType: z.ZodOptional<z.ZodEnum<{
|
|
738
|
-
automation: "automation";
|
|
739
|
-
calendar_event: "calendar_event";
|
|
740
|
-
code_change: "code_change";
|
|
741
|
-
deployment: "deployment";
|
|
742
|
-
item: "item";
|
|
743
|
-
task: "task";
|
|
744
|
-
}>>;
|
|
745
|
-
key: z.ZodString;
|
|
746
|
-
label: z.ZodString;
|
|
747
|
-
url: z.ZodString;
|
|
748
|
-
description: z.ZodOptional<z.ZodString>;
|
|
749
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
750
|
-
closed: "closed";
|
|
751
|
-
draft: "draft";
|
|
752
|
-
merged: "merged";
|
|
753
|
-
open: "open";
|
|
754
|
-
warning: "warning";
|
|
755
|
-
}>>;
|
|
756
|
-
}, z.core.$strict>;
|
|
757
|
-
/** Core-known annotation shapes that plugins may attach to a conversation. */
|
|
758
|
-
export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
759
|
-
kind: z.ZodLiteral<"resource_link">;
|
|
760
|
-
objectType: z.ZodOptional<z.ZodEnum<{
|
|
761
|
-
automation: "automation";
|
|
762
|
-
calendar_event: "calendar_event";
|
|
763
|
-
code_change: "code_change";
|
|
764
|
-
deployment: "deployment";
|
|
765
|
-
item: "item";
|
|
766
|
-
task: "task";
|
|
767
|
-
}>>;
|
|
768
|
-
key: z.ZodString;
|
|
769
|
-
label: z.ZodString;
|
|
770
|
-
url: z.ZodString;
|
|
771
|
-
description: z.ZodOptional<z.ZodString>;
|
|
772
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
773
|
-
closed: "closed";
|
|
774
|
-
draft: "draft";
|
|
775
|
-
merged: "merged";
|
|
776
|
-
open: "open";
|
|
777
|
-
warning: "warning";
|
|
778
|
-
}>>;
|
|
779
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
780
|
-
kind: z.ZodLiteral<"object">;
|
|
781
|
-
key: z.ZodString;
|
|
782
|
-
label: z.ZodString;
|
|
783
|
-
objectType: z.ZodEnum<{
|
|
784
|
-
automation: "automation";
|
|
785
|
-
calendar_event: "calendar_event";
|
|
786
|
-
code_change: "code_change";
|
|
787
|
-
deployment: "deployment";
|
|
788
|
-
item: "item";
|
|
789
|
-
task: "task";
|
|
790
|
-
}>;
|
|
791
|
-
title: z.ZodString;
|
|
792
|
-
url: z.ZodNullable<z.ZodURL>;
|
|
793
|
-
description: z.ZodOptional<z.ZodString>;
|
|
794
|
-
status: z.ZodOptional<z.ZodString>;
|
|
795
|
-
trigger: z.ZodOptional<z.ZodString>;
|
|
796
|
-
warning: z.ZodOptional<z.ZodString>;
|
|
797
|
-
displayType: z.ZodOptional<z.ZodString>;
|
|
798
|
-
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
799
|
-
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
800
|
-
type: z.ZodLiteral<"code_change">;
|
|
801
|
-
author: z.ZodOptional<z.ZodString>;
|
|
802
|
-
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
803
|
-
targetBranch: z.ZodOptional<z.ZodString>;
|
|
804
|
-
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
805
|
-
review: z.ZodOptional<z.ZodEnum<{
|
|
806
|
-
approved: "approved";
|
|
807
|
-
changes_requested: "changes_requested";
|
|
808
|
-
required: "required";
|
|
809
|
-
}>>;
|
|
810
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
811
|
-
passed: z.ZodNumber;
|
|
812
|
-
failed: z.ZodNumber;
|
|
813
|
-
pending: z.ZodNumber;
|
|
814
|
-
}, z.core.$strict>>;
|
|
815
|
-
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
816
|
-
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
817
|
-
additions: z.ZodOptional<z.ZodNumber>;
|
|
818
|
-
deletions: z.ZodOptional<z.ZodNumber>;
|
|
819
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
820
|
-
type: z.ZodLiteral<"task">;
|
|
821
|
-
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
822
|
-
priority: z.ZodOptional<z.ZodString>;
|
|
823
|
-
project: z.ZodOptional<z.ZodString>;
|
|
824
|
-
cycle: z.ZodOptional<z.ZodString>;
|
|
825
|
-
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
826
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
827
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
828
|
-
type: z.ZodLiteral<"deployment">;
|
|
829
|
-
project: z.ZodOptional<z.ZodString>;
|
|
830
|
-
environment: z.ZodOptional<z.ZodString>;
|
|
831
|
-
revision: z.ZodOptional<z.ZodString>;
|
|
832
|
-
branch: z.ZodOptional<z.ZodString>;
|
|
833
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
834
|
-
type: z.ZodLiteral<"calendar_event">;
|
|
835
|
-
when: z.ZodOptional<z.ZodString>;
|
|
836
|
-
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
837
|
-
}, z.core.$strict>], "type">>;
|
|
838
|
-
}, z.core.$strict>], "kind">;
|
|
839
|
-
export type ConversationAnnotationInput = z.output<typeof conversationAnnotationInputSchema>;
|
|
840
|
-
export type ConversationAnnotation = ConversationAnnotationInput & {
|
|
841
|
-
plugin: string;
|
|
842
|
-
createdAt: string;
|
|
843
|
-
updatedAt: string;
|
|
844
|
-
};
|
|
845
|
-
export interface PluginAnnotations {
|
|
846
|
-
upsert(annotation: ConversationAnnotationInput): Promise<void>;
|
|
847
|
-
remove(kind: ConversationAnnotationInput["kind"], key: string): Promise<void>;
|
|
848
|
-
list(): Promise<ConversationAnnotation[]>;
|
|
849
|
-
}
|
|
850
|
-
export interface PluginConversationAnnotations {
|
|
851
|
-
forConversation(conversationId: string): PluginAnnotations;
|
|
883
|
+
export interface PluginImageSource {
|
|
884
|
+
resolve(ctx: ImageSourceContext, ref: string): Promise<ImageFetch | undefined>;
|
|
852
885
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
"triangle-alert": "triangle-alert";
|
|
860
|
-
}>;
|
|
861
|
-
export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
862
|
-
icon: z.ZodOptional<z.ZodEnum<{
|
|
863
|
-
"circle-dashed": "circle-dashed";
|
|
864
|
-
"circle-dot": "circle-dot";
|
|
865
|
-
"circle-x": "circle-x";
|
|
866
|
-
"git-merge": "git-merge";
|
|
867
|
-
"git-pull-request": "git-pull-request";
|
|
868
|
-
"triangle-alert": "triangle-alert";
|
|
869
|
-
}>>;
|
|
870
|
-
objectType: z.ZodOptional<z.ZodEnum<{
|
|
871
|
-
automation: "automation";
|
|
872
|
-
calendar_event: "calendar_event";
|
|
873
|
-
code_change: "code_change";
|
|
874
|
-
deployment: "deployment";
|
|
875
|
-
item: "item";
|
|
876
|
-
task: "task";
|
|
877
|
-
}>>;
|
|
878
|
-
status: z.ZodOptional<z.ZodString>;
|
|
879
|
-
key: z.ZodString;
|
|
880
|
-
label: z.ZodString;
|
|
886
|
+
declare const pluginGrantAccessSchema: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
887
|
+
/** Runtime schema for provider authorization a plugin may request. */
|
|
888
|
+
export declare const pluginAuthorizationSchema: z.ZodObject<{
|
|
889
|
+
provider: z.ZodString;
|
|
890
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
891
|
+
type: z.ZodLiteral<"oauth">;
|
|
881
892
|
}, z.core.$strict>;
|
|
882
|
-
|
|
883
|
-
export
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
export interface ConversationSidebarResult {
|
|
889
|
-
/** Sidebar annotations in display order. Put the newest annotation first. */
|
|
890
|
-
annotationsByConversationId: Record<string, ConversationSidebarAnnotation[]>;
|
|
891
|
-
}
|
|
892
|
-
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
893
|
-
closed: "closed";
|
|
894
|
-
merged: "merged";
|
|
895
|
-
open: "open";
|
|
896
|
-
}>;
|
|
897
|
-
export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
898
|
-
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
899
|
-
closedAt: z.ZodOptional<z.ZodDate>;
|
|
900
|
-
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
901
|
-
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
902
|
-
number: z.ZodNumber;
|
|
903
|
-
openedAt: z.ZodDate;
|
|
904
|
-
providerId: z.ZodString;
|
|
905
|
-
repository: z.ZodObject<{
|
|
906
|
-
name: z.ZodString;
|
|
907
|
-
providerId: z.ZodString;
|
|
908
|
-
url: z.ZodOptional<z.ZodString>;
|
|
909
|
-
}, z.core.$strict>;
|
|
910
|
-
state: z.ZodEnum<{
|
|
911
|
-
closed: "closed";
|
|
912
|
-
merged: "merged";
|
|
913
|
-
open: "open";
|
|
914
|
-
}>;
|
|
915
|
-
title: z.ZodOptional<z.ZodString>;
|
|
916
|
-
updatedAt: z.ZodDate;
|
|
893
|
+
/** Runtime schema for a provider account attached to stored OAuth tokens. */
|
|
894
|
+
export declare const pluginProviderAccountSchema: z.ZodObject<{
|
|
895
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
896
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
897
|
+
id: z.ZodString;
|
|
898
|
+
label: z.ZodOptional<z.ZodString>;
|
|
917
899
|
url: z.ZodOptional<z.ZodString>;
|
|
900
|
+
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
918
901
|
}, z.core.$strict>;
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
repositoryProviderId: string;
|
|
935
|
-
}): Promise<void>;
|
|
936
|
-
}
|
|
937
|
-
export declare const conversationEventIconSchema: z.ZodEnum<{
|
|
938
|
-
activity: "activity";
|
|
939
|
-
brain: "brain";
|
|
940
|
-
calendar: "calendar";
|
|
941
|
-
check: "check";
|
|
942
|
-
database: "database";
|
|
943
|
-
info: "info";
|
|
944
|
-
key: "key";
|
|
945
|
-
link: "link";
|
|
946
|
-
sparkles: "sparkles";
|
|
947
|
-
warning: "warning";
|
|
948
|
-
}>;
|
|
949
|
-
/** Safe, core-rendered presentation for one plugin conversation event. */
|
|
950
|
-
export declare const conversationEventPresentationSchema: z.ZodObject<{
|
|
951
|
-
details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
952
|
-
content: z.ZodOptional<z.ZodString>;
|
|
953
|
-
description: z.ZodOptional<z.ZodString>;
|
|
954
|
-
metadata: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
955
|
-
title: z.ZodString;
|
|
956
|
-
}, z.core.$strict>>>;
|
|
957
|
-
icon: z.ZodOptional<z.ZodEnum<{
|
|
958
|
-
activity: "activity";
|
|
959
|
-
brain: "brain";
|
|
960
|
-
calendar: "calendar";
|
|
961
|
-
check: "check";
|
|
962
|
-
database: "database";
|
|
963
|
-
info: "info";
|
|
964
|
-
key: "key";
|
|
965
|
-
link: "link";
|
|
966
|
-
sparkles: "sparkles";
|
|
967
|
-
warning: "warning";
|
|
968
|
-
}>>;
|
|
969
|
-
preview: z.ZodOptional<z.ZodString>;
|
|
970
|
-
title: z.ZodString;
|
|
902
|
+
/** Runtime schema for OAuth tokens stored by the host for plugin credentials. */
|
|
903
|
+
export declare const pluginStoredTokensSchema: z.ZodObject<{
|
|
904
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
905
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
906
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
907
|
+
id: z.ZodString;
|
|
908
|
+
label: z.ZodOptional<z.ZodString>;
|
|
909
|
+
url: z.ZodOptional<z.ZodString>;
|
|
910
|
+
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
911
|
+
}, z.core.$strict>>;
|
|
912
|
+
accessToken: z.ZodString;
|
|
913
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
914
|
+
refreshToken: z.ZodString;
|
|
915
|
+
refreshTokenExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
916
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
971
917
|
}, z.core.$strict>;
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
918
|
+
/**
|
|
919
|
+
* Provider facts for egress audit events, such as the target repository.
|
|
920
|
+
* Keys use the plugin's `app.<provider>.*` names. Telemetry only.
|
|
921
|
+
*/
|
|
922
|
+
export declare const pluginAuditAttributesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
923
|
+
/** Runtime schema for a plugin-defined outbound credential grant. */
|
|
924
|
+
export declare const pluginGrantSchema: z.ZodObject<{
|
|
925
|
+
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
926
|
+
auditAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
927
|
+
leaseScope: z.ZodOptional<z.ZodString>;
|
|
928
|
+
name: z.ZodString;
|
|
929
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
930
|
+
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
931
|
+
}, z.core.$strict>;
|
|
932
|
+
/** Runtime schema for plugin-issued header mutations. */
|
|
933
|
+
export declare const pluginCredentialHeaderTransformSchema: z.ZodObject<{
|
|
934
|
+
domain: z.ZodString;
|
|
935
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
936
|
+
}, z.core.$strict>;
|
|
937
|
+
/** Runtime schema for a short-lived plugin-issued credential lease. */
|
|
938
|
+
export declare const pluginCredentialLeaseSchema: z.ZodObject<{
|
|
939
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
940
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
941
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
942
|
+
id: z.ZodString;
|
|
943
|
+
label: z.ZodOptional<z.ZodString>;
|
|
944
|
+
url: z.ZodOptional<z.ZodString>;
|
|
945
|
+
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
946
|
+
}, z.core.$strict>>;
|
|
947
|
+
authorization: z.ZodOptional<z.ZodObject<{
|
|
948
|
+
provider: z.ZodString;
|
|
949
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
950
|
+
type: z.ZodLiteral<"oauth">;
|
|
951
|
+
}, z.core.$strict>>;
|
|
952
|
+
expiresAt: z.ZodString;
|
|
953
|
+
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
954
|
+
domain: z.ZodString;
|
|
955
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
956
|
+
}, z.core.$strict>>;
|
|
957
|
+
}, z.core.$strict>;
|
|
958
|
+
/** Runtime schema for the result returned by a plugin credential hook. */
|
|
959
|
+
export declare const pluginCredentialResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
960
|
+
lease: z.ZodObject<{
|
|
961
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
962
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
963
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
964
|
+
id: z.ZodString;
|
|
965
|
+
label: z.ZodOptional<z.ZodString>;
|
|
966
|
+
url: z.ZodOptional<z.ZodString>;
|
|
967
|
+
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
968
|
+
}, z.core.$strict>>;
|
|
969
|
+
authorization: z.ZodOptional<z.ZodObject<{
|
|
970
|
+
provider: z.ZodString;
|
|
971
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
972
|
+
type: z.ZodLiteral<"oauth">;
|
|
973
|
+
}, z.core.$strict>>;
|
|
974
|
+
expiresAt: z.ZodString;
|
|
975
|
+
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
976
|
+
domain: z.ZodString;
|
|
977
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
978
|
+
}, z.core.$strict>>;
|
|
979
|
+
}, z.core.$strict>;
|
|
980
|
+
type: z.ZodLiteral<"lease">;
|
|
981
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
982
|
+
authorization: z.ZodOptional<z.ZodObject<{
|
|
983
|
+
provider: z.ZodString;
|
|
984
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
985
|
+
type: z.ZodLiteral<"oauth">;
|
|
986
|
+
}, z.core.$strict>>;
|
|
987
|
+
message: z.ZodString;
|
|
988
|
+
type: z.ZodLiteral<"needed">;
|
|
989
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
990
|
+
message: z.ZodString;
|
|
991
|
+
type: z.ZodLiteral<"unavailable">;
|
|
992
|
+
}, z.core.$strict>], "type">;
|
|
993
|
+
export type PluginCredentialSubject = z.output<typeof pluginCredentialSubjectSchema>;
|
|
994
|
+
export type PluginGrantAccess = z.output<typeof pluginGrantAccessSchema>;
|
|
995
|
+
/** Provider authorization Junior can start when a plugin-owned grant is missing. */
|
|
996
|
+
export type PluginAuthorization = z.output<typeof pluginAuthorizationSchema>;
|
|
997
|
+
/** Interrupt sandbox egress so Junior can start provider authorization. */
|
|
998
|
+
export declare class EgressAuthRequired extends Error {
|
|
999
|
+
authorization?: PluginAuthorization;
|
|
1000
|
+
constructor(message: string, options?: {
|
|
1001
|
+
authorization?: PluginAuthorization;
|
|
1002
|
+
cause?: unknown;
|
|
1003
|
+
});
|
|
977
1004
|
}
|
|
978
|
-
/**
|
|
979
|
-
export
|
|
980
|
-
|
|
981
|
-
readonly
|
|
982
|
-
|
|
983
|
-
|
|
1005
|
+
/** Deny provider egress before Junior issues credentials for a disallowed operation. */
|
|
1006
|
+
export declare class EgressPolicyDenied extends Error {
|
|
1007
|
+
/** Provider facts for the policy denial event. */
|
|
1008
|
+
readonly auditAttributes?: PluginAuditAttributes;
|
|
1009
|
+
constructor(message: string, options?: {
|
|
1010
|
+
auditAttributes?: PluginAuditAttributes;
|
|
1011
|
+
cause?: unknown;
|
|
1012
|
+
});
|
|
984
1013
|
}
|
|
985
|
-
/**
|
|
986
|
-
export
|
|
987
|
-
|
|
1014
|
+
/** Provider facts for egress audit events. */
|
|
1015
|
+
export type PluginAuditAttributes = z.output<typeof pluginAuditAttributesSchema>;
|
|
1016
|
+
/** Provider account identity resolved by a plugin OAuth hook. */
|
|
1017
|
+
export type PluginProviderAccount = z.output<typeof pluginProviderAccountSchema>;
|
|
1018
|
+
/** Plugin-defined grant required before Junior can forward one outbound request. */
|
|
1019
|
+
export type PluginGrant = z.output<typeof pluginGrantSchema>;
|
|
1020
|
+
/** One ref update command in a Git push. */
|
|
1021
|
+
export interface PluginGitRefUpdate {
|
|
1022
|
+
/** True when the push deletes the ref: its new object id is all zeros. */
|
|
1023
|
+
deletes: boolean;
|
|
1024
|
+
/** Full ref name, such as `refs/heads/main`. */
|
|
1025
|
+
ref: string;
|
|
988
1026
|
}
|
|
989
|
-
/**
|
|
990
|
-
export
|
|
1027
|
+
/** Why the host could not read the ref updates of a Git push. */
|
|
1028
|
+
export type PluginGitPushUnreadableReason = "gzip" | "malformed" | "signed" | "unterminated";
|
|
1029
|
+
/**
|
|
1030
|
+
* Ref updates of a Git smart HTTP push (`git-receive-pack`), which the host
|
|
1031
|
+
* reads from the body before the pack data. An `unreadable` push changes
|
|
1032
|
+
* refs that the host cannot name.
|
|
1033
|
+
*/
|
|
1034
|
+
export type PluginGitPush = {
|
|
1035
|
+
kind: "commands";
|
|
1036
|
+
updates: PluginGitRefUpdate[];
|
|
1037
|
+
} | {
|
|
1038
|
+
kind: "unreadable";
|
|
1039
|
+
reason: PluginGitPushUnreadableReason;
|
|
1040
|
+
};
|
|
1041
|
+
/** One field that a GraphQL operation selects. */
|
|
1042
|
+
export interface PluginGraphqlField {
|
|
1043
|
+
/** Names of the arguments that the field passes. */
|
|
1044
|
+
arguments: string[];
|
|
1045
|
+
/** Schema field name. An alias does not replace it. */
|
|
991
1046
|
name: string;
|
|
992
|
-
version: number;
|
|
993
|
-
schema: TSchema;
|
|
994
|
-
renderEvent(event: z.output<TSchema>): z.input<typeof conversationEventPresentationSchema> | undefined;
|
|
995
|
-
}): DefinedConversationEvent<z.input<TSchema>>;
|
|
996
|
-
/** Conversation-bound event writer supplied by Junior core. */
|
|
997
|
-
export interface PluginConversationEvents {
|
|
998
|
-
emit(event: PluginConversationEventValue): Promise<void>;
|
|
999
1047
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
/**
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
/** Read events owned by the current plugin namespace after Conversation access checks. */
|
|
1015
|
-
export interface PluginConversationEventReader {
|
|
1016
|
-
list(input: {
|
|
1017
|
-
conversationId: string;
|
|
1018
|
-
eventName: string;
|
|
1019
|
-
viewer: User;
|
|
1020
|
-
}): Promise<PluginConversationEventRecord[] | undefined>;
|
|
1048
|
+
/** The GraphQL operation that one request runs. */
|
|
1049
|
+
export interface PluginGraphqlOperation {
|
|
1050
|
+
/**
|
|
1051
|
+
* Each distinct field that the operation selects at any depth, also through
|
|
1052
|
+
* fragments.
|
|
1053
|
+
*/
|
|
1054
|
+
fields: PluginGraphqlField[];
|
|
1055
|
+
name?: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Field names at the operation root, also through fragments. There is one
|
|
1058
|
+
* entry for each field selection, so an aliased repeat shows twice.
|
|
1059
|
+
*/
|
|
1060
|
+
rootFields: string[];
|
|
1061
|
+
type: "mutation" | "query" | "subscription";
|
|
1021
1062
|
}
|
|
1022
1063
|
/**
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
* `
|
|
1064
|
+
* Why the host could not read the operation of a GraphQL request:
|
|
1065
|
+
*
|
|
1066
|
+
* - `document`: the query does not parse, or it spreads a fragment that it
|
|
1067
|
+
* does not define.
|
|
1068
|
+
* - `gzip`: the body is compressed.
|
|
1069
|
+
* - `json`: the body is not a JSON object or a JSON array of objects.
|
|
1070
|
+
* - `operation`: `operationName` names no operation, or the document has more
|
|
1071
|
+
* than one operation and no `operationName`.
|
|
1072
|
+
* - `query`: the body has no `query` string, such as a persisted query hash.
|
|
1073
|
+
* - `too-large`: the body is larger than the host reads before it issues
|
|
1074
|
+
* credentials.
|
|
1029
1075
|
*/
|
|
1030
|
-
export
|
|
1031
|
-
readonly afterToolExecute: "after_tool_execute_model_called";
|
|
1032
|
-
readonly task: "task_model_called";
|
|
1033
|
-
readonly tool: "tool_model_called";
|
|
1034
|
-
readonly userPrompt: "user_prompt_model_called";
|
|
1035
|
-
};
|
|
1036
|
-
/** Whether an event name is one of `pluginModelCostEventNames`. */
|
|
1037
|
-
export declare function isPluginModelCostEventName(eventName: string): boolean;
|
|
1076
|
+
export type PluginGraphqlUnreadableReason = "document" | "gzip" | "json" | "operation" | "query" | "too-large";
|
|
1038
1077
|
/**
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1078
|
+
* The operations of a GraphQL POST, which the host reads from the JSON body.
|
|
1079
|
+
* A `batch` is a JSON array of requests. An `unreadable` request can run any
|
|
1080
|
+
* operation, mutations included.
|
|
1081
|
+
*/
|
|
1082
|
+
export type PluginGraphqlRequest = {
|
|
1083
|
+
kind: "batch";
|
|
1084
|
+
operations: PluginGraphqlOperation[];
|
|
1085
|
+
} | {
|
|
1086
|
+
kind: "operation";
|
|
1087
|
+
operation: PluginGraphqlOperation;
|
|
1088
|
+
} | {
|
|
1089
|
+
kind: "unreadable";
|
|
1090
|
+
reason: PluginGraphqlUnreadableReason;
|
|
1091
|
+
};
|
|
1092
|
+
/** Request details available while selecting the grant for sandbox egress. */
|
|
1093
|
+
export interface PluginEgressRequest {
|
|
1094
|
+
/**
|
|
1095
|
+
* Capped request body text when the host exposes it for provider-specific
|
|
1096
|
+
* grant classification.
|
|
1097
|
+
*/
|
|
1098
|
+
bodyText?: string;
|
|
1099
|
+
/** Set for every Git `git-receive-pack` POST. */
|
|
1100
|
+
gitPush?: PluginGitPush;
|
|
1101
|
+
/** Set for every POST to a URL path that ends in `/graphql`. */
|
|
1102
|
+
graphql?: PluginGraphqlRequest;
|
|
1103
|
+
method: string;
|
|
1104
|
+
/** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
|
|
1105
|
+
operation?: string;
|
|
1106
|
+
url: string;
|
|
1051
1107
|
}
|
|
1052
|
-
export interface
|
|
1053
|
-
|
|
1054
|
-
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
1055
|
-
set(key: string, value: unknown, ttlMs?: number): Promise<void>;
|
|
1056
|
-
setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
|
|
1057
|
-
withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>): Promise<T>;
|
|
1108
|
+
export interface EgressHookContext extends PluginContext {
|
|
1109
|
+
request: PluginEgressRequest;
|
|
1058
1110
|
}
|
|
1059
|
-
export interface
|
|
1060
|
-
|
|
1111
|
+
export interface PluginEgressResponse {
|
|
1112
|
+
/** Snapshot of upstream response headers; mutations do not affect pass-through. */
|
|
1113
|
+
headers: Headers;
|
|
1114
|
+
readText(maxBytes: number): Promise<string | undefined>;
|
|
1115
|
+
status: number;
|
|
1061
1116
|
}
|
|
1062
|
-
export
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
export declare const promptContextSchema: z.ZodObject<{
|
|
1068
|
-
kind: z.ZodString;
|
|
1069
|
-
version: z.ZodNumber;
|
|
1070
|
-
content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1071
|
-
}, z.core.$strict>;
|
|
1072
|
-
/** Structured plugin context retained alongside its model-visible rendering. */
|
|
1073
|
-
type PromptContext = z.output<typeof promptContextSchema>;
|
|
1074
|
-
/** Runtime contribution produced from one validated plugin context value. */
|
|
1075
|
-
interface PromptContextContribution {
|
|
1076
|
-
context: PromptContext;
|
|
1077
|
-
renderPrompt(): string;
|
|
1117
|
+
export interface EgressResponseHookContext extends PluginContext {
|
|
1118
|
+
grant: PluginGrant;
|
|
1119
|
+
permissionDenied(message: string): void;
|
|
1120
|
+
request: Omit<PluginEgressRequest, "bodyText" | "gitPush" | "graphql">;
|
|
1121
|
+
response: PluginEgressResponse;
|
|
1078
1122
|
}
|
|
1079
|
-
/**
|
|
1080
|
-
export
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
platform: Platform;
|
|
1123
|
+
/** Header mutations a plugin-issued credential lease may apply to owned domains. */
|
|
1124
|
+
export type PluginCredentialHeaderTransform = z.output<typeof pluginCredentialHeaderTransformSchema>;
|
|
1125
|
+
/** Short-lived credential headers issued by a plugin for a selected grant. */
|
|
1126
|
+
export type PluginCredentialLease = z.output<typeof pluginCredentialLeaseSchema>;
|
|
1127
|
+
export type PluginCredentialResult = z.output<typeof pluginCredentialResultSchema>;
|
|
1128
|
+
export type PluginCredentialActor = {
|
|
1129
|
+
platform: "system";
|
|
1130
|
+
name: string;
|
|
1131
|
+
} | {
|
|
1132
|
+
type: "user";
|
|
1133
|
+
userId: string;
|
|
1091
1134
|
};
|
|
1092
|
-
|
|
1093
|
-
type
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
|
|
1135
|
+
export interface PluginResolvedCredentialUser {
|
|
1136
|
+
type: "user";
|
|
1137
|
+
userId: string;
|
|
1138
|
+
}
|
|
1139
|
+
export type PluginStoredTokens = z.output<typeof pluginStoredTokensSchema>;
|
|
1140
|
+
export interface PluginUserTokenSlot {
|
|
1141
|
+
get(): Promise<PluginStoredTokens | undefined>;
|
|
1142
|
+
set(tokens: PluginStoredTokens): Promise<void>;
|
|
1143
|
+
/** Run token refresh work after the host has serialized this user/provider slot, or throw after a bounded wait. */
|
|
1144
|
+
withRefresh<T>(callback: () => Promise<T>): Promise<T>;
|
|
1145
|
+
userId: string;
|
|
1146
|
+
}
|
|
1147
|
+
export interface PluginTokenStore {
|
|
1148
|
+
credentialSubject?: PluginUserTokenSlot;
|
|
1149
|
+
currentUser?: PluginUserTokenSlot;
|
|
1150
|
+
}
|
|
1151
|
+
export interface ResolveOAuthAccountHookContext extends PluginContext {
|
|
1152
|
+
tokens: PluginStoredTokens;
|
|
1102
1153
|
/**
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
* non-finite values.
|
|
1154
|
+
* Parsed JSON body of the provider token response. Some providers return
|
|
1155
|
+
* the authorized account in this body.
|
|
1106
1156
|
*/
|
|
1107
|
-
|
|
1108
|
-
/** Location associated with this Conversation. */
|
|
1109
|
-
locationId?: string;
|
|
1110
|
-
actor?: Actor;
|
|
1111
|
-
source: Source;
|
|
1112
|
-
state: PluginState;
|
|
1113
|
-
text: string;
|
|
1114
|
-
users: {
|
|
1115
|
-
/** Resolve the current Actor's Identity and User. */
|
|
1116
|
-
resolveActor(): Promise<{
|
|
1117
|
-
identity: Identity;
|
|
1118
|
-
user?: User;
|
|
1119
|
-
} | undefined>;
|
|
1120
|
-
};
|
|
1121
|
-
};
|
|
1122
|
-
export type DestinationVisibility = z.output<typeof destinationVisibilitySchema>;
|
|
1123
|
-
export type DispatchOptions = z.output<typeof dispatchOptionsSchema>;
|
|
1124
|
-
/** Compact destination-visible context explaining what produced a reply. */
|
|
1125
|
-
export type ReplyAttribution = z.output<typeof replyAttributionSchema>;
|
|
1126
|
-
export type TaskOutcome = z.output<typeof taskOutcomeSchema>;
|
|
1127
|
-
export interface DispatchResult {
|
|
1128
|
-
id: string;
|
|
1129
|
-
status: "created" | "already_exists";
|
|
1157
|
+
tokenResponse: Record<string, unknown>;
|
|
1130
1158
|
}
|
|
1131
|
-
export interface
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1159
|
+
export interface IssueCredentialHookContext extends PluginContext {
|
|
1160
|
+
actor: PluginCredentialActor;
|
|
1161
|
+
credentialSubject?: PluginResolvedCredentialUser;
|
|
1162
|
+
grant: PluginGrant;
|
|
1163
|
+
tokens: PluginTokenStore;
|
|
1136
1164
|
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
export declare const
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1165
|
+
/**
|
|
1166
|
+
* Link an object to a Conversation when the owner has no typed object preview.
|
|
1167
|
+
* Keep a stable key, compact label, source URL, and optional short context or
|
|
1168
|
+
* status. Do not fetch a full object merely to save a link. Rich preview intent
|
|
1169
|
+
* belongs to objectAnnotationSchema, not a second set of resource-link fields.
|
|
1170
|
+
*/
|
|
1171
|
+
export declare const resourceLinkAnnotationSchema: z.ZodObject<{
|
|
1172
|
+
kind: z.ZodLiteral<"resource_link">;
|
|
1173
|
+
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1174
|
+
automation: "automation";
|
|
1175
|
+
calendar_event: "calendar_event";
|
|
1176
|
+
code_change: "code_change";
|
|
1177
|
+
conversation: "conversation";
|
|
1178
|
+
deployment: "deployment";
|
|
1179
|
+
document: "document";
|
|
1180
|
+
item: "item";
|
|
1181
|
+
message: "message";
|
|
1182
|
+
person: "person";
|
|
1183
|
+
task: "task";
|
|
1184
|
+
web_page: "web_page";
|
|
1185
|
+
}>>;
|
|
1186
|
+
key: z.ZodString;
|
|
1187
|
+
label: z.ZodString;
|
|
1188
|
+
url: z.ZodString;
|
|
1189
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1190
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
1191
|
+
closed: "closed";
|
|
1192
|
+
draft: "draft";
|
|
1193
|
+
merged: "merged";
|
|
1194
|
+
open: "open";
|
|
1195
|
+
warning: "warning";
|
|
1160
1196
|
}>>;
|
|
1161
|
-
events: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1162
1197
|
}, z.core.$strict>;
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1198
|
+
/** Core-known annotation shapes that plugins may attach to a conversation. */
|
|
1199
|
+
export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1200
|
+
kind: z.ZodLiteral<"resource_link">;
|
|
1201
|
+
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1202
|
+
automation: "automation";
|
|
1203
|
+
calendar_event: "calendar_event";
|
|
1204
|
+
code_change: "code_change";
|
|
1205
|
+
conversation: "conversation";
|
|
1206
|
+
deployment: "deployment";
|
|
1207
|
+
document: "document";
|
|
1208
|
+
item: "item";
|
|
1209
|
+
message: "message";
|
|
1210
|
+
person: "person";
|
|
1211
|
+
task: "task";
|
|
1212
|
+
web_page: "web_page";
|
|
1175
1213
|
}>>;
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1214
|
+
key: z.ZodString;
|
|
1215
|
+
label: z.ZodString;
|
|
1216
|
+
url: z.ZodString;
|
|
1217
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1218
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
1219
|
+
closed: "closed";
|
|
1220
|
+
draft: "draft";
|
|
1221
|
+
merged: "merged";
|
|
1222
|
+
open: "open";
|
|
1223
|
+
warning: "warning";
|
|
1224
|
+
}>>;
|
|
1225
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1226
|
+
kind: z.ZodLiteral<"object">;
|
|
1227
|
+
key: z.ZodString;
|
|
1228
|
+
label: z.ZodString;
|
|
1229
|
+
objectType: z.ZodEnum<{
|
|
1230
|
+
automation: "automation";
|
|
1231
|
+
calendar_event: "calendar_event";
|
|
1232
|
+
code_change: "code_change";
|
|
1233
|
+
conversation: "conversation";
|
|
1234
|
+
deployment: "deployment";
|
|
1235
|
+
document: "document";
|
|
1236
|
+
item: "item";
|
|
1237
|
+
message: "message";
|
|
1238
|
+
person: "person";
|
|
1239
|
+
task: "task";
|
|
1240
|
+
web_page: "web_page";
|
|
1241
|
+
}>;
|
|
1242
|
+
title: z.ZodString;
|
|
1243
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
1244
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1245
|
+
status: z.ZodOptional<z.ZodString>;
|
|
1246
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
1247
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
1248
|
+
displayType: z.ZodOptional<z.ZodString>;
|
|
1249
|
+
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1250
|
+
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1251
|
+
type: z.ZodLiteral<"code_change">;
|
|
1252
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1253
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1254
|
+
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
1255
|
+
targetBranch: z.ZodOptional<z.ZodString>;
|
|
1256
|
+
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1257
|
+
review: z.ZodOptional<z.ZodEnum<{
|
|
1258
|
+
approved: "approved";
|
|
1259
|
+
changes_requested: "changes_requested";
|
|
1260
|
+
required: "required";
|
|
1261
|
+
}>>;
|
|
1262
|
+
checks: z.ZodOptional<z.ZodObject<{
|
|
1263
|
+
passed: z.ZodNumber;
|
|
1264
|
+
failed: z.ZodNumber;
|
|
1265
|
+
pending: z.ZodNumber;
|
|
1266
|
+
}, z.core.$strict>>;
|
|
1267
|
+
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
1268
|
+
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
1269
|
+
additions: z.ZodOptional<z.ZodNumber>;
|
|
1270
|
+
deletions: z.ZodOptional<z.ZodNumber>;
|
|
1271
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
1272
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1273
|
+
type: z.ZodLiteral<"task">;
|
|
1274
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1275
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1276
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
1277
|
+
project: z.ZodOptional<z.ZodString>;
|
|
1278
|
+
cycle: z.ZodOptional<z.ZodString>;
|
|
1279
|
+
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
1280
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1281
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1282
|
+
type: z.ZodLiteral<"deployment">;
|
|
1283
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1284
|
+
project: z.ZodOptional<z.ZodString>;
|
|
1285
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
1286
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
1287
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1288
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1289
|
+
type: z.ZodLiteral<"calendar_event">;
|
|
1290
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1291
|
+
when: z.ZodOptional<z.ZodString>;
|
|
1292
|
+
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1293
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1294
|
+
type: z.ZodLiteral<"conversation">;
|
|
1295
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1296
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1297
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1298
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1299
|
+
type: z.ZodLiteral<"document">;
|
|
1300
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1301
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
1302
|
+
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1303
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1304
|
+
type: z.ZodLiteral<"message">;
|
|
1305
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1306
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
1307
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1308
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1309
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1310
|
+
type: z.ZodLiteral<"web_page">;
|
|
1311
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1312
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
1313
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1314
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
1315
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1316
|
+
type: z.ZodLiteral<"person">;
|
|
1317
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1318
|
+
email: z.ZodOptional<z.ZodString>;
|
|
1319
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
1320
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
1321
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
1322
|
+
}, z.core.$strict>], "type">>;
|
|
1323
|
+
}, z.core.$strict>], "kind">;
|
|
1324
|
+
export type ConversationAnnotationInput = z.output<typeof conversationAnnotationInputSchema>;
|
|
1325
|
+
export type ConversationAnnotation = ConversationAnnotationInput & {
|
|
1326
|
+
plugin: string;
|
|
1327
|
+
createdAt: string;
|
|
1328
|
+
updatedAt: string;
|
|
1329
|
+
};
|
|
1330
|
+
export interface PluginAnnotations {
|
|
1331
|
+
upsert(annotation: ConversationAnnotationInput): Promise<void>;
|
|
1332
|
+
remove(kind: ConversationAnnotationInput["kind"], key: string): Promise<void>;
|
|
1333
|
+
list(): Promise<ConversationAnnotation[]>;
|
|
1334
|
+
}
|
|
1335
|
+
export interface PluginConversationAnnotations {
|
|
1336
|
+
forConversation(conversationId: string): PluginAnnotations;
|
|
1337
|
+
}
|
|
1338
|
+
export declare const conversationSidebarIconSchema: z.ZodEnum<{
|
|
1339
|
+
"circle-dashed": "circle-dashed";
|
|
1340
|
+
"circle-dot": "circle-dot";
|
|
1341
|
+
"circle-x": "circle-x";
|
|
1342
|
+
"git-merge": "git-merge";
|
|
1343
|
+
"git-pull-request": "git-pull-request";
|
|
1344
|
+
"triangle-alert": "triangle-alert";
|
|
1345
|
+
}>;
|
|
1346
|
+
export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
1347
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
1348
|
+
"circle-dashed": "circle-dashed";
|
|
1349
|
+
"circle-dot": "circle-dot";
|
|
1350
|
+
"circle-x": "circle-x";
|
|
1351
|
+
"git-merge": "git-merge";
|
|
1352
|
+
"git-pull-request": "git-pull-request";
|
|
1353
|
+
"triangle-alert": "triangle-alert";
|
|
1354
|
+
}>>;
|
|
1355
|
+
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1356
|
+
automation: "automation";
|
|
1357
|
+
calendar_event: "calendar_event";
|
|
1358
|
+
code_change: "code_change";
|
|
1359
|
+
conversation: "conversation";
|
|
1360
|
+
deployment: "deployment";
|
|
1361
|
+
document: "document";
|
|
1362
|
+
item: "item";
|
|
1363
|
+
message: "message";
|
|
1364
|
+
person: "person";
|
|
1365
|
+
task: "task";
|
|
1366
|
+
web_page: "web_page";
|
|
1367
|
+
}>>;
|
|
1368
|
+
status: z.ZodOptional<z.ZodString>;
|
|
1369
|
+
key: z.ZodString;
|
|
1370
|
+
label: z.ZodString;
|
|
1371
|
+
}, z.core.$strict>;
|
|
1372
|
+
export type ConversationSidebarAnnotation = z.output<typeof conversationSidebarAnnotationSchema>;
|
|
1373
|
+
export interface ConversationSidebarHookContext extends PluginContext {
|
|
1374
|
+
/** Stored annotations owned by this plugin, keyed by candidate conversation. */
|
|
1375
|
+
annotationsByConversationId: Record<string, ConversationAnnotation[]>;
|
|
1376
|
+
conversationIds: string[];
|
|
1377
|
+
}
|
|
1378
|
+
export interface ConversationSidebarResult {
|
|
1379
|
+
/** Sidebar annotations in display order. Put the newest annotation first. */
|
|
1380
|
+
annotationsByConversationId: Record<string, ConversationSidebarAnnotation[]>;
|
|
1381
|
+
}
|
|
1382
|
+
export declare const EVENT_SUMMARY_MAX_LENGTH = 4000;
|
|
1383
|
+
export declare const EVENT_TEXT_MAX_LENGTH = 8000;
|
|
1384
|
+
export declare const EVENT_DATA_MAX_KEYS = 32;
|
|
1385
|
+
export declare const EVENT_DATA_MAX_JSON_BYTES = 4000;
|
|
1386
|
+
export declare const EVENT_GUIDANCE_MAX_LENGTH = 1000;
|
|
1387
|
+
/** Small trusted data from the plugin. The agent should not look these up again. */
|
|
1388
|
+
export declare const eventDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1389
|
+
/** Canonical dotted event type published and selected across plugins. */
|
|
1390
|
+
export declare const eventTypeSchema: z.ZodString;
|
|
1391
|
+
export declare const resourceTypeSchema: z.ZodString;
|
|
1392
|
+
/** One exact value a watch or event automation may require on trusted event data. */
|
|
1393
|
+
export declare const eventMatchFieldSchema: z.ZodObject<{
|
|
1394
|
+
kind: z.ZodEnum<{
|
|
1395
|
+
boolean: "boolean";
|
|
1396
|
+
number: "number";
|
|
1397
|
+
string: "string";
|
|
1398
|
+
}>;
|
|
1399
|
+
description: z.ZodString;
|
|
1400
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1401
|
+
list: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1402
|
+
case: z.ZodOptional<z.ZodEnum<{
|
|
1403
|
+
lower: "lower";
|
|
1404
|
+
upper: "upper";
|
|
1405
|
+
}>>;
|
|
1406
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1407
|
+
}, z.core.$strict>;
|
|
1408
|
+
export declare const eventMatchFieldsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1409
|
+
kind: z.ZodEnum<{
|
|
1410
|
+
boolean: "boolean";
|
|
1411
|
+
number: "number";
|
|
1412
|
+
string: "string";
|
|
1413
|
+
}>;
|
|
1414
|
+
description: z.ZodString;
|
|
1415
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1416
|
+
list: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1417
|
+
case: z.ZodOptional<z.ZodEnum<{
|
|
1418
|
+
lower: "lower";
|
|
1419
|
+
upper: "upper";
|
|
1420
|
+
}>>;
|
|
1421
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1422
|
+
}, z.core.$strict>>;
|
|
1423
|
+
/** Exact trusted values required before a watch or event automation runs. */
|
|
1424
|
+
export declare const eventMatchSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>;
|
|
1425
|
+
/**
|
|
1426
|
+
* A match as tool inputs and results write it. Each key is the snake_case
|
|
1427
|
+
* name of a declared field: `pullRequest` is `pull_request`.
|
|
1428
|
+
*/
|
|
1429
|
+
export declare const agentEventMatchSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>;
|
|
1430
|
+
/** Name a declared filter as tool inputs and results write it. */
|
|
1431
|
+
export declare function agentEventMatchKey(key: string): string;
|
|
1432
|
+
/** Copy event data or a saved match with snake_case keys, for the agent. */
|
|
1433
|
+
export declare function agentEventKeys<T>(match: Readonly<Record<string, T>>): Record<string, T>;
|
|
1434
|
+
/** Copy a tool-input match with the keys that its plugin declares. */
|
|
1435
|
+
export declare function declaredEventKeys<T>(match: Readonly<Record<string, T>>): Record<string, T>;
|
|
1436
|
+
export type EventMatch = z.output<typeof eventMatchSchema>;
|
|
1437
|
+
export type EventMatchFields = z.output<typeof eventMatchFieldsSchema>;
|
|
1438
|
+
/**
|
|
1439
|
+
* Merge the match fields of resource types that share one parent resource
|
|
1440
|
+
* type, such as a repository. A field in more than one map keeps the first
|
|
1196
1441
|
* description and gets the union of the `events` lists. Fields with the same
|
|
1197
1442
|
* key must have the same kind, enum, and list values, and each copy must list
|
|
1198
1443
|
* its events. Otherwise this throws, because one field cannot describe two
|
|
@@ -1351,9 +1596,14 @@ export declare const eventInputSchema: z.ZodObject<{
|
|
|
1351
1596
|
automation: "automation";
|
|
1352
1597
|
calendar_event: "calendar_event";
|
|
1353
1598
|
code_change: "code_change";
|
|
1599
|
+
conversation: "conversation";
|
|
1354
1600
|
deployment: "deployment";
|
|
1601
|
+
document: "document";
|
|
1355
1602
|
item: "item";
|
|
1603
|
+
message: "message";
|
|
1604
|
+
person: "person";
|
|
1356
1605
|
task: "task";
|
|
1606
|
+
web_page: "web_page";
|
|
1357
1607
|
}>>;
|
|
1358
1608
|
eventKey: z.ZodString;
|
|
1359
1609
|
eventType: z.ZodString;
|
|
@@ -1383,9 +1633,14 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1383
1633
|
automation: "automation";
|
|
1384
1634
|
calendar_event: "calendar_event";
|
|
1385
1635
|
code_change: "code_change";
|
|
1636
|
+
conversation: "conversation";
|
|
1386
1637
|
deployment: "deployment";
|
|
1638
|
+
document: "document";
|
|
1387
1639
|
item: "item";
|
|
1640
|
+
message: "message";
|
|
1641
|
+
person: "person";
|
|
1388
1642
|
task: "task";
|
|
1643
|
+
web_page: "web_page";
|
|
1389
1644
|
}>>;
|
|
1390
1645
|
eventKey: z.ZodString;
|
|
1391
1646
|
eventType: z.ZodString;
|
|
@@ -1436,1160 +1691,1217 @@ export interface EventPublisher {
|
|
|
1436
1691
|
identifiers: string[];
|
|
1437
1692
|
}): Promise<string[]>;
|
|
1438
1693
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
* never matches that event.
|
|
1453
|
-
* - `invalid_value`: the filter value has the wrong type or is not allowed.
|
|
1454
|
-
*/
|
|
1455
|
-
reason: "unknown_resource_type" | "unknown_event" | "identifier_required" | "filter_required" | "unknown_field" | "field_not_set" | "invalid_value";
|
|
1456
|
-
/** The filter with the problem. Missing for a resource type or event problem. */
|
|
1457
|
-
field?: string;
|
|
1458
|
-
/** Plain words for the person or agent who changes the selection. */
|
|
1459
|
-
message: string;
|
|
1694
|
+
export interface PluginState {
|
|
1695
|
+
delete(key: string): Promise<void>;
|
|
1696
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
1697
|
+
set(key: string, value: unknown, ttlMs?: number): Promise<void>;
|
|
1698
|
+
setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
|
|
1699
|
+
withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>): Promise<T>;
|
|
1700
|
+
}
|
|
1701
|
+
export interface PluginReadState {
|
|
1702
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
1703
|
+
}
|
|
1704
|
+
export interface PluginEnv {
|
|
1705
|
+
get(key: string): string | undefined;
|
|
1706
|
+
set(key: string, value: string): void;
|
|
1460
1707
|
}
|
|
1461
1708
|
/**
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1709
|
+
* Decide what happens to one tool call in `beforeToolExecute`.
|
|
1710
|
+
*
|
|
1711
|
+
* `redirect` and `deny` both stop the tool before it runs. Neither ends the
|
|
1712
|
+
* turn: the agent gets the message as the tool result.
|
|
1465
1713
|
*/
|
|
1466
|
-
export interface
|
|
1467
|
-
resourceType?: string;
|
|
1468
|
-
events: readonly string[];
|
|
1469
|
-
match?: EventMatch;
|
|
1470
|
-
}
|
|
1471
|
-
/** The enabled resource types of one source, and the reach of each of its events. */
|
|
1472
|
-
export interface EventTriggerSource {
|
|
1473
|
-
resourceTypes: readonly Pick<PluginEventType, "type" | "matchFields" | "supportedEvents">[];
|
|
1474
|
-
events: Readonly<Record<string, {
|
|
1475
|
-
reach: EventReach;
|
|
1476
|
-
}>>;
|
|
1714
|
+
export interface PluginDecision {
|
|
1477
1715
|
/**
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
* not for each check.
|
|
1716
|
+
* Block the call as a policy refusal. The agent is told not to retry or
|
|
1717
|
+
* reach the same result another way, and to explain the block.
|
|
1481
1718
|
*/
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
* Return the events and filters that a selection can use: those of its
|
|
1490
|
-
* resource type, or with no resource type, the events whose reach is not
|
|
1491
|
-
* `"resource"`, with the filters of every resource type. Return nothing when the source
|
|
1492
|
-
* has no such resource type or cannot run for every resource.
|
|
1493
|
-
*/
|
|
1494
|
-
export declare function eventTriggerChoices(source: EventTriggerSource, selection: Pick<EventTriggerSelection, "resourceType">): {
|
|
1495
|
-
events: readonly string[];
|
|
1496
|
-
fields: EventMatchFields;
|
|
1497
|
-
} | undefined;
|
|
1498
|
-
/**
|
|
1499
|
-
* List why a selection cannot work with the resource types of one source. An
|
|
1500
|
-
* empty list means the resource type exists, every selected event is
|
|
1501
|
-
* supported, and every selected event can match every filter. A filter on a
|
|
1502
|
-
* list field (`list: true`) matches when the event list includes the value.
|
|
1503
|
-
* A selection with no resource type can use only events whose reach is not
|
|
1504
|
-
* `"resource"`, with the filters of every resource type, and must set one of
|
|
1505
|
-
* the filters that the reach of each selected event names.
|
|
1506
|
-
* Set `inputKeys` for the agent, so messages name the snake_case
|
|
1507
|
-
* `match.<key>` input.
|
|
1508
|
-
*/
|
|
1509
|
-
export declare function eventTriggerProblems(source: EventTriggerSource, selection: EventTriggerSelection, options?: {
|
|
1510
|
-
inputKeys?: boolean;
|
|
1511
|
-
}): EventTriggerProblem[];
|
|
1512
|
-
/** How people see one Event trigger. Each entry is one line of plain text. */
|
|
1513
|
-
export interface EventTriggerDescription {
|
|
1514
|
-
/** Each selected event in plain words, such as "pull request opened". */
|
|
1515
|
-
events: string[];
|
|
1516
|
-
/** Each filter in plain words. Every filter must match. */
|
|
1517
|
-
filters: string[];
|
|
1518
|
-
/** Why the trigger cannot work as saved. Empty when it can. */
|
|
1519
|
-
problems: string[];
|
|
1719
|
+
deny(reason: string): void;
|
|
1720
|
+
/**
|
|
1721
|
+
* Block the call because a different path is correct, such as another
|
|
1722
|
+
* tool. The message tells the agent what to do instead.
|
|
1723
|
+
*/
|
|
1724
|
+
redirect(message: string): void;
|
|
1725
|
+
replaceInput(input: Record<string, unknown>): void;
|
|
1520
1726
|
}
|
|
1521
|
-
/** Write one event type in plain words: `pull_request.opened` is "pull request opened". */
|
|
1522
|
-
export declare function eventTypeText(eventType: string): string;
|
|
1523
1727
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1728
|
+
* Decide what the agent reads after one tool call in `afterToolExecute`.
|
|
1729
|
+
*
|
|
1730
|
+
* The tool already ran, so neither choice undoes its effects.
|
|
1526
1731
|
*/
|
|
1527
|
-
export
|
|
1732
|
+
export interface PluginToolResultDecision {
|
|
1733
|
+
/**
|
|
1734
|
+
* Reject the result as a policy refusal. The agent gets the reason instead
|
|
1735
|
+
* of the result, and is told not to retry. Undo the tool's effects first
|
|
1736
|
+
* when they must not stay.
|
|
1737
|
+
*/
|
|
1738
|
+
deny(reason: string): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Add guidance after the result, such as a problem to fix in the change
|
|
1741
|
+
* that the tool made. The agent reads the result and the guidance.
|
|
1742
|
+
*/
|
|
1743
|
+
nudge(message: string): void;
|
|
1744
|
+
}
|
|
1745
|
+
/** Thrown when a plugin tool rejects invalid model or user input. */
|
|
1746
|
+
export declare class PluginToolInputError extends Error {
|
|
1747
|
+
constructor(message: string, options?: {
|
|
1748
|
+
cause?: unknown;
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
export interface PluginSandbox {
|
|
1752
|
+
juniorRoot: string;
|
|
1753
|
+
root: string;
|
|
1754
|
+
readFile(path: string): Promise<Uint8Array | null>;
|
|
1755
|
+
run(input: {
|
|
1756
|
+
args?: string[];
|
|
1757
|
+
cmd: string;
|
|
1758
|
+
cwd?: string;
|
|
1759
|
+
env?: Record<string, string>;
|
|
1760
|
+
signal?: AbortSignal;
|
|
1761
|
+
sudo?: boolean;
|
|
1762
|
+
}): Promise<{
|
|
1763
|
+
exitCode: number;
|
|
1764
|
+
stderr: string;
|
|
1765
|
+
stdout: string;
|
|
1766
|
+
}>;
|
|
1767
|
+
writeFile(input: {
|
|
1768
|
+
content: string | Uint8Array;
|
|
1769
|
+
mode?: number;
|
|
1770
|
+
path: string;
|
|
1771
|
+
}): Promise<void>;
|
|
1772
|
+
}
|
|
1773
|
+
export interface PluginEgress {
|
|
1774
|
+
/**
|
|
1775
|
+
* Fetch a provider URL with host-owned credentials.
|
|
1776
|
+
*
|
|
1777
|
+
* The runtime selects and injects credentials for `provider`; plugin code
|
|
1778
|
+
* owns the request shape and response handling. `operation` names the
|
|
1779
|
+
* provider action for grant selection and diagnostics.
|
|
1780
|
+
*/
|
|
1781
|
+
fetch(input: {
|
|
1782
|
+
operation: string;
|
|
1783
|
+
provider: string;
|
|
1784
|
+
request: Request;
|
|
1785
|
+
}): Promise<Response>;
|
|
1786
|
+
}
|
|
1787
|
+
export declare const pluginToolContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1788
|
+
type: z.ZodLiteral<"text">;
|
|
1789
|
+
text: z.ZodString;
|
|
1790
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1791
|
+
type: z.ZodLiteral<"image">;
|
|
1792
|
+
data: z.ZodString;
|
|
1793
|
+
mimeType: z.ZodString;
|
|
1794
|
+
}, z.core.$strict>], "type">;
|
|
1795
|
+
/** Model-visible content returned by a plugin tool. */
|
|
1796
|
+
export type PluginToolContent = z.output<typeof pluginToolContentSchema>;
|
|
1797
|
+
/** Pi-native projection with model-facing content and canonical runtime details. */
|
|
1798
|
+
export interface PluginToolOutputEnvelope<TDetails = unknown> {
|
|
1799
|
+
content: PluginToolContent[];
|
|
1800
|
+
details: TDetails;
|
|
1801
|
+
}
|
|
1802
|
+
export type PluginMcpContent = PluginToolContent;
|
|
1803
|
+
/** Successful raw provider result returned to a plugin-owned wrapper tool. */
|
|
1804
|
+
export type PluginMcpToolSuccess = {
|
|
1805
|
+
content: PluginMcpContent[];
|
|
1806
|
+
status: "success";
|
|
1807
|
+
structuredContent?: unknown;
|
|
1808
|
+
};
|
|
1809
|
+
/** Handled provider authorization pause with no provider result to consume. */
|
|
1810
|
+
export type PluginMcpAuthorizationPending = {
|
|
1811
|
+
status: "authorization_pending";
|
|
1812
|
+
};
|
|
1813
|
+
/** Definitive provider rejection; transport and session failures still throw. */
|
|
1814
|
+
export type PluginMcpToolError = {
|
|
1815
|
+
message: string;
|
|
1816
|
+
status: "error";
|
|
1817
|
+
};
|
|
1818
|
+
export type PluginMcpToolResult = PluginMcpAuthorizationPending | PluginMcpToolError | PluginMcpToolSuccess;
|
|
1819
|
+
/** Access to this plugin's hosted MCP provider without exposing credentials. */
|
|
1820
|
+
export interface PluginMcp {
|
|
1821
|
+
/**
|
|
1822
|
+
* Call a provider tool declared in `wrappedTools`.
|
|
1823
|
+
*
|
|
1824
|
+
* The host activates the provider when needed. Successful calls return the
|
|
1825
|
+
* provider's original content, provider rejections return an error result,
|
|
1826
|
+
* and authorization pauses return no tool content. Transport failures throw.
|
|
1827
|
+
*/
|
|
1828
|
+
callTool(input: {
|
|
1829
|
+
arguments?: Record<string, unknown>;
|
|
1830
|
+
name: string;
|
|
1831
|
+
toolCallId?: string;
|
|
1832
|
+
}): Promise<PluginMcpToolResult>;
|
|
1833
|
+
/**
|
|
1834
|
+
* Activate the provider before wrapper-owned state changes.
|
|
1835
|
+
*
|
|
1836
|
+
* Ordinary wrappers can call `callTool` directly. Durable mutation wrappers
|
|
1837
|
+
* may prepare first so an initial authorization pause happens before they
|
|
1838
|
+
* record pending work.
|
|
1839
|
+
*/
|
|
1840
|
+
prepare(): Promise<"authorization_pending" | "ready">;
|
|
1841
|
+
}
|
|
1842
|
+
/** Complete Workspace repository preparation after credential egress is removed. */
|
|
1843
|
+
export type WorkspaceFinalize = () => Promise<void> | void;
|
|
1528
1844
|
/**
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1845
|
+
* Provider-owned, repeatable repository preparation for a Workspace Sandbox.
|
|
1846
|
+
* Implementations should refresh complete checkouts and replace missing or
|
|
1847
|
+
* partial ones.
|
|
1532
1848
|
*/
|
|
1533
|
-
export
|
|
1534
|
-
|
|
1535
|
-
|
|
1849
|
+
export interface WorkspacePrepareHookContext extends PluginContext {
|
|
1850
|
+
repos: Array<{
|
|
1851
|
+
path: string;
|
|
1852
|
+
repo: string;
|
|
1853
|
+
}>;
|
|
1854
|
+
sandbox: PluginSandbox;
|
|
1855
|
+
}
|
|
1856
|
+
export interface SandboxPrepareHookContext extends PluginContext {
|
|
1857
|
+
actor?: Actor;
|
|
1858
|
+
sandbox: PluginSandbox;
|
|
1859
|
+
}
|
|
1860
|
+
export interface BeforeToolExecuteHookContext extends PluginContext {
|
|
1861
|
+
decision: PluginDecision;
|
|
1862
|
+
env: PluginEnv;
|
|
1863
|
+
/** Same directory as `PluginSandbox.juniorRoot` from `sandboxPrepare`. */
|
|
1864
|
+
juniorRoot: string;
|
|
1865
|
+
actor?: Actor;
|
|
1866
|
+
/** All actors who contributed instructions to the run so far; see `multi-actor-runs.md`. */
|
|
1867
|
+
actors?: Actor[];
|
|
1868
|
+
tool: {
|
|
1869
|
+
input: Record<string, unknown>;
|
|
1870
|
+
name: string;
|
|
1871
|
+
};
|
|
1872
|
+
/**
|
|
1873
|
+
* Resolve the current actor's stored identity and linked user.
|
|
1874
|
+
* Same contract as tool registration; used for commit attribution.
|
|
1875
|
+
*/
|
|
1876
|
+
users: {
|
|
1877
|
+
resolveActor(): Promise<{
|
|
1878
|
+
identity: Identity;
|
|
1879
|
+
user?: User;
|
|
1880
|
+
} | undefined>;
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1536
1883
|
/**
|
|
1537
|
-
*
|
|
1538
|
-
*
|
|
1884
|
+
* Context for checks after a tool call finishes without an error.
|
|
1885
|
+
*
|
|
1886
|
+
* Runs for every tool, including sandbox tools and Code Mode script calls.
|
|
1887
|
+
* Return early for tools that the check does not cover: each check adds time
|
|
1888
|
+
* to every tool call.
|
|
1539
1889
|
*/
|
|
1540
|
-
export
|
|
1890
|
+
export interface AfterToolExecuteHookContext extends PluginContext {
|
|
1891
|
+
decision: PluginToolResultDecision;
|
|
1892
|
+
/** Decision model for one narrow choice, such as a classifier for a diff. */
|
|
1893
|
+
decider: PluginDecider;
|
|
1894
|
+
/** Structured model calls for judgments that need reasoning. */
|
|
1895
|
+
model: PluginModel;
|
|
1896
|
+
/** The Run's sandbox. A call acquires it when no tool has used it yet. */
|
|
1897
|
+
sandbox: PluginSandbox;
|
|
1898
|
+
signal?: AbortSignal;
|
|
1899
|
+
/** Tool input after `beforeToolExecute` changes, without hook env. */
|
|
1900
|
+
tool: {
|
|
1901
|
+
input: Record<string, unknown>;
|
|
1902
|
+
name: string;
|
|
1903
|
+
};
|
|
1904
|
+
/** Active Workspace, with each repository's checkout path in the sandbox. */
|
|
1905
|
+
workspace?: {
|
|
1906
|
+
name: string;
|
|
1907
|
+
repos: Array<{
|
|
1908
|
+
/** Checkout path relative to `sandbox.root`. */
|
|
1909
|
+
path: string;
|
|
1910
|
+
provider: string;
|
|
1911
|
+
repo: string;
|
|
1912
|
+
}>;
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1541
1915
|
/**
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1916
|
+
* Context for post-success MCP tool processing.
|
|
1917
|
+
*
|
|
1918
|
+
* Runs after a hosted MCP tool succeeds on the model-facing path. Use for
|
|
1919
|
+
* junior-owned side effects such as conversation annotations without replacing
|
|
1920
|
+
* the provider tool contract.
|
|
1545
1921
|
*/
|
|
1546
|
-
export
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1922
|
+
export interface AfterMcpToolHookContext extends PluginContext {
|
|
1923
|
+
/**
|
|
1924
|
+
* Opaque Junior conversation/session identity for this turn.
|
|
1925
|
+
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
1926
|
+
*/
|
|
1927
|
+
conversationId?: string;
|
|
1928
|
+
annotations?: PluginAnnotations;
|
|
1929
|
+
result: {
|
|
1930
|
+
/** Provider content before model-facing truncation. */
|
|
1931
|
+
content?: PluginMcpContent[];
|
|
1932
|
+
structuredContent?: unknown;
|
|
1933
|
+
};
|
|
1934
|
+
tool: {
|
|
1935
|
+
arguments: Record<string, unknown>;
|
|
1936
|
+
/** Provider-local MCP tool name, for example `save_issue`. */
|
|
1937
|
+
name: string;
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
export interface PluginToolExecuteOptions {
|
|
1941
|
+
/**
|
|
1942
|
+
* @deprecated Internal compatibility escape hatch for legacy tool bridges.
|
|
1943
|
+
* Plugin tools should use typed input fields and runtime hook context instead.
|
|
1944
|
+
*/
|
|
1945
|
+
experimental_context?: unknown;
|
|
1946
|
+
/** Abort when the owning agent tool call is cancelled or times out. */
|
|
1947
|
+
signal?: AbortSignal;
|
|
1948
|
+
/** Stable runtime tool-call id; durable create tools should derive idempotency keys from it. */
|
|
1949
|
+
toolCallId?: string;
|
|
1950
|
+
}
|
|
1951
|
+
export declare const pluginToolContinuationSchema: z.ZodObject<{
|
|
1952
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1953
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1574
1954
|
}, z.core.$strict>;
|
|
1575
|
-
/**
|
|
1576
|
-
export declare const
|
|
1577
|
-
type: z.ZodLiteral<"message">;
|
|
1578
|
-
role: z.ZodEnum<{
|
|
1579
|
-
assistant: "assistant";
|
|
1580
|
-
user: "user";
|
|
1581
|
-
}>;
|
|
1955
|
+
/** Junior text that a plugin tool posted to its provider. */
|
|
1956
|
+
export declare const pluginToolReplySchema: z.ZodObject<{
|
|
1582
1957
|
text: z.ZodString;
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1958
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1959
|
+
}, z.core.$strict>;
|
|
1960
|
+
/** Shared optional fields for canonical plugin tool outputs. */
|
|
1961
|
+
export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
1962
|
+
objectAnnotations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1963
|
+
kind: z.ZodLiteral<"object">;
|
|
1964
|
+
key: z.ZodString;
|
|
1965
|
+
label: z.ZodString;
|
|
1966
|
+
objectType: z.ZodEnum<{
|
|
1967
|
+
automation: "automation";
|
|
1968
|
+
calendar_event: "calendar_event";
|
|
1969
|
+
code_change: "code_change";
|
|
1970
|
+
conversation: "conversation";
|
|
1971
|
+
deployment: "deployment";
|
|
1972
|
+
document: "document";
|
|
1973
|
+
item: "item";
|
|
1974
|
+
message: "message";
|
|
1975
|
+
person: "person";
|
|
1976
|
+
task: "task";
|
|
1977
|
+
web_page: "web_page";
|
|
1587
1978
|
}>;
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1979
|
+
title: z.ZodString;
|
|
1980
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
1981
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1982
|
+
status: z.ZodOptional<z.ZodString>;
|
|
1983
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
1984
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
1985
|
+
displayType: z.ZodOptional<z.ZodString>;
|
|
1986
|
+
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1987
|
+
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1988
|
+
type: z.ZodLiteral<"code_change">;
|
|
1989
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1990
|
+
author: z.ZodOptional<z.ZodString>;
|
|
1991
|
+
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
1992
|
+
targetBranch: z.ZodOptional<z.ZodString>;
|
|
1993
|
+
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1994
|
+
review: z.ZodOptional<z.ZodEnum<{
|
|
1995
|
+
approved: "approved";
|
|
1996
|
+
changes_requested: "changes_requested";
|
|
1997
|
+
required: "required";
|
|
1998
|
+
}>>;
|
|
1999
|
+
checks: z.ZodOptional<z.ZodObject<{
|
|
2000
|
+
passed: z.ZodNumber;
|
|
2001
|
+
failed: z.ZodNumber;
|
|
2002
|
+
pending: z.ZodNumber;
|
|
2003
|
+
}, z.core.$strict>>;
|
|
2004
|
+
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
2005
|
+
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
2006
|
+
additions: z.ZodOptional<z.ZodNumber>;
|
|
2007
|
+
deletions: z.ZodOptional<z.ZodNumber>;
|
|
2008
|
+
previewImageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
1595
2009
|
}, z.core.$strict>, z.ZodObject<{
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
2010
|
+
type: z.ZodLiteral<"task">;
|
|
2011
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2012
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2013
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
2014
|
+
project: z.ZodOptional<z.ZodString>;
|
|
2015
|
+
cycle: z.ZodOptional<z.ZodString>;
|
|
2016
|
+
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
2017
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1601
2018
|
}, z.core.$strict>, z.ZodObject<{
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
2019
|
+
type: z.ZodLiteral<"deployment">;
|
|
2020
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2021
|
+
project: z.ZodOptional<z.ZodString>;
|
|
2022
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
2023
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
2024
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1607
2025
|
}, z.core.$strict>, z.ZodObject<{
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
2026
|
+
type: z.ZodLiteral<"calendar_event">;
|
|
2027
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2028
|
+
when: z.ZodOptional<z.ZodString>;
|
|
2029
|
+
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2030
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2031
|
+
type: z.ZodLiteral<"conversation">;
|
|
2032
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2033
|
+
participants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2034
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2035
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2036
|
+
type: z.ZodLiteral<"document">;
|
|
2037
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2038
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
2039
|
+
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2040
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2041
|
+
type: z.ZodLiteral<"message">;
|
|
2042
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2043
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
2044
|
+
author: z.ZodOptional<z.ZodString>;
|
|
2045
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2046
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2047
|
+
type: z.ZodLiteral<"web_page">;
|
|
2048
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2049
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
2050
|
+
author: z.ZodOptional<z.ZodString>;
|
|
2051
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
2052
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2053
|
+
type: z.ZodLiteral<"person">;
|
|
2054
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2055
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2056
|
+
slackHandle: z.ZodOptional<z.ZodString>;
|
|
2057
|
+
githubHandle: z.ZodOptional<z.ZodString>;
|
|
2058
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
2059
|
+
}, z.core.$strict>], "type">>;
|
|
2060
|
+
}, z.core.$strict>>>;
|
|
2061
|
+
reply: z.ZodOptional<z.ZodObject<{
|
|
2062
|
+
text: z.ZodString;
|
|
2063
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1611
2064
|
}, z.core.$strict>>;
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
text: z.ZodOptional<z.ZodString>;
|
|
1618
|
-
}, z.core.$strict>], "type">;
|
|
1619
|
-
export type PluginRunTranscriptProvenance = z.output<typeof pluginRunTranscriptProvenanceSchema>;
|
|
1620
|
-
/** Runtime-owned completed-run projection exposed to plugin tasks. */
|
|
1621
|
-
export declare const pluginRunContextSchema: z.ZodObject<{
|
|
1622
|
-
actorUserId: z.ZodOptional<z.ZodString>;
|
|
1623
|
-
completedAtMs: z.ZodNumber;
|
|
1624
|
-
conversationId: z.ZodString;
|
|
1625
|
-
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1626
|
-
platform: z.ZodLiteral<"slack">;
|
|
1627
|
-
teamId: z.ZodString;
|
|
1628
|
-
channelId: z.ZodString;
|
|
1629
|
-
threadTs: z.ZodOptional<z.ZodString>;
|
|
1630
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1631
|
-
platform: z.ZodLiteral<"local">;
|
|
1632
|
-
conversationId: z.ZodString;
|
|
1633
|
-
}, z.core.$strict>], "platform">;
|
|
1634
|
-
locationId: z.ZodOptional<z.ZodString>;
|
|
1635
|
-
actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1636
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1637
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1638
|
-
userId: z.ZodString;
|
|
1639
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1640
|
-
platform: z.ZodLiteral<"slack">;
|
|
1641
|
-
teamId: z.ZodString;
|
|
1642
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1643
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1644
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1645
|
-
userId: z.ZodString;
|
|
1646
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1647
|
-
platform: z.ZodLiteral<"local">;
|
|
1648
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1649
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1650
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1651
|
-
userId: z.ZodString;
|
|
1652
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1653
|
-
platform: z.ZodLiteral<"web">;
|
|
1654
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1655
|
-
platform: z.ZodLiteral<"system">;
|
|
1656
|
-
name: z.ZodString;
|
|
1657
|
-
}, z.core.$strict>], "platform">>;
|
|
1658
|
-
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1659
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1660
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1661
|
-
userId: z.ZodString;
|
|
1662
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1663
|
-
platform: z.ZodLiteral<"slack">;
|
|
1664
|
-
teamId: z.ZodString;
|
|
1665
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1666
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1667
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1668
|
-
userId: z.ZodString;
|
|
1669
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1670
|
-
platform: z.ZodLiteral<"local">;
|
|
1671
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1672
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1673
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1674
|
-
userId: z.ZodString;
|
|
1675
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1676
|
-
platform: z.ZodLiteral<"web">;
|
|
1677
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1678
|
-
platform: z.ZodLiteral<"system">;
|
|
1679
|
-
name: z.ZodString;
|
|
1680
|
-
}, z.core.$strict>], "platform">>;
|
|
1681
|
-
runId: z.ZodString;
|
|
1682
|
-
source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1683
|
-
kind: z.ZodLiteral<"slack">;
|
|
1684
|
-
teamId: z.ZodString;
|
|
1685
|
-
channelId: z.ZodString;
|
|
1686
|
-
visibility: z.ZodEnum<{
|
|
1687
|
-
private: "private";
|
|
1688
|
-
public: "public";
|
|
1689
|
-
}>;
|
|
1690
|
-
messageTs: z.ZodOptional<z.ZodString>;
|
|
1691
|
-
threadTs: z.ZodOptional<z.ZodString>;
|
|
1692
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1693
|
-
kind: z.ZodLiteral<"local">;
|
|
1694
|
-
visibility: z.ZodLiteral<"private">;
|
|
1695
|
-
conversationId: z.ZodString;
|
|
1696
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1697
|
-
kind: z.ZodLiteral<"web">;
|
|
1698
|
-
visibility: z.ZodEnum<{
|
|
1699
|
-
private: "private";
|
|
1700
|
-
public: "public";
|
|
1701
|
-
}>;
|
|
1702
|
-
conversationId: z.ZodString;
|
|
1703
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1704
|
-
kind: z.ZodLiteral<"event">;
|
|
1705
|
-
eventKey: z.ZodString;
|
|
1706
|
-
eventType: z.ZodString;
|
|
1707
|
-
identifier: z.ZodString;
|
|
1708
|
-
namespace: z.ZodString;
|
|
1709
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1710
|
-
automationId: z.ZodOptional<z.ZodString>;
|
|
1711
|
-
automationRunId: z.ZodOptional<z.ZodString>;
|
|
1712
|
-
kind: z.ZodLiteral<"scheduled_automation">;
|
|
1713
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1714
|
-
automationId: z.ZodOptional<z.ZodString>;
|
|
1715
|
-
automationRunId: z.ZodOptional<z.ZodString>;
|
|
1716
|
-
kind: z.ZodLiteral<"event_automation">;
|
|
1717
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1718
|
-
kind: z.ZodLiteral<"plugin_dispatch">;
|
|
1719
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1720
|
-
kind: z.ZodLiteral<"agent_invocation">;
|
|
1721
|
-
}, z.core.$strict>], "kind">, unknown>;
|
|
1722
|
-
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1723
|
-
type: z.ZodLiteral<"message">;
|
|
1724
|
-
role: z.ZodEnum<{
|
|
1725
|
-
assistant: "assistant";
|
|
1726
|
-
user: "user";
|
|
1727
|
-
}>;
|
|
1728
|
-
text: z.ZodString;
|
|
1729
|
-
provenance: z.ZodOptional<z.ZodObject<{
|
|
1730
|
-
authority: z.ZodEnum<{
|
|
1731
|
-
context: "context";
|
|
1732
|
-
instruction: "instruction";
|
|
1733
|
-
}>;
|
|
1734
|
-
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1735
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1736
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1737
|
-
userId: z.ZodString;
|
|
1738
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1739
|
-
platform: z.ZodLiteral<"slack">;
|
|
1740
|
-
teamId: z.ZodString;
|
|
1741
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1742
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1743
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1744
|
-
userId: z.ZodString;
|
|
1745
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1746
|
-
platform: z.ZodLiteral<"local">;
|
|
1747
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1748
|
-
email: z.ZodOptional<z.ZodString>;
|
|
1749
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
1750
|
-
userId: z.ZodString;
|
|
1751
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
1752
|
-
platform: z.ZodLiteral<"web">;
|
|
1753
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1754
|
-
platform: z.ZodLiteral<"system">;
|
|
1755
|
-
name: z.ZodString;
|
|
1756
|
-
}, z.core.$strict>], "platform">>;
|
|
1757
|
-
}, z.core.$strict>>;
|
|
1758
|
-
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
1759
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1760
|
-
type: z.ZodLiteral<"toolResult">;
|
|
1761
|
-
toolName: z.ZodString;
|
|
1762
|
-
isError: z.ZodBoolean;
|
|
1763
|
-
text: z.ZodOptional<z.ZodString>;
|
|
1764
|
-
}, z.core.$strict>], "type">>;
|
|
1765
|
-
}, z.core.$strict>;
|
|
1766
|
-
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
1767
|
-
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
1768
|
-
/** Runtime context passed to a plugin-owned background task. */
|
|
1769
|
-
export interface PluginTaskContext extends PluginContext {
|
|
1770
|
-
embedder: PluginEmbedder;
|
|
1771
|
-
events: PluginConversationEvents;
|
|
1772
|
-
id: string;
|
|
1773
|
-
model: PluginModel;
|
|
1774
|
-
name: string;
|
|
1775
|
-
run: {
|
|
1776
|
-
load(): Promise<PluginRunContext>;
|
|
1777
|
-
};
|
|
1778
|
-
state: PluginState;
|
|
1779
|
-
}
|
|
1780
|
-
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
1781
|
-
export interface PluginTaskDefinition {
|
|
1782
|
-
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
1783
|
-
}
|
|
1784
|
-
/** Task handlers keyed by the plugin-owned task name. */
|
|
1785
|
-
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
1786
|
-
declare const pluginGrantAccessSchema: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
1787
|
-
/** Runtime schema for provider authorization a plugin may request. */
|
|
1788
|
-
export declare const pluginAuthorizationSchema: z.ZodObject<{
|
|
1789
|
-
provider: z.ZodString;
|
|
1790
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
1791
|
-
type: z.ZodLiteral<"oauth">;
|
|
1792
|
-
}, z.core.$strict>;
|
|
1793
|
-
/** Runtime schema for a provider account attached to stored OAuth tokens. */
|
|
1794
|
-
export declare const pluginProviderAccountSchema: z.ZodObject<{
|
|
1795
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
1796
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
1797
|
-
id: z.ZodString;
|
|
1798
|
-
label: z.ZodOptional<z.ZodString>;
|
|
1799
|
-
url: z.ZodOptional<z.ZodString>;
|
|
1800
|
-
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1801
|
-
}, z.core.$strict>;
|
|
1802
|
-
/** Runtime schema for OAuth tokens stored by the host for plugin credentials. */
|
|
1803
|
-
export declare const pluginStoredTokensSchema: z.ZodObject<{
|
|
1804
|
-
account: z.ZodOptional<z.ZodObject<{
|
|
1805
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
1806
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
1807
|
-
id: z.ZodString;
|
|
1808
|
-
label: z.ZodOptional<z.ZodString>;
|
|
1809
|
-
url: z.ZodOptional<z.ZodString>;
|
|
1810
|
-
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2065
|
+
target: z.ZodOptional<z.ZodString>;
|
|
2066
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
2067
|
+
continuation: z.ZodOptional<z.ZodObject<{
|
|
2068
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2069
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1811
2070
|
}, z.core.$strict>>;
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}, z.core.$strict>;
|
|
2071
|
+
}, z.core.$loose>;
|
|
2072
|
+
export type PluginToolOutput = z.output<typeof pluginToolOutputSchema>;
|
|
2073
|
+
export type PluginToolExecute<TInput = unknown, TOutput = unknown> = {
|
|
2074
|
+
bivarianceHack(input: TInput, options: PluginToolExecuteOptions): Promise<TOutput> | TOutput;
|
|
2075
|
+
}["bivarianceHack"];
|
|
1818
2076
|
/**
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
2077
|
+
* Tool-declared approval mode.
|
|
2078
|
+
*
|
|
2079
|
+
* `auto` delegates to core policy, `review` enters Guardian review, and
|
|
2080
|
+
* `approve` permits execution without review. Plugin tool helpers normalize
|
|
2081
|
+
* omission to `auto`.
|
|
2082
|
+
*
|
|
2083
|
+
* Core resolves the effective mode immediately before execution.
|
|
1821
2084
|
*/
|
|
1822
|
-
export declare const
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
id: z.ZodString;
|
|
1843
|
-
label: z.ZodOptional<z.ZodString>;
|
|
1844
|
-
url: z.ZodOptional<z.ZodString>;
|
|
1845
|
-
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1846
|
-
}, z.core.$strict>>;
|
|
1847
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
1848
|
-
provider: z.ZodString;
|
|
1849
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
1850
|
-
type: z.ZodLiteral<"oauth">;
|
|
1851
|
-
}, z.core.$strict>>;
|
|
1852
|
-
expiresAt: z.ZodString;
|
|
1853
|
-
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
1854
|
-
domain: z.ZodString;
|
|
1855
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1856
|
-
}, z.core.$strict>>;
|
|
1857
|
-
}, z.core.$strict>;
|
|
1858
|
-
/** Runtime schema for the result returned by a plugin credential hook. */
|
|
1859
|
-
export declare const pluginCredentialResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1860
|
-
lease: z.ZodObject<{
|
|
1861
|
-
account: z.ZodOptional<z.ZodObject<{
|
|
1862
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
1863
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
1864
|
-
id: z.ZodString;
|
|
1865
|
-
label: z.ZodOptional<z.ZodString>;
|
|
1866
|
-
url: z.ZodOptional<z.ZodString>;
|
|
1867
|
-
verifiedEmails: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1868
|
-
}, z.core.$strict>>;
|
|
1869
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
1870
|
-
provider: z.ZodString;
|
|
1871
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
1872
|
-
type: z.ZodLiteral<"oauth">;
|
|
1873
|
-
}, z.core.$strict>>;
|
|
1874
|
-
expiresAt: z.ZodString;
|
|
1875
|
-
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
1876
|
-
domain: z.ZodString;
|
|
1877
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1878
|
-
}, z.core.$strict>>;
|
|
1879
|
-
}, z.core.$strict>;
|
|
1880
|
-
type: z.ZodLiteral<"lease">;
|
|
1881
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1882
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
1883
|
-
provider: z.ZodString;
|
|
1884
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
1885
|
-
type: z.ZodLiteral<"oauth">;
|
|
1886
|
-
}, z.core.$strict>>;
|
|
1887
|
-
message: z.ZodString;
|
|
1888
|
-
type: z.ZodLiteral<"needed">;
|
|
1889
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1890
|
-
message: z.ZodString;
|
|
1891
|
-
type: z.ZodLiteral<"unavailable">;
|
|
1892
|
-
}, z.core.$strict>], "type">;
|
|
1893
|
-
export type PluginCredentialSubject = z.output<typeof pluginCredentialSubjectSchema>;
|
|
1894
|
-
export type PluginGrantAccess = z.output<typeof pluginGrantAccessSchema>;
|
|
1895
|
-
/** Provider authorization Junior can start when a plugin-owned grant is missing. */
|
|
1896
|
-
export type PluginAuthorization = z.output<typeof pluginAuthorizationSchema>;
|
|
1897
|
-
/** Interrupt sandbox egress so Junior can start provider authorization. */
|
|
1898
|
-
export declare class EgressAuthRequired extends Error {
|
|
1899
|
-
authorization?: PluginAuthorization;
|
|
1900
|
-
constructor(message: string, options?: {
|
|
1901
|
-
authorization?: PluginAuthorization;
|
|
1902
|
-
cause?: unknown;
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
/** Deny provider egress before Junior issues credentials for a disallowed operation. */
|
|
1906
|
-
export declare class EgressPolicyDenied extends Error {
|
|
1907
|
-
/** Provider facts for the policy denial event. */
|
|
1908
|
-
readonly auditAttributes?: PluginAuditAttributes;
|
|
1909
|
-
constructor(message: string, options?: {
|
|
1910
|
-
auditAttributes?: PluginAuditAttributes;
|
|
1911
|
-
cause?: unknown;
|
|
1912
|
-
});
|
|
1913
|
-
}
|
|
1914
|
-
/** Provider facts for egress audit events. */
|
|
1915
|
-
export type PluginAuditAttributes = z.output<typeof pluginAuditAttributesSchema>;
|
|
1916
|
-
/** Provider account identity resolved by a plugin OAuth hook. */
|
|
1917
|
-
export type PluginProviderAccount = z.output<typeof pluginProviderAccountSchema>;
|
|
1918
|
-
/** Plugin-defined grant required before Junior can forward one outbound request. */
|
|
1919
|
-
export type PluginGrant = z.output<typeof pluginGrantSchema>;
|
|
1920
|
-
/** One ref update command in a Git push. */
|
|
1921
|
-
export interface PluginGitRefUpdate {
|
|
1922
|
-
/** True when the push deletes the ref: its new object id is all zeros. */
|
|
1923
|
-
deletes: boolean;
|
|
1924
|
-
/** Full ref name, such as `refs/heads/main`. */
|
|
1925
|
-
ref: string;
|
|
2085
|
+
export declare const toolApprovalModeSchema: z.ZodEnum<{
|
|
2086
|
+
approve: "approve";
|
|
2087
|
+
auto: "auto";
|
|
2088
|
+
review: "review";
|
|
2089
|
+
}>;
|
|
2090
|
+
export type ToolApprovalMode = z.output<typeof toolApprovalModeSchema>;
|
|
2091
|
+
/**
|
|
2092
|
+
* Reviewer signals describing a tool's side-effect behavior.
|
|
2093
|
+
*
|
|
2094
|
+
* These hints follow the MCP tool annotation contract. Guardian may use
|
|
2095
|
+
* them as signals, but they never grant authority or override deterministic
|
|
2096
|
+
* authorization.
|
|
2097
|
+
*/
|
|
2098
|
+
export interface ToolAnnotations {
|
|
2099
|
+
[key: string]: unknown;
|
|
2100
|
+
destructiveHint?: boolean;
|
|
2101
|
+
idempotentHint?: boolean;
|
|
2102
|
+
openWorldHint?: boolean;
|
|
2103
|
+
readOnlyHint?: boolean;
|
|
2104
|
+
title?: string;
|
|
1926
2105
|
}
|
|
1927
|
-
|
|
1928
|
-
export type
|
|
2106
|
+
export declare const REQUIRED_TOOL_ANNOTATION_KEYS: readonly ["destructiveHint", "idempotentHint", "openWorldHint", "readOnlyHint"];
|
|
2107
|
+
export type RequiredToolAnnotationKey = (typeof REQUIRED_TOOL_ANNOTATION_KEYS)[number];
|
|
2108
|
+
/** Return behavioral annotation keys that a tool did not declare. */
|
|
2109
|
+
export declare function missingToolAnnotationKeys(annotations: ToolAnnotations | undefined): RequiredToolAnnotationKey[];
|
|
1929
2110
|
/**
|
|
1930
|
-
*
|
|
1931
|
-
* reads from the body before the pack data. An `unreadable` push changes
|
|
1932
|
-
* refs that the host cannot name.
|
|
2111
|
+
* Canonical approval metadata declared by core and plugin tools.
|
|
1933
2112
|
*/
|
|
1934
|
-
export
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
kind: "unreadable";
|
|
1939
|
-
reason: PluginGitPushUnreadableReason;
|
|
1940
|
-
};
|
|
1941
|
-
/** One field that a GraphQL operation selects. */
|
|
1942
|
-
export interface PluginGraphqlField {
|
|
1943
|
-
/** Names of the arguments that the field passes. */
|
|
1944
|
-
arguments: string[];
|
|
1945
|
-
/** Schema field name. An alias does not replace it. */
|
|
1946
|
-
name: string;
|
|
1947
|
-
}
|
|
1948
|
-
/** The GraphQL operation that one request runs. */
|
|
1949
|
-
export interface PluginGraphqlOperation {
|
|
1950
|
-
/**
|
|
1951
|
-
* Each distinct field that the operation selects at any depth, also through
|
|
1952
|
-
* fragments.
|
|
1953
|
-
*/
|
|
1954
|
-
fields: PluginGraphqlField[];
|
|
1955
|
-
name?: string;
|
|
2113
|
+
export interface ToolApprovalMetadata<TInput = unknown> {
|
|
2114
|
+
/** Optional declared approval mode; the owning tool boundary selects defaults. */
|
|
2115
|
+
approvalMode?: ToolApprovalMode;
|
|
2116
|
+
annotations?: ToolAnnotations;
|
|
1956
2117
|
/**
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
2118
|
+
* Describe the reviewed semantic action for the review request.
|
|
2119
|
+
*
|
|
2120
|
+
* Core owns authoritative tool, actor, source, destination, conversation,
|
|
2121
|
+
* credential, and input data. This description adds domain-specific context
|
|
2122
|
+
* only and is never an authorization grant.
|
|
1959
2123
|
*/
|
|
1960
|
-
|
|
1961
|
-
type: "mutation" | "query" | "subscription";
|
|
2124
|
+
describeProposal?(input: TInput): string;
|
|
1962
2125
|
}
|
|
1963
2126
|
/**
|
|
1964
|
-
*
|
|
2127
|
+
* Control who may call a tool.
|
|
1965
2128
|
*
|
|
1966
|
-
*
|
|
1967
|
-
*
|
|
1968
|
-
*
|
|
1969
|
-
*
|
|
1970
|
-
*
|
|
1971
|
-
*
|
|
1972
|
-
*
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
|
|
1976
|
-
export type PluginGraphqlUnreadableReason = "document" | "gzip" | "json" | "operation" | "query" | "too-large";
|
|
1977
|
-
/**
|
|
1978
|
-
* The operations of a GraphQL POST, which the host reads from the JSON body.
|
|
1979
|
-
* A `batch` is a JSON array of requests. An `unreadable` request can run any
|
|
1980
|
-
* operation, mutations included.
|
|
2129
|
+
* | Exposure | Model tool list | Tool catalog | Code Mode script |
|
|
2130
|
+
* | ----------- | --------------- | ------------ | ---------------- |
|
|
2131
|
+
* | `direct` | yes | yes | yes |
|
|
2132
|
+
* | `deferred` | no | yes | yes |
|
|
2133
|
+
* | `modelOnly` | yes | no | no |
|
|
2134
|
+
* | `codemode` | no | no | yes |
|
|
2135
|
+
* | `hidden` | no | no | no |
|
|
2136
|
+
*
|
|
2137
|
+
* The tool catalog is `searchTools` and `executeTool`. Use `modelOnly` for
|
|
2138
|
+
* tools that control the agent loop or dispatch other tools.
|
|
1981
2139
|
*/
|
|
1982
|
-
export type
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
} | {
|
|
1986
|
-
kind: "operation";
|
|
1987
|
-
operation: PluginGraphqlOperation;
|
|
1988
|
-
} | {
|
|
1989
|
-
kind: "unreadable";
|
|
1990
|
-
reason: PluginGraphqlUnreadableReason;
|
|
1991
|
-
};
|
|
1992
|
-
/** Request details available while selecting the grant for sandbox egress. */
|
|
1993
|
-
export interface PluginEgressRequest {
|
|
2140
|
+
export type ToolExposure = "direct" | "deferred" | "modelOnly" | "codemode" | "hidden";
|
|
2141
|
+
export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExecuteOutput = TOutput> extends ToolApprovalMetadata<TInput> {
|
|
2142
|
+
description: string;
|
|
1994
2143
|
/**
|
|
1995
|
-
*
|
|
1996
|
-
*
|
|
2144
|
+
* Why the current Turn cannot run this tool. The host keeps the tool in the
|
|
2145
|
+
* tool list, so the cached prompt stays the same, and rejects its calls.
|
|
1997
2146
|
*/
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
/** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
|
|
2005
|
-
operation?: string;
|
|
2006
|
-
url: string;
|
|
2007
|
-
}
|
|
2008
|
-
export interface EgressHookContext extends PluginContext {
|
|
2009
|
-
request: PluginEgressRequest;
|
|
2010
|
-
}
|
|
2011
|
-
export interface PluginEgressResponse {
|
|
2012
|
-
/** Snapshot of upstream response headers; mutations do not affect pass-through. */
|
|
2013
|
-
headers: Headers;
|
|
2014
|
-
readText(maxBytes: number): Promise<string | undefined>;
|
|
2015
|
-
status: number;
|
|
2016
|
-
}
|
|
2017
|
-
export interface EgressResponseHookContext extends PluginContext {
|
|
2018
|
-
grant: PluginGrant;
|
|
2019
|
-
permissionDenied(message: string): void;
|
|
2020
|
-
request: Omit<PluginEgressRequest, "bodyText" | "gitPush" | "graphql">;
|
|
2021
|
-
response: PluginEgressResponse;
|
|
2022
|
-
}
|
|
2023
|
-
/** Header mutations a plugin-issued credential lease may apply to owned domains. */
|
|
2024
|
-
export type PluginCredentialHeaderTransform = z.output<typeof pluginCredentialHeaderTransformSchema>;
|
|
2025
|
-
/** Short-lived credential headers issued by a plugin for a selected grant. */
|
|
2026
|
-
export type PluginCredentialLease = z.output<typeof pluginCredentialLeaseSchema>;
|
|
2027
|
-
export type PluginCredentialResult = z.output<typeof pluginCredentialResultSchema>;
|
|
2028
|
-
export type PluginCredentialActor = {
|
|
2029
|
-
platform: "system";
|
|
2030
|
-
name: string;
|
|
2031
|
-
} | {
|
|
2032
|
-
type: "user";
|
|
2033
|
-
userId: string;
|
|
2034
|
-
};
|
|
2035
|
-
export interface PluginResolvedCredentialUser {
|
|
2036
|
-
type: "user";
|
|
2037
|
-
userId: string;
|
|
2038
|
-
}
|
|
2039
|
-
export type PluginStoredTokens = z.output<typeof pluginStoredTokensSchema>;
|
|
2040
|
-
export interface PluginUserTokenSlot {
|
|
2041
|
-
get(): Promise<PluginStoredTokens | undefined>;
|
|
2042
|
-
set(tokens: PluginStoredTokens): Promise<void>;
|
|
2043
|
-
/** Run token refresh work after the host has serialized this user/provider slot, or throw after a bounded wait. */
|
|
2044
|
-
withRefresh<T>(callback: () => Promise<T>): Promise<T>;
|
|
2045
|
-
userId: string;
|
|
2046
|
-
}
|
|
2047
|
-
export interface PluginTokenStore {
|
|
2048
|
-
credentialSubject?: PluginUserTokenSlot;
|
|
2049
|
-
currentUser?: PluginUserTokenSlot;
|
|
2050
|
-
}
|
|
2051
|
-
export interface ResolveOAuthAccountHookContext extends PluginContext {
|
|
2052
|
-
tokens: PluginStoredTokens;
|
|
2147
|
+
disabledReason?: string;
|
|
2148
|
+
executionMode?: unknown;
|
|
2149
|
+
/** Override the host's default tool exposure. */
|
|
2150
|
+
exposure?: ToolExposure;
|
|
2151
|
+
inputSchema: unknown;
|
|
2152
|
+
outputSchema?: unknown;
|
|
2053
2153
|
/**
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2154
|
+
* Select result fields that are safe to retain in private traces.
|
|
2155
|
+
* Returning `undefined` suppresses private result capture.
|
|
2056
2156
|
*/
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
export interface IssueCredentialHookContext extends PluginContext {
|
|
2060
|
-
actor: PluginCredentialActor;
|
|
2061
|
-
credentialSubject?: PluginResolvedCredentialUser;
|
|
2062
|
-
grant: PluginGrant;
|
|
2063
|
-
tokens: PluginTokenStore;
|
|
2064
|
-
}
|
|
2065
|
-
export interface PluginEnv {
|
|
2066
|
-
get(key: string): string | undefined;
|
|
2067
|
-
set(key: string, value: string): void;
|
|
2068
|
-
}
|
|
2069
|
-
/**
|
|
2070
|
-
* Decide what happens to one tool call in `beforeToolExecute`.
|
|
2071
|
-
*
|
|
2072
|
-
* `redirect` and `deny` both stop the tool before it runs. Neither ends the
|
|
2073
|
-
* turn: the agent gets the message as the tool result.
|
|
2074
|
-
*/
|
|
2075
|
-
export interface PluginDecision {
|
|
2157
|
+
privateTraceResult?(result: TOutput): unknown;
|
|
2158
|
+
prepareArguments?: (args: unknown) => TInput;
|
|
2076
2159
|
/**
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2160
|
+
* @deprecated Put tool-selection and usage guidance directly in `description`
|
|
2161
|
+
* and parameter descriptions. Retained for compatibility; may be removed in a
|
|
2162
|
+
* future major version.
|
|
2079
2163
|
*/
|
|
2080
|
-
|
|
2164
|
+
promptGuidelines?: string[];
|
|
2081
2165
|
/**
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2166
|
+
* @deprecated Put tool-selection and usage guidance directly in `description`
|
|
2167
|
+
* and parameter descriptions. Retained for compatibility; may be removed in a
|
|
2168
|
+
* future major version.
|
|
2084
2169
|
*/
|
|
2085
|
-
|
|
2086
|
-
|
|
2170
|
+
promptSnippet?: string;
|
|
2171
|
+
execute?: PluginToolExecute<TInput, TExecuteOutput>;
|
|
2087
2172
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2173
|
+
type ZodPluginToolDefinition<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>> = Omit<PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>>, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
2174
|
+
inputSchema: TInputSchema;
|
|
2175
|
+
outputSchema: TOutputSchema;
|
|
2176
|
+
prepareArguments?: (args: unknown) => z.input<TInputSchema>;
|
|
2177
|
+
execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions) => Promise<TExecuteResult> | TExecuteResult;
|
|
2178
|
+
};
|
|
2179
|
+
type ParsedPluginToolExecuteResult<TOutputSchema extends ZodTypeAny, TResult> = TResult extends PluginToolOutputEnvelope<unknown> ? PluginToolOutputEnvelope<z.output<TOutputSchema>> : z.output<TOutputSchema>;
|
|
2180
|
+
/** Define a plugin tool with Zod input parsing and validated structured results. */
|
|
2181
|
+
export declare function zodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>>;
|
|
2182
|
+
/** Define a plugin tool with Zod input parsing and the structured result contract. */
|
|
2183
|
+
export declare function definePluginTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>>;
|
|
2184
|
+
export interface SlackToolRegistrationHookContext {
|
|
2094
2185
|
/**
|
|
2095
|
-
*
|
|
2096
|
-
*
|
|
2097
|
-
* when they must not stay.
|
|
2186
|
+
* What Slack tools can do in the Conversation Location.
|
|
2187
|
+
* Computed from Location, not from Source or Destination.
|
|
2098
2188
|
*/
|
|
2099
|
-
|
|
2189
|
+
channelCapabilities: {
|
|
2190
|
+
canAddReactions: boolean;
|
|
2191
|
+
canCreateCanvas: boolean;
|
|
2192
|
+
canPostToChannel: boolean;
|
|
2193
|
+
};
|
|
2194
|
+
credentialSubject?: Extract<PluginCredentialSubject, {
|
|
2195
|
+
allowedWhen: "private-direct-conversation";
|
|
2196
|
+
}>;
|
|
2197
|
+
}
|
|
2198
|
+
export interface PluginEventToolContext {
|
|
2199
|
+
/** Whether this invocation can create a working watch. */
|
|
2200
|
+
canSubscribe: boolean;
|
|
2201
|
+
/** Create a temporary watch for the current conversation. */
|
|
2202
|
+
subscribe(input: {
|
|
2203
|
+
events: string[];
|
|
2204
|
+
intent: string;
|
|
2205
|
+
resource: SubscribableResource;
|
|
2206
|
+
/**
|
|
2207
|
+
* Guidance for this Watch only, by event type. Core adds it after the
|
|
2208
|
+
* resource type guidance when a matching Event arrives.
|
|
2209
|
+
*/
|
|
2210
|
+
guidance?: Partial<Record<string, string>>;
|
|
2211
|
+
}): Promise<WatchResult>;
|
|
2212
|
+
}
|
|
2213
|
+
export interface PluginWorkspaceToolContext {
|
|
2100
2214
|
/**
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2215
|
+
* Workspace that the current Sandbox started from. Returns undefined for
|
|
2216
|
+
* the default Sandbox. `name` is missing when the recipe no longer exists.
|
|
2103
2217
|
*/
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2218
|
+
active(): Promise<{
|
|
2219
|
+
name?: string;
|
|
2220
|
+
} | undefined>;
|
|
2221
|
+
/** Find named Workspaces that include one provider repository. */
|
|
2222
|
+
findByRepository(input: {
|
|
2223
|
+
provider: string;
|
|
2224
|
+
repo: string;
|
|
2225
|
+
}): Promise<string[]>;
|
|
2111
2226
|
}
|
|
2112
|
-
|
|
2113
|
-
juniorRoot: string;
|
|
2114
|
-
root: string;
|
|
2115
|
-
readFile(path: string): Promise<Uint8Array | null>;
|
|
2116
|
-
run(input: {
|
|
2117
|
-
args?: string[];
|
|
2118
|
-
cmd: string;
|
|
2119
|
-
cwd?: string;
|
|
2120
|
-
env?: Record<string, string>;
|
|
2121
|
-
signal?: AbortSignal;
|
|
2122
|
-
sudo?: boolean;
|
|
2123
|
-
}): Promise<{
|
|
2124
|
-
exitCode: number;
|
|
2125
|
-
stderr: string;
|
|
2126
|
-
stdout: string;
|
|
2127
|
-
}>;
|
|
2128
|
-
writeFile(input: {
|
|
2129
|
-
content: string | Uint8Array;
|
|
2130
|
-
mode?: number;
|
|
2131
|
-
path: string;
|
|
2132
|
-
}): Promise<void>;
|
|
2133
|
-
}
|
|
2134
|
-
export interface PluginEgress {
|
|
2135
|
-
/**
|
|
2136
|
-
* Fetch a provider URL with host-owned credentials.
|
|
2137
|
-
*
|
|
2138
|
-
* The runtime selects and injects credentials for `provider`; plugin code
|
|
2139
|
-
* owns the request shape and response handling. `operation` names the
|
|
2140
|
-
* provider action for grant selection and diagnostics.
|
|
2141
|
-
*/
|
|
2142
|
-
fetch(input: {
|
|
2143
|
-
operation: string;
|
|
2144
|
-
provider: string;
|
|
2145
|
-
request: Request;
|
|
2146
|
-
}): Promise<Response>;
|
|
2147
|
-
}
|
|
2148
|
-
export declare const pluginToolContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2149
|
-
type: z.ZodLiteral<"text">;
|
|
2150
|
-
text: z.ZodString;
|
|
2151
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
2152
|
-
type: z.ZodLiteral<"image">;
|
|
2153
|
-
data: z.ZodString;
|
|
2154
|
-
mimeType: z.ZodString;
|
|
2155
|
-
}, z.core.$strict>], "type">;
|
|
2156
|
-
/** Model-visible content returned by a plugin tool. */
|
|
2157
|
-
export type PluginToolContent = z.output<typeof pluginToolContentSchema>;
|
|
2158
|
-
/** Pi-native projection with model-facing content and canonical runtime details. */
|
|
2159
|
-
export interface PluginToolOutputEnvelope<TDetails = unknown> {
|
|
2160
|
-
content: PluginToolContent[];
|
|
2161
|
-
details: TDetails;
|
|
2162
|
-
}
|
|
2163
|
-
export type PluginMcpContent = PluginToolContent;
|
|
2164
|
-
/** Successful raw provider result returned to a plugin-owned wrapper tool. */
|
|
2165
|
-
export type PluginMcpToolSuccess = {
|
|
2166
|
-
content: PluginMcpContent[];
|
|
2167
|
-
status: "success";
|
|
2168
|
-
structuredContent?: unknown;
|
|
2169
|
-
};
|
|
2170
|
-
/** Handled provider authorization pause with no provider result to consume. */
|
|
2171
|
-
export type PluginMcpAuthorizationPending = {
|
|
2172
|
-
status: "authorization_pending";
|
|
2173
|
-
};
|
|
2174
|
-
/** Definitive provider rejection; transport and session failures still throw. */
|
|
2175
|
-
export type PluginMcpToolError = {
|
|
2176
|
-
message: string;
|
|
2177
|
-
status: "error";
|
|
2178
|
-
};
|
|
2179
|
-
export type PluginMcpToolResult = PluginMcpAuthorizationPending | PluginMcpToolError | PluginMcpToolSuccess;
|
|
2180
|
-
/** Access to this plugin's hosted MCP provider without exposing credentials. */
|
|
2181
|
-
export interface PluginMcp {
|
|
2182
|
-
/**
|
|
2183
|
-
* Call a provider tool declared in `wrappedTools`.
|
|
2184
|
-
*
|
|
2185
|
-
* The host activates the provider when needed. Successful calls return the
|
|
2186
|
-
* provider's original content, provider rejections return an error result,
|
|
2187
|
-
* and authorization pauses return no tool content. Transport failures throw.
|
|
2188
|
-
*/
|
|
2189
|
-
callTool(input: {
|
|
2190
|
-
arguments?: Record<string, unknown>;
|
|
2191
|
-
name: string;
|
|
2192
|
-
toolCallId?: string;
|
|
2193
|
-
}): Promise<PluginMcpToolResult>;
|
|
2227
|
+
interface BaseToolRegistrationHookContext extends PluginContext {
|
|
2194
2228
|
/**
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2197
|
-
*
|
|
2198
|
-
*
|
|
2199
|
-
* record pending work.
|
|
2229
|
+
* Opaque Junior conversation/session identity for this turn.
|
|
2230
|
+
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
2231
|
+
* Scheduled/web turns use an internal id such as `agent-dispatch:{id}`.
|
|
2232
|
+
* Do not parse as Slack unless the value starts with `slack:`.
|
|
2200
2233
|
*/
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
/**
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
* Provider-owned, repeatable repository preparation for a Workspace Sandbox.
|
|
2207
|
-
* Implementations should refresh complete checkouts and replace missing or
|
|
2208
|
-
* partial ones.
|
|
2209
|
-
*/
|
|
2210
|
-
export interface WorkspacePrepareHookContext extends PluginContext {
|
|
2211
|
-
repos: Array<{
|
|
2212
|
-
path: string;
|
|
2213
|
-
repo: string;
|
|
2214
|
-
}>;
|
|
2215
|
-
sandbox: PluginSandbox;
|
|
2216
|
-
}
|
|
2217
|
-
export interface SandboxPrepareHookContext extends PluginContext {
|
|
2218
|
-
actor?: Actor;
|
|
2219
|
-
sandbox: PluginSandbox;
|
|
2220
|
-
}
|
|
2221
|
-
export interface BeforeToolExecuteHookContext extends PluginContext {
|
|
2222
|
-
decision: PluginDecision;
|
|
2223
|
-
env: PluginEnv;
|
|
2224
|
-
/** Same directory as `PluginSandbox.juniorRoot` from `sandboxPrepare`. */
|
|
2225
|
-
juniorRoot: string;
|
|
2226
|
-
actor?: Actor;
|
|
2227
|
-
/** All actors who contributed instructions to the run so far; see `multi-actor-runs.md`. */
|
|
2228
|
-
actors?: Actor[];
|
|
2229
|
-
tool: {
|
|
2230
|
-
input: Record<string, unknown>;
|
|
2231
|
-
name: string;
|
|
2234
|
+
conversationId?: string;
|
|
2235
|
+
annotations?: PluginAnnotations;
|
|
2236
|
+
/** Host-owned dashboard link to the Automation that started this run. */
|
|
2237
|
+
automationLink?: {
|
|
2238
|
+
url: string;
|
|
2232
2239
|
};
|
|
2233
|
-
/**
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2240
|
+
/** Host-owned dashboard link to this conversation, when the dashboard is enabled. */
|
|
2241
|
+
conversationLink?: {
|
|
2242
|
+
url: string;
|
|
2243
|
+
};
|
|
2244
|
+
/** Decision model for narrow choices, such as checks on text a tool writes. */
|
|
2245
|
+
decider: PluginDecider;
|
|
2246
|
+
embedder: PluginEmbedder;
|
|
2247
|
+
egress: PluginEgress;
|
|
2248
|
+
mcp?: PluginMcp;
|
|
2249
|
+
model: PluginModel;
|
|
2250
|
+
events: PluginEventToolContext;
|
|
2251
|
+
/** Sandbox filesystem and command capability for plugin-owned workspace tools. */
|
|
2252
|
+
sandbox: PluginSandbox;
|
|
2253
|
+
state: PluginState;
|
|
2237
2254
|
users: {
|
|
2255
|
+
/** Resolve the current actor's stored identity and linked user. */
|
|
2238
2256
|
resolveActor(): Promise<{
|
|
2239
2257
|
identity: Identity;
|
|
2240
2258
|
user?: User;
|
|
2241
2259
|
} | undefined>;
|
|
2260
|
+
/**
|
|
2261
|
+
* Resolve the current actor's IANA timezone. Uses their profile when
|
|
2262
|
+
* Junior knows it, else the install default. Always returns a timezone.
|
|
2263
|
+
*/
|
|
2264
|
+
resolveTimezone(): Promise<string>;
|
|
2242
2265
|
};
|
|
2266
|
+
userText?: string;
|
|
2267
|
+
workspaces: PluginWorkspaceToolContext;
|
|
2243
2268
|
}
|
|
2269
|
+
export type ToolRegistrationHookContext = BaseToolRegistrationHookContext & InvocationContext & {
|
|
2270
|
+
/** Slack tool details when the Conversation has a Slack Location. */
|
|
2271
|
+
slack?: SlackToolRegistrationHookContext;
|
|
2272
|
+
};
|
|
2273
|
+
/** Which URLs a link type claims. Give at most one path field. */
|
|
2274
|
+
export declare const objectLinkFilterSchema: z.ZodObject<{
|
|
2275
|
+
scheme: z.ZodOptional<z.ZodEnum<{
|
|
2276
|
+
http: "http";
|
|
2277
|
+
https: "https";
|
|
2278
|
+
mailto: "mailto";
|
|
2279
|
+
}>>;
|
|
2280
|
+
host: z.ZodOptional<z.ZodString>;
|
|
2281
|
+
path: z.ZodOptional<z.ZodString>;
|
|
2282
|
+
pathPattern: z.ZodOptional<z.ZodString>;
|
|
2283
|
+
pathPrefix: z.ZodOptional<z.ZodString>;
|
|
2284
|
+
}, z.core.$strict>;
|
|
2285
|
+
export type ObjectLinkFilter = z.output<typeof objectLinkFilterSchema>;
|
|
2286
|
+
/** Return whether a filter claims a URL. A trailing slash does not count. */
|
|
2287
|
+
export declare function objectLinkFilterMatches(filter: ObjectLinkFilter, url: URL): boolean;
|
|
2244
2288
|
/**
|
|
2245
|
-
*
|
|
2246
|
-
*
|
|
2247
|
-
*
|
|
2248
|
-
* Return early for tools that the check does not cover: each check adds time
|
|
2249
|
-
* to every tool call.
|
|
2289
|
+
* Rank how specific a filter is. Compare ranks in order: an exact host
|
|
2290
|
+
* before a wildcard host, an exact path before a pattern before a prefix,
|
|
2291
|
+
* and then the longer match.
|
|
2250
2292
|
*/
|
|
2251
|
-
export
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
name: string;
|
|
2264
|
-
};
|
|
2265
|
-
/** Active Workspace, with each repository's checkout path in the sandbox. */
|
|
2266
|
-
workspace?: {
|
|
2267
|
-
name: string;
|
|
2268
|
-
repos: Array<{
|
|
2269
|
-
/** Checkout path relative to `sandbox.root`. */
|
|
2270
|
-
path: string;
|
|
2271
|
-
provider: string;
|
|
2272
|
-
repo: string;
|
|
2273
|
-
}>;
|
|
2274
|
-
};
|
|
2293
|
+
export declare function objectLinkFilterSpecificity(filter: ObjectLinkFilter): number[];
|
|
2294
|
+
/** Trusted host context for one link resolution. */
|
|
2295
|
+
export interface ObjectLinkContext extends PluginContext {
|
|
2296
|
+
/**
|
|
2297
|
+
* Provider egress as a system Actor. It gets only credentials that the
|
|
2298
|
+
* plugin owns, such as an app or Junior's own account, and never the
|
|
2299
|
+
* viewer's credentials. Check that the viewer may see the object before
|
|
2300
|
+
* you return it.
|
|
2301
|
+
*/
|
|
2302
|
+
egress: PluginEgress;
|
|
2303
|
+
/** The signed-in person who sees the card. */
|
|
2304
|
+
viewer: User;
|
|
2275
2305
|
}
|
|
2276
2306
|
/**
|
|
2277
|
-
*
|
|
2278
|
-
*
|
|
2279
|
-
*
|
|
2280
|
-
* junior-owned side effects such as conversation annotations without replacing
|
|
2281
|
-
* the provider tool contract.
|
|
2307
|
+
* One link type of a plugin. Return nothing when the viewer cannot read the
|
|
2308
|
+
* object, so the card does not show that it exists. Junior does not save the
|
|
2309
|
+
* result.
|
|
2282
2310
|
*/
|
|
2283
|
-
export interface
|
|
2311
|
+
export interface PluginObjectLinkDefinition {
|
|
2312
|
+
filters: ObjectLinkFilter[];
|
|
2313
|
+
objectType: ObjectType;
|
|
2314
|
+
resolve(ctx: ObjectLinkContext, url: URL): Promise<ObjectAnnotation | undefined>;
|
|
2284
2315
|
/**
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2316
|
+
* The plugin tool that reads the object live, such as `readGoogleFile`.
|
|
2317
|
+
* When a person attaches the link to a Conversation, its next Turn is told
|
|
2318
|
+
* to read the object with this tool. Omit it when no tool reads the object.
|
|
2287
2319
|
*/
|
|
2288
|
-
|
|
2289
|
-
annotations?: PluginAnnotations;
|
|
2290
|
-
result: {
|
|
2291
|
-
/** Provider content before model-facing truncation. */
|
|
2292
|
-
content?: PluginMcpContent[];
|
|
2293
|
-
structuredContent?: unknown;
|
|
2294
|
-
};
|
|
2295
|
-
tool: {
|
|
2296
|
-
arguments: Record<string, unknown>;
|
|
2297
|
-
/** Provider-local MCP tool name, for example `save_issue`. */
|
|
2298
|
-
name: string;
|
|
2299
|
-
};
|
|
2320
|
+
readTool?: string;
|
|
2300
2321
|
}
|
|
2301
|
-
export
|
|
2322
|
+
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
2323
|
+
closed: "closed";
|
|
2324
|
+
merged: "merged";
|
|
2325
|
+
open: "open";
|
|
2326
|
+
}>;
|
|
2327
|
+
export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
2328
|
+
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
2329
|
+
closedAt: z.ZodOptional<z.ZodDate>;
|
|
2330
|
+
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2331
|
+
draft: z.ZodOptional<z.ZodBoolean>;
|
|
2332
|
+
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
2333
|
+
number: z.ZodNumber;
|
|
2334
|
+
openedAt: z.ZodDate;
|
|
2335
|
+
providerId: z.ZodString;
|
|
2336
|
+
repository: z.ZodObject<{
|
|
2337
|
+
name: z.ZodString;
|
|
2338
|
+
providerId: z.ZodString;
|
|
2339
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2340
|
+
}, z.core.$strict>;
|
|
2341
|
+
state: z.ZodEnum<{
|
|
2342
|
+
closed: "closed";
|
|
2343
|
+
merged: "merged";
|
|
2344
|
+
open: "open";
|
|
2345
|
+
}>;
|
|
2346
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2347
|
+
updatedAt: z.ZodDate;
|
|
2348
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2349
|
+
}, z.core.$strict>;
|
|
2350
|
+
export type CodeChangeInput = z.input<typeof codeChangeInputSchema>;
|
|
2351
|
+
/** Write code changes from a plugin to Junior's code records. */
|
|
2352
|
+
export interface CodeChangePublisher {
|
|
2353
|
+
associateConversations(input: {
|
|
2354
|
+
conversationIds: string[];
|
|
2355
|
+
providerId: string;
|
|
2356
|
+
}): Promise<void>;
|
|
2357
|
+
record(input: CodeChangeInput): Promise<void>;
|
|
2302
2358
|
/**
|
|
2303
|
-
*
|
|
2304
|
-
*
|
|
2359
|
+
* Record a push, review, or comment by a person on a code change. Junior
|
|
2360
|
+
* ignores activity on code changes that it did not record.
|
|
2305
2361
|
*/
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2362
|
+
recordActivity(input: {
|
|
2363
|
+
at: Date;
|
|
2364
|
+
number: number;
|
|
2365
|
+
repositoryProviderId: string;
|
|
2366
|
+
}): Promise<void>;
|
|
2311
2367
|
}
|
|
2312
|
-
export declare const
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
automation: "automation";
|
|
2329
|
-
calendar_event: "calendar_event";
|
|
2330
|
-
code_change: "code_change";
|
|
2331
|
-
deployment: "deployment";
|
|
2332
|
-
item: "item";
|
|
2333
|
-
task: "task";
|
|
2334
|
-
}>;
|
|
2335
|
-
title: z.ZodString;
|
|
2336
|
-
url: z.ZodNullable<z.ZodURL>;
|
|
2368
|
+
export declare const conversationEventIconSchema: z.ZodEnum<{
|
|
2369
|
+
activity: "activity";
|
|
2370
|
+
brain: "brain";
|
|
2371
|
+
calendar: "calendar";
|
|
2372
|
+
check: "check";
|
|
2373
|
+
database: "database";
|
|
2374
|
+
info: "info";
|
|
2375
|
+
key: "key";
|
|
2376
|
+
link: "link";
|
|
2377
|
+
sparkles: "sparkles";
|
|
2378
|
+
warning: "warning";
|
|
2379
|
+
}>;
|
|
2380
|
+
/** Safe, core-rendered presentation for one plugin conversation event. */
|
|
2381
|
+
export declare const conversationEventPresentationSchema: z.ZodObject<{
|
|
2382
|
+
details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2383
|
+
content: z.ZodOptional<z.ZodString>;
|
|
2337
2384
|
description: z.ZodOptional<z.ZodString>;
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
warning: z.ZodOptional<z.ZodString>;
|
|
2341
|
-
displayType: z.ZodOptional<z.ZodString>;
|
|
2342
|
-
sourceUpdatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2343
|
-
facts: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2344
|
-
type: z.ZodLiteral<"code_change">;
|
|
2345
|
-
author: z.ZodOptional<z.ZodString>;
|
|
2346
|
-
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
2347
|
-
targetBranch: z.ZodOptional<z.ZodString>;
|
|
2348
|
-
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2349
|
-
review: z.ZodOptional<z.ZodEnum<{
|
|
2350
|
-
approved: "approved";
|
|
2351
|
-
changes_requested: "changes_requested";
|
|
2352
|
-
required: "required";
|
|
2353
|
-
}>>;
|
|
2354
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
2355
|
-
passed: z.ZodNumber;
|
|
2356
|
-
failed: z.ZodNumber;
|
|
2357
|
-
pending: z.ZodNumber;
|
|
2358
|
-
}, z.core.$strict>>;
|
|
2359
|
-
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
2360
|
-
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
2361
|
-
additions: z.ZodOptional<z.ZodNumber>;
|
|
2362
|
-
deletions: z.ZodOptional<z.ZodNumber>;
|
|
2363
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
2364
|
-
type: z.ZodLiteral<"task">;
|
|
2365
|
-
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2366
|
-
priority: z.ZodOptional<z.ZodString>;
|
|
2367
|
-
project: z.ZodOptional<z.ZodString>;
|
|
2368
|
-
cycle: z.ZodOptional<z.ZodString>;
|
|
2369
|
-
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
2370
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2371
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
2372
|
-
type: z.ZodLiteral<"deployment">;
|
|
2373
|
-
project: z.ZodOptional<z.ZodString>;
|
|
2374
|
-
environment: z.ZodOptional<z.ZodString>;
|
|
2375
|
-
revision: z.ZodOptional<z.ZodString>;
|
|
2376
|
-
branch: z.ZodOptional<z.ZodString>;
|
|
2377
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
2378
|
-
type: z.ZodLiteral<"calendar_event">;
|
|
2379
|
-
when: z.ZodOptional<z.ZodString>;
|
|
2380
|
-
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2381
|
-
}, z.core.$strict>], "type">>;
|
|
2385
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2386
|
+
title: z.ZodString;
|
|
2382
2387
|
}, z.core.$strict>>>;
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
}
|
|
2388
|
+
icon: z.ZodOptional<z.ZodEnum<{
|
|
2389
|
+
activity: "activity";
|
|
2390
|
+
brain: "brain";
|
|
2391
|
+
calendar: "calendar";
|
|
2392
|
+
check: "check";
|
|
2393
|
+
database: "database";
|
|
2394
|
+
info: "info";
|
|
2395
|
+
key: "key";
|
|
2396
|
+
link: "link";
|
|
2397
|
+
sparkles: "sparkles";
|
|
2398
|
+
warning: "warning";
|
|
2399
|
+
}>>;
|
|
2400
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
2401
|
+
title: z.ZodString;
|
|
2402
|
+
}, z.core.$strict>;
|
|
2403
|
+
export type ConversationEventPresentation = z.output<typeof conversationEventPresentationSchema>;
|
|
2404
|
+
/** One validated plugin event value waiting for conversation-bound emission. */
|
|
2405
|
+
export interface PluginConversationEventValue {
|
|
2406
|
+
readonly data: Record<string, unknown>;
|
|
2407
|
+
readonly definition: PluginConversationEventDefinition;
|
|
2408
|
+
}
|
|
2409
|
+
/** Registered schema and optional transcript presentation for one event version. */
|
|
2410
|
+
export interface PluginConversationEventDefinition {
|
|
2411
|
+
readonly eventName: string;
|
|
2412
|
+
readonly version: number;
|
|
2413
|
+
parse(data: unknown): Record<string, unknown>;
|
|
2414
|
+
renderEvent(data: Record<string, unknown>): ConversationEventPresentation | undefined;
|
|
2415
|
+
}
|
|
2416
|
+
/** Typed factory returned while authoring one plugin conversation event. */
|
|
2417
|
+
export interface DefinedConversationEvent<TInput> extends PluginConversationEventDefinition {
|
|
2418
|
+
(data: TInput): PluginConversationEventValue;
|
|
2419
|
+
}
|
|
2420
|
+
/** Define one typed, versioned plugin-owned conversation event. */
|
|
2421
|
+
export declare function defineConversationEvent<TSchema extends z.ZodType<Record<string, unknown>>>(definition: {
|
|
2422
|
+
name: string;
|
|
2423
|
+
version: number;
|
|
2424
|
+
schema: TSchema;
|
|
2425
|
+
renderEvent(event: z.output<TSchema>): z.input<typeof conversationEventPresentationSchema> | undefined;
|
|
2426
|
+
}): DefinedConversationEvent<z.input<TSchema>>;
|
|
2427
|
+
/** Conversation-bound event writer supplied by Junior core. */
|
|
2428
|
+
export interface PluginConversationEvents {
|
|
2429
|
+
emit(event: PluginConversationEventValue): Promise<void>;
|
|
2430
|
+
}
|
|
2431
|
+
export interface PluginConversationEventCostDay {
|
|
2432
|
+
costUsd: number;
|
|
2433
|
+
date: string;
|
|
2434
|
+
events: number;
|
|
2435
|
+
}
|
|
2436
|
+
export interface PluginConversationEventRecord {
|
|
2437
|
+
content: Record<string, unknown>;
|
|
2438
|
+
createdAt: string;
|
|
2439
|
+
/** Position in the Conversation's events. The transcript opens there. */
|
|
2440
|
+
seq: number;
|
|
2441
|
+
/** Turn that emitted the event. Events from outside a Turn have none. */
|
|
2442
|
+
turnId?: string;
|
|
2443
|
+
version: number;
|
|
2444
|
+
}
|
|
2445
|
+
/** Read events owned by the current plugin namespace after Conversation access checks. */
|
|
2446
|
+
export interface PluginConversationEventReader {
|
|
2447
|
+
list(input: {
|
|
2448
|
+
conversationId: string;
|
|
2449
|
+
eventName: string;
|
|
2450
|
+
viewer: User;
|
|
2451
|
+
}): Promise<PluginConversationEventRecord[] | undefined>;
|
|
2452
|
+
}
|
|
2398
2453
|
/**
|
|
2399
|
-
*
|
|
2400
|
-
*
|
|
2401
|
-
*
|
|
2402
|
-
*
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
2405
|
-
* Core resolves the effective mode immediately before execution.
|
|
2454
|
+
* Events that Junior writes in a plugin's namespace for the cost of each
|
|
2455
|
+
* priced `model`, `decider`, `embedder`, or `reranker` call in a
|
|
2456
|
+
* Conversation, by the context that made the call. Junior counts them in
|
|
2457
|
+
* Conversation cost, so plugin events must not repeat that cost. A plugin
|
|
2458
|
+
* cannot register these names. It can read their costs through
|
|
2459
|
+
* `PluginConversationEventStats`.
|
|
2406
2460
|
*/
|
|
2407
|
-
export declare const
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2461
|
+
export declare const pluginModelCostEventNames: {
|
|
2462
|
+
readonly afterToolExecute: "after_tool_execute_model_called";
|
|
2463
|
+
readonly task: "task_model_called";
|
|
2464
|
+
readonly tool: "tool_model_called";
|
|
2465
|
+
readonly userPrompt: "user_prompt_model_called";
|
|
2466
|
+
};
|
|
2467
|
+
/** Whether an event name is one of `pluginModelCostEventNames`. */
|
|
2468
|
+
export declare function isPluginModelCostEventName(eventName: string): boolean;
|
|
2413
2469
|
/**
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
2416
|
-
* These hints follow the MCP tool annotation contract. Guardian may use
|
|
2417
|
-
* them as signals, but they never grant authority or override deterministic
|
|
2418
|
-
* authorization.
|
|
2470
|
+
* Read aggregate costs for events owned by the current plugin namespace:
|
|
2471
|
+
* registered events and `pluginModelCostEventNames`.
|
|
2419
2472
|
*/
|
|
2420
|
-
export interface
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2473
|
+
export interface PluginConversationEventStats {
|
|
2474
|
+
costsByDay(input: {
|
|
2475
|
+
days: 7 | 30 | 90;
|
|
2476
|
+
eventName: string;
|
|
2477
|
+
}): Promise<PluginConversationEventCostDay[]>;
|
|
2478
|
+
costsByHour(input: {
|
|
2479
|
+
eventName: string;
|
|
2480
|
+
hours?: number;
|
|
2481
|
+
}): Promise<PluginConversationEventCostDay[]>;
|
|
2427
2482
|
}
|
|
2428
|
-
export declare const
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
* only and is never an authorization grant.
|
|
2445
|
-
*/
|
|
2446
|
-
describeProposal?(input: TInput): string;
|
|
2483
|
+
export declare const promptMessageSchema: z.ZodObject<{
|
|
2484
|
+
text: z.ZodString;
|
|
2485
|
+
}, z.core.$strict>;
|
|
2486
|
+
/** Small plugin-owned prompt text block rendered by Junior core. */
|
|
2487
|
+
type PromptMessage = z.output<typeof promptMessageSchema>;
|
|
2488
|
+
export declare const promptContextSchema: z.ZodObject<{
|
|
2489
|
+
kind: z.ZodString;
|
|
2490
|
+
version: z.ZodNumber;
|
|
2491
|
+
content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2492
|
+
}, z.core.$strict>;
|
|
2493
|
+
/** Structured plugin context retained alongside its model-visible rendering. */
|
|
2494
|
+
type PromptContext = z.output<typeof promptContextSchema>;
|
|
2495
|
+
/** Runtime contribution produced from one validated plugin context value. */
|
|
2496
|
+
interface PromptContextContribution {
|
|
2497
|
+
context: PromptContext;
|
|
2498
|
+
renderPrompt(): string;
|
|
2447
2499
|
}
|
|
2448
|
-
/**
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
* tools that control the agent loop or dispatch other tools.
|
|
2461
|
-
*/
|
|
2462
|
-
export type ToolExposure = "direct" | "deferred" | "modelOnly" | "codemode" | "hidden";
|
|
2463
|
-
export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExecuteOutput = TOutput> extends ToolApprovalMetadata<TInput> {
|
|
2464
|
-
description: string;
|
|
2465
|
-
/**
|
|
2466
|
-
* Why the current Turn cannot run this tool. The host keeps the tool in the
|
|
2467
|
-
* tool list, so the cached prompt stays the same, and rejects its calls.
|
|
2468
|
-
*/
|
|
2469
|
-
disabledReason?: string;
|
|
2470
|
-
executionMode?: unknown;
|
|
2471
|
-
/** Override the host's default tool exposure. */
|
|
2472
|
-
exposure?: ToolExposure;
|
|
2473
|
-
inputSchema: unknown;
|
|
2474
|
-
outputSchema?: unknown;
|
|
2475
|
-
/**
|
|
2476
|
-
* Select result fields that are safe to retain in private traces.
|
|
2477
|
-
* Returning `undefined` suppresses private result capture.
|
|
2478
|
-
*/
|
|
2479
|
-
privateTraceResult?(result: TOutput): unknown;
|
|
2480
|
-
prepareArguments?: (args: unknown) => TInput;
|
|
2481
|
-
/**
|
|
2482
|
-
* @deprecated Put tool-selection and usage guidance directly in `description`
|
|
2483
|
-
* and parameter descriptions. Retained for compatibility; may be removed in a
|
|
2484
|
-
* future major version.
|
|
2485
|
-
*/
|
|
2486
|
-
promptGuidelines?: string[];
|
|
2487
|
-
/**
|
|
2488
|
-
* @deprecated Put tool-selection and usage guidance directly in `description`
|
|
2489
|
-
* and parameter descriptions. Retained for compatibility; may be removed in a
|
|
2490
|
-
* future major version.
|
|
2491
|
-
*/
|
|
2492
|
-
promptSnippet?: string;
|
|
2493
|
-
execute?: PluginToolExecute<TInput, TExecuteOutput>;
|
|
2494
|
-
}
|
|
2495
|
-
type ZodPluginToolDefinition<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>> = Omit<PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>>, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
2496
|
-
inputSchema: TInputSchema;
|
|
2497
|
-
outputSchema: TOutputSchema;
|
|
2498
|
-
prepareArguments?: (args: unknown) => z.input<TInputSchema>;
|
|
2499
|
-
execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions) => Promise<TExecuteResult> | TExecuteResult;
|
|
2500
|
+
/** Define one typed, versioned plugin context contribution. */
|
|
2501
|
+
export declare function definePromptContext<TSchema extends z.ZodType<Record<string, unknown>>>(definition: {
|
|
2502
|
+
kind: string;
|
|
2503
|
+
version: number;
|
|
2504
|
+
schema: TSchema;
|
|
2505
|
+
renderPrompt(content: z.output<TSchema>): string;
|
|
2506
|
+
}): (content: z.input<TSchema>) => PromptContextContribution;
|
|
2507
|
+
/** One request-scoped plugin contribution to the model-visible user prompt. */
|
|
2508
|
+
type UserPromptContribution = PromptMessage | PromptContextContribution;
|
|
2509
|
+
/** Stable platform context for plugin system prompt guidance. */
|
|
2510
|
+
type SystemPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
|
|
2511
|
+
platform: Platform;
|
|
2500
2512
|
};
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
export declare function zodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>>;
|
|
2504
|
-
/** Define a plugin tool with Zod input parsing and the structured result contract. */
|
|
2505
|
-
export declare function definePluginTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>>;
|
|
2506
|
-
export interface SlackToolRegistrationHookContext {
|
|
2507
|
-
/**
|
|
2508
|
-
* What Slack tools can do in the Conversation Location.
|
|
2509
|
-
* Computed from Location, not from Source or Destination.
|
|
2510
|
-
*/
|
|
2511
|
-
channelCapabilities: {
|
|
2512
|
-
canAddReactions: boolean;
|
|
2513
|
-
canCreateCanvas: boolean;
|
|
2514
|
-
canPostToChannel: boolean;
|
|
2515
|
-
};
|
|
2516
|
-
credentialSubject?: Extract<PluginCredentialSubject, {
|
|
2517
|
-
allowedWhen: "private-direct-conversation";
|
|
2518
|
-
}>;
|
|
2519
|
-
}
|
|
2520
|
-
export interface PluginEventToolContext {
|
|
2521
|
-
/** Whether this invocation can create a working watch. */
|
|
2522
|
-
canSubscribe: boolean;
|
|
2523
|
-
/** Create a temporary watch for the current conversation. */
|
|
2524
|
-
subscribe(input: {
|
|
2525
|
-
events: string[];
|
|
2526
|
-
intent: string;
|
|
2527
|
-
resource: SubscribableResource;
|
|
2528
|
-
/**
|
|
2529
|
-
* Guidance for this Watch only, by event type. Core adds it after the
|
|
2530
|
-
* resource type guidance when a matching Event arrives.
|
|
2531
|
-
*/
|
|
2532
|
-
guidance?: Partial<Record<string, string>>;
|
|
2533
|
-
}): Promise<WatchResult>;
|
|
2534
|
-
}
|
|
2535
|
-
export interface PluginWorkspaceToolContext {
|
|
2536
|
-
/**
|
|
2537
|
-
* Workspace that the current Sandbox started from. Returns undefined for
|
|
2538
|
-
* the default Sandbox. `name` is missing when the recipe no longer exists.
|
|
2539
|
-
*/
|
|
2540
|
-
active(): Promise<{
|
|
2541
|
-
name?: string;
|
|
2542
|
-
} | undefined>;
|
|
2543
|
-
/** Find named Workspaces that include one provider repository. */
|
|
2544
|
-
findByRepository(input: {
|
|
2545
|
-
provider: string;
|
|
2546
|
-
repo: string;
|
|
2547
|
-
}): Promise<string[]>;
|
|
2548
|
-
}
|
|
2549
|
-
interface BaseToolRegistrationHookContext extends PluginContext {
|
|
2550
|
-
/**
|
|
2551
|
-
* Opaque Junior conversation/session identity for this turn.
|
|
2552
|
-
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
2553
|
-
* Scheduled/web turns use an internal id such as `agent-dispatch:{id}`.
|
|
2554
|
-
* Do not parse as Slack unless the value starts with `slack:`.
|
|
2555
|
-
*/
|
|
2513
|
+
/** Runtime facts available while building plugin user prompt context. */
|
|
2514
|
+
type UserPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
|
|
2556
2515
|
conversationId?: string;
|
|
2557
|
-
|
|
2558
|
-
/** Host-owned dashboard link to the Automation that started this run. */
|
|
2559
|
-
automationLink?: {
|
|
2560
|
-
url: string;
|
|
2561
|
-
};
|
|
2562
|
-
/** Host-owned dashboard link to this conversation, when the dashboard is enabled. */
|
|
2563
|
-
conversationLink?: {
|
|
2564
|
-
url: string;
|
|
2565
|
-
};
|
|
2516
|
+
destination: Destination;
|
|
2566
2517
|
embedder: PluginEmbedder;
|
|
2567
|
-
|
|
2568
|
-
|
|
2518
|
+
/** Conversation-bound event writer when the prompt belongs to a durable turn. */
|
|
2519
|
+
events?: PluginConversationEvents;
|
|
2569
2520
|
model: PluginModel;
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2521
|
+
/** Host reranker bound to the configured reranking model. */
|
|
2522
|
+
reranker: PluginReranker;
|
|
2523
|
+
/**
|
|
2524
|
+
* Record numeric diagnostics on the host span for this hook. Keys must
|
|
2525
|
+
* start with `app.<plugin name>.`; the host drops other keys and
|
|
2526
|
+
* non-finite values.
|
|
2527
|
+
*/
|
|
2528
|
+
setSpanAttributes(attributes: Record<string, number>): void;
|
|
2529
|
+
/** Location associated with this Conversation. */
|
|
2530
|
+
locationId?: string;
|
|
2531
|
+
actor?: Actor;
|
|
2532
|
+
source: Source;
|
|
2573
2533
|
state: PluginState;
|
|
2534
|
+
text: string;
|
|
2574
2535
|
users: {
|
|
2575
|
-
/** Resolve the current
|
|
2536
|
+
/** Resolve the current Actor's Identity and User. */
|
|
2576
2537
|
resolveActor(): Promise<{
|
|
2577
2538
|
identity: Identity;
|
|
2578
2539
|
user?: User;
|
|
2579
2540
|
} | undefined>;
|
|
2580
|
-
/**
|
|
2581
|
-
* Resolve the current actor's IANA timezone. Uses their profile when
|
|
2582
|
-
* Junior knows it, else the install default. Always returns a timezone.
|
|
2583
|
-
*/
|
|
2584
|
-
resolveTimezone(): Promise<string>;
|
|
2585
2541
|
};
|
|
2586
|
-
userText?: string;
|
|
2587
|
-
workspaces: PluginWorkspaceToolContext;
|
|
2588
|
-
}
|
|
2589
|
-
export type ToolRegistrationHookContext = BaseToolRegistrationHookContext & InvocationContext & {
|
|
2590
|
-
/** Slack tool details when the Conversation has a Slack Location. */
|
|
2591
|
-
slack?: SlackToolRegistrationHookContext;
|
|
2592
2542
|
};
|
|
2543
|
+
export type DestinationVisibility = z.output<typeof destinationVisibilitySchema>;
|
|
2544
|
+
export type DispatchOptions = z.output<typeof dispatchOptionsSchema>;
|
|
2545
|
+
/** Compact destination-visible context explaining what produced a reply. */
|
|
2546
|
+
export type ReplyAttribution = z.output<typeof replyAttributionSchema>;
|
|
2547
|
+
export type TaskOutcome = z.output<typeof taskOutcomeSchema>;
|
|
2548
|
+
export interface DispatchResult {
|
|
2549
|
+
id: string;
|
|
2550
|
+
status: "created" | "already_exists";
|
|
2551
|
+
}
|
|
2552
|
+
export interface Dispatch {
|
|
2553
|
+
errorMessage?: string;
|
|
2554
|
+
id: string;
|
|
2555
|
+
resultMessageTs?: string;
|
|
2556
|
+
status: "pending" | "running" | "awaiting_resume" | "completed" | "failed" | "blocked";
|
|
2557
|
+
}
|
|
2558
|
+
type EventMatchField = EventMatchFields[string];
|
|
2559
|
+
/** One reason a selection of events and filters cannot work. */
|
|
2560
|
+
export interface EventTriggerProblem {
|
|
2561
|
+
/**
|
|
2562
|
+
* - `unknown_resource_type`: the source has no such enabled resource type.
|
|
2563
|
+
* - `unknown_event`: the resource type has no such event.
|
|
2564
|
+
* - `identifier_required`: a trigger with no identifier selects an event
|
|
2565
|
+
* that cannot run for every resource.
|
|
2566
|
+
* - `filter_required`: a trigger with no identifier selects an event whose
|
|
2567
|
+
* reach names filters, and the trigger sets none of them.
|
|
2568
|
+
* - `unknown_field`: the resource type has no such filter. Saved triggers
|
|
2569
|
+
* get this after a plugin renames or removes a filter.
|
|
2570
|
+
* - `field_not_set`: a selected event never sets the filter, so the filter
|
|
2571
|
+
* never matches that event.
|
|
2572
|
+
* - `invalid_value`: the filter value has the wrong type or is not allowed.
|
|
2573
|
+
*/
|
|
2574
|
+
reason: "unknown_resource_type" | "unknown_event" | "identifier_required" | "filter_required" | "unknown_field" | "field_not_set" | "invalid_value";
|
|
2575
|
+
/** The filter with the problem. Missing for a resource type or event problem. */
|
|
2576
|
+
field?: string;
|
|
2577
|
+
/** Plain words for the person or agent who changes the selection. */
|
|
2578
|
+
message: string;
|
|
2579
|
+
}
|
|
2580
|
+
/**
|
|
2581
|
+
* The selection to check: one resource type, its events, and its filters.
|
|
2582
|
+
* Leave out the resource type for a trigger with no identifier. It runs for
|
|
2583
|
+
* every resource of the source that its filters match.
|
|
2584
|
+
*/
|
|
2585
|
+
export interface EventTriggerSelection {
|
|
2586
|
+
resourceType?: string;
|
|
2587
|
+
events: readonly string[];
|
|
2588
|
+
match?: EventMatch;
|
|
2589
|
+
}
|
|
2590
|
+
/** The enabled resource types of one source, and the reach of each of its events. */
|
|
2591
|
+
export interface EventTriggerSource {
|
|
2592
|
+
resourceTypes: readonly Pick<PluginEventType, "type" | "matchFields" | "supportedEvents">[];
|
|
2593
|
+
events: Readonly<Record<string, {
|
|
2594
|
+
reach: EventReach;
|
|
2595
|
+
}>>;
|
|
2596
|
+
/**
|
|
2597
|
+
* The filters of every resource type, for a trigger with no identifier.
|
|
2598
|
+
* Merge them once with `anyResourceMatchFields` when the catalog is built,
|
|
2599
|
+
* not for each check.
|
|
2600
|
+
*/
|
|
2601
|
+
anyResourceFields: EventMatchFields;
|
|
2602
|
+
}
|
|
2603
|
+
/** The events of a source that a trigger with no identifier can select. */
|
|
2604
|
+
export declare function anyResourceEvents(source: EventTriggerSource): string[];
|
|
2605
|
+
/** Return the selected events that never set one filter field. */
|
|
2606
|
+
export declare function eventsWithoutMatchField(field: Pick<EventMatchField, "events">, events: readonly string[]): string[];
|
|
2607
|
+
/**
|
|
2608
|
+
* Return the events and filters that a selection can use: those of its
|
|
2609
|
+
* resource type, or with no resource type, the events whose reach is not
|
|
2610
|
+
* `"resource"`, with the filters of every resource type. Return nothing when the source
|
|
2611
|
+
* has no such resource type or cannot run for every resource.
|
|
2612
|
+
*/
|
|
2613
|
+
export declare function eventTriggerChoices(source: EventTriggerSource, selection: Pick<EventTriggerSelection, "resourceType">): {
|
|
2614
|
+
events: readonly string[];
|
|
2615
|
+
fields: EventMatchFields;
|
|
2616
|
+
} | undefined;
|
|
2617
|
+
/**
|
|
2618
|
+
* List why a selection cannot work with the resource types of one source. An
|
|
2619
|
+
* empty list means the resource type exists, every selected event is
|
|
2620
|
+
* supported, and every selected event can match every filter. A filter on a
|
|
2621
|
+
* list field (`list: true`) matches when the event list includes the value.
|
|
2622
|
+
* A selection with no resource type can use only events whose reach is not
|
|
2623
|
+
* `"resource"`, with the filters of every resource type, and must set one of
|
|
2624
|
+
* the filters that the reach of each selected event names.
|
|
2625
|
+
* Set `inputKeys` for the agent, so messages name the snake_case
|
|
2626
|
+
* `match.<key>` input.
|
|
2627
|
+
*/
|
|
2628
|
+
export declare function eventTriggerProblems(source: EventTriggerSource, selection: EventTriggerSelection, options?: {
|
|
2629
|
+
inputKeys?: boolean;
|
|
2630
|
+
}): EventTriggerProblem[];
|
|
2631
|
+
/** How people see one Event trigger. Each entry is one line of plain text. */
|
|
2632
|
+
export interface EventTriggerDescription {
|
|
2633
|
+
/** Each selected event in plain words, such as "pull request opened". */
|
|
2634
|
+
events: string[];
|
|
2635
|
+
/** Each filter in plain words. Every filter must match. */
|
|
2636
|
+
filters: string[];
|
|
2637
|
+
/** Why the trigger cannot work as saved. Empty when it can. */
|
|
2638
|
+
problems: string[];
|
|
2639
|
+
}
|
|
2640
|
+
/** Write one event type in plain words: `pull_request.opened` is "pull request opened". */
|
|
2641
|
+
export declare function eventTypeText(eventType: string): string;
|
|
2642
|
+
/**
|
|
2643
|
+
* Write one filter in plain words. A list field (`list: true`) reads
|
|
2644
|
+
* "authors includes alice"; other fields read "repo is api or web".
|
|
2645
|
+
*/
|
|
2646
|
+
export declare function eventMatchFilterText(key: string, field: EventMatchField | undefined, value: EventMatch[string]): string;
|
|
2647
|
+
/**
|
|
2648
|
+
* Describe a selection for the dashboard and Slack, so both show the same
|
|
2649
|
+
* words. Pass the selection's source, as for `eventTriggerProblems`. Its
|
|
2650
|
+
* problems are the messages of that check.
|
|
2651
|
+
*/
|
|
2652
|
+
export declare function describeEventTrigger(source: EventTriggerSource, selection: EventTriggerSelection): EventTriggerDescription;
|
|
2653
|
+
/** Join filters into one line. Every filter must match, so join with "and". */
|
|
2654
|
+
export declare function eventTriggerFiltersText(filters: readonly string[]): string;
|
|
2655
|
+
/**
|
|
2656
|
+
* Write a whole trigger as one line, for cards and lists:
|
|
2657
|
+
* "Pull request · pull request opened · filters: isDraft is false".
|
|
2658
|
+
*/
|
|
2659
|
+
export declare function eventTriggerText(resource: string, description: Pick<EventTriggerDescription, "events" | "filters">): string;
|
|
2660
|
+
/**
|
|
2661
|
+
* Runtime-owned provenance for a transcript message: whether it is a durable
|
|
2662
|
+
* instruction or ambient context, plus the actor identity when known. Missing
|
|
2663
|
+
* provenance on an entry means unattributed context.
|
|
2664
|
+
*/
|
|
2665
|
+
export declare const pluginRunTranscriptProvenanceSchema: z.ZodObject<{
|
|
2666
|
+
authority: z.ZodEnum<{
|
|
2667
|
+
context: "context";
|
|
2668
|
+
instruction: "instruction";
|
|
2669
|
+
}>;
|
|
2670
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2671
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2672
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2673
|
+
userId: z.ZodString;
|
|
2674
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2675
|
+
platform: z.ZodLiteral<"slack">;
|
|
2676
|
+
teamId: z.ZodString;
|
|
2677
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2678
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2679
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2680
|
+
userId: z.ZodString;
|
|
2681
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2682
|
+
platform: z.ZodLiteral<"local">;
|
|
2683
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2684
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2685
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2686
|
+
userId: z.ZodString;
|
|
2687
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2688
|
+
platform: z.ZodLiteral<"web">;
|
|
2689
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2690
|
+
platform: z.ZodLiteral<"system">;
|
|
2691
|
+
name: z.ZodString;
|
|
2692
|
+
}, z.core.$strict>], "platform">>;
|
|
2693
|
+
}, z.core.$strict>;
|
|
2694
|
+
/** One normalized transcript entry from the completed run exposed to plugin tasks. */
|
|
2695
|
+
export declare const pluginRunTranscriptEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2696
|
+
type: z.ZodLiteral<"message">;
|
|
2697
|
+
role: z.ZodEnum<{
|
|
2698
|
+
assistant: "assistant";
|
|
2699
|
+
user: "user";
|
|
2700
|
+
}>;
|
|
2701
|
+
text: z.ZodString;
|
|
2702
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
2703
|
+
authority: z.ZodEnum<{
|
|
2704
|
+
context: "context";
|
|
2705
|
+
instruction: "instruction";
|
|
2706
|
+
}>;
|
|
2707
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2708
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2709
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2710
|
+
userId: z.ZodString;
|
|
2711
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2712
|
+
platform: z.ZodLiteral<"slack">;
|
|
2713
|
+
teamId: z.ZodString;
|
|
2714
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2715
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2716
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2717
|
+
userId: z.ZodString;
|
|
2718
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2719
|
+
platform: z.ZodLiteral<"local">;
|
|
2720
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2721
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2722
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2723
|
+
userId: z.ZodString;
|
|
2724
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2725
|
+
platform: z.ZodLiteral<"web">;
|
|
2726
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2727
|
+
platform: z.ZodLiteral<"system">;
|
|
2728
|
+
name: z.ZodString;
|
|
2729
|
+
}, z.core.$strict>], "platform">>;
|
|
2730
|
+
}, z.core.$strict>>;
|
|
2731
|
+
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
2732
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2733
|
+
type: z.ZodLiteral<"toolResult">;
|
|
2734
|
+
toolName: z.ZodString;
|
|
2735
|
+
isError: z.ZodBoolean;
|
|
2736
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2737
|
+
}, z.core.$strict>], "type">;
|
|
2738
|
+
export type PluginRunTranscriptProvenance = z.output<typeof pluginRunTranscriptProvenanceSchema>;
|
|
2739
|
+
/** Runtime-owned completed-run projection exposed to plugin tasks. */
|
|
2740
|
+
export declare const pluginRunContextSchema: z.ZodObject<{
|
|
2741
|
+
actorUserId: z.ZodOptional<z.ZodString>;
|
|
2742
|
+
completedAtMs: z.ZodNumber;
|
|
2743
|
+
conversationId: z.ZodString;
|
|
2744
|
+
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2745
|
+
platform: z.ZodLiteral<"slack">;
|
|
2746
|
+
teamId: z.ZodString;
|
|
2747
|
+
channelId: z.ZodString;
|
|
2748
|
+
threadTs: z.ZodOptional<z.ZodString>;
|
|
2749
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2750
|
+
platform: z.ZodLiteral<"local">;
|
|
2751
|
+
conversationId: z.ZodString;
|
|
2752
|
+
}, z.core.$strict>], "platform">;
|
|
2753
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
2754
|
+
actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2755
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2756
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2757
|
+
userId: z.ZodString;
|
|
2758
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2759
|
+
platform: z.ZodLiteral<"slack">;
|
|
2760
|
+
teamId: z.ZodString;
|
|
2761
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2762
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2763
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2764
|
+
userId: z.ZodString;
|
|
2765
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2766
|
+
platform: z.ZodLiteral<"local">;
|
|
2767
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2768
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2769
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2770
|
+
userId: z.ZodString;
|
|
2771
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2772
|
+
platform: z.ZodLiteral<"web">;
|
|
2773
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2774
|
+
platform: z.ZodLiteral<"system">;
|
|
2775
|
+
name: z.ZodString;
|
|
2776
|
+
}, z.core.$strict>], "platform">>;
|
|
2777
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2778
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2779
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2780
|
+
userId: z.ZodString;
|
|
2781
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2782
|
+
platform: z.ZodLiteral<"slack">;
|
|
2783
|
+
teamId: z.ZodString;
|
|
2784
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2785
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2786
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2787
|
+
userId: z.ZodString;
|
|
2788
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2789
|
+
platform: z.ZodLiteral<"local">;
|
|
2790
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2791
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2792
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2793
|
+
userId: z.ZodString;
|
|
2794
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2795
|
+
platform: z.ZodLiteral<"web">;
|
|
2796
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2797
|
+
platform: z.ZodLiteral<"system">;
|
|
2798
|
+
name: z.ZodString;
|
|
2799
|
+
}, z.core.$strict>], "platform">>;
|
|
2800
|
+
runId: z.ZodString;
|
|
2801
|
+
source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2802
|
+
kind: z.ZodLiteral<"slack">;
|
|
2803
|
+
teamId: z.ZodString;
|
|
2804
|
+
channelId: z.ZodString;
|
|
2805
|
+
visibility: z.ZodEnum<{
|
|
2806
|
+
private: "private";
|
|
2807
|
+
public: "public";
|
|
2808
|
+
}>;
|
|
2809
|
+
messageTs: z.ZodOptional<z.ZodString>;
|
|
2810
|
+
threadTs: z.ZodOptional<z.ZodString>;
|
|
2811
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2812
|
+
kind: z.ZodLiteral<"local">;
|
|
2813
|
+
visibility: z.ZodLiteral<"private">;
|
|
2814
|
+
conversationId: z.ZodString;
|
|
2815
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2816
|
+
kind: z.ZodLiteral<"web">;
|
|
2817
|
+
visibility: z.ZodEnum<{
|
|
2818
|
+
private: "private";
|
|
2819
|
+
public: "public";
|
|
2820
|
+
}>;
|
|
2821
|
+
conversationId: z.ZodString;
|
|
2822
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2823
|
+
kind: z.ZodLiteral<"event">;
|
|
2824
|
+
eventKey: z.ZodString;
|
|
2825
|
+
eventType: z.ZodString;
|
|
2826
|
+
identifier: z.ZodString;
|
|
2827
|
+
namespace: z.ZodString;
|
|
2828
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2829
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
2830
|
+
automationRunId: z.ZodOptional<z.ZodString>;
|
|
2831
|
+
kind: z.ZodLiteral<"scheduled_automation">;
|
|
2832
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2833
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
2834
|
+
automationRunId: z.ZodOptional<z.ZodString>;
|
|
2835
|
+
kind: z.ZodLiteral<"event_automation">;
|
|
2836
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2837
|
+
kind: z.ZodLiteral<"plugin_dispatch">;
|
|
2838
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2839
|
+
kind: z.ZodLiteral<"agent_invocation">;
|
|
2840
|
+
}, z.core.$strict>], "kind">, unknown>;
|
|
2841
|
+
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2842
|
+
type: z.ZodLiteral<"message">;
|
|
2843
|
+
role: z.ZodEnum<{
|
|
2844
|
+
assistant: "assistant";
|
|
2845
|
+
user: "user";
|
|
2846
|
+
}>;
|
|
2847
|
+
text: z.ZodString;
|
|
2848
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
2849
|
+
authority: z.ZodEnum<{
|
|
2850
|
+
context: "context";
|
|
2851
|
+
instruction: "instruction";
|
|
2852
|
+
}>;
|
|
2853
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2854
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2855
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2856
|
+
userId: z.ZodString;
|
|
2857
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2858
|
+
platform: z.ZodLiteral<"slack">;
|
|
2859
|
+
teamId: z.ZodString;
|
|
2860
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2861
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2862
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2863
|
+
userId: z.ZodString;
|
|
2864
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2865
|
+
platform: z.ZodLiteral<"local">;
|
|
2866
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2867
|
+
email: z.ZodOptional<z.ZodString>;
|
|
2868
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
2869
|
+
userId: z.ZodString;
|
|
2870
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
2871
|
+
platform: z.ZodLiteral<"web">;
|
|
2872
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2873
|
+
platform: z.ZodLiteral<"system">;
|
|
2874
|
+
name: z.ZodString;
|
|
2875
|
+
}, z.core.$strict>], "platform">>;
|
|
2876
|
+
}, z.core.$strict>>;
|
|
2877
|
+
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
2878
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2879
|
+
type: z.ZodLiteral<"toolResult">;
|
|
2880
|
+
toolName: z.ZodString;
|
|
2881
|
+
isError: z.ZodBoolean;
|
|
2882
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2883
|
+
}, z.core.$strict>], "type">>;
|
|
2884
|
+
}, z.core.$strict>;
|
|
2885
|
+
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
2886
|
+
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
2887
|
+
/** Runtime context passed to a plugin-owned background task. */
|
|
2888
|
+
export interface PluginTaskContext extends PluginContext {
|
|
2889
|
+
embedder: PluginEmbedder;
|
|
2890
|
+
events: PluginConversationEvents;
|
|
2891
|
+
id: string;
|
|
2892
|
+
model: PluginModel;
|
|
2893
|
+
name: string;
|
|
2894
|
+
run: {
|
|
2895
|
+
load(): Promise<PluginRunContext>;
|
|
2896
|
+
};
|
|
2897
|
+
state: PluginState;
|
|
2898
|
+
}
|
|
2899
|
+
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
2900
|
+
export interface PluginTaskDefinition {
|
|
2901
|
+
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
2902
|
+
}
|
|
2903
|
+
/** Task handlers keyed by the plugin-owned task name. */
|
|
2904
|
+
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
2593
2905
|
/**
|
|
2594
2906
|
* An item that a plugin puts on the review desk: a notice for information,
|
|
2595
2907
|
* or an ask that waits on its assignees.
|
|
@@ -3196,8 +3508,12 @@ export type PluginRegistrationInput = {
|
|
|
3196
3508
|
cli?: PluginCliDefinition;
|
|
3197
3509
|
conversationEvents?: PluginConversationEventDefinition[];
|
|
3198
3510
|
hooks?: PluginHooks;
|
|
3511
|
+
/** Images that this plugin serves through the Junior image proxy. */
|
|
3512
|
+
images?: PluginImageSource;
|
|
3199
3513
|
manifest: PluginManifest;
|
|
3200
3514
|
model?: PluginModelConfig;
|
|
3515
|
+
/** URLs that this plugin shows as object cards. */
|
|
3516
|
+
objectLinks?: PluginObjectLinkDefinition[];
|
|
3201
3517
|
packageName?: string;
|
|
3202
3518
|
events?: PluginEvents;
|
|
3203
3519
|
tasks?: PluginTasks;
|