@sentry/junior-plugin-api 0.305.0 → 0.307.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/context-Buwf8ZyW.d.ts +523 -0
- package/dist/embeddings.d.ts +171 -0
- package/dist/embeddings.js +147 -0
- package/dist/index.d.ts +175 -515
- package/dist/index.js +382 -119
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -152,6 +152,15 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
152
152
|
lastCheckedAt: z.iso.datetime({ offset: true }).optional(),
|
|
153
153
|
trend: trend.optional()
|
|
154
154
|
}),
|
|
155
|
+
z.strictObject({
|
|
156
|
+
type: z.literal("alert"),
|
|
157
|
+
summary: summary.optional(),
|
|
158
|
+
enabled: z.boolean(),
|
|
159
|
+
projects: z.array(text).max(5),
|
|
160
|
+
trigger: text.optional(),
|
|
161
|
+
notifies: z.array(text).max(5),
|
|
162
|
+
lastTriggeredAt: z.iso.datetime({ offset: true }).optional()
|
|
163
|
+
}),
|
|
155
164
|
z.strictObject({
|
|
156
165
|
type: z.literal("trace"),
|
|
157
166
|
summary: summary.optional(),
|
|
@@ -242,106 +251,297 @@ const MONITOR_DETAILS = {
|
|
|
242
251
|
cron: "Schedule",
|
|
243
252
|
uptime: "Checks"
|
|
244
253
|
};
|
|
254
|
+
function list(values) {
|
|
255
|
+
return values?.length ? `${values.join(", ")}${values.length === 5 ? " (up to 5 shown)" : ""}` : void 0;
|
|
256
|
+
}
|
|
257
|
+
function dateTime(value) {
|
|
258
|
+
return value && new Date(value).toLocaleString(void 0, {
|
|
259
|
+
dateStyle: "medium",
|
|
260
|
+
timeStyle: "short"
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
const FACT_FIELDS = {
|
|
264
|
+
code_change: (facts) => [[
|
|
265
|
+
"sourceBranch",
|
|
266
|
+
"Branch",
|
|
267
|
+
facts.sourceBranch
|
|
268
|
+
]],
|
|
269
|
+
task: (facts) => [
|
|
270
|
+
[
|
|
271
|
+
"assignees",
|
|
272
|
+
"Assignees",
|
|
273
|
+
facts.assignees?.length === 0 ? "Unassigned" : list(facts.assignees)
|
|
274
|
+
],
|
|
275
|
+
[
|
|
276
|
+
"priority",
|
|
277
|
+
"Priority",
|
|
278
|
+
facts.priority
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
"project",
|
|
282
|
+
"Project",
|
|
283
|
+
facts.project
|
|
284
|
+
],
|
|
285
|
+
[
|
|
286
|
+
"cycle",
|
|
287
|
+
"Cycle",
|
|
288
|
+
facts.cycle
|
|
289
|
+
],
|
|
290
|
+
[
|
|
291
|
+
"dueDate",
|
|
292
|
+
"Due",
|
|
293
|
+
facts.dueDate
|
|
294
|
+
],
|
|
295
|
+
[
|
|
296
|
+
"labels",
|
|
297
|
+
"Labels",
|
|
298
|
+
list(facts.labels)
|
|
299
|
+
]
|
|
300
|
+
],
|
|
301
|
+
deployment: (facts) => [
|
|
302
|
+
[
|
|
303
|
+
"environment",
|
|
304
|
+
"Environment",
|
|
305
|
+
facts.environment
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
"project",
|
|
309
|
+
"Project",
|
|
310
|
+
facts.project
|
|
311
|
+
],
|
|
312
|
+
[
|
|
313
|
+
"revision",
|
|
314
|
+
"Revision",
|
|
315
|
+
facts.revision
|
|
316
|
+
],
|
|
317
|
+
[
|
|
318
|
+
"branch",
|
|
319
|
+
"Branch",
|
|
320
|
+
facts.branch
|
|
321
|
+
]
|
|
322
|
+
],
|
|
323
|
+
calendar_event: (facts) => [[
|
|
324
|
+
"when",
|
|
325
|
+
"When",
|
|
326
|
+
facts.when
|
|
327
|
+
], [
|
|
328
|
+
"attendees",
|
|
329
|
+
"Attendees",
|
|
330
|
+
list(facts.attendees)
|
|
331
|
+
]],
|
|
332
|
+
conversation: (facts) => [[
|
|
333
|
+
"participants",
|
|
334
|
+
"Participants",
|
|
335
|
+
list(facts.participants)
|
|
336
|
+
], [
|
|
337
|
+
"lastActivityAt",
|
|
338
|
+
"Last activity",
|
|
339
|
+
dateTime(facts.lastActivityAt)
|
|
340
|
+
]],
|
|
341
|
+
document: (facts) => [[
|
|
342
|
+
"owner",
|
|
343
|
+
"Owner",
|
|
344
|
+
facts.owner
|
|
345
|
+
], [
|
|
346
|
+
"modifiedAt",
|
|
347
|
+
"Modified",
|
|
348
|
+
dateTime(facts.modifiedAt)
|
|
349
|
+
]],
|
|
350
|
+
message: (facts) => [
|
|
351
|
+
[
|
|
352
|
+
"channel",
|
|
353
|
+
"Channel",
|
|
354
|
+
facts.channel
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
"author",
|
|
358
|
+
"Author",
|
|
359
|
+
facts.author
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
"sentAt",
|
|
363
|
+
"Sent",
|
|
364
|
+
dateTime(facts.sentAt)
|
|
365
|
+
]
|
|
366
|
+
],
|
|
367
|
+
web_page: (facts) => [[
|
|
368
|
+
"siteName",
|
|
369
|
+
"Site",
|
|
370
|
+
facts.siteName
|
|
371
|
+
], [
|
|
372
|
+
"author",
|
|
373
|
+
"Author",
|
|
374
|
+
facts.author
|
|
375
|
+
]],
|
|
376
|
+
chart: (facts) => [[
|
|
377
|
+
"range",
|
|
378
|
+
"Range",
|
|
379
|
+
facts.range
|
|
380
|
+
]],
|
|
381
|
+
event: (facts) => [
|
|
382
|
+
[
|
|
383
|
+
"level",
|
|
384
|
+
"Level",
|
|
385
|
+
facts.level
|
|
386
|
+
],
|
|
387
|
+
[
|
|
388
|
+
"project",
|
|
389
|
+
"Project",
|
|
390
|
+
facts.project
|
|
391
|
+
],
|
|
392
|
+
[
|
|
393
|
+
"release",
|
|
394
|
+
"Release",
|
|
395
|
+
facts.release
|
|
396
|
+
],
|
|
397
|
+
[
|
|
398
|
+
"environment",
|
|
399
|
+
"Environment",
|
|
400
|
+
facts.environment
|
|
401
|
+
]
|
|
402
|
+
],
|
|
403
|
+
release: (facts) => [
|
|
404
|
+
[
|
|
405
|
+
"projects",
|
|
406
|
+
"Projects",
|
|
407
|
+
list(facts.projects)
|
|
408
|
+
],
|
|
409
|
+
[
|
|
410
|
+
"newIssues",
|
|
411
|
+
"New issues",
|
|
412
|
+
facts.newIssues?.toLocaleString("en-US")
|
|
413
|
+
],
|
|
414
|
+
[
|
|
415
|
+
"crashFreeSessions",
|
|
416
|
+
"Crash-free sessions",
|
|
417
|
+
facts.crashFreeSessions === void 0 ? void 0 : `${Number(facts.crashFreeSessions.toFixed(2))}%`
|
|
418
|
+
],
|
|
419
|
+
[
|
|
420
|
+
"deploys",
|
|
421
|
+
"Deploys",
|
|
422
|
+
facts.deployCount === void 0 ? void 0 : facts.lastDeploy ? `${facts.deployCount.toLocaleString("en-US")}, last to ${facts.lastDeploy.environment}` : facts.deployCount.toLocaleString("en-US")
|
|
423
|
+
]
|
|
424
|
+
],
|
|
425
|
+
monitor: (facts) => [
|
|
426
|
+
[
|
|
427
|
+
"kind",
|
|
428
|
+
"Kind",
|
|
429
|
+
MONITOR_KINDS[facts.kind]
|
|
430
|
+
],
|
|
431
|
+
[
|
|
432
|
+
"project",
|
|
433
|
+
"Project",
|
|
434
|
+
facts.project
|
|
435
|
+
],
|
|
436
|
+
[
|
|
437
|
+
"environment",
|
|
438
|
+
"Environment",
|
|
439
|
+
facts.environment
|
|
440
|
+
],
|
|
441
|
+
[
|
|
442
|
+
"detail",
|
|
443
|
+
MONITOR_DETAILS[facts.kind],
|
|
444
|
+
facts.detail
|
|
445
|
+
]
|
|
446
|
+
],
|
|
447
|
+
alert: (facts) => [
|
|
448
|
+
[
|
|
449
|
+
"projects",
|
|
450
|
+
facts.projects.length === 1 ? "Project" : "Projects",
|
|
451
|
+
list(facts.projects)
|
|
452
|
+
],
|
|
453
|
+
[
|
|
454
|
+
"trigger",
|
|
455
|
+
"When",
|
|
456
|
+
facts.trigger
|
|
457
|
+
],
|
|
458
|
+
[
|
|
459
|
+
"notifies",
|
|
460
|
+
"Notifies",
|
|
461
|
+
list(facts.notifies)
|
|
462
|
+
],
|
|
463
|
+
[
|
|
464
|
+
"lastTriggeredAt",
|
|
465
|
+
"Last triggered",
|
|
466
|
+
dateTime(facts.lastTriggeredAt)
|
|
467
|
+
]
|
|
468
|
+
],
|
|
469
|
+
trace: (facts) => [
|
|
470
|
+
[
|
|
471
|
+
"duration",
|
|
472
|
+
"Duration",
|
|
473
|
+
formatDuration(facts.durationMs)
|
|
474
|
+
],
|
|
475
|
+
[
|
|
476
|
+
"spans",
|
|
477
|
+
"Spans",
|
|
478
|
+
facts.spanCount.toLocaleString("en-US")
|
|
479
|
+
],
|
|
480
|
+
[
|
|
481
|
+
"issues",
|
|
482
|
+
"Issues",
|
|
483
|
+
`${plural(facts.errorCount, "error")}, ${plural(facts.performanceIssueCount, "performance issue")}`
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"projects",
|
|
487
|
+
"Projects",
|
|
488
|
+
list(facts.projects)
|
|
489
|
+
]
|
|
490
|
+
],
|
|
491
|
+
dashboard: (facts) => [
|
|
492
|
+
[
|
|
493
|
+
"widgets",
|
|
494
|
+
"Widgets",
|
|
495
|
+
facts.widgetCount.toLocaleString("en-US")
|
|
496
|
+
],
|
|
497
|
+
[
|
|
498
|
+
"projects",
|
|
499
|
+
"Projects",
|
|
500
|
+
list(facts.projects)
|
|
501
|
+
],
|
|
502
|
+
[
|
|
503
|
+
"environments",
|
|
504
|
+
"Environments",
|
|
505
|
+
list(facts.environments)
|
|
506
|
+
],
|
|
507
|
+
[
|
|
508
|
+
"range",
|
|
509
|
+
"Time range",
|
|
510
|
+
facts.range
|
|
511
|
+
]
|
|
512
|
+
],
|
|
513
|
+
person: (facts) => [
|
|
514
|
+
[
|
|
515
|
+
"email",
|
|
516
|
+
"Email",
|
|
517
|
+
facts.email
|
|
518
|
+
],
|
|
519
|
+
[
|
|
520
|
+
"slackHandle",
|
|
521
|
+
"Slack",
|
|
522
|
+
facts.slackHandle && `@${facts.slackHandle}`
|
|
523
|
+
],
|
|
524
|
+
[
|
|
525
|
+
"githubHandle",
|
|
526
|
+
"GitHub",
|
|
527
|
+
facts.githubHandle && `@${facts.githubHandle}`,
|
|
528
|
+
facts.githubHandle && `https://github.com/${facts.githubHandle}`
|
|
529
|
+
]
|
|
530
|
+
]
|
|
531
|
+
};
|
|
532
|
+
function factFields(facts) {
|
|
533
|
+
const read = FACT_FIELDS[facts.type];
|
|
534
|
+
return read(facts);
|
|
535
|
+
}
|
|
245
536
|
/** Show at most four card attributes, in priority order, on every surface. */
|
|
246
537
|
function objectFactFields(facts) {
|
|
247
538
|
if (!facts) return [];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
value: String(value),
|
|
255
|
-
...href && { href }
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
switch (facts.type) {
|
|
259
|
-
case "code_change":
|
|
260
|
-
add("sourceBranch", "Branch", facts.sourceBranch);
|
|
261
|
-
break;
|
|
262
|
-
case "task":
|
|
263
|
-
add("assignees", "Assignees", facts.assignees?.length === 0 ? "Unassigned" : list(facts.assignees));
|
|
264
|
-
add("priority", "Priority", facts.priority);
|
|
265
|
-
add("project", "Project", facts.project);
|
|
266
|
-
add("cycle", "Cycle", facts.cycle);
|
|
267
|
-
add("dueDate", "Due", facts.dueDate);
|
|
268
|
-
add("labels", "Labels", list(facts.labels));
|
|
269
|
-
break;
|
|
270
|
-
case "deployment":
|
|
271
|
-
add("environment", "Environment", facts.environment);
|
|
272
|
-
add("project", "Project", facts.project);
|
|
273
|
-
add("revision", "Revision", facts.revision);
|
|
274
|
-
add("branch", "Branch", facts.branch);
|
|
275
|
-
break;
|
|
276
|
-
case "calendar_event":
|
|
277
|
-
add("when", "When", facts.when);
|
|
278
|
-
add("attendees", "Attendees", list(facts.attendees));
|
|
279
|
-
break;
|
|
280
|
-
case "conversation":
|
|
281
|
-
add("participants", "Participants", list(facts.participants));
|
|
282
|
-
add("lastActivityAt", "Last activity", facts.lastActivityAt && new Date(facts.lastActivityAt).toLocaleString(void 0, {
|
|
283
|
-
dateStyle: "medium",
|
|
284
|
-
timeStyle: "short"
|
|
285
|
-
}));
|
|
286
|
-
break;
|
|
287
|
-
case "document":
|
|
288
|
-
add("owner", "Owner", facts.owner);
|
|
289
|
-
add("modifiedAt", "Modified", facts.modifiedAt && new Date(facts.modifiedAt).toLocaleString(void 0, {
|
|
290
|
-
dateStyle: "medium",
|
|
291
|
-
timeStyle: "short"
|
|
292
|
-
}));
|
|
293
|
-
break;
|
|
294
|
-
case "message":
|
|
295
|
-
add("channel", "Channel", facts.channel);
|
|
296
|
-
add("author", "Author", facts.author);
|
|
297
|
-
add("sentAt", "Sent", facts.sentAt && new Date(facts.sentAt).toLocaleString(void 0, {
|
|
298
|
-
dateStyle: "medium",
|
|
299
|
-
timeStyle: "short"
|
|
300
|
-
}));
|
|
301
|
-
break;
|
|
302
|
-
case "web_page":
|
|
303
|
-
add("siteName", "Site", facts.siteName);
|
|
304
|
-
add("author", "Author", facts.author);
|
|
305
|
-
break;
|
|
306
|
-
case "chart":
|
|
307
|
-
add("range", "Range", facts.range);
|
|
308
|
-
break;
|
|
309
|
-
case "event":
|
|
310
|
-
add("level", "Level", facts.level);
|
|
311
|
-
add("project", "Project", facts.project);
|
|
312
|
-
add("release", "Release", facts.release);
|
|
313
|
-
add("environment", "Environment", facts.environment);
|
|
314
|
-
break;
|
|
315
|
-
case "release":
|
|
316
|
-
add("projects", "Projects", list(facts.projects));
|
|
317
|
-
add("newIssues", "New issues", facts.newIssues?.toLocaleString("en-US"));
|
|
318
|
-
add("crashFreeSessions", "Crash-free sessions", facts.crashFreeSessions === void 0 ? void 0 : `${Number(facts.crashFreeSessions.toFixed(2))}%`);
|
|
319
|
-
add("deploys", "Deploys", facts.deployCount === void 0 ? void 0 : facts.lastDeploy ? `${facts.deployCount.toLocaleString("en-US")}, last to ${facts.lastDeploy.environment}` : facts.deployCount.toLocaleString("en-US"));
|
|
320
|
-
break;
|
|
321
|
-
case "monitor":
|
|
322
|
-
add("kind", "Kind", MONITOR_KINDS[facts.kind]);
|
|
323
|
-
add("project", "Project", facts.project);
|
|
324
|
-
add("environment", "Environment", facts.environment);
|
|
325
|
-
add("detail", MONITOR_DETAILS[facts.kind], facts.detail);
|
|
326
|
-
break;
|
|
327
|
-
case "trace":
|
|
328
|
-
add("duration", "Duration", formatDuration(facts.durationMs));
|
|
329
|
-
add("spans", "Spans", facts.spanCount.toLocaleString("en-US"));
|
|
330
|
-
add("issues", "Issues", `${plural(facts.errorCount, "error")}, ${plural(facts.performanceIssueCount, "performance issue")}`);
|
|
331
|
-
add("projects", "Projects", list(facts.projects));
|
|
332
|
-
break;
|
|
333
|
-
case "dashboard":
|
|
334
|
-
add("widgets", "Widgets", facts.widgetCount.toLocaleString("en-US"));
|
|
335
|
-
add("projects", "Projects", list(facts.projects));
|
|
336
|
-
add("environments", "Environments", list(facts.environments));
|
|
337
|
-
add("range", "Time range", facts.range);
|
|
338
|
-
break;
|
|
339
|
-
case "person":
|
|
340
|
-
add("email", "Email", facts.email);
|
|
341
|
-
add("slackHandle", "Slack", facts.slackHandle && `@${facts.slackHandle}`);
|
|
342
|
-
add("githubHandle", "GitHub", facts.githubHandle && `@${facts.githubHandle}`, facts.githubHandle && `https://github.com/${facts.githubHandle}`);
|
|
343
|
-
}
|
|
344
|
-
return fields.slice(0, 4);
|
|
539
|
+
return factFields(facts).filter(([, , value]) => value !== void 0 && value !== "").map(([key, label, value, href]) => ({
|
|
540
|
+
key,
|
|
541
|
+
label,
|
|
542
|
+
value: String(value),
|
|
543
|
+
...href && { href }
|
|
544
|
+
})).slice(0, 4);
|
|
345
545
|
}
|
|
346
546
|
// src/object-presentation.ts
|
|
347
547
|
/** Native object types. `task` is the stored name for a Ticket. */
|
|
@@ -362,6 +562,7 @@ const objectTypeSchema = z.enum([
|
|
|
362
562
|
"release",
|
|
363
563
|
"dashboard",
|
|
364
564
|
"monitor",
|
|
565
|
+
"alert",
|
|
365
566
|
"item"
|
|
366
567
|
]);
|
|
367
568
|
const objectTypeLabels = {
|
|
@@ -381,6 +582,7 @@ const objectTypeLabels = {
|
|
|
381
582
|
release: "Release",
|
|
382
583
|
dashboard: "Dashboard",
|
|
383
584
|
monitor: "Monitor",
|
|
585
|
+
alert: "Alert",
|
|
384
586
|
item: "Item"
|
|
385
587
|
};
|
|
386
588
|
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
@@ -404,6 +606,7 @@ function objectPresentation(object) {
|
|
|
404
606
|
release: "tag",
|
|
405
607
|
dashboard: "apps",
|
|
406
608
|
monitor: "bell",
|
|
609
|
+
alert: "bell",
|
|
407
610
|
item: "package"
|
|
408
611
|
}[type];
|
|
409
612
|
let tone = type === "automation" ? "info" : "neutral";
|
|
@@ -433,6 +636,8 @@ function objectPresentation(object) {
|
|
|
433
636
|
if (state === "ok") tone = "success";
|
|
434
637
|
if (state === "failing") tone = "danger";
|
|
435
638
|
if (state === "pending") tone = "info";
|
|
639
|
+
} else if (type === "alert") {
|
|
640
|
+
if (object.facts?.enabled) tone = "success";
|
|
436
641
|
} else if (type === "conversation") {
|
|
437
642
|
if (status === "running") tone = "info";
|
|
438
643
|
if (status === "failed") tone = "danger";
|
|
@@ -1030,6 +1235,28 @@ const replyAttributionSchema = z.object({
|
|
|
1030
1235
|
label: exactNonBlankStringSchema.pipe(z.string().max(48)).refine((value) => !/[\r\n]/.test(value)),
|
|
1031
1236
|
detail: exactNonBlankStringSchema.pipe(z.string().max(128)).refine((value) => !/[\r\n]/.test(value)).optional()
|
|
1032
1237
|
}).strict();
|
|
1238
|
+
const identityDispatchFields = {
|
|
1239
|
+
idempotencyKey: nonBlankStringSchema.pipe(z.string().max(512)),
|
|
1240
|
+
input: nonBlankStringSchema.pipe(z.string().max(32e3))
|
|
1241
|
+
};
|
|
1242
|
+
/**
|
|
1243
|
+
* Plugin request to start work for one person. `input` becomes that person's
|
|
1244
|
+
* first Message in a new public Conversation, so it must be what they asked
|
|
1245
|
+
* for, not text that someone else wrote. Name the person by exactly one of:
|
|
1246
|
+
*
|
|
1247
|
+
* - `subjectId`: the provider account id that the OAuth account-linking flow
|
|
1248
|
+
* stored. Core binds the provider to the calling plugin.
|
|
1249
|
+
* - `verifiedEmail`: an address that the plugin proved this person sent from,
|
|
1250
|
+
* such as the From address of an email that passed DMARC. Never an address
|
|
1251
|
+
* that only appears in content.
|
|
1252
|
+
*/
|
|
1253
|
+
const identityDispatchOptionsSchema = z.union([z.object({
|
|
1254
|
+
...identityDispatchFields,
|
|
1255
|
+
subjectId: exactNonBlankStringSchema.pipe(z.string().max(255))
|
|
1256
|
+
}).strict(), z.object({
|
|
1257
|
+
...identityDispatchFields,
|
|
1258
|
+
verifiedEmail: z.email().max(320)
|
|
1259
|
+
}).strict()]);
|
|
1033
1260
|
/** Plugin dispatch request accepted by Junior core. */
|
|
1034
1261
|
const dispatchOptionsSchema = z.object({
|
|
1035
1262
|
idempotencyKey: nonBlankStringSchema.pipe(z.string().max(512)),
|
|
@@ -1358,16 +1585,16 @@ const pluginEventTypeSchema = z.object({
|
|
|
1358
1585
|
matchFields: eventMatchFieldsSchema.optional()
|
|
1359
1586
|
}).strict().superRefine((resourceType, context) => {
|
|
1360
1587
|
const supported = /* @__PURE__ */ new Set();
|
|
1361
|
-
resourceType.supportedEvents.
|
|
1588
|
+
for (const [index, eventType] of resourceType.supportedEvents.entries()) {
|
|
1362
1589
|
if (supported.has(eventType)) context.addIssue({
|
|
1363
1590
|
code: "custom",
|
|
1364
1591
|
message: `Duplicate supported event type "${eventType}".`,
|
|
1365
1592
|
path: ["supportedEvents", index]
|
|
1366
1593
|
});
|
|
1367
1594
|
supported.add(eventType);
|
|
1368
|
-
}
|
|
1595
|
+
}
|
|
1369
1596
|
const suggested = /* @__PURE__ */ new Set();
|
|
1370
|
-
resourceType.suggestedEvents
|
|
1597
|
+
for (const [index, eventType] of (resourceType.suggestedEvents ?? []).entries()) {
|
|
1371
1598
|
if (suggested.has(eventType)) context.addIssue({
|
|
1372
1599
|
code: "custom",
|
|
1373
1600
|
message: `Duplicate suggested event type "${eventType}".`,
|
|
@@ -1379,18 +1606,16 @@ const pluginEventTypeSchema = z.object({
|
|
|
1379
1606
|
path: ["suggestedEvents", index]
|
|
1380
1607
|
});
|
|
1381
1608
|
suggested.add(eventType);
|
|
1382
|
-
}
|
|
1383
|
-
for (const [key, field] of Object.entries(resourceType.matchFields ?? {})) field.events
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
]
|
|
1393
|
-
});
|
|
1609
|
+
}
|
|
1610
|
+
for (const [key, field] of Object.entries(resourceType.matchFields ?? {})) for (const [index, eventType] of (field.events ?? []).entries()) if (!supported.has(eventType)) context.addIssue({
|
|
1611
|
+
code: "custom",
|
|
1612
|
+
message: `Match field "${key}" event type "${eventType}" is not supported.`,
|
|
1613
|
+
path: [
|
|
1614
|
+
"matchFields",
|
|
1615
|
+
key,
|
|
1616
|
+
"events",
|
|
1617
|
+
index
|
|
1618
|
+
]
|
|
1394
1619
|
});
|
|
1395
1620
|
});
|
|
1396
1621
|
/**
|
|
@@ -1449,7 +1674,7 @@ const pluginEventsSchema = z.object({
|
|
|
1449
1674
|
}).optional()
|
|
1450
1675
|
}).strict().superRefine((registration, context) => {
|
|
1451
1676
|
const seen = /* @__PURE__ */ new Set();
|
|
1452
|
-
registration.resourceTypes.
|
|
1677
|
+
for (const [index, resourceType] of registration.resourceTypes.entries()) {
|
|
1453
1678
|
if (seen.has(resourceType.type)) context.addIssue({
|
|
1454
1679
|
code: "custom",
|
|
1455
1680
|
message: `Duplicate resource type "${resourceType.type}".`,
|
|
@@ -1460,7 +1685,7 @@ const pluginEventsSchema = z.object({
|
|
|
1460
1685
|
]
|
|
1461
1686
|
});
|
|
1462
1687
|
seen.add(resourceType.type);
|
|
1463
|
-
}
|
|
1688
|
+
}
|
|
1464
1689
|
const supported = new Set(registration.resourceTypes.flatMap((resourceType) => resourceType.supportedEvents));
|
|
1465
1690
|
for (const eventType of supported) if (!registration.events[eventType]) context.addIssue({
|
|
1466
1691
|
code: "custom",
|
|
@@ -1531,6 +1756,35 @@ const eventPersonSchema = z.union([z.object({
|
|
|
1531
1756
|
provider: z.string().min(1),
|
|
1532
1757
|
handle: z.string().min(1)
|
|
1533
1758
|
}).strict(), z.object({ email: z.string().trim().min(3) }).strict()]);
|
|
1759
|
+
/**
|
|
1760
|
+
* The account that wrote the content of an Event, such as a commenter or a
|
|
1761
|
+
* reviewer. It is always an account of the publishing plugin's provider.
|
|
1762
|
+
* Core decides from it whether the author is a Trusted author. An Event with
|
|
1763
|
+
* no author is a system Event.
|
|
1764
|
+
*/
|
|
1765
|
+
const eventAuthorSchema = z.object({
|
|
1766
|
+
/** Display handle, such as a login. It never proves who the author is. */
|
|
1767
|
+
handle: z.string().min(1),
|
|
1768
|
+
/**
|
|
1769
|
+
* The account id that the provider never changes or gives to another
|
|
1770
|
+
* account, such as the numeric GitHub user id. Set it only when the
|
|
1771
|
+
* provider authenticated that this account wrote the content. Core
|
|
1772
|
+
* matches it to an account that the OAuth account-linking flow linked.
|
|
1773
|
+
*/
|
|
1774
|
+
subjectId: z.string().min(1).optional(),
|
|
1775
|
+
/** The account is a bot, not a person. */
|
|
1776
|
+
bot: z.boolean().optional(),
|
|
1777
|
+
/**
|
|
1778
|
+
* The plugin's trusted authors list names this account. Core trusts the
|
|
1779
|
+
* author without a linked account. Core never reads the list itself.
|
|
1780
|
+
*/
|
|
1781
|
+
trusted: z.boolean().optional(),
|
|
1782
|
+
/**
|
|
1783
|
+
* The author's own text, without what they quote. Leave it out of
|
|
1784
|
+
* `untrustedText`: core shows it once, as context that names the author.
|
|
1785
|
+
*/
|
|
1786
|
+
text: z.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
|
|
1787
|
+
}).strict();
|
|
1534
1788
|
const eventInputSchema = z.object({
|
|
1535
1789
|
objectType: objectTypeSchema.optional(),
|
|
1536
1790
|
eventKey: z.string().min(1),
|
|
@@ -1546,15 +1800,19 @@ const eventInputSchema = z.object({
|
|
|
1546
1800
|
trustedSummary: z.string().min(1).transform((value) => value.slice(0, EVENT_SUMMARY_MAX_LENGTH)),
|
|
1547
1801
|
/** Trusted structured facts. Prefer ids and urls over long prose. */
|
|
1548
1802
|
data: eventDataSchema.optional(),
|
|
1803
|
+
/**
|
|
1804
|
+
* Provider text that is context, never instruction. When `author.text`
|
|
1805
|
+
* is set, this is only the rest, such as what the author quotes.
|
|
1806
|
+
*/
|
|
1549
1807
|
untrustedText: z.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional(),
|
|
1550
1808
|
/** People involved in the change. Watch Events list them as mentions. */
|
|
1551
1809
|
people: z.array(eventPersonSchema).max(20).optional(),
|
|
1552
1810
|
/**
|
|
1553
|
-
* The
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1811
|
+
* The account that wrote the content. Core decides whether to trust it.
|
|
1812
|
+
* A trusted person writes the Event's Message. `text` is never an
|
|
1813
|
+
* instruction.
|
|
1556
1814
|
*/
|
|
1557
|
-
|
|
1815
|
+
author: eventAuthorSchema.optional()
|
|
1558
1816
|
}).strict();
|
|
1559
1817
|
const eventSchema = eventInputSchema.extend({ namespace: z.string().min(1) });
|
|
1560
1818
|
// src/event-triggers.ts
|
|
@@ -2299,6 +2557,11 @@ const pluginUserPageContentSchema = z.object({
|
|
|
2299
2557
|
metrics: z.array(pluginUserPageMetricSchema).max(6).optional(),
|
|
2300
2558
|
nextCursor: nonBlankStringSchema.max(1e3).optional(),
|
|
2301
2559
|
records: z.array(pluginUserPageRecordSchema).max(100),
|
|
2560
|
+
/**
|
|
2561
|
+
* Set when `read` matches `input.query`. The dashboard's command palette
|
|
2562
|
+
* then keeps every returned record as a match; without it, the palette
|
|
2563
|
+
* matches titles and descriptions itself.
|
|
2564
|
+
*/
|
|
2302
2565
|
searchPlaceholder: nonBlankStringSchema.max(120).optional(),
|
|
2303
2566
|
type: z.literal("list")
|
|
2304
2567
|
}).strict();
|
|
@@ -2324,4 +2587,4 @@ const pluginUserPageInputSchema = z.object({
|
|
|
2324
2587
|
limit: z.number().int().min(1).max(50),
|
|
2325
2588
|
query: pluginUserPageQuerySchema
|
|
2326
2589
|
}).strict();
|
|
2327
|
-
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 };
|
|
2590
|
+
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, eventAuthorSchema, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, formatDuration, getSourceKey, identityDispatchOptionsSchema, 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.
|
|
3
|
+
"version": "0.307.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./embeddings": {
|
|
20
|
+
"types": "./dist/embeddings.d.ts",
|
|
21
|
+
"default": "./dist/embeddings.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"files": [
|
|
@@ -23,6 +27,7 @@
|
|
|
23
27
|
],
|
|
24
28
|
"dependencies": {
|
|
25
29
|
"commander": "^14.0.3",
|
|
30
|
+
"drizzle-orm": "^0.45.4",
|
|
26
31
|
"zod": "^4.6.7"
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|