@sentry/junior-plugin-api 0.301.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 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". */
@@ -1150,14 +1308,17 @@ export declare const resourceLinkAnnotationSchema: z.ZodObject<{
1150
1308
  objectType: z.ZodOptional<z.ZodEnum<{
1151
1309
  automation: "automation";
1152
1310
  calendar_event: "calendar_event";
1311
+ chart: "chart";
1153
1312
  code_change: "code_change";
1154
1313
  conversation: "conversation";
1155
1314
  deployment: "deployment";
1156
1315
  document: "document";
1316
+ event: "event";
1157
1317
  item: "item";
1158
1318
  message: "message";
1159
1319
  person: "person";
1160
1320
  task: "task";
1321
+ trace: "trace";
1161
1322
  web_page: "web_page";
1162
1323
  }>>;
1163
1324
  key: z.ZodString;
@@ -1178,14 +1339,17 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1178
1339
  objectType: z.ZodOptional<z.ZodEnum<{
1179
1340
  automation: "automation";
1180
1341
  calendar_event: "calendar_event";
1342
+ chart: "chart";
1181
1343
  code_change: "code_change";
1182
1344
  conversation: "conversation";
1183
1345
  deployment: "deployment";
1184
1346
  document: "document";
1347
+ event: "event";
1185
1348
  item: "item";
1186
1349
  message: "message";
1187
1350
  person: "person";
1188
1351
  task: "task";
1352
+ trace: "trace";
1189
1353
  web_page: "web_page";
1190
1354
  }>>;
1191
1355
  key: z.ZodString;
@@ -1206,14 +1370,17 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1206
1370
  objectType: z.ZodEnum<{
1207
1371
  automation: "automation";
1208
1372
  calendar_event: "calendar_event";
1373
+ chart: "chart";
1209
1374
  code_change: "code_change";
1210
1375
  conversation: "conversation";
1211
1376
  deployment: "deployment";
1212
1377
  document: "document";
1378
+ event: "event";
1213
1379
  item: "item";
1214
1380
  message: "message";
1215
1381
  person: "person";
1216
1382
  task: "task";
1383
+ trace: "trace";
1217
1384
  web_page: "web_page";
1218
1385
  }>;
1219
1386
  title: z.ZodString;
@@ -1255,6 +1422,10 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1255
1422
  cycle: z.ZodOptional<z.ZodString>;
1256
1423
  dueDate: z.ZodOptional<z.ZodISODate>;
1257
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>>;
1258
1429
  }, z.core.$strict>, z.ZodObject<{
1259
1430
  type: z.ZodLiteral<"deployment">;
1260
1431
  summary: z.ZodOptional<z.ZodString>;
@@ -1277,6 +1448,7 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1277
1448
  summary: z.ZodOptional<z.ZodString>;
1278
1449
  owner: z.ZodOptional<z.ZodString>;
1279
1450
  modifiedAt: z.ZodOptional<z.ZodISODateTime>;
1451
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
1280
1452
  }, z.core.$strict>, z.ZodObject<{
1281
1453
  type: z.ZodLiteral<"message">;
1282
1454
  summary: z.ZodOptional<z.ZodString>;
@@ -1288,7 +1460,50 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1288
1460
  summary: z.ZodOptional<z.ZodString>;
1289
1461
  siteName: z.ZodOptional<z.ZodString>;
1290
1462
  author: z.ZodOptional<z.ZodString>;
1463
+ media: z.ZodOptional<z.ZodEnum<{
1464
+ image: "image";
1465
+ video: "video";
1466
+ }>>;
1291
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>>;
1292
1507
  }, z.core.$strict>, z.ZodObject<{
1293
1508
  type: z.ZodLiteral<"person">;
1294
1509
  summary: z.ZodOptional<z.ZodString>;
@@ -1332,14 +1547,17 @@ export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
1332
1547
  objectType: z.ZodOptional<z.ZodEnum<{
1333
1548
  automation: "automation";
1334
1549
  calendar_event: "calendar_event";
1550
+ chart: "chart";
1335
1551
  code_change: "code_change";
1336
1552
  conversation: "conversation";
1337
1553
  deployment: "deployment";
1338
1554
  document: "document";
1555
+ event: "event";
1339
1556
  item: "item";
1340
1557
  message: "message";
1341
1558
  person: "person";
1342
1559
  task: "task";
1560
+ trace: "trace";
1343
1561
  web_page: "web_page";
1344
1562
  }>>;
1345
1563
  status: z.ZodOptional<z.ZodString>;
@@ -1572,14 +1790,17 @@ export declare const eventInputSchema: z.ZodObject<{
1572
1790
  objectType: z.ZodOptional<z.ZodEnum<{
1573
1791
  automation: "automation";
1574
1792
  calendar_event: "calendar_event";
1793
+ chart: "chart";
1575
1794
  code_change: "code_change";
1576
1795
  conversation: "conversation";
1577
1796
  deployment: "deployment";
1578
1797
  document: "document";
1798
+ event: "event";
1579
1799
  item: "item";
1580
1800
  message: "message";
1581
1801
  person: "person";
1582
1802
  task: "task";
1803
+ trace: "trace";
1583
1804
  web_page: "web_page";
1584
1805
  }>>;
1585
1806
  eventKey: z.ZodString;
@@ -1609,14 +1830,17 @@ export declare const eventSchema: z.ZodObject<{
1609
1830
  objectType: z.ZodOptional<z.ZodEnum<{
1610
1831
  automation: "automation";
1611
1832
  calendar_event: "calendar_event";
1833
+ chart: "chart";
1612
1834
  code_change: "code_change";
1613
1835
  conversation: "conversation";
1614
1836
  deployment: "deployment";
1615
1837
  document: "document";
1838
+ event: "event";
1616
1839
  item: "item";
1617
1840
  message: "message";
1618
1841
  person: "person";
1619
1842
  task: "task";
1843
+ trace: "trace";
1620
1844
  web_page: "web_page";
1621
1845
  }>>;
1622
1846
  eventKey: z.ZodString;
@@ -1816,6 +2040,27 @@ export interface PluginMcp {
1816
2040
  */
1817
2041
  prepare(): Promise<"authorization_pending" | "ready">;
1818
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
+ }
1819
2064
  /** Complete Workspace repository preparation after credential egress is removed. */
1820
2065
  export type WorkspaceFinalize = () => Promise<void> | void;
1821
2066
  /**
@@ -1943,14 +2188,17 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
1943
2188
  objectType: z.ZodEnum<{
1944
2189
  automation: "automation";
1945
2190
  calendar_event: "calendar_event";
2191
+ chart: "chart";
1946
2192
  code_change: "code_change";
1947
2193
  conversation: "conversation";
1948
2194
  deployment: "deployment";
1949
2195
  document: "document";
2196
+ event: "event";
1950
2197
  item: "item";
1951
2198
  message: "message";
1952
2199
  person: "person";
1953
2200
  task: "task";
2201
+ trace: "trace";
1954
2202
  web_page: "web_page";
1955
2203
  }>;
1956
2204
  title: z.ZodString;
@@ -1992,6 +2240,10 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
1992
2240
  cycle: z.ZodOptional<z.ZodString>;
1993
2241
  dueDate: z.ZodOptional<z.ZodISODate>;
1994
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>>;
1995
2247
  }, z.core.$strict>, z.ZodObject<{
1996
2248
  type: z.ZodLiteral<"deployment">;
1997
2249
  summary: z.ZodOptional<z.ZodString>;
@@ -2014,6 +2266,7 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
2014
2266
  summary: z.ZodOptional<z.ZodString>;
2015
2267
  owner: z.ZodOptional<z.ZodString>;
2016
2268
  modifiedAt: z.ZodOptional<z.ZodISODateTime>;
2269
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
2017
2270
  }, z.core.$strict>, z.ZodObject<{
2018
2271
  type: z.ZodLiteral<"message">;
2019
2272
  summary: z.ZodOptional<z.ZodString>;
@@ -2025,7 +2278,50 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
2025
2278
  summary: z.ZodOptional<z.ZodString>;
2026
2279
  siteName: z.ZodOptional<z.ZodString>;
2027
2280
  author: z.ZodOptional<z.ZodString>;
2281
+ media: z.ZodOptional<z.ZodEnum<{
2282
+ image: "image";
2283
+ video: "video";
2284
+ }>>;
2028
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>>;
2029
2325
  }, z.core.$strict>, z.ZodObject<{
2030
2326
  type: z.ZodLiteral<"person">;
2031
2327
  summary: z.ZodOptional<z.ZodString>;
@@ -2047,8 +2343,12 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
2047
2343
  }, z.core.$strict>>;
2048
2344
  }, z.core.$loose>;
2049
2345
  export type PluginToolOutput = z.output<typeof pluginToolOutputSchema>;
2050
- export type PluginToolExecute<TInput = unknown, TOutput = unknown> = {
2051
- bivarianceHack(input: TInput, options: PluginToolExecuteOptions): Promise<TOutput> | TOutput;
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;
2052
2352
  }["bivarianceHack"];
2053
2353
  /**
2054
2354
  * Tool-declared approval mode.
@@ -2115,13 +2415,8 @@ export interface ToolApprovalMetadata<TInput = unknown> {
2115
2415
  * tools that control the agent loop or dispatch other tools.
2116
2416
  */
2117
2417
  export type ToolExposure = "direct" | "deferred" | "modelOnly" | "codemode" | "hidden";
2118
- 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> {
2119
2419
  description: string;
2120
- /**
2121
- * Why the current Turn cannot run this tool. The host keeps the tool in the
2122
- * tool list, so the cached prompt stays the same, and rejects its calls.
2123
- */
2124
- disabledReason?: string;
2125
2420
  executionMode?: unknown;
2126
2421
  /** Override the host's default tool exposure. */
2127
2422
  exposure?: ToolExposure;
@@ -2145,19 +2440,24 @@ export interface PluginToolDefinition<TInput = unknown, TOutput = unknown, TExec
2145
2440
  * future major version.
2146
2441
  */
2147
2442
  promptSnippet?: string;
2148
- execute?: PluginToolExecute<TInput, TExecuteOutput>;
2443
+ execute?: PluginToolExecute<TInput, TExecuteOutput, TContext>;
2149
2444
  }
2150
- 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"> & {
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"> & {
2151
2446
  inputSchema: TInputSchema;
2152
2447
  outputSchema: TOutputSchema;
2153
2448
  prepareArguments?: (args: unknown) => z.input<TInputSchema>;
2154
- execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions) => Promise<TExecuteResult> | TExecuteResult;
2449
+ execute?: (input: z.output<TInputSchema>, options: PluginToolExecuteOptions, ctx: TContext) => Promise<TExecuteResult> | TExecuteResult;
2155
2450
  };
2156
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>;
2157
2457
  /** Define a plugin tool with Zod input parsing and validated structured results. */
2158
- 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>>;
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>;
2159
2459
  /** Define a plugin tool with Zod input parsing and the structured result contract. */
2160
- 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>>;
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>;
2161
2461
  export interface SlackToolRegistrationHookContext {
2162
2462
  /**
2163
2463
  * What Slack tools can do in the Conversation Location.
@@ -2201,6 +2501,36 @@ export interface PluginWorkspaceToolContext {
2201
2501
  repo: string;
2202
2502
  }): Promise<string[]>;
2203
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
+ }
2204
2534
  interface BaseToolRegistrationHookContext extends PluginContext {
2205
2535
  /**
2206
2536
  * Opaque Junior conversation/session identity for this turn.
@@ -2210,6 +2540,8 @@ interface BaseToolRegistrationHookContext extends PluginContext {
2210
2540
  */
2211
2541
  conversationId?: string;
2212
2542
  annotations?: PluginAnnotations;
2543
+ /** Other Conversations. Set only when the turn has a `conversationId`. */
2544
+ conversations?: PluginConversationToolContext;
2213
2545
  /** Host-owned dashboard link to the Automation that started this run. */
2214
2546
  automationLink?: {
2215
2547
  url: string;
@@ -2281,6 +2613,8 @@ export interface ImageSourceContext extends PluginContext {
2281
2613
  egress: PluginEgress;
2282
2614
  /** The signed-in person who sees the image. */
2283
2615
  viewer: User;
2616
+ /** This plugin's hosted MCP provider as the viewer. See `ObjectLinkContext`. */
2617
+ viewerMcp: PluginViewerMcp;
2284
2618
  }
2285
2619
  /**
2286
2620
  * Images that a plugin serves through the Junior image proxy. `resolve`
@@ -2340,6 +2674,13 @@ export interface ObjectLinkContext extends PluginContext {
2340
2674
  * you return it.
2341
2675
  */
2342
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;
2343
2684
  /**
2344
2685
  * Return the Junior person card of the one known person with this
2345
2686
  * provider account, or undefined. Return it for a profile link of that
@@ -2351,6 +2692,23 @@ export interface ObjectLinkContext extends PluginContext {
2351
2692
  }): Promise<ObjectAnnotation | undefined>;
2352
2693
  /** The signed-in person who sees the card. */
2353
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;
2354
2712
  }
2355
2713
  /**
2356
2714
  * One link type of a plugin. Junior calls `canView` first, and calls
@@ -2372,11 +2730,19 @@ export interface PluginObjectLinkDefinition {
2372
2730
  */
2373
2731
  resolve(ctx: ObjectLinkContext, url: URL): Promise<ObjectAnnotation | undefined>;
2374
2732
  /**
2375
- * The plugin tool that reads the object live, such as `readGoogleFile`.
2376
- * When a person attaches the link to a Conversation, its next Turn is told
2377
- * to read the object with this tool. Omit it when no tool reads the object.
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.
2378
2737
  */
2379
- readTool?: string;
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;
2380
2746
  }
2381
2747
  export declare const codeChangeStateSchema: z.ZodEnum<{
2382
2748
  closed: "closed";
@@ -3030,6 +3396,8 @@ export interface HeartbeatHookContext extends PluginContext {
3030
3396
  /** Publish events, as from a plugin route. */
3031
3397
  events: EventPublisher;
3032
3398
  nowMs: number;
3399
+ /** Review desk items, as from a plugin route. */
3400
+ reviewItems: PluginConversationReviewItems;
3033
3401
  state: PluginState;
3034
3402
  }
3035
3403
  export interface HeartbeatResult {
@@ -3323,7 +3691,18 @@ export interface PluginHooks {
3323
3691
  slackConversationLink?(ctx: SlackConversationLinkHookContext): SlackConversationLink | undefined;
3324
3692
  /** Pure Markdown rewrite. Emit ordinary Markdown only. */
3325
3693
  formatMarkdown?(ctx: FormatMarkdownHookContext): string;
3326
- tools?(ctx: ToolRegistrationHookContext): Record<string, PluginToolDefinition>;
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>;
3327
3706
  }
3328
3707
  export interface PluginCliIo {
3329
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({
@@ -43,7 +49,8 @@ const objectFactsSchema = z.discriminatedUnion("type", [
43
49
  project: text.optional(),
44
50
  cycle: text.optional(),
45
51
  dueDate: z.iso.date().optional(),
46
- labels: z.array(text).max(5).optional()
52
+ labels: z.array(text).max(5).optional(),
53
+ trend: trend.optional()
47
54
  }),
48
55
  z.strictObject({
49
56
  type: z.literal("deployment"),
@@ -69,7 +76,8 @@ const objectFactsSchema = z.discriminatedUnion("type", [
69
76
  type: z.literal("document"),
70
77
  summary: summary.optional(),
71
78
  owner: text.optional(),
72
- modifiedAt: z.iso.datetime({ offset: true }).optional()
79
+ modifiedAt: z.iso.datetime({ offset: true }).optional(),
80
+ thumbnailUrl: imagePath.optional()
73
81
  }),
74
82
  z.strictObject({
75
83
  type: z.literal("message"),
@@ -83,7 +91,50 @@ const objectFactsSchema = z.discriminatedUnion("type", [
83
91
  summary: summary.optional(),
84
92
  siteName: text.optional(),
85
93
  author: text.optional(),
86
- thumbnailUrl: z.string().max(4e3).regex(/^\/api\/images\/[\w-]+\.[\w-]+\?w=\d+$/).optional()
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)
87
138
  }),
88
139
  z.strictObject({
89
140
  type: z.literal("person"),
@@ -114,6 +165,15 @@ function objectSummary(text) {
114
165
  }
115
166
  return `${cut}…`;
116
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
+ }
117
177
  /** Show at most four card attributes, in priority order, on every surface. */
118
178
  function objectFactFields(facts) {
119
179
  if (!facts) return [];
@@ -175,6 +235,21 @@ function objectFactFields(facts) {
175
235
  add("siteName", "Site", facts.siteName);
176
236
  add("author", "Author", facts.author);
177
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;
178
253
  case "person":
179
254
  add("email", "Email", facts.email);
180
255
  add("slackHandle", "Slack", facts.slackHandle && `@${facts.slackHandle}`);
@@ -195,6 +270,9 @@ const objectTypeSchema = z.enum([
195
270
  "document",
196
271
  "message",
197
272
  "web_page",
273
+ "chart",
274
+ "event",
275
+ "trace",
198
276
  "item"
199
277
  ]);
200
278
  const objectTypeLabels = {
@@ -208,6 +286,9 @@ const objectTypeLabels = {
208
286
  document: "Document",
209
287
  message: "Message",
210
288
  web_page: "Web page",
289
+ chart: "Chart",
290
+ event: "Event",
291
+ trace: "Trace",
211
292
  item: "Item"
212
293
  };
213
294
  /** Resolve identity and state without replacing the type icon with a warning. */
@@ -225,6 +306,9 @@ function objectPresentation(object) {
225
306
  document: "file",
226
307
  message: "comment",
227
308
  web_page: "globe",
309
+ chart: "graph",
310
+ event: "pulse",
311
+ trace: "rows",
228
312
  item: "package"
229
313
  }[type];
230
314
  let tone = type === "automation" ? "info" : "neutral";
@@ -334,6 +418,9 @@ const objectIconPaths = {
334
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"],
335
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"],
336
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"],
337
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"]
338
425
  };
339
426
  // src/images.ts
@@ -1713,8 +1800,8 @@ function createZodTool(definition, helperName) {
1713
1800
  prepareArguments(args) {
1714
1801
  return parsePluginToolInput(inputSchema, prepareArguments ? prepareArguments(args) : args);
1715
1802
  },
1716
- ...execute ? { async execute(input, options) {
1717
- const result = await execute(input, options);
1803
+ ...execute ? { async execute(input, options, ctx) {
1804
+ const result = await execute(input, options, ctx);
1718
1805
  if (isPluginToolOutputEnvelope(result)) return {
1719
1806
  content: z.array(pluginToolContentSchema).parse(result.content),
1720
1807
  details: outputSchema.parse(result.details)
@@ -1723,6 +1810,16 @@ function createZodTool(definition, helperName) {
1723
1810
  } } : void 0
1724
1811
  };
1725
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
+ }
1726
1823
  /** Define a plugin tool with Zod input parsing and validated structured results. */
1727
1824
  function zodTool(definition) {
1728
1825
  return createZodTool(definition, "zodTool");
@@ -2109,4 +2206,4 @@ const pluginUserPageInputSchema = z.object({
2109
2206
  limit: z.number().int().min(1).max(50),
2110
2207
  query: pluginUserPageQuerySchema
2111
2208
  }).strict();
2112
- 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.301.0",
3
+ "version": "0.302.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"