@sentry/junior-plugin-api 0.320.0 → 0.322.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 +102 -26
- 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";
|
|
@@ -3459,6 +3477,14 @@ export interface ObjectLinkContext extends PluginContext {
|
|
|
3459
3477
|
* that read asks the provider as usual.
|
|
3460
3478
|
*/
|
|
3461
3479
|
prefetchOutcome?: ObjectLinkPrefetchOutcome;
|
|
3480
|
+
/**
|
|
3481
|
+
* True when a page load or a poll reads the card. Read only your cache,
|
|
3482
|
+
* such as objects that webhooks keep: `egress`, `viewerEgress`, and
|
|
3483
|
+
* `viewerMcp` throw. The viewer can read the Conversation or Inbox item
|
|
3484
|
+
* of the link, so show the stored card with no access check.
|
|
3485
|
+
* Junior calls only link types that set `cacheOnlyReads`.
|
|
3486
|
+
*/
|
|
3487
|
+
cacheOnly?: true;
|
|
3462
3488
|
}
|
|
3463
3489
|
/**
|
|
3464
3490
|
* One link type of a plugin. Junior calls `canView` first, and calls
|
|
@@ -3472,6 +3498,12 @@ export interface PluginObjectLinkDefinition {
|
|
|
3472
3498
|
* last card when a read fails.
|
|
3473
3499
|
*/
|
|
3474
3500
|
cacheCards?: true;
|
|
3501
|
+
/**
|
|
3502
|
+
* Set true when `canView` and `resolve` honor `ctx.cacheOnly`. Without
|
|
3503
|
+
* it, a cache-only read shows only the card that `cacheCards` kept, or no
|
|
3504
|
+
* card.
|
|
3505
|
+
*/
|
|
3506
|
+
cacheOnlyReads?: true;
|
|
3475
3507
|
/**
|
|
3476
3508
|
* Return whether `ctx.viewer` may see the object. Junior calls it before
|
|
3477
3509
|
* each card read and again on each Attach. Return true for a public
|
|
@@ -3570,6 +3602,14 @@ export interface PluginInboxSubjectKind {
|
|
|
3570
3602
|
* object Annotation uses.
|
|
3571
3603
|
*/
|
|
3572
3604
|
owner: PluginInboxSubjectOwner | "annotation";
|
|
3605
|
+
/**
|
|
3606
|
+
* Buttons on each open item of the kind, in display order, such as
|
|
3607
|
+
* Keep fixing. An item of a kind with actions waits on its assignees. The
|
|
3608
|
+
* first click closes it as done, records the action's `id`, and calls the
|
|
3609
|
+
* plugin's `inboxItemAction` hook. It starts no Turn: the plugin does the
|
|
3610
|
+
* work.
|
|
3611
|
+
*/
|
|
3612
|
+
actions?: PluginInboxKindAction[];
|
|
3573
3613
|
/**
|
|
3574
3614
|
* Each assignee holds a role on the object, such as a GitHub assignee, so
|
|
3575
3615
|
* they are on the item without the owner Conversation. Nobody can take it.
|
|
@@ -3578,6 +3618,19 @@ export interface PluginInboxSubjectKind {
|
|
|
3578
3618
|
*/
|
|
3579
3619
|
assigneeRoles?: boolean;
|
|
3580
3620
|
}
|
|
3621
|
+
/**
|
|
3622
|
+
* The icons that a kind action can show next to its label. The dashboard
|
|
3623
|
+
* maps each name to one of its icons, so add a name there too.
|
|
3624
|
+
*/
|
|
3625
|
+
export declare const PLUGIN_INBOX_ACTION_ICONS: readonly ["wrench"];
|
|
3626
|
+
/** One button on the open items of a subject kind. */
|
|
3627
|
+
export interface PluginInboxKindAction {
|
|
3628
|
+
/** Stable id, recorded on the item that it closes, such as `resume`. */
|
|
3629
|
+
id: string;
|
|
3630
|
+
label: string;
|
|
3631
|
+
/** The dashboard shows it before the label. Slack shows no icons. */
|
|
3632
|
+
icon?: (typeof PLUGIN_INBOX_ACTION_ICONS)[number];
|
|
3633
|
+
}
|
|
3581
3634
|
/** The table and columns that map a subject id to its owner Conversation. */
|
|
3582
3635
|
export interface PluginInboxSubjectOwner {
|
|
3583
3636
|
conversationId: string;
|
|
@@ -3633,16 +3686,6 @@ export interface PluginReviewNotice {
|
|
|
3633
3686
|
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
3634
3687
|
*/
|
|
3635
3688
|
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
3689
|
/**
|
|
3647
3690
|
* The assignees must act, such as merge a pull request that is ready. The
|
|
3648
3691
|
* item then waits on them: its Conversation shows in their Needs you, and
|
|
@@ -3651,12 +3694,29 @@ export interface PluginReviewNotice {
|
|
|
3651
3694
|
*/
|
|
3652
3695
|
waitsOnAssignees?: boolean;
|
|
3653
3696
|
}
|
|
3697
|
+
/**
|
|
3698
|
+
* One item of a subject as the Inbox records it. A closed item keeps how
|
|
3699
|
+
* and when it closed, so a subject's items say what people did on it.
|
|
3700
|
+
*/
|
|
3701
|
+
export interface PluginInboxItemRecord {
|
|
3702
|
+
/** The id of the kind action that a person ran to close it. */
|
|
3703
|
+
action?: string;
|
|
3704
|
+
/** Unset while the item is open. */
|
|
3705
|
+
closedAtMs?: number;
|
|
3706
|
+
id: string;
|
|
3707
|
+
status: "open" | "done" | "dismissed";
|
|
3708
|
+
}
|
|
3654
3709
|
/**
|
|
3655
3710
|
* Inbox items that a plugin adds and closes from its own events. Each item
|
|
3656
3711
|
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
3657
3712
|
* the Slack cards.
|
|
3658
3713
|
*/
|
|
3659
3714
|
export interface PluginInboxItems {
|
|
3715
|
+
/**
|
|
3716
|
+
* The items of the subject, newest first: the open one, if any, then the
|
|
3717
|
+
* closed ones.
|
|
3718
|
+
*/
|
|
3719
|
+
history(subject: PluginInboxItemSubject): Promise<PluginInboxItemRecord[]>;
|
|
3660
3720
|
/** Add an open item, or change the open one of the subject. */
|
|
3661
3721
|
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
3662
3722
|
/**
|
|
@@ -3702,10 +3762,10 @@ export interface InboxItemDismissedHookContext extends PluginContext {
|
|
|
3702
3762
|
/** The subject of the item, with the plugin's own kind. */
|
|
3703
3763
|
subject: PluginInboxItemSubject;
|
|
3704
3764
|
}
|
|
3705
|
-
/** A person
|
|
3706
|
-
export interface
|
|
3707
|
-
/** The
|
|
3708
|
-
|
|
3765
|
+
/** A person ran an action of the kind of an item that this plugin added. */
|
|
3766
|
+
export interface InboxItemActionHookContext extends PluginContext {
|
|
3767
|
+
/** The `id` of the kind action. */
|
|
3768
|
+
action: string;
|
|
3709
3769
|
/** Junior's native code index, as from a plugin route. */
|
|
3710
3770
|
codeChanges: PluginCodeChanges;
|
|
3711
3771
|
/** The Conversation that the item belongs to. */
|
|
@@ -3714,7 +3774,7 @@ export interface InboxItemAnsweredHookContext extends PluginContext {
|
|
|
3714
3774
|
subject: PluginInboxItemSubject;
|
|
3715
3775
|
/** Publish events, as from a plugin route. */
|
|
3716
3776
|
events: EventPublisher;
|
|
3717
|
-
/** The closed item's id. It is the same on a retry of the same
|
|
3777
|
+
/** The closed item's id. It is the same on a retry of the same action. */
|
|
3718
3778
|
itemId: string;
|
|
3719
3779
|
nowMs: number;
|
|
3720
3780
|
/** Inbox items, as from a plugin route. */
|
|
@@ -3892,6 +3952,12 @@ export interface PluginConversationEventStats {
|
|
|
3892
3952
|
hours?: number;
|
|
3893
3953
|
}): Promise<PluginConversationEventCostDay[]>;
|
|
3894
3954
|
}
|
|
3955
|
+
/**
|
|
3956
|
+
* Wait for `work` until `signal` aborts, then reject with its reason. The
|
|
3957
|
+
* work goes on, so use it for work that takes no signal, or that must not
|
|
3958
|
+
* be cut off midway, such as a shared OAuth refresh.
|
|
3959
|
+
*/
|
|
3960
|
+
export declare function untilAborted<T>(work: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
3895
3961
|
/** One provider GET that a plugin sends with a credential it holds. */
|
|
3896
3962
|
export interface PluginHttpCacheRequest {
|
|
3897
3963
|
/**
|
|
@@ -4939,11 +5005,11 @@ export interface PluginHooks {
|
|
|
4939
5005
|
*/
|
|
4940
5006
|
grantForEgress?(ctx: EgressHookContext): Promise<PluginGrant | undefined> | PluginGrant | undefined;
|
|
4941
5007
|
/**
|
|
4942
|
-
* Do the work
|
|
4943
|
-
* plugin added. Junior calls it again
|
|
4944
|
-
* failure, so it must be safe to repeat.
|
|
5008
|
+
* Do the work of a kind action that a person ran on an item that this
|
|
5009
|
+
* plugin added (`PluginInboxSubjectKind.actions`). Junior calls it again
|
|
5010
|
+
* when the person retries after a failure, so it must be safe to repeat.
|
|
4945
5011
|
*/
|
|
4946
|
-
|
|
5012
|
+
inboxItemAction?(ctx: InboxItemActionHookContext): Promise<void> | void;
|
|
4947
5013
|
/**
|
|
4948
5014
|
* Remove the person who dismissed an item of an `assigneeRoles` subject
|
|
4949
5015
|
* kind from the object on the provider. Throw when the provider refuses:
|
|
@@ -5150,11 +5216,21 @@ export interface PluginMcpOAuthClientConfig {
|
|
|
5150
5216
|
/** Space-delimited scope requested instead of the scopes the MCP server advertises. */
|
|
5151
5217
|
scope?: string;
|
|
5152
5218
|
}
|
|
5219
|
+
/** Guardian settings for one MCP server. */
|
|
5220
|
+
export interface PluginMcpGuardianConfig {
|
|
5221
|
+
/**
|
|
5222
|
+
* Exact remote tool names whose calls skip review because they have no
|
|
5223
|
+
* effect. Every other tool is reviewed, also one the server renames.
|
|
5224
|
+
*/
|
|
5225
|
+
skipReview?: string[];
|
|
5226
|
+
}
|
|
5153
5227
|
export interface PluginMcpConfig {
|
|
5154
5228
|
/** Provider tools exposed directly to the model. */
|
|
5155
5229
|
allowedTools?: string[];
|
|
5156
5230
|
/** Bot auth: sign short-lived JWT assertions instead of per-actor OAuth. */
|
|
5157
5231
|
auth?: PluginMcpAuthConfig;
|
|
5232
|
+
/** How Guardian treats this server's tools. */
|
|
5233
|
+
guardian?: PluginMcpGuardianConfig;
|
|
5158
5234
|
/** Request headers. Values may use `${NAME}` refs to declared env vars; Junior resolves them at connect time. */
|
|
5159
5235
|
headers?: Record<string, string>;
|
|
5160
5236
|
/** Per-actor OAuth with a pre-registered client instead of dynamic client registration. */
|
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 };
|