@sentry/junior-plugin-api 0.311.0 → 0.313.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 -22
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1532,6 +1532,13 @@ export interface PluginTokenStore {
|
|
|
1532
1532
|
credentialSubject?: PluginUserTokenSlot;
|
|
1533
1533
|
currentUser?: PluginUserTokenSlot;
|
|
1534
1534
|
}
|
|
1535
|
+
/** Input for a search of one provider's accounts by person. */
|
|
1536
|
+
export interface SearchUsersHookContext extends PluginContext {
|
|
1537
|
+
/** Fetch provider URLs with host-owned credentials. */
|
|
1538
|
+
egress: PluginEgress;
|
|
1539
|
+
/** The text to match: an ID, handle, email, mention, or name. */
|
|
1540
|
+
query: string;
|
|
1541
|
+
}
|
|
1535
1542
|
export interface ResolveOAuthAccountHookContext extends PluginContext {
|
|
1536
1543
|
tokens: PluginStoredTokens;
|
|
1537
1544
|
/**
|
|
@@ -2375,6 +2382,24 @@ export interface PluginEgress {
|
|
|
2375
2382
|
request: Request;
|
|
2376
2383
|
}): Promise<Response>;
|
|
2377
2384
|
}
|
|
2385
|
+
/** Public artifacts that a plugin tool publishes for the conversation. */
|
|
2386
|
+
export interface PluginArtifacts {
|
|
2387
|
+
/**
|
|
2388
|
+
* Publish image bytes at a public HTTPS URL that anyone with the URL can
|
|
2389
|
+
* open. With `expiresInMs`, the URL stops serving after that long. PNG,
|
|
2390
|
+
* JPEG, GIF, or WebP up to 10 MB; other input throws a tool input error.
|
|
2391
|
+
*/
|
|
2392
|
+
publishImage(input: {
|
|
2393
|
+
body: Uint8Array;
|
|
2394
|
+
expiresInMs?: number;
|
|
2395
|
+
}): Promise<{
|
|
2396
|
+
url: string;
|
|
2397
|
+
/** ISO time when the URL stops serving. Absent when it does not expire. */
|
|
2398
|
+
expiresAt?: string;
|
|
2399
|
+
}>;
|
|
2400
|
+
/** Stop serving an image that this conversation published, by its URL. */
|
|
2401
|
+
unpublishImage(url: string): Promise<void>;
|
|
2402
|
+
}
|
|
2378
2403
|
export declare const pluginToolContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2379
2404
|
type: z.ZodLiteral<"text">;
|
|
2380
2405
|
text: z.ZodString;
|
|
@@ -3019,6 +3044,16 @@ export type PluginWorkOwner = {
|
|
|
3019
3044
|
/** Host-owned dashboard link to the record. */
|
|
3020
3045
|
url?: string;
|
|
3021
3046
|
};
|
|
3047
|
+
/**
|
|
3048
|
+
* Result of `users.findLinkedHandle`. `unlinked` means one person matched
|
|
3049
|
+
* but has no linked account at the provider.
|
|
3050
|
+
*/
|
|
3051
|
+
export type PluginLinkedHandleLookup = {
|
|
3052
|
+
status: "found";
|
|
3053
|
+
handle: string;
|
|
3054
|
+
} | {
|
|
3055
|
+
status: "ambiguous" | "not_found" | "unlinked";
|
|
3056
|
+
};
|
|
3022
3057
|
interface BaseToolRegistrationHookContext extends PluginContext {
|
|
3023
3058
|
/**
|
|
3024
3059
|
* Opaque Junior conversation/session identity for this turn.
|
|
@@ -3040,6 +3075,8 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
3040
3075
|
conversationLink?: {
|
|
3041
3076
|
url: string;
|
|
3042
3077
|
};
|
|
3078
|
+
/** Absent when the install has no artifact storage or public base URL. */
|
|
3079
|
+
artifacts?: PluginArtifacts;
|
|
3043
3080
|
/** Decision model for narrow choices, such as checks on text a tool writes. */
|
|
3044
3081
|
decider: PluginDecider;
|
|
3045
3082
|
embedder: PluginEmbedder;
|
|
@@ -3068,6 +3105,13 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
3068
3105
|
* written. Call it before you send model text out.
|
|
3069
3106
|
*/
|
|
3070
3107
|
replaceSlackMentions<T>(value: T, provider: string): Promise<T>;
|
|
3108
|
+
/**
|
|
3109
|
+
* Find the one person that `query` names, such as an email, a Slack
|
|
3110
|
+
* mention, or a name, and return the handle of their linked `provider`
|
|
3111
|
+
* account. Only accounts that people linked count, so the handle is
|
|
3112
|
+
* verified.
|
|
3113
|
+
*/
|
|
3114
|
+
findLinkedHandle(query: string, provider: string): Promise<PluginLinkedHandleLookup>;
|
|
3071
3115
|
};
|
|
3072
3116
|
userText?: string;
|
|
3073
3117
|
workspaces: PluginWorkspaceToolContext;
|
|
@@ -3488,7 +3532,7 @@ type UserPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
|
|
|
3488
3532
|
* The request of this Turn: what a person wrote, the task or message of a
|
|
3489
3533
|
* parent agent, or the instructions of an Automation. Runtime text, such as
|
|
3490
3534
|
* tags, generic instructions, Events, child agent results, and the question
|
|
3491
|
-
* of
|
|
3535
|
+
* of an Inbox item, is not in it. Empty when the Turn has no request.
|
|
3492
3536
|
*/
|
|
3493
3537
|
text: string;
|
|
3494
3538
|
users: {
|
|
@@ -3977,6 +4021,29 @@ export interface PluginTaskDefinition {
|
|
|
3977
4021
|
}
|
|
3978
4022
|
/** Task handlers keyed by the plugin-owned task name. */
|
|
3979
4023
|
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
4024
|
+
/**
|
|
4025
|
+
* A code change title split by Conventional Commits, such as
|
|
4026
|
+
* `feat(api)!: Add retries`. The plugin that owns the code change parses it,
|
|
4027
|
+
* so the Inbox can lead with the words and show the rest as pills.
|
|
4028
|
+
*/
|
|
4029
|
+
export interface InboxItemSubjectTitleParts {
|
|
4030
|
+
/** The title without its type prefix, such as `Add retries`. */
|
|
4031
|
+
text: string;
|
|
4032
|
+
/** The change type as one word, such as `Feature`. Unset when unknown. */
|
|
4033
|
+
type?: string;
|
|
4034
|
+
/** The scope, such as `api`. */
|
|
4035
|
+
scope?: string;
|
|
4036
|
+
/** The title marks a breaking change, such as with `!`. */
|
|
4037
|
+
breaking?: boolean;
|
|
4038
|
+
}
|
|
4039
|
+
/** What a plugin item is about, such as a pull request. */
|
|
4040
|
+
export interface InboxItemSubjectInput {
|
|
4041
|
+
id: string;
|
|
4042
|
+
title?: string;
|
|
4043
|
+
url?: string;
|
|
4044
|
+
/** Set only for a code change whose title follows Conventional Commits. */
|
|
4045
|
+
titleParts?: InboxItemSubjectTitleParts;
|
|
4046
|
+
}
|
|
3980
4047
|
/**
|
|
3981
4048
|
* An item that a plugin puts in the Inbox: a notice for information,
|
|
3982
4049
|
* or an ask that waits on its assignees.
|
|
@@ -3995,11 +4062,7 @@ export interface PluginReviewNotice {
|
|
|
3995
4062
|
*/
|
|
3996
4063
|
dedupeKey: string;
|
|
3997
4064
|
/** What the notice is about, such as a pull request. Search matches `id`. */
|
|
3998
|
-
subject?:
|
|
3999
|
-
id: string;
|
|
4000
|
-
title?: string;
|
|
4001
|
-
url?: string;
|
|
4002
|
-
};
|
|
4065
|
+
subject?: InboxItemSubjectInput;
|
|
4003
4066
|
/**
|
|
4004
4067
|
* For an item that waits on its assignees, name their step, such as
|
|
4005
4068
|
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
@@ -4008,7 +4071,7 @@ export interface PluginReviewNotice {
|
|
|
4008
4071
|
/**
|
|
4009
4072
|
* Buttons that answer the item, in display order, such as `Resume`. An
|
|
4010
4073
|
* item with choices waits on its assignees. The first click closes it as
|
|
4011
|
-
* done and calls the plugin's `
|
|
4074
|
+
* done and calls the plugin's `inboxItemAnswered` hook with the choice.
|
|
4012
4075
|
* The answer starts no Turn: the plugin does the work.
|
|
4013
4076
|
*/
|
|
4014
4077
|
choices?: Array<{
|
|
@@ -4024,26 +4087,29 @@ export interface PluginReviewNotice {
|
|
|
4024
4087
|
waitsOnAssignees?: boolean;
|
|
4025
4088
|
}
|
|
4026
4089
|
/**
|
|
4027
|
-
*
|
|
4090
|
+
* Inbox items that a plugin adds and closes from its own events. Each item
|
|
4028
4091
|
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
4029
4092
|
* the Slack cards.
|
|
4030
4093
|
*/
|
|
4031
|
-
export interface
|
|
4094
|
+
export interface PluginInboxItems {
|
|
4032
4095
|
/** Add an open item, or replace the content of the open one with the key. */
|
|
4033
4096
|
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
4034
|
-
/**
|
|
4097
|
+
/**
|
|
4098
|
+
* Close the open item with the key. Do nothing when no item is open, such
|
|
4099
|
+
* as after a person dismissed it. Return whether an open item closed.
|
|
4100
|
+
*/
|
|
4035
4101
|
close(input: {
|
|
4036
4102
|
dedupeKey: string;
|
|
4037
4103
|
reason: string;
|
|
4038
4104
|
status: "done" | "dismissed";
|
|
4039
|
-
}): Promise<
|
|
4105
|
+
}): Promise<boolean>;
|
|
4040
4106
|
}
|
|
4041
|
-
/**
|
|
4042
|
-
export interface
|
|
4043
|
-
forConversation(conversationId: string):
|
|
4107
|
+
/** Inbox items of a plugin, for the Conversation that each item belongs to. */
|
|
4108
|
+
export interface PluginConversationInboxItems {
|
|
4109
|
+
forConversation(conversationId: string): PluginInboxItems;
|
|
4044
4110
|
}
|
|
4045
4111
|
/** A person picked one of the `choices` of an item that this plugin added. */
|
|
4046
|
-
export interface
|
|
4112
|
+
export interface InboxItemAnsweredHookContext extends PluginContext {
|
|
4047
4113
|
/** The label of the picked choice. */
|
|
4048
4114
|
choice: string;
|
|
4049
4115
|
/** The Conversation that the item belongs to. */
|
|
@@ -4055,8 +4121,8 @@ export interface ReviewItemAnsweredHookContext extends PluginContext {
|
|
|
4055
4121
|
/** The closed item's id. It is the same on a retry of the same answer. */
|
|
4056
4122
|
itemId: string;
|
|
4057
4123
|
nowMs: number;
|
|
4058
|
-
/**
|
|
4059
|
-
|
|
4124
|
+
/** Inbox items, as from a plugin route. */
|
|
4125
|
+
inboxItems: PluginConversationInboxItems;
|
|
4060
4126
|
state: PluginState;
|
|
4061
4127
|
/** Watches of the item's Conversation. */
|
|
4062
4128
|
watches: PluginConversationWatches;
|
|
@@ -4092,8 +4158,8 @@ export interface HeartbeatHookContext extends PluginContext {
|
|
|
4092
4158
|
/** Publish events, as from a plugin route. */
|
|
4093
4159
|
events: EventPublisher;
|
|
4094
4160
|
nowMs: number;
|
|
4095
|
-
/**
|
|
4096
|
-
|
|
4161
|
+
/** Inbox items, as from a plugin route. */
|
|
4162
|
+
inboxItems: PluginConversationInboxItems;
|
|
4097
4163
|
state: PluginState;
|
|
4098
4164
|
}
|
|
4099
4165
|
export interface HeartbeatResult {
|
|
@@ -4223,8 +4289,8 @@ export interface RouteRegistrationHookContext extends PluginContext {
|
|
|
4223
4289
|
codeChanges: CodeChangePublisher;
|
|
4224
4290
|
/** Core-owned delivery boundary for provider webhook events. */
|
|
4225
4291
|
events: EventPublisher;
|
|
4226
|
-
/**
|
|
4227
|
-
|
|
4292
|
+
/** Inbox items that the plugin adds and closes from its events. */
|
|
4293
|
+
inboxItems: PluginConversationInboxItems;
|
|
4228
4294
|
/** Plugin-namespaced state, the same as in heartbeats. */
|
|
4229
4295
|
state: PluginState;
|
|
4230
4296
|
users: {
|
|
@@ -4385,7 +4451,7 @@ export interface PluginHooks {
|
|
|
4385
4451
|
* plugin added. Junior calls it again when the person retries after a
|
|
4386
4452
|
* failure, so it must be safe to repeat.
|
|
4387
4453
|
*/
|
|
4388
|
-
|
|
4454
|
+
inboxItemAnswered?(ctx: InboxItemAnsweredHookContext): Promise<void> | void;
|
|
4389
4455
|
heartbeat?(ctx: HeartbeatHookContext): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
4390
4456
|
unfinishedWork?(ctx: UnfinishedWorkHookContext): Promise<UnfinishedWorkResult> | UnfinishedWorkResult;
|
|
4391
4457
|
issueCredential?(ctx: IssueCredentialHookContext): Promise<PluginCredentialResult> | PluginCredentialResult;
|
|
@@ -4399,6 +4465,12 @@ export interface PluginHooks {
|
|
|
4399
4465
|
/** Return plugin-owned product API routes mounted under Junior's authenticated plugin namespace. */
|
|
4400
4466
|
apiRoutes?(ctx: ApiRouteRegistrationHookContext): PluginRouteApp | undefined;
|
|
4401
4467
|
resolveOAuthAccount?(ctx: ResolveOAuthAccountHookContext): Promise<PluginProviderAccount | undefined> | PluginProviderAccount | undefined;
|
|
4468
|
+
/**
|
|
4469
|
+
* Return the provider accounts that match a person search. Return only
|
|
4470
|
+
* close matches, such as an exact login, so the agent can choose between
|
|
4471
|
+
* them. `userLookup` links each account to a known person.
|
|
4472
|
+
*/
|
|
4473
|
+
searchUsers?(ctx: SearchUsersHookContext): Promise<PluginProviderAccount[]> | PluginProviderAccount[];
|
|
4402
4474
|
routes?(ctx: RouteRegistrationHookContext): PluginRoute[];
|
|
4403
4475
|
sandboxPrepare?(ctx: SandboxPrepareHookContext): Promise<void> | void;
|
|
4404
4476
|
workspacePrepare?(ctx: WorkspacePrepareHookContext): Promise<WorkspaceFinalize | void> | WorkspaceFinalize | void;
|
package/dist/index.js
CHANGED
|
@@ -1883,7 +1883,7 @@ const pluginEventsSchema = z.object({
|
|
|
1883
1883
|
}).optional(),
|
|
1884
1884
|
/**
|
|
1885
1885
|
* The resource that one web page shows, the inverse of `resourceUrl`, so
|
|
1886
|
-
* a link such as
|
|
1886
|
+
* a link such as an Inbox item's subject can name an Event resource.
|
|
1887
1887
|
* Returns undefined when no resource type of the source has the page.
|
|
1888
1888
|
*/
|
|
1889
1889
|
resourceForUrl: z.function({
|