@sentry/junior-plugin-api 0.300.0 → 0.302.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 +509 -45
- package/dist/index.js +131 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
35
35
|
cycle: z.ZodOptional<z.ZodString>;
|
|
36
36
|
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
37
37
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
|
+
trend: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
label: z.ZodString;
|
|
40
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
38
42
|
}, z.core.$strict>, z.ZodObject<{
|
|
39
43
|
type: z.ZodLiteral<"deployment">;
|
|
40
44
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -57,6 +61,7 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
57
61
|
summary: z.ZodOptional<z.ZodString>;
|
|
58
62
|
owner: z.ZodOptional<z.ZodString>;
|
|
59
63
|
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
64
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
60
65
|
}, z.core.$strict>, z.ZodObject<{
|
|
61
66
|
type: z.ZodLiteral<"message">;
|
|
62
67
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -68,7 +73,50 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
68
73
|
summary: z.ZodOptional<z.ZodString>;
|
|
69
74
|
siteName: z.ZodOptional<z.ZodString>;
|
|
70
75
|
author: z.ZodOptional<z.ZodString>;
|
|
76
|
+
media: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
image: "image";
|
|
78
|
+
video: "video";
|
|
79
|
+
}>>;
|
|
71
80
|
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
type: z.ZodLiteral<"chart">;
|
|
83
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
84
|
+
display: z.ZodEnum<{
|
|
85
|
+
area: "area";
|
|
86
|
+
bar: "bar";
|
|
87
|
+
line: "line";
|
|
88
|
+
}>;
|
|
89
|
+
yAxis: z.ZodString;
|
|
90
|
+
range: z.ZodString;
|
|
91
|
+
series: z.ZodArray<z.ZodObject<{
|
|
92
|
+
label: z.ZodString;
|
|
93
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strict>>;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"event">;
|
|
97
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
98
|
+
level: z.ZodOptional<z.ZodString>;
|
|
99
|
+
project: z.ZodOptional<z.ZodString>;
|
|
100
|
+
release: z.ZodOptional<z.ZodString>;
|
|
101
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
102
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"trace">;
|
|
105
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
106
|
+
rootOp: z.ZodOptional<z.ZodString>;
|
|
107
|
+
rootName: z.ZodOptional<z.ZodString>;
|
|
108
|
+
durationMs: z.ZodNumber;
|
|
109
|
+
spanCount: z.ZodNumber;
|
|
110
|
+
errorCount: z.ZodNumber;
|
|
111
|
+
performanceIssueCount: z.ZodNumber;
|
|
112
|
+
projects: z.ZodArray<z.ZodString>;
|
|
113
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
114
|
+
op: z.ZodOptional<z.ZodString>;
|
|
115
|
+
name: z.ZodString;
|
|
116
|
+
startMs: z.ZodNumber;
|
|
117
|
+
durationMs: z.ZodNumber;
|
|
118
|
+
issue: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strict>>;
|
|
72
120
|
}, z.core.$strict>, z.ZodObject<{
|
|
73
121
|
type: z.ZodLiteral<"person">;
|
|
74
122
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -83,6 +131,8 @@ export type ObjectFacts = z.output<typeof objectFactsSchema>;
|
|
|
83
131
|
* text at a word, with an ellipsis. Empty text gives no summary.
|
|
84
132
|
*/
|
|
85
133
|
export declare function objectSummary(text: string): string | undefined;
|
|
134
|
+
/** Format a span or trace duration, such as "850 ms" or "2.4 s". */
|
|
135
|
+
export declare function formatDuration(ms: number): string;
|
|
86
136
|
type ObjectField = {
|
|
87
137
|
href?: string;
|
|
88
138
|
key: string;
|
|
@@ -95,18 +145,21 @@ export declare function objectFactFields(facts: ObjectFacts | undefined): Object
|
|
|
95
145
|
export declare const objectTypeSchema: z.ZodEnum<{
|
|
96
146
|
automation: "automation";
|
|
97
147
|
calendar_event: "calendar_event";
|
|
148
|
+
chart: "chart";
|
|
98
149
|
code_change: "code_change";
|
|
99
150
|
conversation: "conversation";
|
|
100
151
|
deployment: "deployment";
|
|
101
152
|
document: "document";
|
|
153
|
+
event: "event";
|
|
102
154
|
item: "item";
|
|
103
155
|
message: "message";
|
|
104
156
|
person: "person";
|
|
105
157
|
task: "task";
|
|
158
|
+
trace: "trace";
|
|
106
159
|
web_page: "web_page";
|
|
107
160
|
}>;
|
|
108
161
|
export type ObjectType = z.output<typeof objectTypeSchema>;
|
|
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"];
|
|
162
|
+
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", "graph", "pulse", "rows", "package"];
|
|
110
163
|
export type ObjectIconName = (typeof objectIconNames)[number];
|
|
111
164
|
export type ObjectTone = "neutral" | "success" | "danger" | "warning" | "info" | "accent";
|
|
112
165
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -148,14 +201,17 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
148
201
|
objectType: z.ZodEnum<{
|
|
149
202
|
automation: "automation";
|
|
150
203
|
calendar_event: "calendar_event";
|
|
204
|
+
chart: "chart";
|
|
151
205
|
code_change: "code_change";
|
|
152
206
|
conversation: "conversation";
|
|
153
207
|
deployment: "deployment";
|
|
154
208
|
document: "document";
|
|
209
|
+
event: "event";
|
|
155
210
|
item: "item";
|
|
156
211
|
message: "message";
|
|
157
212
|
person: "person";
|
|
158
213
|
task: "task";
|
|
214
|
+
trace: "trace";
|
|
159
215
|
web_page: "web_page";
|
|
160
216
|
}>;
|
|
161
217
|
title: z.ZodString;
|
|
@@ -197,6 +253,10 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
197
253
|
cycle: z.ZodOptional<z.ZodString>;
|
|
198
254
|
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
199
255
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
256
|
+
trend: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
label: z.ZodString;
|
|
258
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
259
|
+
}, z.core.$strict>>;
|
|
200
260
|
}, z.core.$strict>, z.ZodObject<{
|
|
201
261
|
type: z.ZodLiteral<"deployment">;
|
|
202
262
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -219,6 +279,7 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
219
279
|
summary: z.ZodOptional<z.ZodString>;
|
|
220
280
|
owner: z.ZodOptional<z.ZodString>;
|
|
221
281
|
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
282
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
222
283
|
}, z.core.$strict>, z.ZodObject<{
|
|
223
284
|
type: z.ZodLiteral<"message">;
|
|
224
285
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -230,7 +291,50 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
230
291
|
summary: z.ZodOptional<z.ZodString>;
|
|
231
292
|
siteName: z.ZodOptional<z.ZodString>;
|
|
232
293
|
author: z.ZodOptional<z.ZodString>;
|
|
294
|
+
media: z.ZodOptional<z.ZodEnum<{
|
|
295
|
+
image: "image";
|
|
296
|
+
video: "video";
|
|
297
|
+
}>>;
|
|
233
298
|
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
299
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
300
|
+
type: z.ZodLiteral<"chart">;
|
|
301
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
302
|
+
display: z.ZodEnum<{
|
|
303
|
+
area: "area";
|
|
304
|
+
bar: "bar";
|
|
305
|
+
line: "line";
|
|
306
|
+
}>;
|
|
307
|
+
yAxis: z.ZodString;
|
|
308
|
+
range: z.ZodString;
|
|
309
|
+
series: z.ZodArray<z.ZodObject<{
|
|
310
|
+
label: z.ZodString;
|
|
311
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
312
|
+
}, z.core.$strict>>;
|
|
313
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
314
|
+
type: z.ZodLiteral<"event">;
|
|
315
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
316
|
+
level: z.ZodOptional<z.ZodString>;
|
|
317
|
+
project: z.ZodOptional<z.ZodString>;
|
|
318
|
+
release: z.ZodOptional<z.ZodString>;
|
|
319
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
320
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
321
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
322
|
+
type: z.ZodLiteral<"trace">;
|
|
323
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
324
|
+
rootOp: z.ZodOptional<z.ZodString>;
|
|
325
|
+
rootName: z.ZodOptional<z.ZodString>;
|
|
326
|
+
durationMs: z.ZodNumber;
|
|
327
|
+
spanCount: z.ZodNumber;
|
|
328
|
+
errorCount: z.ZodNumber;
|
|
329
|
+
performanceIssueCount: z.ZodNumber;
|
|
330
|
+
projects: z.ZodArray<z.ZodString>;
|
|
331
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
332
|
+
op: z.ZodOptional<z.ZodString>;
|
|
333
|
+
name: z.ZodString;
|
|
334
|
+
startMs: z.ZodNumber;
|
|
335
|
+
durationMs: z.ZodNumber;
|
|
336
|
+
issue: z.ZodOptional<z.ZodBoolean>;
|
|
337
|
+
}, z.core.$strict>>;
|
|
234
338
|
}, z.core.$strict>, z.ZodObject<{
|
|
235
339
|
type: z.ZodLiteral<"person">;
|
|
236
340
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -249,14 +353,17 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
249
353
|
objectType: z.ZodEnum<{
|
|
250
354
|
automation: "automation";
|
|
251
355
|
calendar_event: "calendar_event";
|
|
356
|
+
chart: "chart";
|
|
252
357
|
code_change: "code_change";
|
|
253
358
|
conversation: "conversation";
|
|
254
359
|
deployment: "deployment";
|
|
255
360
|
document: "document";
|
|
361
|
+
event: "event";
|
|
256
362
|
item: "item";
|
|
257
363
|
message: "message";
|
|
258
364
|
person: "person";
|
|
259
365
|
task: "task";
|
|
366
|
+
trace: "trace";
|
|
260
367
|
web_page: "web_page";
|
|
261
368
|
}>;
|
|
262
369
|
title: z.ZodString;
|
|
@@ -298,6 +405,10 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
298
405
|
cycle: z.ZodOptional<z.ZodString>;
|
|
299
406
|
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
300
407
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
408
|
+
trend: z.ZodOptional<z.ZodObject<{
|
|
409
|
+
label: z.ZodString;
|
|
410
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
411
|
+
}, z.core.$strict>>;
|
|
301
412
|
}, z.core.$strict>, z.ZodObject<{
|
|
302
413
|
type: z.ZodLiteral<"deployment">;
|
|
303
414
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -320,6 +431,7 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
320
431
|
summary: z.ZodOptional<z.ZodString>;
|
|
321
432
|
owner: z.ZodOptional<z.ZodString>;
|
|
322
433
|
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
434
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
323
435
|
}, z.core.$strict>, z.ZodObject<{
|
|
324
436
|
type: z.ZodLiteral<"message">;
|
|
325
437
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -331,7 +443,50 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
331
443
|
summary: z.ZodOptional<z.ZodString>;
|
|
332
444
|
siteName: z.ZodOptional<z.ZodString>;
|
|
333
445
|
author: z.ZodOptional<z.ZodString>;
|
|
446
|
+
media: z.ZodOptional<z.ZodEnum<{
|
|
447
|
+
image: "image";
|
|
448
|
+
video: "video";
|
|
449
|
+
}>>;
|
|
334
450
|
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
451
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
452
|
+
type: z.ZodLiteral<"chart">;
|
|
453
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
454
|
+
display: z.ZodEnum<{
|
|
455
|
+
area: "area";
|
|
456
|
+
bar: "bar";
|
|
457
|
+
line: "line";
|
|
458
|
+
}>;
|
|
459
|
+
yAxis: z.ZodString;
|
|
460
|
+
range: z.ZodString;
|
|
461
|
+
series: z.ZodArray<z.ZodObject<{
|
|
462
|
+
label: z.ZodString;
|
|
463
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
464
|
+
}, z.core.$strict>>;
|
|
465
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
466
|
+
type: z.ZodLiteral<"event">;
|
|
467
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
468
|
+
level: z.ZodOptional<z.ZodString>;
|
|
469
|
+
project: z.ZodOptional<z.ZodString>;
|
|
470
|
+
release: z.ZodOptional<z.ZodString>;
|
|
471
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
472
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
473
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
474
|
+
type: z.ZodLiteral<"trace">;
|
|
475
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
476
|
+
rootOp: z.ZodOptional<z.ZodString>;
|
|
477
|
+
rootName: z.ZodOptional<z.ZodString>;
|
|
478
|
+
durationMs: z.ZodNumber;
|
|
479
|
+
spanCount: z.ZodNumber;
|
|
480
|
+
errorCount: z.ZodNumber;
|
|
481
|
+
performanceIssueCount: z.ZodNumber;
|
|
482
|
+
projects: z.ZodArray<z.ZodString>;
|
|
483
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
484
|
+
op: z.ZodOptional<z.ZodString>;
|
|
485
|
+
name: z.ZodString;
|
|
486
|
+
startMs: z.ZodNumber;
|
|
487
|
+
durationMs: z.ZodNumber;
|
|
488
|
+
issue: z.ZodOptional<z.ZodBoolean>;
|
|
489
|
+
}, z.core.$strict>>;
|
|
335
490
|
}, z.core.$strict>, z.ZodObject<{
|
|
336
491
|
type: z.ZodLiteral<"person">;
|
|
337
492
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -359,6 +514,9 @@ export declare const objectIconPaths: {
|
|
|
359
514
|
file: string[];
|
|
360
515
|
comment: string[];
|
|
361
516
|
globe: string[];
|
|
517
|
+
graph: string[];
|
|
518
|
+
pulse: string[];
|
|
519
|
+
rows: string[];
|
|
362
520
|
package: string[];
|
|
363
521
|
};
|
|
364
522
|
/** Exact non-blank actor user id that rejects the sentinel "unknown". */
|
|
@@ -860,29 +1018,6 @@ export declare function isPrivateSource(source: Source): boolean;
|
|
|
860
1018
|
export declare function getSourceKey(source: Source): string | undefined;
|
|
861
1019
|
/** Narrow a runtime destination to the Slack-specific address shape. */
|
|
862
1020
|
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
|
-
}
|
|
877
|
-
/**
|
|
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.
|
|
882
|
-
*/
|
|
883
|
-
export interface PluginImageSource {
|
|
884
|
-
resolve(ctx: ImageSourceContext, ref: string): Promise<ImageFetch | undefined>;
|
|
885
|
-
}
|
|
886
1021
|
declare const pluginGrantAccessSchema: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
887
1022
|
/** Runtime schema for provider authorization a plugin may request. */
|
|
888
1023
|
export declare const pluginAuthorizationSchema: z.ZodObject<{
|
|
@@ -1173,14 +1308,17 @@ export declare const resourceLinkAnnotationSchema: z.ZodObject<{
|
|
|
1173
1308
|
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1174
1309
|
automation: "automation";
|
|
1175
1310
|
calendar_event: "calendar_event";
|
|
1311
|
+
chart: "chart";
|
|
1176
1312
|
code_change: "code_change";
|
|
1177
1313
|
conversation: "conversation";
|
|
1178
1314
|
deployment: "deployment";
|
|
1179
1315
|
document: "document";
|
|
1316
|
+
event: "event";
|
|
1180
1317
|
item: "item";
|
|
1181
1318
|
message: "message";
|
|
1182
1319
|
person: "person";
|
|
1183
1320
|
task: "task";
|
|
1321
|
+
trace: "trace";
|
|
1184
1322
|
web_page: "web_page";
|
|
1185
1323
|
}>>;
|
|
1186
1324
|
key: z.ZodString;
|
|
@@ -1201,14 +1339,17 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1201
1339
|
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1202
1340
|
automation: "automation";
|
|
1203
1341
|
calendar_event: "calendar_event";
|
|
1342
|
+
chart: "chart";
|
|
1204
1343
|
code_change: "code_change";
|
|
1205
1344
|
conversation: "conversation";
|
|
1206
1345
|
deployment: "deployment";
|
|
1207
1346
|
document: "document";
|
|
1347
|
+
event: "event";
|
|
1208
1348
|
item: "item";
|
|
1209
1349
|
message: "message";
|
|
1210
1350
|
person: "person";
|
|
1211
1351
|
task: "task";
|
|
1352
|
+
trace: "trace";
|
|
1212
1353
|
web_page: "web_page";
|
|
1213
1354
|
}>>;
|
|
1214
1355
|
key: z.ZodString;
|
|
@@ -1229,14 +1370,17 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1229
1370
|
objectType: z.ZodEnum<{
|
|
1230
1371
|
automation: "automation";
|
|
1231
1372
|
calendar_event: "calendar_event";
|
|
1373
|
+
chart: "chart";
|
|
1232
1374
|
code_change: "code_change";
|
|
1233
1375
|
conversation: "conversation";
|
|
1234
1376
|
deployment: "deployment";
|
|
1235
1377
|
document: "document";
|
|
1378
|
+
event: "event";
|
|
1236
1379
|
item: "item";
|
|
1237
1380
|
message: "message";
|
|
1238
1381
|
person: "person";
|
|
1239
1382
|
task: "task";
|
|
1383
|
+
trace: "trace";
|
|
1240
1384
|
web_page: "web_page";
|
|
1241
1385
|
}>;
|
|
1242
1386
|
title: z.ZodString;
|
|
@@ -1278,6 +1422,10 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1278
1422
|
cycle: z.ZodOptional<z.ZodString>;
|
|
1279
1423
|
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
1280
1424
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1425
|
+
trend: z.ZodOptional<z.ZodObject<{
|
|
1426
|
+
label: z.ZodString;
|
|
1427
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
1428
|
+
}, z.core.$strict>>;
|
|
1281
1429
|
}, z.core.$strict>, z.ZodObject<{
|
|
1282
1430
|
type: z.ZodLiteral<"deployment">;
|
|
1283
1431
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -1300,6 +1448,7 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1300
1448
|
summary: z.ZodOptional<z.ZodString>;
|
|
1301
1449
|
owner: z.ZodOptional<z.ZodString>;
|
|
1302
1450
|
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1451
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
1303
1452
|
}, z.core.$strict>, z.ZodObject<{
|
|
1304
1453
|
type: z.ZodLiteral<"message">;
|
|
1305
1454
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -1311,7 +1460,50 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1311
1460
|
summary: z.ZodOptional<z.ZodString>;
|
|
1312
1461
|
siteName: z.ZodOptional<z.ZodString>;
|
|
1313
1462
|
author: z.ZodOptional<z.ZodString>;
|
|
1463
|
+
media: z.ZodOptional<z.ZodEnum<{
|
|
1464
|
+
image: "image";
|
|
1465
|
+
video: "video";
|
|
1466
|
+
}>>;
|
|
1314
1467
|
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
1468
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1469
|
+
type: z.ZodLiteral<"chart">;
|
|
1470
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1471
|
+
display: z.ZodEnum<{
|
|
1472
|
+
area: "area";
|
|
1473
|
+
bar: "bar";
|
|
1474
|
+
line: "line";
|
|
1475
|
+
}>;
|
|
1476
|
+
yAxis: z.ZodString;
|
|
1477
|
+
range: z.ZodString;
|
|
1478
|
+
series: z.ZodArray<z.ZodObject<{
|
|
1479
|
+
label: z.ZodString;
|
|
1480
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
1481
|
+
}, z.core.$strict>>;
|
|
1482
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1483
|
+
type: z.ZodLiteral<"event">;
|
|
1484
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1485
|
+
level: z.ZodOptional<z.ZodString>;
|
|
1486
|
+
project: z.ZodOptional<z.ZodString>;
|
|
1487
|
+
release: z.ZodOptional<z.ZodString>;
|
|
1488
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
1489
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
1490
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1491
|
+
type: z.ZodLiteral<"trace">;
|
|
1492
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1493
|
+
rootOp: z.ZodOptional<z.ZodString>;
|
|
1494
|
+
rootName: z.ZodOptional<z.ZodString>;
|
|
1495
|
+
durationMs: z.ZodNumber;
|
|
1496
|
+
spanCount: z.ZodNumber;
|
|
1497
|
+
errorCount: z.ZodNumber;
|
|
1498
|
+
performanceIssueCount: z.ZodNumber;
|
|
1499
|
+
projects: z.ZodArray<z.ZodString>;
|
|
1500
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
1501
|
+
op: z.ZodOptional<z.ZodString>;
|
|
1502
|
+
name: z.ZodString;
|
|
1503
|
+
startMs: z.ZodNumber;
|
|
1504
|
+
durationMs: z.ZodNumber;
|
|
1505
|
+
issue: z.ZodOptional<z.ZodBoolean>;
|
|
1506
|
+
}, z.core.$strict>>;
|
|
1315
1507
|
}, z.core.$strict>, z.ZodObject<{
|
|
1316
1508
|
type: z.ZodLiteral<"person">;
|
|
1317
1509
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -1355,14 +1547,17 @@ export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
|
1355
1547
|
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1356
1548
|
automation: "automation";
|
|
1357
1549
|
calendar_event: "calendar_event";
|
|
1550
|
+
chart: "chart";
|
|
1358
1551
|
code_change: "code_change";
|
|
1359
1552
|
conversation: "conversation";
|
|
1360
1553
|
deployment: "deployment";
|
|
1361
1554
|
document: "document";
|
|
1555
|
+
event: "event";
|
|
1362
1556
|
item: "item";
|
|
1363
1557
|
message: "message";
|
|
1364
1558
|
person: "person";
|
|
1365
1559
|
task: "task";
|
|
1560
|
+
trace: "trace";
|
|
1366
1561
|
web_page: "web_page";
|
|
1367
1562
|
}>>;
|
|
1368
1563
|
status: z.ZodOptional<z.ZodString>;
|
|
@@ -1595,14 +1790,17 @@ export declare const eventInputSchema: z.ZodObject<{
|
|
|
1595
1790
|
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1596
1791
|
automation: "automation";
|
|
1597
1792
|
calendar_event: "calendar_event";
|
|
1793
|
+
chart: "chart";
|
|
1598
1794
|
code_change: "code_change";
|
|
1599
1795
|
conversation: "conversation";
|
|
1600
1796
|
deployment: "deployment";
|
|
1601
1797
|
document: "document";
|
|
1798
|
+
event: "event";
|
|
1602
1799
|
item: "item";
|
|
1603
1800
|
message: "message";
|
|
1604
1801
|
person: "person";
|
|
1605
1802
|
task: "task";
|
|
1803
|
+
trace: "trace";
|
|
1606
1804
|
web_page: "web_page";
|
|
1607
1805
|
}>>;
|
|
1608
1806
|
eventKey: z.ZodString;
|
|
@@ -1632,14 +1830,17 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1632
1830
|
objectType: z.ZodOptional<z.ZodEnum<{
|
|
1633
1831
|
automation: "automation";
|
|
1634
1832
|
calendar_event: "calendar_event";
|
|
1833
|
+
chart: "chart";
|
|
1635
1834
|
code_change: "code_change";
|
|
1636
1835
|
conversation: "conversation";
|
|
1637
1836
|
deployment: "deployment";
|
|
1638
1837
|
document: "document";
|
|
1838
|
+
event: "event";
|
|
1639
1839
|
item: "item";
|
|
1640
1840
|
message: "message";
|
|
1641
1841
|
person: "person";
|
|
1642
1842
|
task: "task";
|
|
1843
|
+
trace: "trace";
|
|
1643
1844
|
web_page: "web_page";
|
|
1644
1845
|
}>>;
|
|
1645
1846
|
eventKey: z.ZodString;
|
|
@@ -1839,6 +2040,27 @@ export interface PluginMcp {
|
|
|
1839
2040
|
*/
|
|
1840
2041
|
prepare(): Promise<"authorization_pending" | "ready">;
|
|
1841
2042
|
}
|
|
2043
|
+
/** The result of one tool call as the viewer, or `not_connected`. */
|
|
2044
|
+
export type PluginViewerMcpToolResult = PluginMcpToolError | PluginMcpToolSuccess | {
|
|
2045
|
+
status: "not_connected";
|
|
2046
|
+
};
|
|
2047
|
+
/**
|
|
2048
|
+
* Read-only access to this plugin's hosted MCP provider as the viewer, for
|
|
2049
|
+
* link cards and their images.
|
|
2050
|
+
*/
|
|
2051
|
+
export interface PluginViewerMcp {
|
|
2052
|
+
/**
|
|
2053
|
+
* Call one tool of this plugin's `allowedTools` that the provider marks
|
|
2054
|
+
* read-only, with only the viewer's own stored login. It never asks the
|
|
2055
|
+
* viewer to sign in: a viewer without a usable login gets
|
|
2056
|
+
* `not_connected`. Provider rejections return an error result. Transport
|
|
2057
|
+
* failures throw.
|
|
2058
|
+
*/
|
|
2059
|
+
callTool(input: {
|
|
2060
|
+
arguments?: Record<string, unknown>;
|
|
2061
|
+
name: string;
|
|
2062
|
+
}): Promise<PluginViewerMcpToolResult>;
|
|
2063
|
+
}
|
|
1842
2064
|
/** Complete Workspace repository preparation after credential egress is removed. */
|
|
1843
2065
|
export type WorkspaceFinalize = () => Promise<void> | void;
|
|
1844
2066
|
/**
|
|
@@ -1966,14 +2188,17 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
1966
2188
|
objectType: z.ZodEnum<{
|
|
1967
2189
|
automation: "automation";
|
|
1968
2190
|
calendar_event: "calendar_event";
|
|
2191
|
+
chart: "chart";
|
|
1969
2192
|
code_change: "code_change";
|
|
1970
2193
|
conversation: "conversation";
|
|
1971
2194
|
deployment: "deployment";
|
|
1972
2195
|
document: "document";
|
|
2196
|
+
event: "event";
|
|
1973
2197
|
item: "item";
|
|
1974
2198
|
message: "message";
|
|
1975
2199
|
person: "person";
|
|
1976
2200
|
task: "task";
|
|
2201
|
+
trace: "trace";
|
|
1977
2202
|
web_page: "web_page";
|
|
1978
2203
|
}>;
|
|
1979
2204
|
title: z.ZodString;
|
|
@@ -2015,6 +2240,10 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2015
2240
|
cycle: z.ZodOptional<z.ZodString>;
|
|
2016
2241
|
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
2017
2242
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2243
|
+
trend: z.ZodOptional<z.ZodObject<{
|
|
2244
|
+
label: z.ZodString;
|
|
2245
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
2246
|
+
}, z.core.$strict>>;
|
|
2018
2247
|
}, z.core.$strict>, z.ZodObject<{
|
|
2019
2248
|
type: z.ZodLiteral<"deployment">;
|
|
2020
2249
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -2037,6 +2266,7 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2037
2266
|
summary: z.ZodOptional<z.ZodString>;
|
|
2038
2267
|
owner: z.ZodOptional<z.ZodString>;
|
|
2039
2268
|
modifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2269
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
2040
2270
|
}, z.core.$strict>, z.ZodObject<{
|
|
2041
2271
|
type: z.ZodLiteral<"message">;
|
|
2042
2272
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -2048,7 +2278,50 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2048
2278
|
summary: z.ZodOptional<z.ZodString>;
|
|
2049
2279
|
siteName: z.ZodOptional<z.ZodString>;
|
|
2050
2280
|
author: z.ZodOptional<z.ZodString>;
|
|
2281
|
+
media: z.ZodOptional<z.ZodEnum<{
|
|
2282
|
+
image: "image";
|
|
2283
|
+
video: "video";
|
|
2284
|
+
}>>;
|
|
2051
2285
|
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
2286
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2287
|
+
type: z.ZodLiteral<"chart">;
|
|
2288
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2289
|
+
display: z.ZodEnum<{
|
|
2290
|
+
area: "area";
|
|
2291
|
+
bar: "bar";
|
|
2292
|
+
line: "line";
|
|
2293
|
+
}>;
|
|
2294
|
+
yAxis: z.ZodString;
|
|
2295
|
+
range: z.ZodString;
|
|
2296
|
+
series: z.ZodArray<z.ZodObject<{
|
|
2297
|
+
label: z.ZodString;
|
|
2298
|
+
points: z.ZodArray<z.ZodNumber>;
|
|
2299
|
+
}, z.core.$strict>>;
|
|
2300
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2301
|
+
type: z.ZodLiteral<"event">;
|
|
2302
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2303
|
+
level: z.ZodOptional<z.ZodString>;
|
|
2304
|
+
project: z.ZodOptional<z.ZodString>;
|
|
2305
|
+
release: z.ZodOptional<z.ZodString>;
|
|
2306
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
2307
|
+
occurredAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2308
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2309
|
+
type: z.ZodLiteral<"trace">;
|
|
2310
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
2311
|
+
rootOp: z.ZodOptional<z.ZodString>;
|
|
2312
|
+
rootName: z.ZodOptional<z.ZodString>;
|
|
2313
|
+
durationMs: z.ZodNumber;
|
|
2314
|
+
spanCount: z.ZodNumber;
|
|
2315
|
+
errorCount: z.ZodNumber;
|
|
2316
|
+
performanceIssueCount: z.ZodNumber;
|
|
2317
|
+
projects: z.ZodArray<z.ZodString>;
|
|
2318
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
2319
|
+
op: z.ZodOptional<z.ZodString>;
|
|
2320
|
+
name: z.ZodString;
|
|
2321
|
+
startMs: z.ZodNumber;
|
|
2322
|
+
durationMs: z.ZodNumber;
|
|
2323
|
+
issue: z.ZodOptional<z.ZodBoolean>;
|
|
2324
|
+
}, z.core.$strict>>;
|
|
2052
2325
|
}, z.core.$strict>, z.ZodObject<{
|
|
2053
2326
|
type: z.ZodLiteral<"person">;
|
|
2054
2327
|
summary: z.ZodOptional<z.ZodString>;
|
|
@@ -2070,8 +2343,12 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2070
2343
|
}, z.core.$strict>>;
|
|
2071
2344
|
}, z.core.$loose>;
|
|
2072
2345
|
export type PluginToolOutput = z.output<typeof pluginToolOutputSchema>;
|
|
2073
|
-
|
|
2074
|
-
|
|
2346
|
+
/**
|
|
2347
|
+
* Run a plugin tool. The host passes the Turn context as `ctx` on each call,
|
|
2348
|
+
* so a tool definition never holds Turn state.
|
|
2349
|
+
*/
|
|
2350
|
+
export type PluginToolExecute<TInput = unknown, TOutput = unknown, TContext = ToolRegistrationHookContext> = {
|
|
2351
|
+
bivarianceHack(input: TInput, options: PluginToolExecuteOptions, ctx: TContext): Promise<TOutput> | TOutput;
|
|
2075
2352
|
}["bivarianceHack"];
|
|
2076
2353
|
/**
|
|
2077
2354
|
* Tool-declared approval mode.
|
|
@@ -2138,13 +2415,8 @@ export interface ToolApprovalMetadata<TInput = unknown> {
|
|
|
2138
2415
|
* tools that control the agent loop or dispatch other tools.
|
|
2139
2416
|
*/
|
|
2140
2417
|
export type ToolExposure = "direct" | "deferred" | "modelOnly" | "codemode" | "hidden";
|
|
2141
|
-
export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExecuteOutput = TOutput> extends ToolApprovalMetadata<TInput> {
|
|
2418
|
+
export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExecuteOutput = TOutput, TContext = ToolRegistrationHookContext> extends ToolApprovalMetadata<TInput> {
|
|
2142
2419
|
description: string;
|
|
2143
|
-
/**
|
|
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.
|
|
2146
|
-
*/
|
|
2147
|
-
disabledReason?: string;
|
|
2148
2420
|
executionMode?: unknown;
|
|
2149
2421
|
/** Override the host's default tool exposure. */
|
|
2150
2422
|
exposure?: ToolExposure;
|
|
@@ -2168,19 +2440,24 @@ export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExec
|
|
|
2168
2440
|
* future major version.
|
|
2169
2441
|
*/
|
|
2170
2442
|
promptSnippet?: string;
|
|
2171
|
-
execute?: PluginToolExecute<TInput, TExecuteOutput>;
|
|
2443
|
+
execute?: PluginToolExecute<TInput, TExecuteOutput, TContext>;
|
|
2172
2444
|
}
|
|
2173
|
-
type ZodPluginToolDefinition<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema
|
|
2445
|
+
type ZodPluginToolDefinition<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>, TContext> = Omit<PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>>, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
2174
2446
|
inputSchema: TInputSchema;
|
|
2175
2447
|
outputSchema: TOutputSchema;
|
|
2176
2448
|
prepareArguments?: (args: unknown) => z.input<TInputSchema>;
|
|
2177
|
-
execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions) => Promise<TExecuteResult> | TExecuteResult;
|
|
2449
|
+
execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions, ctx: TContext) => Promise<TExecuteResult> | TExecuteResult;
|
|
2178
2450
|
};
|
|
2179
2451
|
type ParsedPluginToolExecuteResult<TOutputSchema extends ZodTypeAny, TResult> = TResult extends PluginToolOutputEnvelope<unknown> ? PluginToolOutputEnvelope<z.output<TOutputSchema>> : z.output<TOutputSchema>;
|
|
2452
|
+
/**
|
|
2453
|
+
* Run tools that take a plugin-built context, such as deployment config plus
|
|
2454
|
+
* the Turn capabilities that they use. `toContext` runs on each call.
|
|
2455
|
+
*/
|
|
2456
|
+
export declare function withToolContext<TContext>(tools: Record<string, PluginToolDefinition<unknown, unknown, unknown, TContext>>, toContext: (ctx: ToolRegistrationHookContext) => TContext): Record<string, PluginToolDefinition>;
|
|
2180
2457
|
/** 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
|
|
2458
|
+
export declare function zodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>, TContext = ToolRegistrationHookContext>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult, TContext>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>, TContext>;
|
|
2182
2459
|
/** 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
|
|
2460
|
+
export declare function definePluginTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodTypeAny, TExecuteResult extends z.input<TOutputSchema> | PluginToolOutputEnvelope<z.input<TOutputSchema>>, TContext = ToolRegistrationHookContext>(definition: ZodPluginToolDefinition<TInputSchema, TOutputSchema, TExecuteResult, TContext>): PluginToolDefinition<z.output<TInputSchema>, z.output<TOutputSchema>, ParsedPluginToolExecuteResult<TOutputSchema, TExecuteResult>, TContext>;
|
|
2184
2461
|
export interface SlackToolRegistrationHookContext {
|
|
2185
2462
|
/**
|
|
2186
2463
|
* What Slack tools can do in the Conversation Location.
|
|
@@ -2224,6 +2501,36 @@ export interface PluginWorkspaceToolContext {
|
|
|
2224
2501
|
repo: string;
|
|
2225
2502
|
}): Promise<string[]>;
|
|
2226
2503
|
}
|
|
2504
|
+
/** One Conversation that the current Conversation may find. */
|
|
2505
|
+
export interface PluginConversationMatch {
|
|
2506
|
+
conversationId: string;
|
|
2507
|
+
/** Root of a child agent. Missing for a root Conversation. */
|
|
2508
|
+
rootConversationId?: string;
|
|
2509
|
+
/**
|
|
2510
|
+
* What its agent does now. pending: waiting to run. running or paused:
|
|
2511
|
+
* working. idle: waits for a message. A failed Turn shows as idle.
|
|
2512
|
+
*/
|
|
2513
|
+
status: "pending" | "running" | "paused" | "idle";
|
|
2514
|
+
/** Summary of the latest Brief, when it has one. */
|
|
2515
|
+
summary?: string;
|
|
2516
|
+
title?: string;
|
|
2517
|
+
/** ISO time of the latest activity. */
|
|
2518
|
+
updatedAt: string;
|
|
2519
|
+
}
|
|
2520
|
+
export interface PluginConversationToolContext {
|
|
2521
|
+
/**
|
|
2522
|
+
* Find other Conversations that have an Annotation with `annotation`, or a
|
|
2523
|
+
* nested key that continues with `#`. A root does not match for the
|
|
2524
|
+
* Annotation of its child agent. Core applies the Conversation access
|
|
2525
|
+
* rules, and leaves out archived Conversations and the current tree.
|
|
2526
|
+
* Working Conversations (pending, running, paused) first, then newest
|
|
2527
|
+
* activity.
|
|
2528
|
+
*/
|
|
2529
|
+
search(input: {
|
|
2530
|
+
annotation: string;
|
|
2531
|
+
limit?: number;
|
|
2532
|
+
}): Promise<PluginConversationMatch[]>;
|
|
2533
|
+
}
|
|
2227
2534
|
interface BaseToolRegistrationHookContext extends PluginContext {
|
|
2228
2535
|
/**
|
|
2229
2536
|
* Opaque Junior conversation/session identity for this turn.
|
|
@@ -2233,6 +2540,8 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
2233
2540
|
*/
|
|
2234
2541
|
conversationId?: string;
|
|
2235
2542
|
annotations?: PluginAnnotations;
|
|
2543
|
+
/** Other Conversations. Set only when the turn has a `conversationId`. */
|
|
2544
|
+
conversations?: PluginConversationToolContext;
|
|
2236
2545
|
/** Host-owned dashboard link to the Automation that started this run. */
|
|
2237
2546
|
automationLink?: {
|
|
2238
2547
|
url: string;
|
|
@@ -2262,6 +2571,13 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
2262
2571
|
* Junior knows it, else the install default. Always returns a timezone.
|
|
2263
2572
|
*/
|
|
2264
2573
|
resolveTimezone(): Promise<string>;
|
|
2574
|
+
/**
|
|
2575
|
+
* Rewrite Slack mention syntax in every string of `value`, such as a tool
|
|
2576
|
+
* input that goes to `provider`. A Slack user becomes `@handle` of their
|
|
2577
|
+
* linked `provider` account, or else their name. Markdown code stays as
|
|
2578
|
+
* written. Call it before you send model text out.
|
|
2579
|
+
*/
|
|
2580
|
+
replaceSlackMentions<T>(value: T, provider: string): Promise<T>;
|
|
2265
2581
|
};
|
|
2266
2582
|
userText?: string;
|
|
2267
2583
|
workspaces: PluginWorkspaceToolContext;
|
|
@@ -2270,6 +2586,64 @@ export type ToolRegistrationHookContext = BaseToolRegistrationHookContext & Invo
|
|
|
2270
2586
|
/** Slack tool details when the Conversation has a Slack Location. */
|
|
2271
2587
|
slack?: SlackToolRegistrationHookContext;
|
|
2272
2588
|
};
|
|
2589
|
+
/** How Junior fetches one image. */
|
|
2590
|
+
export interface ImageFetch {
|
|
2591
|
+
/**
|
|
2592
|
+
* Request headers, such as the plugin's credential. Junior sends them only
|
|
2593
|
+
* to the origin of `url`, not after a redirect to another origin.
|
|
2594
|
+
*/
|
|
2595
|
+
headers?: Record<string, string>;
|
|
2596
|
+
/**
|
|
2597
|
+
* Return the address to fetch instead of `url`, such as a short-lived
|
|
2598
|
+
* signed URL that the plugin reads through egress. Junior calls it only
|
|
2599
|
+
* when it fetches the image, not when it serves a cached copy, and sends
|
|
2600
|
+
* no `headers` to it. `url` stays the identity of the cached image.
|
|
2601
|
+
* Return nothing when the image is gone.
|
|
2602
|
+
*/
|
|
2603
|
+
location?: () => Promise<string | undefined>;
|
|
2604
|
+
url: string;
|
|
2605
|
+
}
|
|
2606
|
+
/** Trusted host context for one image read. */
|
|
2607
|
+
export interface ImageSourceContext extends PluginContext {
|
|
2608
|
+
/**
|
|
2609
|
+
* Provider egress as a system Actor. It gets only credentials that the
|
|
2610
|
+
* plugin owns, such as an app, and never the viewer's credentials. Check
|
|
2611
|
+
* that the viewer may see the image before you fetch it.
|
|
2612
|
+
*/
|
|
2613
|
+
egress: PluginEgress;
|
|
2614
|
+
/** The signed-in person who sees the image. */
|
|
2615
|
+
viewer: User;
|
|
2616
|
+
/** This plugin's hosted MCP provider as the viewer. See `ObjectLinkContext`. */
|
|
2617
|
+
viewerMcp: PluginViewerMcp;
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* Images that a plugin serves through the Junior image proxy. `resolve`
|
|
2621
|
+
* checks that the viewer may see the image and returns how to fetch it.
|
|
2622
|
+
* Return nothing when the viewer cannot see it. Junior checks the address,
|
|
2623
|
+
* the type, and the size of each image, and caches it for every viewer.
|
|
2624
|
+
* The preview images of the plugin's object annotations come with refs from
|
|
2625
|
+
* `encodeObjectImageRef`.
|
|
2626
|
+
*/
|
|
2627
|
+
export interface PluginImageSource {
|
|
2628
|
+
resolve(ctx: ImageSourceContext, ref: string): Promise<ImageFetch | undefined>;
|
|
2629
|
+
}
|
|
2630
|
+
declare const objectImageRefSchema: z.ZodObject<{
|
|
2631
|
+
key: z.ZodString;
|
|
2632
|
+
url: z.ZodString;
|
|
2633
|
+
}, z.core.$strict>;
|
|
2634
|
+
/**
|
|
2635
|
+
* One preview image of an object annotation, such as `previewImageUrls` of a
|
|
2636
|
+
* code change. `key` is the annotation key, so the plugin can check that the
|
|
2637
|
+
* viewer may see that object.
|
|
2638
|
+
*/
|
|
2639
|
+
export type ObjectImageRef = z.output<typeof objectImageRefSchema>;
|
|
2640
|
+
/** Return the image source ref of one object preview image. */
|
|
2641
|
+
export declare function encodeObjectImageRef(image: ObjectImageRef): string;
|
|
2642
|
+
/**
|
|
2643
|
+
* Return the object preview image of an image source ref, or nothing when
|
|
2644
|
+
* the ref names another kind of image.
|
|
2645
|
+
*/
|
|
2646
|
+
export declare function decodeObjectImageRef(ref: string): ObjectImageRef | undefined;
|
|
2273
2647
|
/** Which URLs a link type claims. Give at most one path field. */
|
|
2274
2648
|
export declare const objectLinkFilterSchema: z.ZodObject<{
|
|
2275
2649
|
scheme: z.ZodOptional<z.ZodEnum<{
|
|
@@ -2300,24 +2674,75 @@ export interface ObjectLinkContext extends PluginContext {
|
|
|
2300
2674
|
* you return it.
|
|
2301
2675
|
*/
|
|
2302
2676
|
egress: PluginEgress;
|
|
2677
|
+
/**
|
|
2678
|
+
* Return the Junior path of one image that this plugin serves through
|
|
2679
|
+
* `images`, such as a file thumbnail. Put the path in facts, never the
|
|
2680
|
+
* address of the image. The image route asks `images.resolve` again for
|
|
2681
|
+
* each viewer. `version` changes the path when the image changes.
|
|
2682
|
+
*/
|
|
2683
|
+
imagePath(ref: string, version?: string): string;
|
|
2684
|
+
/**
|
|
2685
|
+
* Return the Junior person card of the one known person with this
|
|
2686
|
+
* provider account, or undefined. Return it for a profile link of that
|
|
2687
|
+
* account, so the card shows the person and not only the account.
|
|
2688
|
+
*/
|
|
2689
|
+
findPerson(account: {
|
|
2690
|
+
handle: string;
|
|
2691
|
+
provider: string;
|
|
2692
|
+
}): Promise<ObjectAnnotation | undefined>;
|
|
2303
2693
|
/** The signed-in person who sees the card. */
|
|
2304
2694
|
viewer: User;
|
|
2695
|
+
/**
|
|
2696
|
+
* Provider egress with only the viewer's own stored OAuth token for this
|
|
2697
|
+
* plugin's provider, such as a token from the dashboard Connections page.
|
|
2698
|
+
* It never asks the viewer to authorize, and it never uses a plugin
|
|
2699
|
+
* grant, an app token, or another person's token. A viewer without a
|
|
2700
|
+
* usable token gets HTTP 401. Use it to check that the viewer may see an
|
|
2701
|
+
* object, and read the card data with `egress`. Read the data with it only
|
|
2702
|
+
* when the data depends on who reads it, such as a query over the
|
|
2703
|
+
* viewer's own projects, and cache it per viewer.
|
|
2704
|
+
*/
|
|
2705
|
+
viewerEgress: PluginEgress;
|
|
2706
|
+
/**
|
|
2707
|
+
* This plugin's hosted MCP provider as the viewer, with only the viewer's
|
|
2708
|
+
* own stored login. Use it when the provider decides access only through
|
|
2709
|
+
* MCP.
|
|
2710
|
+
*/
|
|
2711
|
+
viewerMcp: PluginViewerMcp;
|
|
2305
2712
|
}
|
|
2306
2713
|
/**
|
|
2307
|
-
* One link type of a plugin.
|
|
2308
|
-
*
|
|
2309
|
-
* result.
|
|
2714
|
+
* One link type of a plugin. Junior calls `canView` first, and calls
|
|
2715
|
+
* `resolve` only when it returns true. Junior does not save the result.
|
|
2310
2716
|
*/
|
|
2311
2717
|
export interface PluginObjectLinkDefinition {
|
|
2718
|
+
/**
|
|
2719
|
+
* Return whether `ctx.viewer` may see the object. Junior calls it before
|
|
2720
|
+
* each card read and again on each Attach. Return true for a public
|
|
2721
|
+
* object. Return false when you cannot tell, so the card does not show
|
|
2722
|
+
* that the object exists.
|
|
2723
|
+
*/
|
|
2724
|
+
canView(ctx: ObjectLinkContext, url: URL): Promise<boolean>;
|
|
2312
2725
|
filters: ObjectLinkFilter[];
|
|
2313
2726
|
objectType: ObjectType;
|
|
2727
|
+
/**
|
|
2728
|
+
* Read the card. Junior calls it only after `canView` returns true.
|
|
2729
|
+
* Return nothing for a missing object.
|
|
2730
|
+
*/
|
|
2314
2731
|
resolve(ctx: ObjectLinkContext, url: URL): Promise<ObjectAnnotation | undefined>;
|
|
2315
2732
|
/**
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
*
|
|
2733
|
+
* When `canView` returns false, show the public web page card of the
|
|
2734
|
+
* link, as for a link that no link type claims. Use it for a provider
|
|
2735
|
+
* whose public pages have useful web page metadata. That card reads only
|
|
2736
|
+
* what anyone can read without signing in.
|
|
2319
2737
|
*/
|
|
2320
|
-
|
|
2738
|
+
webPageFallback?: true;
|
|
2739
|
+
/**
|
|
2740
|
+
* Name the plugin tool that reads the resolved object live, such as
|
|
2741
|
+
* `readGoogleFile`. When a person attaches the link to a Conversation, its
|
|
2742
|
+
* next Turn is told to read the object with this tool. Return nothing when
|
|
2743
|
+
* no tool reads this object.
|
|
2744
|
+
*/
|
|
2745
|
+
readTool?(object: ObjectAnnotation): string | undefined;
|
|
2321
2746
|
}
|
|
2322
2747
|
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
2323
2748
|
closed: "closed";
|
|
@@ -2971,6 +3396,8 @@ export interface HeartbeatHookContext extends PluginContext {
|
|
|
2971
3396
|
/** Publish events, as from a plugin route. */
|
|
2972
3397
|
events: EventPublisher;
|
|
2973
3398
|
nowMs: number;
|
|
3399
|
+
/** Review desk items, as from a plugin route. */
|
|
3400
|
+
reviewItems: PluginConversationReviewItems;
|
|
2974
3401
|
state: PluginState;
|
|
2975
3402
|
}
|
|
2976
3403
|
export interface HeartbeatResult {
|
|
@@ -3156,6 +3583,32 @@ export declare function enforceEgressPolicy(input: {
|
|
|
3156
3583
|
export declare function parseShellCommands(text: string): string[][];
|
|
3157
3584
|
/** Input for a pure Markdown rewrite before destination delivery formatting. */
|
|
3158
3585
|
export interface FormatMarkdownHookContext {
|
|
3586
|
+
/**
|
|
3587
|
+
* String config values of this plugin for the Conversation's Location, by
|
|
3588
|
+
* short key, over install defaults. Runtime notices get install defaults.
|
|
3589
|
+
*/
|
|
3590
|
+
config: Record<string, string>;
|
|
3591
|
+
/**
|
|
3592
|
+
* Return the destination's mention of the one known person who has this
|
|
3593
|
+
* provider account, or undefined. Core resolves the `@handle` words in
|
|
3594
|
+
* `text` before the hook runs. Insert the result as is. Only Slack text
|
|
3595
|
+
* gets mentions: Slack syntax never goes to another place.
|
|
3596
|
+
*/
|
|
3597
|
+
mention(account: {
|
|
3598
|
+
provider: string;
|
|
3599
|
+
handle: string;
|
|
3600
|
+
}): string | undefined;
|
|
3601
|
+
/**
|
|
3602
|
+
* Where the text shows: a Slack message, or the dashboard (`web`). The
|
|
3603
|
+
* dashboard shows a bare object link as a card, so keep bare links there.
|
|
3604
|
+
*/
|
|
3605
|
+
platform: "slack" | "web";
|
|
3606
|
+
/**
|
|
3607
|
+
* The provider that wrote the text or that it went to, such as `github`
|
|
3608
|
+
* for a GitHub Event or a comment posted to GitHub. In that text, every
|
|
3609
|
+
* `@name` is an account of that provider. Undefined for chat replies.
|
|
3610
|
+
*/
|
|
3611
|
+
provider?: string;
|
|
3159
3612
|
text: string;
|
|
3160
3613
|
}
|
|
3161
3614
|
/** First human message of a new Conversation, given before title generation. */
|
|
@@ -3238,7 +3691,18 @@ export interface PluginHooks {
|
|
|
3238
3691
|
slackConversationLink?(ctx: SlackConversationLinkHookContext): SlackConversationLink | undefined;
|
|
3239
3692
|
/** Pure Markdown rewrite. Emit ordinary Markdown only. */
|
|
3240
3693
|
formatMarkdown?(ctx: FormatMarkdownHookContext): string;
|
|
3241
|
-
|
|
3694
|
+
/**
|
|
3695
|
+
* Tools by plugin-local camelCase name. Read only deployment configuration
|
|
3696
|
+
* here, never Turn context: the host reads them with no Turn, and passes
|
|
3697
|
+
* the Turn context to each `execute` call.
|
|
3698
|
+
*/
|
|
3699
|
+
tools?(): Record<string, PluginToolDefinition>;
|
|
3700
|
+
/**
|
|
3701
|
+
* Tools from `tools()` that this Turn cannot run, with the reason. The host
|
|
3702
|
+
* keeps them in the tool list, so the cached prompt stays the same, and
|
|
3703
|
+
* rejects their calls.
|
|
3704
|
+
*/
|
|
3705
|
+
disabledTools?(ctx: ToolRegistrationHookContext): Record<string, string>;
|
|
3242
3706
|
}
|
|
3243
3707
|
export interface PluginCliIo {
|
|
3244
3708
|
writeError(text: string): Promise<void> | void;
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,15 @@ import * as z from "zod";
|
|
|
2
2
|
// src/object-facts.ts
|
|
3
3
|
const text = z.string().trim().min(1).max(160);
|
|
4
4
|
const count = z.number().int().nonnegative();
|
|
5
|
+
const duration = z.number().finite().nonnegative();
|
|
6
|
+
const imagePath = z.string().max(4e3).regex(/^\/api\/images\/[\w-]+\.[\w-]+\?w=\d+(&v=[\w-]+)?$/);
|
|
5
7
|
/** The longest object summary, in UTF-16 code units. */
|
|
6
8
|
const OBJECT_SUMMARY_MAX_LENGTH = 280;
|
|
7
9
|
const summary = z.string().trim().min(1).max(280);
|
|
10
|
+
const trend = z.strictObject({
|
|
11
|
+
label: text,
|
|
12
|
+
points: z.array(z.number().finite().nonnegative()).min(2).max(60)
|
|
13
|
+
});
|
|
8
14
|
/** Small, provider-neutral facts. Missing values mean unknown, not success. */
|
|
9
15
|
const objectFactsSchema = z.discriminatedUnion("type", [
|
|
10
16
|
z.strictObject({
|
|
@@ -29,8 +35,9 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
29
35
|
additions: count.optional(),
|
|
30
36
|
deletions: count.optional(),
|
|
31
37
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
38
|
+
* Images from the description. The dashboard loads them through the
|
|
39
|
+
* Junior image route, and the plugin's `images` source checks each
|
|
40
|
+
* viewer. The 4 KiB facts limit sets how many fit.
|
|
34
41
|
*/
|
|
35
42
|
previewImageUrls: z.array(z.url({ protocol: /^https?$/ }).max(512)).min(1).optional()
|
|
36
43
|
}),
|
|
@@ -42,7 +49,8 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
42
49
|
project: text.optional(),
|
|
43
50
|
cycle: text.optional(),
|
|
44
51
|
dueDate: z.iso.date().optional(),
|
|
45
|
-
labels: z.array(text).max(5).optional()
|
|
52
|
+
labels: z.array(text).max(5).optional(),
|
|
53
|
+
trend: trend.optional()
|
|
46
54
|
}),
|
|
47
55
|
z.strictObject({
|
|
48
56
|
type: z.literal("deployment"),
|
|
@@ -68,7 +76,8 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
68
76
|
type: z.literal("document"),
|
|
69
77
|
summary: summary.optional(),
|
|
70
78
|
owner: text.optional(),
|
|
71
|
-
modifiedAt: z.iso.datetime({ offset: true }).optional()
|
|
79
|
+
modifiedAt: z.iso.datetime({ offset: true }).optional(),
|
|
80
|
+
thumbnailUrl: imagePath.optional()
|
|
72
81
|
}),
|
|
73
82
|
z.strictObject({
|
|
74
83
|
type: z.literal("message"),
|
|
@@ -82,7 +91,50 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
82
91
|
summary: summary.optional(),
|
|
83
92
|
siteName: text.optional(),
|
|
84
93
|
author: text.optional(),
|
|
85
|
-
|
|
94
|
+
media: z.enum(["video", "image"]).optional(),
|
|
95
|
+
thumbnailUrl: imagePath.optional()
|
|
96
|
+
}),
|
|
97
|
+
z.strictObject({
|
|
98
|
+
type: z.literal("chart"),
|
|
99
|
+
summary: summary.optional(),
|
|
100
|
+
display: z.enum([
|
|
101
|
+
"line",
|
|
102
|
+
"bar",
|
|
103
|
+
"area"
|
|
104
|
+
]),
|
|
105
|
+
yAxis: text,
|
|
106
|
+
range: text,
|
|
107
|
+
series: z.array(z.strictObject({
|
|
108
|
+
label: text,
|
|
109
|
+
points: z.array(z.number().finite()).min(2).max(120)
|
|
110
|
+
})).min(1).max(5)
|
|
111
|
+
}),
|
|
112
|
+
z.strictObject({
|
|
113
|
+
type: z.literal("event"),
|
|
114
|
+
summary: summary.optional(),
|
|
115
|
+
level: text.optional(),
|
|
116
|
+
project: text.optional(),
|
|
117
|
+
release: text.optional(),
|
|
118
|
+
environment: text.optional(),
|
|
119
|
+
occurredAt: z.iso.datetime({ offset: true }).optional()
|
|
120
|
+
}),
|
|
121
|
+
z.strictObject({
|
|
122
|
+
type: z.literal("trace"),
|
|
123
|
+
summary: summary.optional(),
|
|
124
|
+
rootOp: text.optional(),
|
|
125
|
+
rootName: text.optional(),
|
|
126
|
+
durationMs: duration,
|
|
127
|
+
spanCount: count,
|
|
128
|
+
errorCount: count,
|
|
129
|
+
performanceIssueCount: count,
|
|
130
|
+
projects: z.array(text).max(5),
|
|
131
|
+
spans: z.array(z.strictObject({
|
|
132
|
+
op: text.optional(),
|
|
133
|
+
name: text,
|
|
134
|
+
startMs: duration,
|
|
135
|
+
durationMs: duration,
|
|
136
|
+
issue: z.boolean().optional()
|
|
137
|
+
})).max(12)
|
|
86
138
|
}),
|
|
87
139
|
z.strictObject({
|
|
88
140
|
type: z.literal("person"),
|
|
@@ -113,6 +165,15 @@ function objectSummary(text) {
|
|
|
113
165
|
}
|
|
114
166
|
return `${cut}…`;
|
|
115
167
|
}
|
|
168
|
+
function plural(value, noun) {
|
|
169
|
+
return `${value.toLocaleString("en-US")} ${noun}${value === 1 ? "" : "s"}`;
|
|
170
|
+
}
|
|
171
|
+
/** Format a span or trace duration, such as "850 ms" or "2.4 s". */
|
|
172
|
+
function formatDuration(ms) {
|
|
173
|
+
if (ms < 1e3) return `${Math.round(ms)} ms`;
|
|
174
|
+
if (ms < 6e4) return `${Number((ms / 1e3).toPrecision(3))} s`;
|
|
175
|
+
return `${Number((ms / 6e4).toPrecision(3))} min`;
|
|
176
|
+
}
|
|
116
177
|
/** Show at most four card attributes, in priority order, on every surface. */
|
|
117
178
|
function objectFactFields(facts) {
|
|
118
179
|
if (!facts) return [];
|
|
@@ -174,6 +235,21 @@ function objectFactFields(facts) {
|
|
|
174
235
|
add("siteName", "Site", facts.siteName);
|
|
175
236
|
add("author", "Author", facts.author);
|
|
176
237
|
break;
|
|
238
|
+
case "chart":
|
|
239
|
+
add("range", "Range", facts.range);
|
|
240
|
+
break;
|
|
241
|
+
case "event":
|
|
242
|
+
add("level", "Level", facts.level);
|
|
243
|
+
add("project", "Project", facts.project);
|
|
244
|
+
add("release", "Release", facts.release);
|
|
245
|
+
add("environment", "Environment", facts.environment);
|
|
246
|
+
break;
|
|
247
|
+
case "trace":
|
|
248
|
+
add("duration", "Duration", formatDuration(facts.durationMs));
|
|
249
|
+
add("spans", "Spans", facts.spanCount.toLocaleString("en-US"));
|
|
250
|
+
add("issues", "Issues", `${plural(facts.errorCount, "error")}, ${plural(facts.performanceIssueCount, "performance issue")}`);
|
|
251
|
+
add("projects", "Projects", list(facts.projects));
|
|
252
|
+
break;
|
|
177
253
|
case "person":
|
|
178
254
|
add("email", "Email", facts.email);
|
|
179
255
|
add("slackHandle", "Slack", facts.slackHandle && `@${facts.slackHandle}`);
|
|
@@ -194,6 +270,9 @@ const objectTypeSchema = z.enum([
|
|
|
194
270
|
"document",
|
|
195
271
|
"message",
|
|
196
272
|
"web_page",
|
|
273
|
+
"chart",
|
|
274
|
+
"event",
|
|
275
|
+
"trace",
|
|
197
276
|
"item"
|
|
198
277
|
]);
|
|
199
278
|
const objectTypeLabels = {
|
|
@@ -207,6 +286,9 @@ const objectTypeLabels = {
|
|
|
207
286
|
document: "Document",
|
|
208
287
|
message: "Message",
|
|
209
288
|
web_page: "Web page",
|
|
289
|
+
chart: "Chart",
|
|
290
|
+
event: "Event",
|
|
291
|
+
trace: "Trace",
|
|
210
292
|
item: "Item"
|
|
211
293
|
};
|
|
212
294
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -224,6 +306,9 @@ function objectPresentation(object) {
|
|
|
224
306
|
document: "file",
|
|
225
307
|
message: "comment",
|
|
226
308
|
web_page: "globe",
|
|
309
|
+
chart: "graph",
|
|
310
|
+
event: "pulse",
|
|
311
|
+
trace: "rows",
|
|
227
312
|
item: "package"
|
|
228
313
|
}[type];
|
|
229
314
|
let tone = type === "automation" ? "info" : "neutral";
|
|
@@ -333,8 +418,35 @@ const objectIconPaths = {
|
|
|
333
418
|
file: ["M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"],
|
|
334
419
|
comment: ["M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"],
|
|
335
420
|
globe: ["M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM5.78 8.75a9.64 9.64 0 0 0 1.363 4.177c.255.426.542.832.857 1.215.245-.296.551-.705.857-1.215A9.64 9.64 0 0 0 10.22 8.75Zm4.44-1.5a9.64 9.64 0 0 0-1.363-4.177c-.307-.51-.612-.919-.857-1.215a9.927 9.927 0 0 0-.857 1.215A9.64 9.64 0 0 0 5.78 7.25Zm-5.944 1.5H1.543a6.507 6.507 0 0 0 4.666 5.5c-.123-.181-.24-.365-.352-.552-.715-1.192-1.437-2.874-1.581-4.948Zm-2.733-1.5h2.733c.144-2.074.866-3.756 1.58-4.948.12-.197.237-.381.353-.552a6.507 6.507 0 0 0-4.666 5.5Zm10.181 1.5c-.144 2.074-.866 3.756-1.58 4.948-.12.197-.237.381-.353.552a6.507 6.507 0 0 0 4.666-5.5Zm2.733-1.5a6.507 6.507 0 0 0-4.666-5.5c.123.181.24.365.353.552.714 1.192 1.436 2.874 1.58 4.948Z"],
|
|
421
|
+
graph: ["M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"],
|
|
422
|
+
pulse: ["M6 2c.306 0 .582.187.696.471L10 10.731l1.304-3.26A.751.751 0 0 1 12 7h3.25a.75.75 0 0 1 0 1.5h-2.742l-1.812 4.528a.751.751 0 0 1-1.392 0L6 4.77 4.696 8.03A.75.75 0 0 1 4 8.5H.75a.75.75 0 0 1 0-1.5h2.742l1.812-4.529A.751.751 0 0 1 6 2Z"],
|
|
423
|
+
rows: ["M16 10.75v2.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25v-2.5C0 9.784.784 9 1.75 9h12.5c.966 0 1.75.784 1.75 1.75Zm0-8v2.5A1.75 1.75 0 0 1 14.25 7H1.75A1.75 1.75 0 0 1 0 5.25v-2.5C0 1.784.784 1 1.75 1h12.5c.966 0 1.75.784 1.75 1.75Zm-1.75-.25H1.75a.25.25 0 0 0-.25.25v2.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-2.5a.25.25 0 0 0-.25-.25Zm0 8H1.75a.25.25 0 0 0-.25.25v2.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-2.5a.25.25 0 0 0-.25-.25Z"],
|
|
336
424
|
package: ["m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"]
|
|
337
425
|
};
|
|
426
|
+
// src/images.ts
|
|
427
|
+
const objectImageRefSchema = z.object({
|
|
428
|
+
key: z.string().min(1),
|
|
429
|
+
url: z.string().min(1)
|
|
430
|
+
}).strict();
|
|
431
|
+
/** Return the image source ref of one object preview image. */
|
|
432
|
+
function encodeObjectImageRef(image) {
|
|
433
|
+
return JSON.stringify({
|
|
434
|
+
key: image.key,
|
|
435
|
+
url: image.url
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Return the object preview image of an image source ref, or nothing when
|
|
440
|
+
* the ref names another kind of image.
|
|
441
|
+
*/
|
|
442
|
+
function decodeObjectImageRef(ref) {
|
|
443
|
+
try {
|
|
444
|
+
const parsed = objectImageRefSchema.safeParse(JSON.parse(ref));
|
|
445
|
+
return parsed.success ? parsed.data : void 0;
|
|
446
|
+
} catch {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
338
450
|
// src/object-links.ts
|
|
339
451
|
/**
|
|
340
452
|
* Link types: URLs that a plugin or core can show as object cards.
|
|
@@ -1688,8 +1800,8 @@ function createZodTool(definition, helperName) {
|
|
|
1688
1800
|
prepareArguments(args) {
|
|
1689
1801
|
return parsePluginToolInput(inputSchema, prepareArguments ? prepareArguments(args) : args);
|
|
1690
1802
|
},
|
|
1691
|
-
...execute ? { async execute(input, options) {
|
|
1692
|
-
const result = await execute(input, options);
|
|
1803
|
+
...execute ? { async execute(input, options, ctx) {
|
|
1804
|
+
const result = await execute(input, options, ctx);
|
|
1693
1805
|
if (isPluginToolOutputEnvelope(result)) return {
|
|
1694
1806
|
content: z.array(pluginToolContentSchema).parse(result.content),
|
|
1695
1807
|
details: outputSchema.parse(result.details)
|
|
@@ -1698,6 +1810,16 @@ function createZodTool(definition, helperName) {
|
|
|
1698
1810
|
} } : void 0
|
|
1699
1811
|
};
|
|
1700
1812
|
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Run tools that take a plugin-built context, such as deployment config plus
|
|
1815
|
+
* the Turn capabilities that they use. `toContext` runs on each call.
|
|
1816
|
+
*/
|
|
1817
|
+
function withToolContext(tools, toContext) {
|
|
1818
|
+
return Object.fromEntries(Object.entries(tools).map(([name, { execute, ...tool }]) => [name, {
|
|
1819
|
+
...tool,
|
|
1820
|
+
...execute ? { execute: async (input, options, ctx) => await execute(input, options, toContext(ctx)) } : void 0
|
|
1821
|
+
}]));
|
|
1822
|
+
}
|
|
1701
1823
|
/** Define a plugin tool with Zod input parsing and validated structured results. */
|
|
1702
1824
|
function zodTool(definition) {
|
|
1703
1825
|
return createZodTool(definition, "zodTool");
|
|
@@ -1999,7 +2121,7 @@ function validateObjectLinks(name, links) {
|
|
|
1999
2121
|
if (links === void 0) return;
|
|
2000
2122
|
if (!Array.isArray(links)) throw new Error(`Junior plugin "${name}" objectLinks must be an array.`);
|
|
2001
2123
|
for (const link of links) {
|
|
2002
|
-
if (!objectTypeSchema.safeParse(link?.objectType).success || typeof link.resolve !== "function" || !Array.isArray(link.filters) || link.filters.length === 0) throw new Error(`Junior plugin "${name}" object links need an objectType, filters, and a resolve function.`);
|
|
2124
|
+
if (!objectTypeSchema.safeParse(link?.objectType).success || typeof link.canView !== "function" || typeof link.resolve !== "function" || !Array.isArray(link.filters) || link.filters.length === 0) throw new Error(`Junior plugin "${name}" object links need an objectType, filters, a canView function, and a resolve function.`);
|
|
2003
2125
|
for (const filter of link.filters) {
|
|
2004
2126
|
const parsed = objectLinkFilterSchema.safeParse(filter);
|
|
2005
2127
|
if (!parsed.success) throw new Error(`Junior plugin "${name}" has an invalid ${link.objectType} link filter.`, { cause: parsed.error });
|
|
@@ -2084,4 +2206,4 @@ const pluginUserPageInputSchema = z.object({
|
|
|
2084
2206
|
limit: z.number().int().min(1).max(50),
|
|
2085
2207
|
query: pluginUserPageQuerySchema
|
|
2086
2208
|
}).strict();
|
|
2087
|
-
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, OBJECT_FACTS_MAX_BYTES, OBJECT_SUMMARY_MAX_LENGTH, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsBytes, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectLinkFilterMatches, objectLinkFilterSchema, objectLinkFilterSpecificity, objectPresentation, objectSummary, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
|
|
2209
|
+
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, OBJECT_FACTS_MAX_BYTES, OBJECT_SUMMARY_MAX_LENGTH, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, decodeObjectImageRef, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, encodeObjectImageRef, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, formatDuration, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsBytes, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectLinkFilterMatches, objectLinkFilterSchema, objectLinkFilterSpecificity, objectPresentation, objectSummary, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, withToolContext, zodTool };
|