@sentry/junior-plugin-api 0.321.0 → 0.323.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 +94 -27
- package/dist/index.js +78 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
19
19
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
20
20
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
21
21
|
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
24
|
review: z.ZodOptional<z.ZodEnum<{
|
|
23
25
|
approved: "approved";
|
|
24
26
|
changes_requested: "changes_requested";
|
|
@@ -336,6 +338,8 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
336
338
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
337
339
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
338
340
|
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
341
|
+
approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
342
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
339
343
|
review: z.ZodOptional<z.ZodEnum<{
|
|
340
344
|
approved: "approved";
|
|
341
345
|
changes_requested: "changes_requested";
|
|
@@ -568,6 +572,8 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
568
572
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
569
573
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
570
574
|
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
575
|
+
approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
576
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
571
577
|
review: z.ZodOptional<z.ZodEnum<{
|
|
572
578
|
approved: "approved";
|
|
573
579
|
changes_requested: "changes_requested";
|
|
@@ -1174,6 +1180,12 @@ export interface CacheEntry<T> {
|
|
|
1174
1180
|
/** Must survive JSON serialization. */
|
|
1175
1181
|
value: T;
|
|
1176
1182
|
}
|
|
1183
|
+
/**
|
|
1184
|
+
* How long a `getOrLoad` load that calls a provider may run. Other callers
|
|
1185
|
+
* of the key wait 10 s for it, so a load that ends within this answers them
|
|
1186
|
+
* all, and none of them calls the provider too.
|
|
1187
|
+
*/
|
|
1188
|
+
export declare const CACHE_LOAD_TIMEOUT_MS = 8000;
|
|
1177
1189
|
/**
|
|
1178
1190
|
* Short-lived copies of values that are slow or costly to load, such as
|
|
1179
1191
|
* provider API reads. Junior can drop an entry at any time. A lost entry only
|
|
@@ -1181,18 +1193,22 @@ export interface CacheEntry<T> {
|
|
|
1181
1193
|
* `PluginState` for that.
|
|
1182
1194
|
*/
|
|
1183
1195
|
export interface PluginCache {
|
|
1196
|
+
/**
|
|
1197
|
+
* Return the fresh cached value of `key`, or `undefined`. It never loads
|
|
1198
|
+
* or waits on a load. `stale` also returns a `staleIfError` entry past
|
|
1199
|
+
* its TTL, as the last good value.
|
|
1200
|
+
*/
|
|
1201
|
+
get<T>(key: string, options?: {
|
|
1202
|
+
stale?: boolean;
|
|
1203
|
+
}): Promise<T | undefined>;
|
|
1184
1204
|
/**
|
|
1185
1205
|
* Return the cached value for `key`, or call `load` and cache its result.
|
|
1186
1206
|
* Concurrent callers share one load. A load that throws is not cached,
|
|
1187
1207
|
* and it throws to the caller unless a `staleIfError` value is kept.
|
|
1188
|
-
*
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
* Return the fresh cached value of `key`, or `undefined` when there is
|
|
1192
|
-
* none. It never loads, so a caller can find the misses of many keys and
|
|
1193
|
-
* load them in one provider call.
|
|
1208
|
+
* A caller that waits too long for another load gets that kept value, or
|
|
1209
|
+
* loads the value itself when there is none. `refresh` ignores the cached
|
|
1210
|
+
* value and replaces it.
|
|
1194
1211
|
*/
|
|
1195
|
-
get<T>(key: string): Promise<T | undefined>;
|
|
1196
1212
|
getOrLoad<T>(key: string, load: () => Promise<CacheEntry<T>>, options?: {
|
|
1197
1213
|
refresh?: boolean;
|
|
1198
1214
|
}): Promise<T>;
|
|
@@ -1866,6 +1882,8 @@ export declare const liveAnnotationSchema: z.ZodIntersection<z.ZodDiscriminatedU
|
|
|
1866
1882
|
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
1867
1883
|
targetBranch: z.ZodOptional<z.ZodString>;
|
|
1868
1884
|
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1885
|
+
approvers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1886
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1869
1887
|
review: z.ZodOptional<z.ZodEnum<{
|
|
1870
1888
|
approved: "approved";
|
|
1871
1889
|
changes_requested: "changes_requested";
|
|
@@ -3148,7 +3166,8 @@ export interface PluginEventToolContext {
|
|
|
3148
3166
|
/**
|
|
3149
3167
|
* Event types, from `events`, that this Watch delivers quietly: core
|
|
3150
3168
|
* saves each one as a Conversation note and starts no Turn. Use it for
|
|
3151
|
-
* outcomes that a later Turn must know but that need no action.
|
|
3169
|
+
* outcomes that a later Turn must know but that need no action. A child
|
|
3170
|
+
* agent's Watch starts a Turn for them, so its parent hears.
|
|
3152
3171
|
*/
|
|
3153
3172
|
quietEvents?: string[];
|
|
3154
3173
|
}): Promise<WatchResult>;
|
|
@@ -3459,6 +3478,14 @@ export interface ObjectLinkContext extends PluginContext {
|
|
|
3459
3478
|
* that read asks the provider as usual.
|
|
3460
3479
|
*/
|
|
3461
3480
|
prefetchOutcome?: ObjectLinkPrefetchOutcome;
|
|
3481
|
+
/**
|
|
3482
|
+
* True when a page load or a poll reads the card. Read only your cache,
|
|
3483
|
+
* such as objects that webhooks keep: `egress`, `viewerEgress`, and
|
|
3484
|
+
* `viewerMcp` throw. The viewer can read the Conversation or Inbox item
|
|
3485
|
+
* of the link, so show the stored card with no access check.
|
|
3486
|
+
* Junior calls only link types that set `cacheOnlyReads`.
|
|
3487
|
+
*/
|
|
3488
|
+
cacheOnly?: true;
|
|
3462
3489
|
}
|
|
3463
3490
|
/**
|
|
3464
3491
|
* One link type of a plugin. Junior calls `canView` first, and calls
|
|
@@ -3472,6 +3499,12 @@ export interface PluginObjectLinkDefinition {
|
|
|
3472
3499
|
* last card when a read fails.
|
|
3473
3500
|
*/
|
|
3474
3501
|
cacheCards?: true;
|
|
3502
|
+
/**
|
|
3503
|
+
* Set true when `canView` and `resolve` honor `ctx.cacheOnly`. Without
|
|
3504
|
+
* it, a cache-only read shows only the card that `cacheCards` kept, or no
|
|
3505
|
+
* card.
|
|
3506
|
+
*/
|
|
3507
|
+
cacheOnlyReads?: true;
|
|
3475
3508
|
/**
|
|
3476
3509
|
* Return whether `ctx.viewer` may see the object. Junior calls it before
|
|
3477
3510
|
* each card read and again on each Attach. Return true for a public
|
|
@@ -3570,6 +3603,14 @@ export interface PluginInboxSubjectKind {
|
|
|
3570
3603
|
* object Annotation uses.
|
|
3571
3604
|
*/
|
|
3572
3605
|
owner: PluginInboxSubjectOwner | "annotation";
|
|
3606
|
+
/**
|
|
3607
|
+
* Buttons on each open item of the kind, in display order, such as
|
|
3608
|
+
* Keep fixing. An item of a kind with actions waits on its assignees. The
|
|
3609
|
+
* first click closes it as done, records the action's `id`, and calls the
|
|
3610
|
+
* plugin's `inboxItemAction` hook. It starts no Turn: the plugin does the
|
|
3611
|
+
* work.
|
|
3612
|
+
*/
|
|
3613
|
+
actions?: PluginInboxKindAction[];
|
|
3573
3614
|
/**
|
|
3574
3615
|
* Each assignee holds a role on the object, such as a GitHub assignee, so
|
|
3575
3616
|
* they are on the item without the owner Conversation. Nobody can take it.
|
|
@@ -3578,6 +3619,19 @@ export interface PluginInboxSubjectKind {
|
|
|
3578
3619
|
*/
|
|
3579
3620
|
assigneeRoles?: boolean;
|
|
3580
3621
|
}
|
|
3622
|
+
/**
|
|
3623
|
+
* The icons that a kind action can show next to its label. The dashboard
|
|
3624
|
+
* maps each name to one of its icons, so add a name there too.
|
|
3625
|
+
*/
|
|
3626
|
+
export declare const PLUGIN_INBOX_ACTION_ICONS: readonly ["wrench"];
|
|
3627
|
+
/** One button on the open items of a subject kind. */
|
|
3628
|
+
export interface PluginInboxKindAction {
|
|
3629
|
+
/** Stable id, recorded on the item that it closes, such as `resume`. */
|
|
3630
|
+
id: string;
|
|
3631
|
+
label: string;
|
|
3632
|
+
/** The dashboard shows it before the label. Slack shows no icons. */
|
|
3633
|
+
icon?: (typeof PLUGIN_INBOX_ACTION_ICONS)[number];
|
|
3634
|
+
}
|
|
3581
3635
|
/** The table and columns that map a subject id to its owner Conversation. */
|
|
3582
3636
|
export interface PluginInboxSubjectOwner {
|
|
3583
3637
|
conversationId: string;
|
|
@@ -3633,16 +3687,6 @@ export interface PluginReviewNotice {
|
|
|
3633
3687
|
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
3634
3688
|
*/
|
|
3635
3689
|
title: string;
|
|
3636
|
-
/**
|
|
3637
|
-
* Buttons that answer the item, in display order, such as `Resume`. An
|
|
3638
|
-
* item with choices waits on its assignees. The first click closes it as
|
|
3639
|
-
* done and calls the plugin's `inboxItemAnswered` hook with the choice.
|
|
3640
|
-
* The answer starts no Turn: the plugin does the work.
|
|
3641
|
-
*/
|
|
3642
|
-
choices?: Array<{
|
|
3643
|
-
label: string;
|
|
3644
|
-
description?: string;
|
|
3645
|
-
}>;
|
|
3646
3690
|
/**
|
|
3647
3691
|
* The assignees must act, such as merge a pull request that is ready. The
|
|
3648
3692
|
* item then waits on them: its Conversation shows in their Needs you, and
|
|
@@ -3651,12 +3695,29 @@ export interface PluginReviewNotice {
|
|
|
3651
3695
|
*/
|
|
3652
3696
|
waitsOnAssignees?: boolean;
|
|
3653
3697
|
}
|
|
3698
|
+
/**
|
|
3699
|
+
* One item of a subject as the Inbox records it. A closed item keeps how
|
|
3700
|
+
* and when it closed, so a subject's items say what people did on it.
|
|
3701
|
+
*/
|
|
3702
|
+
export interface PluginInboxItemRecord {
|
|
3703
|
+
/** The id of the kind action that a person ran to close it. */
|
|
3704
|
+
action?: string;
|
|
3705
|
+
/** Unset while the item is open. */
|
|
3706
|
+
closedAtMs?: number;
|
|
3707
|
+
id: string;
|
|
3708
|
+
status: "open" | "done" | "dismissed";
|
|
3709
|
+
}
|
|
3654
3710
|
/**
|
|
3655
3711
|
* Inbox items that a plugin adds and closes from its own events. Each item
|
|
3656
3712
|
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
3657
3713
|
* the Slack cards.
|
|
3658
3714
|
*/
|
|
3659
3715
|
export interface PluginInboxItems {
|
|
3716
|
+
/**
|
|
3717
|
+
* The items of the subject, newest first: the open one, if any, then the
|
|
3718
|
+
* closed ones.
|
|
3719
|
+
*/
|
|
3720
|
+
history(subject: PluginInboxItemSubject): Promise<PluginInboxItemRecord[]>;
|
|
3660
3721
|
/** Add an open item, or change the open one of the subject. */
|
|
3661
3722
|
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
3662
3723
|
/**
|
|
@@ -3702,10 +3763,10 @@ export interface InboxItemDismissedHookContext extends PluginContext {
|
|
|
3702
3763
|
/** The subject of the item, with the plugin's own kind. */
|
|
3703
3764
|
subject: PluginInboxItemSubject;
|
|
3704
3765
|
}
|
|
3705
|
-
/** A person
|
|
3706
|
-
export interface
|
|
3707
|
-
/** The
|
|
3708
|
-
|
|
3766
|
+
/** A person ran an action of the kind of an item that this plugin added. */
|
|
3767
|
+
export interface InboxItemActionHookContext extends PluginContext {
|
|
3768
|
+
/** The `id` of the kind action. */
|
|
3769
|
+
action: string;
|
|
3709
3770
|
/** Junior's native code index, as from a plugin route. */
|
|
3710
3771
|
codeChanges: PluginCodeChanges;
|
|
3711
3772
|
/** The Conversation that the item belongs to. */
|
|
@@ -3714,7 +3775,7 @@ export interface InboxItemAnsweredHookContext extends PluginContext {
|
|
|
3714
3775
|
subject: PluginInboxItemSubject;
|
|
3715
3776
|
/** Publish events, as from a plugin route. */
|
|
3716
3777
|
events: EventPublisher;
|
|
3717
|
-
/** The closed item's id. It is the same on a retry of the same
|
|
3778
|
+
/** The closed item's id. It is the same on a retry of the same action. */
|
|
3718
3779
|
itemId: string;
|
|
3719
3780
|
nowMs: number;
|
|
3720
3781
|
/** Inbox items, as from a plugin route. */
|
|
@@ -3892,6 +3953,12 @@ export interface PluginConversationEventStats {
|
|
|
3892
3953
|
hours?: number;
|
|
3893
3954
|
}): Promise<PluginConversationEventCostDay[]>;
|
|
3894
3955
|
}
|
|
3956
|
+
/**
|
|
3957
|
+
* Wait for `work` until `signal` aborts, then reject with its reason. The
|
|
3958
|
+
* work goes on, so use it for work that takes no signal, or that must not
|
|
3959
|
+
* be cut off midway, such as a shared OAuth refresh.
|
|
3960
|
+
*/
|
|
3961
|
+
export declare function untilAborted<T>(work: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
3895
3962
|
/** One provider GET that a plugin sends with a credential it holds. */
|
|
3896
3963
|
export interface PluginHttpCacheRequest {
|
|
3897
3964
|
/**
|
|
@@ -4939,11 +5006,11 @@ export interface PluginHooks {
|
|
|
4939
5006
|
*/
|
|
4940
5007
|
grantForEgress?(ctx: EgressHookContext): Promise<PluginGrant | undefined> | PluginGrant | undefined;
|
|
4941
5008
|
/**
|
|
4942
|
-
* Do the work
|
|
4943
|
-
* plugin added. Junior calls it again
|
|
4944
|
-
* failure, so it must be safe to repeat.
|
|
5009
|
+
* Do the work of a kind action that a person ran on an item that this
|
|
5010
|
+
* plugin added (`PluginInboxSubjectKind.actions`). Junior calls it again
|
|
5011
|
+
* when the person retries after a failure, so it must be safe to repeat.
|
|
4945
5012
|
*/
|
|
4946
|
-
|
|
5013
|
+
inboxItemAction?(ctx: InboxItemActionHookContext): Promise<void> | void;
|
|
4947
5014
|
/**
|
|
4948
5015
|
* Remove the person who dismissed an item of an `assigneeRoles` subject
|
|
4949
5016
|
* kind from the object on the provider. Throw when the provider refuses:
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,11 @@ const objectFactsSchema = z.discriminatedUnion("type", [
|
|
|
28
28
|
author: text.optional(),
|
|
29
29
|
sourceBranch: text.optional(),
|
|
30
30
|
targetBranch: text.optional(),
|
|
31
|
+
/** People whose review the change waits for. */
|
|
31
32
|
reviewers: z.array(text).max(5).optional(),
|
|
33
|
+
/** People whose latest review approves the change. */
|
|
34
|
+
approvers: z.array(text).max(5).optional(),
|
|
35
|
+
assignees: z.array(text).max(5).optional(),
|
|
32
36
|
review: z.enum([
|
|
33
37
|
"required",
|
|
34
38
|
"approved",
|
|
@@ -279,6 +283,11 @@ const MONITOR_DETAILS = {
|
|
|
279
283
|
function list(values) {
|
|
280
284
|
return values?.length ? `${values.join(", ")}${values.length === 5 ? " (up to 5 shown)" : ""}` : void 0;
|
|
281
285
|
}
|
|
286
|
+
function codeChangeReviewers(facts) {
|
|
287
|
+
const approvers = facts.approvers ?? [];
|
|
288
|
+
const waiting = (facts.reviewers ?? []).filter((login) => !approvers.includes(login));
|
|
289
|
+
return [...approvers.map((login) => `${login} (approved)`), ...waiting].join(", ") || void 0;
|
|
290
|
+
}
|
|
282
291
|
function dateTime(value) {
|
|
283
292
|
return value && new Date(value).toLocaleString(void 0, {
|
|
284
293
|
dateStyle: "medium",
|
|
@@ -286,11 +295,28 @@ function dateTime(value) {
|
|
|
286
295
|
});
|
|
287
296
|
}
|
|
288
297
|
const FACT_FIELDS = {
|
|
289
|
-
code_change: (facts) => [
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
298
|
+
code_change: (facts) => [
|
|
299
|
+
[
|
|
300
|
+
"sourceBranch",
|
|
301
|
+
"Branch",
|
|
302
|
+
facts.sourceBranch
|
|
303
|
+
],
|
|
304
|
+
[
|
|
305
|
+
"author",
|
|
306
|
+
"Author",
|
|
307
|
+
facts.author
|
|
308
|
+
],
|
|
309
|
+
[
|
|
310
|
+
"reviewers",
|
|
311
|
+
"Reviewers",
|
|
312
|
+
codeChangeReviewers(facts)
|
|
313
|
+
],
|
|
314
|
+
[
|
|
315
|
+
"assignees",
|
|
316
|
+
"Assignees",
|
|
317
|
+
list(facts.assignees)
|
|
318
|
+
]
|
|
319
|
+
],
|
|
294
320
|
task: (facts) => [
|
|
295
321
|
[
|
|
296
322
|
"assignees",
|
|
@@ -1380,6 +1406,33 @@ const dispatchOptionsSchema = z.object({
|
|
|
1380
1406
|
/** Saved title. Title generation runs only when it is omitted. */
|
|
1381
1407
|
title: nonBlankStringSchema.pipe(z.string().max(200)).optional()
|
|
1382
1408
|
}).strict();
|
|
1409
|
+
// src/abort.ts
|
|
1410
|
+
/**
|
|
1411
|
+
* Wait for `work` until `signal` aborts, then reject with its reason. The
|
|
1412
|
+
* work goes on, so use it for work that takes no signal, or that must not
|
|
1413
|
+
* be cut off midway, such as a shared OAuth refresh.
|
|
1414
|
+
*/
|
|
1415
|
+
async function untilAborted(work, signal) {
|
|
1416
|
+
if (!signal) return await work;
|
|
1417
|
+
signal.throwIfAborted();
|
|
1418
|
+
let onAbort;
|
|
1419
|
+
const aborted = new Promise((_, reject) => {
|
|
1420
|
+
onAbort = () => reject(signal.reason);
|
|
1421
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1422
|
+
});
|
|
1423
|
+
try {
|
|
1424
|
+
return await Promise.race([work, aborted]);
|
|
1425
|
+
} finally {
|
|
1426
|
+
signal.removeEventListener("abort", onAbort);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
// src/cache.ts
|
|
1430
|
+
/**
|
|
1431
|
+
* How long a `getOrLoad` load that calls a provider may run. Other callers
|
|
1432
|
+
* of the key wait 10 s for it, so a load that ends within this answers them
|
|
1433
|
+
* all, and none of them calls the provider too.
|
|
1434
|
+
*/
|
|
1435
|
+
const CACHE_LOAD_TIMEOUT_MS = 8e3;
|
|
1383
1436
|
// src/context.ts
|
|
1384
1437
|
/** Build a normalized Slack source from runtime-owned Slack coordinates. */
|
|
1385
1438
|
function createSlackSource(input) {
|
|
@@ -2782,6 +2835,23 @@ function skipHeredocBody(text, newlineIndex, heredoc) {
|
|
|
2782
2835
|
}
|
|
2783
2836
|
return index;
|
|
2784
2837
|
}
|
|
2838
|
+
// src/inbox-items.ts
|
|
2839
|
+
/**
|
|
2840
|
+
* The icons that a kind action can show next to its label. The dashboard
|
|
2841
|
+
* maps each name to one of its icons, so add a name there too.
|
|
2842
|
+
*/
|
|
2843
|
+
const PLUGIN_INBOX_ACTION_ICONS = ["wrench"];
|
|
2844
|
+
/**
|
|
2845
|
+
* A plugin changed an open item through a Conversation that does not own it.
|
|
2846
|
+
* A plugin that picks the owner from provider data, such as a GitHub issue
|
|
2847
|
+
* footer, can catch it when that data is stale.
|
|
2848
|
+
*/
|
|
2849
|
+
var PluginInboxItemOwnerError = class extends Error {
|
|
2850
|
+
constructor(message) {
|
|
2851
|
+
super(message);
|
|
2852
|
+
this.name = "PluginInboxItemOwnerError";
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2785
2855
|
// src/registration.ts
|
|
2786
2856
|
const PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
2787
2857
|
const INBOX_SUBJECT_KIND_RE = /^[a-z][a-z0-9_]*$/;
|
|
@@ -2859,22 +2929,12 @@ function validateInboxSubjects(name, kinds) {
|
|
|
2859
2929
|
owner?.conversationId
|
|
2860
2930
|
].every((identifier) => typeof identifier === "string" && SQL_IDENTIFIER_RE.test(identifier))) throw new Error(`Plugin "${name}" inbox subject "${subject.kind}" needs an owner: "annotation", or a table, subjectId column, and conversationId column in snake_case.`);
|
|
2861
2931
|
if (subject.assigneeRoles !== void 0 && typeof subject.assigneeRoles !== "boolean") throw new Error(`Plugin "${name}" inbox subject "${subject.kind}" assigneeRoles must be a boolean.`);
|
|
2932
|
+
const actionIds = (subject.actions ?? []).map((action) => action?.id);
|
|
2933
|
+
if (subject.actions !== void 0 && !Array.isArray(subject.actions) || (subject.actions ?? []).some((action) => typeof action?.id !== "string" || !INBOX_SUBJECT_KIND_RE.test(action.id) || typeof action.label !== "string" || !action.label.trim() || action.icon !== void 0 && !PLUGIN_INBOX_ACTION_ICONS.includes(action.icon)) || new Set(actionIds).size !== actionIds.length) throw new Error(`Plugin "${name}" inbox subject "${subject.kind}" actions need unique snake_case ids, labels, and icons from ${PLUGIN_INBOX_ACTION_ICONS.join(", ")}.`);
|
|
2862
2934
|
if (seen.has(subject.kind)) throw new Error(`Plugin "${name}" has duplicate inbox subject kind "${subject.kind}".`);
|
|
2863
2935
|
seen.add(subject.kind);
|
|
2864
2936
|
}
|
|
2865
2937
|
}
|
|
2866
|
-
// src/inbox-items.ts
|
|
2867
|
-
/**
|
|
2868
|
-
* A plugin changed an open item through a Conversation that does not own it.
|
|
2869
|
-
* A plugin that picks the owner from provider data, such as a GitHub issue
|
|
2870
|
-
* footer, can catch it when that data is stale.
|
|
2871
|
-
*/
|
|
2872
|
-
var PluginInboxItemOwnerError = class extends Error {
|
|
2873
|
-
constructor(message) {
|
|
2874
|
-
super(message);
|
|
2875
|
-
this.name = "PluginInboxItemOwnerError";
|
|
2876
|
-
}
|
|
2877
|
-
};
|
|
2878
2938
|
// src/markdown.ts
|
|
2879
2939
|
/**
|
|
2880
2940
|
* Parse GitHub-flavored Markdown. Each node position holds offsets into
|
|
@@ -3020,4 +3080,4 @@ const pluginUserPageInputSchema = z.object({
|
|
|
3020
3080
|
limit: z.number().int().min(1).max(50),
|
|
3021
3081
|
query: pluginUserPageQuerySchema
|
|
3022
3082
|
}).strict();
|
|
3023
|
-
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, MAX_CONVERSATION_CHANGES, OBJECT_FACTS_MAX_BYTES, OBJECT_SUMMARY_MAX_LENGTH, PluginInboxItemOwnerError, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, annotatedObjectSchema, annotationActionSchema, anyResourceEvents, anyResourceMatchFields, codeChangeFilterSchema, codeChangeInputSchema, codeChangeSizeSchema, codeChangeStateSchema, codeRepositoryInputSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, decodeObjectImageRef, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, encodeObjectImageRef, enforceEgressPolicy, escapeClosingTag, escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, eventAuthorSchema, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, findTag, findTags, formatDuration, getSourceKey, identityDispatchOptionsSchema, identitySchema, indentTagLines, isPluginModelCostEventName, isPrivateSource, isSlackDestination, liveAnnotationSchema, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, markdownNodes, markdownPlainText, markdownText, mentionsTag, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsBytes, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectLinkFilterMatches, objectLinkFilterSchema, objectLinkFilterSpecificity, objectPresentation, objectSubjectSchema, objectSummary, objectTypeSchema, openingTag, ownedObjectAnnotationSchema, parentMessageSourceSchema, parseMarkdown, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginTaskStartInputSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, readTag, renderEmptyTag, renderInlineTag, renderTag, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, savedObjectAnnotationSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, startsWithTag, stripTags, subscribableResourceSchema, systemActorSchema, tagJson, taskOutcomeSchema, toolApprovalModeSchema, unescapeClosingTag, unescapeClosingTags, unescapeTagText, userSchema, watchResultSchema, webActorSchema, webSourceSchema, withToolContext, zodTool };
|
|
3083
|
+
export { CACHE_LOAD_TIMEOUT_MS, EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, MAX_CONVERSATION_CHANGES, OBJECT_FACTS_MAX_BYTES, OBJECT_SUMMARY_MAX_LENGTH, PLUGIN_INBOX_ACTION_ICONS, PluginInboxItemOwnerError, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, annotatedObjectSchema, annotationActionSchema, anyResourceEvents, anyResourceMatchFields, codeChangeFilterSchema, codeChangeInputSchema, codeChangeSizeSchema, codeChangeStateSchema, codeRepositoryInputSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, decodeObjectImageRef, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, encodeObjectImageRef, enforceEgressPolicy, escapeClosingTag, escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, eventAuthorSchema, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, findTag, findTags, formatDuration, getSourceKey, identityDispatchOptionsSchema, identitySchema, indentTagLines, isPluginModelCostEventName, isPrivateSource, isSlackDestination, liveAnnotationSchema, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, markdownNodes, markdownPlainText, markdownText, mentionsTag, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsBytes, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectLinkFilterMatches, objectLinkFilterSchema, objectLinkFilterSpecificity, objectPresentation, objectSubjectSchema, objectSummary, objectTypeSchema, openingTag, ownedObjectAnnotationSchema, parentMessageSourceSchema, parseMarkdown, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginTaskStartInputSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, readTag, renderEmptyTag, renderInlineTag, renderTag, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, savedObjectAnnotationSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, startsWithTag, stripTags, subscribableResourceSchema, systemActorSchema, tagJson, taskOutcomeSchema, toolApprovalModeSchema, unescapeClosingTag, unescapeClosingTags, unescapeTagText, untilAborted, userSchema, watchResultSchema, webActorSchema, webSourceSchema, withToolContext, zodTool };
|