@sentry/junior-plugin-api 0.295.0 → 0.297.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 +408 -338
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { ZodTypeAny } from "zod";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
+
/** Small, provider-neutral facts. Missing values mean unknown, not success. */
|
|
5
|
+
export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"code_change">;
|
|
7
|
+
author: z.ZodOptional<z.ZodString>;
|
|
8
|
+
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
9
|
+
targetBranch: z.ZodOptional<z.ZodString>;
|
|
10
|
+
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
review: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
approved: "approved";
|
|
13
|
+
changes_requested: "changes_requested";
|
|
14
|
+
required: "required";
|
|
15
|
+
}>>;
|
|
16
|
+
checks: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
passed: z.ZodNumber;
|
|
18
|
+
failed: z.ZodNumber;
|
|
19
|
+
pending: z.ZodNumber;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
additions: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
deletions: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"task">;
|
|
27
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
29
|
+
project: z.ZodOptional<z.ZodString>;
|
|
30
|
+
cycle: z.ZodOptional<z.ZodString>;
|
|
31
|
+
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
32
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"deployment">;
|
|
35
|
+
project: z.ZodOptional<z.ZodString>;
|
|
36
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
37
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
38
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"calendar_event">;
|
|
41
|
+
when: z.ZodOptional<z.ZodString>;
|
|
42
|
+
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
}, z.core.$strict>], "type">;
|
|
44
|
+
export type ObjectFacts = z.output<typeof objectFactsSchema>;
|
|
45
|
+
type ObjectField = {
|
|
46
|
+
key: string;
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
50
|
+
/** Show at most four card attributes, in priority order, on every surface. */
|
|
51
|
+
export declare function objectFactFields(facts: ObjectFacts | undefined): ObjectField[];
|
|
52
|
+
/** Native object types. `task` is the stored name for a Ticket. */
|
|
53
|
+
export declare const objectTypeSchema: z.ZodEnum<{
|
|
54
|
+
automation: "automation";
|
|
55
|
+
calendar_event: "calendar_event";
|
|
56
|
+
code_change: "code_change";
|
|
57
|
+
deployment: "deployment";
|
|
58
|
+
item: "item";
|
|
59
|
+
task: "task";
|
|
60
|
+
}>;
|
|
61
|
+
export type ObjectType = z.output<typeof objectTypeSchema>;
|
|
62
|
+
declare const objectIconNames: readonly ["issue-opened", "issue-closed", "git-pull-request", "git-pull-request-draft", "git-pull-request-closed", "git-merge", "workflow", "rocket", "calendar", "package"];
|
|
63
|
+
export type ObjectIconName = (typeof objectIconNames)[number];
|
|
64
|
+
export type ObjectTone = "neutral" | "success" | "danger" | "warning" | "info" | "accent";
|
|
65
|
+
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
66
|
+
export declare function objectPresentation(object: {
|
|
67
|
+
objectType: ObjectType;
|
|
68
|
+
status?: string;
|
|
69
|
+
facts?: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
}): {
|
|
73
|
+
icon: ObjectIconName;
|
|
74
|
+
tone: ObjectTone;
|
|
75
|
+
label: string;
|
|
76
|
+
};
|
|
77
|
+
/** Public, versioned asset path shared by Slack delivery and the web host. */
|
|
78
|
+
export declare function objectIconPath(icon: ObjectIconName): string;
|
|
79
|
+
/** Return whether facts fit an object type. Deployment facts also fit an item. */
|
|
80
|
+
export declare function objectFactsMatchType(facts: ObjectFacts, objectType: ObjectType): boolean;
|
|
4
81
|
/**
|
|
5
82
|
* Verified facts shared by Conversation annotations and Message cards.
|
|
6
83
|
* Plugins select small facts from responses they already have. Each surface owns
|
|
@@ -137,33 +214,6 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
137
214
|
plugin: z.ZodString;
|
|
138
215
|
}, z.core.$strict>;
|
|
139
216
|
export type OwnedObjectAnnotation = z.output<typeof ownedObjectAnnotationSchema>;
|
|
140
|
-
/** Native object types. `task` is the stored name for a Ticket. */
|
|
141
|
-
export declare const objectTypeSchema: z.ZodEnum<{
|
|
142
|
-
automation: "automation";
|
|
143
|
-
calendar_event: "calendar_event";
|
|
144
|
-
code_change: "code_change";
|
|
145
|
-
deployment: "deployment";
|
|
146
|
-
item: "item";
|
|
147
|
-
task: "task";
|
|
148
|
-
}>;
|
|
149
|
-
export type ObjectType = z.output<typeof objectTypeSchema>;
|
|
150
|
-
declare const objectIconNames: readonly ["issue-opened", "issue-closed", "git-pull-request", "git-pull-request-draft", "git-pull-request-closed", "git-merge", "workflow", "rocket", "calendar", "package"];
|
|
151
|
-
export type ObjectIconName = (typeof objectIconNames)[number];
|
|
152
|
-
export type ObjectTone = "neutral" | "success" | "danger" | "warning" | "info" | "accent";
|
|
153
|
-
/** Resolve identity and state without replacing the type icon with a warning. */
|
|
154
|
-
export declare function objectPresentation(object: {
|
|
155
|
-
objectType: ObjectType;
|
|
156
|
-
status?: string;
|
|
157
|
-
facts?: {
|
|
158
|
-
type: string;
|
|
159
|
-
};
|
|
160
|
-
}): {
|
|
161
|
-
icon: ObjectIconName;
|
|
162
|
-
tone: ObjectTone;
|
|
163
|
-
label: string;
|
|
164
|
-
};
|
|
165
|
-
/** Public, versioned asset path shared by Slack delivery and the web host. */
|
|
166
|
-
export declare function objectIconPath(icon: ObjectIconName): string;
|
|
167
217
|
/** Original Octicons paths, shared by web and Slack image assets. */
|
|
168
218
|
export declare const objectIconPaths: {
|
|
169
219
|
"issue-opened": string[];
|
|
@@ -177,54 +227,6 @@ export declare const objectIconPaths: {
|
|
|
177
227
|
calendar: string[];
|
|
178
228
|
package: string[];
|
|
179
229
|
};
|
|
180
|
-
/** Small, provider-neutral facts. Missing values mean unknown, not success. */
|
|
181
|
-
export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
182
|
-
type: z.ZodLiteral<"code_change">;
|
|
183
|
-
author: z.ZodOptional<z.ZodString>;
|
|
184
|
-
sourceBranch: z.ZodOptional<z.ZodString>;
|
|
185
|
-
targetBranch: z.ZodOptional<z.ZodString>;
|
|
186
|
-
reviewers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
-
review: z.ZodOptional<z.ZodEnum<{
|
|
188
|
-
approved: "approved";
|
|
189
|
-
changes_requested: "changes_requested";
|
|
190
|
-
required: "required";
|
|
191
|
-
}>>;
|
|
192
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
193
|
-
passed: z.ZodNumber;
|
|
194
|
-
failed: z.ZodNumber;
|
|
195
|
-
pending: z.ZodNumber;
|
|
196
|
-
}, z.core.$strict>>;
|
|
197
|
-
mergeable: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
-
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
199
|
-
additions: z.ZodOptional<z.ZodNumber>;
|
|
200
|
-
deletions: z.ZodOptional<z.ZodNumber>;
|
|
201
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
202
|
-
type: z.ZodLiteral<"task">;
|
|
203
|
-
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
204
|
-
priority: z.ZodOptional<z.ZodString>;
|
|
205
|
-
project: z.ZodOptional<z.ZodString>;
|
|
206
|
-
cycle: z.ZodOptional<z.ZodString>;
|
|
207
|
-
dueDate: z.ZodOptional<z.ZodISODate>;
|
|
208
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
210
|
-
type: z.ZodLiteral<"deployment">;
|
|
211
|
-
project: z.ZodOptional<z.ZodString>;
|
|
212
|
-
environment: z.ZodOptional<z.ZodString>;
|
|
213
|
-
revision: z.ZodOptional<z.ZodString>;
|
|
214
|
-
branch: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
216
|
-
type: z.ZodLiteral<"calendar_event">;
|
|
217
|
-
when: z.ZodOptional<z.ZodString>;
|
|
218
|
-
attendees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
-
}, z.core.$strict>], "type">;
|
|
220
|
-
export type ObjectFacts = z.output<typeof objectFactsSchema>;
|
|
221
|
-
type ObjectField = {
|
|
222
|
-
key: string;
|
|
223
|
-
label: string;
|
|
224
|
-
value: string;
|
|
225
|
-
};
|
|
226
|
-
/** Show at most four card attributes, in priority order, on every surface. */
|
|
227
|
-
export declare function objectFactFields(facts: ObjectFacts | undefined): ObjectField[];
|
|
228
230
|
/** Exact non-blank actor user id that rejects the sentinel "unknown". */
|
|
229
231
|
export declare const actorUserIdSchema: z.ZodString;
|
|
230
232
|
export declare const nonBlankStringSchema: z.ZodString;
|
|
@@ -922,6 +924,15 @@ export interface CodeChangePublisher {
|
|
|
922
924
|
providerId: string;
|
|
923
925
|
}): Promise<void>;
|
|
924
926
|
record(input: CodeChangeInput): Promise<void>;
|
|
927
|
+
/**
|
|
928
|
+
* Record a push, review, or comment by a person on a code change. Junior
|
|
929
|
+
* ignores activity on code changes that it did not record.
|
|
930
|
+
*/
|
|
931
|
+
recordActivity(input: {
|
|
932
|
+
at: Date;
|
|
933
|
+
number: number;
|
|
934
|
+
repositoryProviderId: string;
|
|
935
|
+
}): Promise<void>;
|
|
925
936
|
}
|
|
926
937
|
export declare const conversationEventIconSchema: z.ZodEnum<{
|
|
927
938
|
activity: "activity";
|
|
@@ -1927,6 +1938,57 @@ export type PluginGitPush = {
|
|
|
1927
1938
|
kind: "unreadable";
|
|
1928
1939
|
reason: PluginGitPushUnreadableReason;
|
|
1929
1940
|
};
|
|
1941
|
+
/** One field that a GraphQL operation selects. */
|
|
1942
|
+
export interface PluginGraphqlField {
|
|
1943
|
+
/** Names of the arguments that the field passes. */
|
|
1944
|
+
arguments: string[];
|
|
1945
|
+
/** Schema field name. An alias does not replace it. */
|
|
1946
|
+
name: string;
|
|
1947
|
+
}
|
|
1948
|
+
/** The GraphQL operation that one request runs. */
|
|
1949
|
+
export interface PluginGraphqlOperation {
|
|
1950
|
+
/**
|
|
1951
|
+
* Each distinct field that the operation selects at any depth, also through
|
|
1952
|
+
* fragments.
|
|
1953
|
+
*/
|
|
1954
|
+
fields: PluginGraphqlField[];
|
|
1955
|
+
name?: string;
|
|
1956
|
+
/**
|
|
1957
|
+
* Field names at the operation root, also through fragments. There is one
|
|
1958
|
+
* entry for each field selection, so an aliased repeat shows twice.
|
|
1959
|
+
*/
|
|
1960
|
+
rootFields: string[];
|
|
1961
|
+
type: "mutation" | "query" | "subscription";
|
|
1962
|
+
}
|
|
1963
|
+
/**
|
|
1964
|
+
* Why the host could not read the operation of a GraphQL request:
|
|
1965
|
+
*
|
|
1966
|
+
* - `document`: the query does not parse, or it spreads a fragment that it
|
|
1967
|
+
* does not define.
|
|
1968
|
+
* - `gzip`: the body is compressed.
|
|
1969
|
+
* - `json`: the body is not a JSON object or a JSON array of objects.
|
|
1970
|
+
* - `operation`: `operationName` names no operation, or the document has more
|
|
1971
|
+
* than one operation and no `operationName`.
|
|
1972
|
+
* - `query`: the body has no `query` string, such as a persisted query hash.
|
|
1973
|
+
* - `too-large`: the body is larger than the host reads before it issues
|
|
1974
|
+
* credentials.
|
|
1975
|
+
*/
|
|
1976
|
+
export type PluginGraphqlUnreadableReason = "document" | "gzip" | "json" | "operation" | "query" | "too-large";
|
|
1977
|
+
/**
|
|
1978
|
+
* The operations of a GraphQL POST, which the host reads from the JSON body.
|
|
1979
|
+
* A `batch` is a JSON array of requests. An `unreadable` request can run any
|
|
1980
|
+
* operation, mutations included.
|
|
1981
|
+
*/
|
|
1982
|
+
export type PluginGraphqlRequest = {
|
|
1983
|
+
kind: "batch";
|
|
1984
|
+
operations: PluginGraphqlOperation[];
|
|
1985
|
+
} | {
|
|
1986
|
+
kind: "operation";
|
|
1987
|
+
operation: PluginGraphqlOperation;
|
|
1988
|
+
} | {
|
|
1989
|
+
kind: "unreadable";
|
|
1990
|
+
reason: PluginGraphqlUnreadableReason;
|
|
1991
|
+
};
|
|
1930
1992
|
/** Request details available while selecting the grant for sandbox egress. */
|
|
1931
1993
|
export interface PluginEgressRequest {
|
|
1932
1994
|
/**
|
|
@@ -1936,6 +1998,8 @@ export interface PluginEgressRequest {
|
|
|
1936
1998
|
bodyText?: string;
|
|
1937
1999
|
/** Set for every Git `git-receive-pack` POST. */
|
|
1938
2000
|
gitPush?: PluginGitPush;
|
|
2001
|
+
/** Set for every POST to a URL path that ends in `/graphql`. */
|
|
2002
|
+
graphql?: PluginGraphqlRequest;
|
|
1939
2003
|
method: string;
|
|
1940
2004
|
/** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
|
|
1941
2005
|
operation?: string;
|
|
@@ -1953,7 +2017,7 @@ export interface PluginEgressResponse {
|
|
|
1953
2017
|
export interface EgressResponseHookContext extends PluginContext {
|
|
1954
2018
|
grant: PluginGrant;
|
|
1955
2019
|
permissionDenied(message: string): void;
|
|
1956
|
-
request: Omit<PluginEgressRequest, "bodyText" | "gitPush">;
|
|
2020
|
+
request: Omit<PluginEgressRequest, "bodyText" | "gitPush" | "graphql">;
|
|
1957
2021
|
response: PluginEgressResponse;
|
|
1958
2022
|
}
|
|
1959
2023
|
/** Header mutations a plugin-issued credential lease may apply to owned domains. */
|
|
@@ -1998,277 +2062,52 @@ export interface IssueCredentialHookContext extends PluginContext {
|
|
|
1998
2062
|
grant: PluginGrant;
|
|
1999
2063
|
tokens: PluginTokenStore;
|
|
2000
2064
|
}
|
|
2065
|
+
export interface PluginEnv {
|
|
2066
|
+
get(key: string): string | undefined;
|
|
2067
|
+
set(key: string, value: string): void;
|
|
2068
|
+
}
|
|
2001
2069
|
/**
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
2070
|
+
* Decide what happens to one tool call in `beforeToolExecute`.
|
|
2071
|
+
*
|
|
2072
|
+
* `redirect` and `deny` both stop the tool before it runs. Neither ends the
|
|
2073
|
+
* turn: the agent gets the message as the tool result.
|
|
2004
2074
|
*/
|
|
2005
|
-
export interface
|
|
2075
|
+
export interface PluginDecision {
|
|
2006
2076
|
/**
|
|
2007
|
-
*
|
|
2008
|
-
*
|
|
2077
|
+
* Block the call as a policy refusal. The agent is told not to retry or
|
|
2078
|
+
* reach the same result another way, and to explain the block.
|
|
2009
2079
|
*/
|
|
2010
|
-
|
|
2011
|
-
/** Markdown details for the person. */
|
|
2012
|
-
body: string;
|
|
2080
|
+
deny(reason: string): void;
|
|
2013
2081
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2082
|
+
* Block the call because a different path is correct, such as another
|
|
2083
|
+
* tool. The message tells the agent what to do instead.
|
|
2016
2084
|
*/
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2085
|
+
redirect(message: string): void;
|
|
2086
|
+
replaceInput(input: Record<string, unknown>): void;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* Decide what the agent reads after one tool call in `afterToolExecute`.
|
|
2090
|
+
*
|
|
2091
|
+
* The tool already ran, so neither choice undoes its effects.
|
|
2092
|
+
*/
|
|
2093
|
+
export interface PluginToolResultDecision {
|
|
2024
2094
|
/**
|
|
2025
|
-
*
|
|
2026
|
-
*
|
|
2095
|
+
* Reject the result as a policy refusal. The agent gets the reason instead
|
|
2096
|
+
* of the result, and is told not to retry. Undo the tool's effects first
|
|
2097
|
+
* when they must not stay.
|
|
2027
2098
|
*/
|
|
2028
|
-
|
|
2099
|
+
deny(reason: string): void;
|
|
2029
2100
|
/**
|
|
2030
|
-
*
|
|
2031
|
-
*
|
|
2032
|
-
* it counts in their Inbox. Leave it unset for a notice that is only for
|
|
2033
|
-
* information.
|
|
2101
|
+
* Add guidance after the result, such as a problem to fix in the change
|
|
2102
|
+
* that the tool made. The agent reads the result and the guidance.
|
|
2034
2103
|
*/
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
/**
|
|
2038
|
-
* Review items that a plugin adds and closes from its own events. Each item
|
|
2039
|
-
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
2040
|
-
* the Slack cards.
|
|
2041
|
-
*/
|
|
2042
|
-
export interface PluginReviewItems {
|
|
2043
|
-
/** Add an open item, or replace the content of the open one with the key. */
|
|
2044
|
-
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
2045
|
-
/** Close the open item with the key. Do nothing when no item is open. */
|
|
2046
|
-
close(input: {
|
|
2047
|
-
dedupeKey: string;
|
|
2048
|
-
reason: string;
|
|
2049
|
-
status: "done" | "dismissed";
|
|
2050
|
-
}): Promise<void>;
|
|
2104
|
+
nudge(message: string): void;
|
|
2051
2105
|
}
|
|
2052
|
-
/**
|
|
2053
|
-
export
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
agent: {
|
|
2058
|
-
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
2059
|
-
get(id: string): Promise<Dispatch | undefined>;
|
|
2060
|
-
};
|
|
2061
|
-
/** Host embedder bound to the configured embedding model. */
|
|
2062
|
-
embedder: PluginEmbedder;
|
|
2063
|
-
/** Publish events, as from a plugin route. */
|
|
2064
|
-
events: EventPublisher;
|
|
2065
|
-
nowMs: number;
|
|
2066
|
-
state: PluginState;
|
|
2067
|
-
}
|
|
2068
|
-
export interface HeartbeatResult {
|
|
2069
|
-
dispatchCount?: number;
|
|
2070
|
-
}
|
|
2071
|
-
export interface UnfinishedWorkHookContext extends PluginContext {
|
|
2072
|
-
/**
|
|
2073
|
-
* Bounded conversation candidates selected by the host, with the child
|
|
2074
|
-
* conversations of candidate roots. Work in a child counts for its root.
|
|
2075
|
-
*/
|
|
2076
|
-
conversationIds: string[];
|
|
2077
|
-
}
|
|
2078
|
-
export interface UnfinishedWorkResult {
|
|
2079
|
-
/** Candidate conversations that have plugin-owned work to finish. */
|
|
2080
|
-
conversationIds: string[];
|
|
2081
|
-
/**
|
|
2082
|
-
* Candidate conversations that have any associated plugin-owned work,
|
|
2083
|
-
* finished or unfinished. Omit when the plugin cannot distinguish assignment.
|
|
2084
|
-
*
|
|
2085
|
-
* The host uses this with unfinished work and finish times to set feed
|
|
2086
|
-
* `isPriority`. Finished assigned work stays out of Priority unless the
|
|
2087
|
-
* conversation has activity after the finish time.
|
|
2088
|
-
*/
|
|
2089
|
-
assignedConversationIds?: string[];
|
|
2090
|
-
/**
|
|
2091
|
-
* Latest time when all known work finished, keyed by conversation id.
|
|
2092
|
-
* ISO-8601 timestamps. Used with conversation activity to decide whether
|
|
2093
|
-
* finished work still belongs in Priority, and whether auto-archive may
|
|
2094
|
-
* archive the conversation for users who turned it on.
|
|
2095
|
-
*/
|
|
2096
|
-
finishedWorkAtByConversationId?: Record<string, string>;
|
|
2097
|
-
}
|
|
2098
|
-
export type PluginOperationalTone = "danger" | "good" | "neutral" | "warning";
|
|
2099
|
-
export interface PluginOperationalMetric {
|
|
2100
|
-
label: string;
|
|
2101
|
-
tone?: PluginOperationalTone;
|
|
2102
|
-
value: string;
|
|
2103
|
-
}
|
|
2104
|
-
export interface PluginOperationalField {
|
|
2105
|
-
key: string;
|
|
2106
|
-
label: string;
|
|
2107
|
-
}
|
|
2108
|
-
export interface PluginOperationalRecord {
|
|
2109
|
-
id: string;
|
|
2110
|
-
tone?: PluginOperationalTone;
|
|
2111
|
-
values: Record<string, string>;
|
|
2112
|
-
}
|
|
2113
|
-
export interface PluginOperationalRecordSet {
|
|
2114
|
-
fields?: PluginOperationalField[];
|
|
2115
|
-
emptyText?: string;
|
|
2116
|
-
records?: PluginOperationalRecord[];
|
|
2117
|
-
title: string;
|
|
2118
|
-
}
|
|
2119
|
-
export interface PluginOperationalChartSeries {
|
|
2120
|
-
format?: "usd";
|
|
2121
|
-
key: string;
|
|
2122
|
-
label: string;
|
|
2123
|
-
tone?: PluginOperationalTone;
|
|
2124
|
-
}
|
|
2125
|
-
export interface PluginOperationalChartCategory {
|
|
2126
|
-
id: string;
|
|
2127
|
-
label: string;
|
|
2128
|
-
values: Record<string, number>;
|
|
2129
|
-
}
|
|
2130
|
-
export interface PluginOperationalBarChartWidget {
|
|
2131
|
-
categories: PluginOperationalChartCategory[];
|
|
2132
|
-
description?: string;
|
|
2133
|
-
emptyText?: string;
|
|
2134
|
-
id: string;
|
|
2135
|
-
series: PluginOperationalChartSeries[];
|
|
2136
|
-
timeRangeDays?: Array<1 | 7 | 30 | 90>;
|
|
2137
|
-
title: string;
|
|
2138
|
-
type: "bar_chart";
|
|
2139
|
-
}
|
|
2140
|
-
export interface PluginOperationalReportContent {
|
|
2141
|
-
generatedAt?: string;
|
|
2142
|
-
metrics?: PluginOperationalMetric[];
|
|
2143
|
-
recordSets?: PluginOperationalRecordSet[];
|
|
2144
|
-
title?: string;
|
|
2145
|
-
widgets?: PluginOperationalBarChartWidget[];
|
|
2146
|
-
}
|
|
2147
|
-
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
2148
|
-
pluginName: string;
|
|
2149
|
-
}
|
|
2150
|
-
export interface OperationalReportHookContext extends PluginContext {
|
|
2151
|
-
eventStats: PluginConversationEventStats;
|
|
2152
|
-
nowMs: number;
|
|
2153
|
-
state: PluginReadState;
|
|
2154
|
-
}
|
|
2155
|
-
/** Read-only context for one person-scoped plugin report on a profile page. */
|
|
2156
|
-
export interface ProfileReportHookContext extends PluginContext {
|
|
2157
|
-
nowMs: number;
|
|
2158
|
-
state: PluginReadState;
|
|
2159
|
-
/** Canonical user for the profile being viewed. */
|
|
2160
|
-
subject: User;
|
|
2161
|
-
/** Canonical user for the authenticated viewer. */
|
|
2162
|
-
viewer: User;
|
|
2163
|
-
}
|
|
2164
|
-
export type PluginRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "ALL";
|
|
2165
|
-
export type PluginRouteHandler = {
|
|
2166
|
-
bivarianceHack(request: Request): Promise<Response> | Response;
|
|
2167
|
-
}["bivarianceHack"];
|
|
2168
|
-
export interface PluginRoute {
|
|
2169
|
-
handler: PluginRouteHandler;
|
|
2170
|
-
method?: PluginRouteMethod | PluginRouteMethod[];
|
|
2171
|
-
path: string;
|
|
2172
|
-
}
|
|
2173
|
-
/** Fetch-compatible plugin HTTP app mounted by Junior. */
|
|
2174
|
-
export type PluginRouteApp = {
|
|
2175
|
-
fetch(request: Request, context?: PluginApiRouteRequestContext): Promise<Response> | Response;
|
|
2176
|
-
};
|
|
2177
|
-
export interface RouteRegistrationHookContext extends PluginContext {
|
|
2178
|
-
annotations: PluginConversationAnnotations;
|
|
2179
|
-
/** Provider-neutral write boundary for Junior's native code index. */
|
|
2180
|
-
codeChanges: CodeChangePublisher;
|
|
2181
|
-
/** Core-owned delivery boundary for provider webhook events. */
|
|
2182
|
-
events: EventPublisher;
|
|
2183
|
-
/** Review desk items that the plugin adds and closes from its events. */
|
|
2184
|
-
reviewItems: PluginConversationReviewItems;
|
|
2185
|
-
/** Plugin-namespaced state, the same as in heartbeats. */
|
|
2186
|
-
state: PluginState;
|
|
2187
|
-
users: {
|
|
2188
|
-
/**
|
|
2189
|
-
* Read one stored identity and the user it links to now, with every
|
|
2190
|
-
* identity of that user. A plugin that saved an identity id uses this to
|
|
2191
|
-
* find the person's other linked accounts later.
|
|
2192
|
-
*/
|
|
2193
|
-
readIdentity(identityId: string): Promise<{
|
|
2194
|
-
identity: Identity;
|
|
2195
|
-
user?: User;
|
|
2196
|
-
} | undefined>;
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
export interface ApiRouteRegistrationHookContext extends PluginContext {
|
|
2200
|
-
conversationEvents: PluginConversationEventReader;
|
|
2201
|
-
eventStats: PluginConversationEventStats;
|
|
2202
|
-
users: {
|
|
2203
|
-
/** Resolve or create the canonical user for one verified email. */
|
|
2204
|
-
resolve(email: string): Promise<User | undefined>;
|
|
2205
|
-
};
|
|
2206
|
-
}
|
|
2207
|
-
/** Per-request context Junior passes to authenticated plugin product API routes. */
|
|
2208
|
-
export declare const pluginApiRouteRequestContextSchema: z.ZodObject<{
|
|
2209
|
-
auth: z.ZodObject<{
|
|
2210
|
-
user: z.ZodObject<{
|
|
2211
|
-
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2212
|
-
emailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
2213
|
-
isAdmin: z.ZodBoolean;
|
|
2214
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2215
|
-
}, z.core.$strict>;
|
|
2216
|
-
}, z.core.$strict>;
|
|
2217
|
-
pluginName: z.ZodString;
|
|
2218
|
-
}, z.core.$strict>;
|
|
2219
|
-
export type PluginApiRouteRequestContext = z.output<typeof pluginApiRouteRequestContextSchema>;
|
|
2220
|
-
export interface SlackConversationLink {
|
|
2221
|
-
url: string;
|
|
2222
|
-
}
|
|
2223
|
-
export interface SlackConversationLinkHookContext extends PluginContext {
|
|
2224
|
-
conversationId: string;
|
|
2225
|
-
}
|
|
2226
|
-
export interface PluginEnv {
|
|
2227
|
-
get(key: string): string | undefined;
|
|
2228
|
-
set(key: string, value: string): void;
|
|
2229
|
-
}
|
|
2230
|
-
/**
|
|
2231
|
-
* Decide what happens to one tool call in `beforeToolExecute`.
|
|
2232
|
-
*
|
|
2233
|
-
* `redirect` and `deny` both stop the tool before it runs. Neither ends the
|
|
2234
|
-
* turn: the agent gets the message as the tool result.
|
|
2235
|
-
*/
|
|
2236
|
-
export interface PluginDecision {
|
|
2237
|
-
/**
|
|
2238
|
-
* Block the call as a policy refusal. The agent is told not to retry or
|
|
2239
|
-
* reach the same result another way, and to explain the block.
|
|
2240
|
-
*/
|
|
2241
|
-
deny(reason: string): void;
|
|
2242
|
-
/**
|
|
2243
|
-
* Block the call because a different path is correct, such as another
|
|
2244
|
-
* tool. The message tells the agent what to do instead.
|
|
2245
|
-
*/
|
|
2246
|
-
redirect(message: string): void;
|
|
2247
|
-
replaceInput(input: Record<string, unknown>): void;
|
|
2248
|
-
}
|
|
2249
|
-
/**
|
|
2250
|
-
* Decide what the agent reads after one tool call in `afterToolExecute`.
|
|
2251
|
-
*
|
|
2252
|
-
* The tool already ran, so neither choice undoes its effects.
|
|
2253
|
-
*/
|
|
2254
|
-
export interface PluginToolResultDecision {
|
|
2255
|
-
/**
|
|
2256
|
-
* Reject the result as a policy refusal. The agent gets the reason instead
|
|
2257
|
-
* of the result, and is told not to retry. Undo the tool's effects first
|
|
2258
|
-
* when they must not stay.
|
|
2259
|
-
*/
|
|
2260
|
-
deny(reason: string): void;
|
|
2261
|
-
/**
|
|
2262
|
-
* Add guidance after the result, such as a problem to fix in the change
|
|
2263
|
-
* that the tool made. The agent reads the result and the guidance.
|
|
2264
|
-
*/
|
|
2265
|
-
nudge(message: string): void;
|
|
2266
|
-
}
|
|
2267
|
-
/** Thrown when a plugin tool rejects invalid model or user input. */
|
|
2268
|
-
export declare class PluginToolInputError extends Error {
|
|
2269
|
-
constructor(message: string, options?: {
|
|
2270
|
-
cause?: unknown;
|
|
2271
|
-
});
|
|
2106
|
+
/** Thrown when a plugin tool rejects invalid model or user input. */
|
|
2107
|
+
export declare class PluginToolInputError extends Error {
|
|
2108
|
+
constructor(message: string, options?: {
|
|
2109
|
+
cause?: unknown;
|
|
2110
|
+
});
|
|
2272
2111
|
}
|
|
2273
2112
|
export interface PluginSandbox {
|
|
2274
2113
|
juniorRoot: string;
|
|
@@ -2674,8 +2513,6 @@ export interface SlackToolRegistrationHookContext {
|
|
|
2674
2513
|
canCreateCanvas: boolean;
|
|
2675
2514
|
canPostToChannel: boolean;
|
|
2676
2515
|
};
|
|
2677
|
-
/** Host-owned link to this conversation, preferring the dashboard when enabled. */
|
|
2678
|
-
conversationLink?: SlackConversationLink;
|
|
2679
2516
|
credentialSubject?: Extract<PluginCredentialSubject, {
|
|
2680
2517
|
allowedWhen: "private-direct-conversation";
|
|
2681
2518
|
}>;
|
|
@@ -2722,6 +2559,10 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
2722
2559
|
automationLink?: {
|
|
2723
2560
|
url: string;
|
|
2724
2561
|
};
|
|
2562
|
+
/** Host-owned dashboard link to this conversation, when the dashboard is enabled. */
|
|
2563
|
+
conversationLink?: {
|
|
2564
|
+
url: string;
|
|
2565
|
+
};
|
|
2725
2566
|
embedder: PluginEmbedder;
|
|
2726
2567
|
egress: PluginEgress;
|
|
2727
2568
|
mcp?: PluginMcp;
|
|
@@ -2749,6 +2590,235 @@ export type ToolRegistrationHookContext = BaseToolRegistrationHookContext & Invo
|
|
|
2749
2590
|
/** Slack tool details when the Conversation has a Slack Location. */
|
|
2750
2591
|
slack?: SlackToolRegistrationHookContext;
|
|
2751
2592
|
};
|
|
2593
|
+
/**
|
|
2594
|
+
* An item that a plugin puts on the review desk: a notice for information,
|
|
2595
|
+
* or an ask that waits on its assignees.
|
|
2596
|
+
*/
|
|
2597
|
+
export interface PluginReviewNotice {
|
|
2598
|
+
/**
|
|
2599
|
+
* Junior assigns the User linked to each Identity, but only when that User
|
|
2600
|
+
* is in the notice's Conversation. It leaves out the others.
|
|
2601
|
+
*/
|
|
2602
|
+
assigneeIdentityIds: string[];
|
|
2603
|
+
/** Markdown details for the person. */
|
|
2604
|
+
body: string;
|
|
2605
|
+
/**
|
|
2606
|
+
* Stable key for what the notice is about. A plugin has at most one open
|
|
2607
|
+
* item for each key.
|
|
2608
|
+
*/
|
|
2609
|
+
dedupeKey: string;
|
|
2610
|
+
/** What the notice is about, such as a pull request. Search matches `id`. */
|
|
2611
|
+
subject?: {
|
|
2612
|
+
id: string;
|
|
2613
|
+
title?: string;
|
|
2614
|
+
url?: string;
|
|
2615
|
+
};
|
|
2616
|
+
/**
|
|
2617
|
+
* For an item that waits on its assignees, name their step, such as
|
|
2618
|
+
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
2619
|
+
*/
|
|
2620
|
+
title: string;
|
|
2621
|
+
/**
|
|
2622
|
+
* The assignees must act, such as merge a pull request that is ready. The
|
|
2623
|
+
* item then waits on them: its Conversation shows in their Needs you, and
|
|
2624
|
+
* it counts in their Inbox. Leave it unset for a notice that is only for
|
|
2625
|
+
* information.
|
|
2626
|
+
*/
|
|
2627
|
+
waitsOnAssignees?: boolean;
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Review items that a plugin adds and closes from its own events. Each item
|
|
2631
|
+
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
2632
|
+
* the Slack cards.
|
|
2633
|
+
*/
|
|
2634
|
+
export interface PluginReviewItems {
|
|
2635
|
+
/** Add an open item, or replace the content of the open one with the key. */
|
|
2636
|
+
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
2637
|
+
/** Close the open item with the key. Do nothing when no item is open. */
|
|
2638
|
+
close(input: {
|
|
2639
|
+
dedupeKey: string;
|
|
2640
|
+
reason: string;
|
|
2641
|
+
status: "done" | "dismissed";
|
|
2642
|
+
}): Promise<void>;
|
|
2643
|
+
}
|
|
2644
|
+
/** Review items of a plugin, for the Conversation that each item belongs to. */
|
|
2645
|
+
export interface PluginConversationReviewItems {
|
|
2646
|
+
forConversation(conversationId: string): PluginReviewItems;
|
|
2647
|
+
}
|
|
2648
|
+
export interface HeartbeatHookContext extends PluginContext {
|
|
2649
|
+
agent: {
|
|
2650
|
+
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
2651
|
+
get(id: string): Promise<Dispatch | undefined>;
|
|
2652
|
+
};
|
|
2653
|
+
/** Conversation annotations, as from a plugin route. */
|
|
2654
|
+
annotations: PluginConversationAnnotations;
|
|
2655
|
+
/** Junior's native code index, as from a plugin route. */
|
|
2656
|
+
codeChanges: CodeChangePublisher;
|
|
2657
|
+
/** Host embedder bound to the configured embedding model. */
|
|
2658
|
+
embedder: PluginEmbedder;
|
|
2659
|
+
/** Publish events, as from a plugin route. */
|
|
2660
|
+
events: EventPublisher;
|
|
2661
|
+
nowMs: number;
|
|
2662
|
+
state: PluginState;
|
|
2663
|
+
}
|
|
2664
|
+
export interface HeartbeatResult {
|
|
2665
|
+
dispatchCount?: number;
|
|
2666
|
+
}
|
|
2667
|
+
export interface UnfinishedWorkHookContext extends PluginContext {
|
|
2668
|
+
/**
|
|
2669
|
+
* Bounded conversation candidates selected by the host, with the child
|
|
2670
|
+
* conversations of candidate roots. Work in a child counts for its root.
|
|
2671
|
+
*/
|
|
2672
|
+
conversationIds: string[];
|
|
2673
|
+
}
|
|
2674
|
+
export interface UnfinishedWorkResult {
|
|
2675
|
+
/** Candidate conversations that have plugin-owned work to finish. */
|
|
2676
|
+
conversationIds: string[];
|
|
2677
|
+
/**
|
|
2678
|
+
* Candidate conversations that have any associated plugin-owned work,
|
|
2679
|
+
* finished or unfinished. Omit when the plugin cannot distinguish assignment.
|
|
2680
|
+
*
|
|
2681
|
+
* The host uses this with unfinished work and finish times to set feed
|
|
2682
|
+
* `isPriority`. Finished assigned work stays out of Priority unless the
|
|
2683
|
+
* conversation has activity after the finish time.
|
|
2684
|
+
*/
|
|
2685
|
+
assignedConversationIds?: string[];
|
|
2686
|
+
/**
|
|
2687
|
+
* Latest time when all known work finished, keyed by conversation id.
|
|
2688
|
+
* ISO-8601 timestamps. Used with conversation activity to decide whether
|
|
2689
|
+
* finished work still belongs in Priority, and whether auto-archive may
|
|
2690
|
+
* archive the conversation for users who turned it on.
|
|
2691
|
+
*/
|
|
2692
|
+
finishedWorkAtByConversationId?: Record<string, string>;
|
|
2693
|
+
}
|
|
2694
|
+
export type PluginOperationalTone = "danger" | "good" | "neutral" | "warning";
|
|
2695
|
+
export interface PluginOperationalMetric {
|
|
2696
|
+
label: string;
|
|
2697
|
+
tone?: PluginOperationalTone;
|
|
2698
|
+
value: string;
|
|
2699
|
+
}
|
|
2700
|
+
export interface PluginOperationalField {
|
|
2701
|
+
key: string;
|
|
2702
|
+
label: string;
|
|
2703
|
+
}
|
|
2704
|
+
export interface PluginOperationalRecord {
|
|
2705
|
+
id: string;
|
|
2706
|
+
tone?: PluginOperationalTone;
|
|
2707
|
+
values: Record<string, string>;
|
|
2708
|
+
}
|
|
2709
|
+
export interface PluginOperationalRecordSet {
|
|
2710
|
+
fields?: PluginOperationalField[];
|
|
2711
|
+
emptyText?: string;
|
|
2712
|
+
records?: PluginOperationalRecord[];
|
|
2713
|
+
title: string;
|
|
2714
|
+
}
|
|
2715
|
+
export interface PluginOperationalChartSeries {
|
|
2716
|
+
format?: "usd";
|
|
2717
|
+
key: string;
|
|
2718
|
+
label: string;
|
|
2719
|
+
tone?: PluginOperationalTone;
|
|
2720
|
+
}
|
|
2721
|
+
export interface PluginOperationalChartCategory {
|
|
2722
|
+
id: string;
|
|
2723
|
+
label: string;
|
|
2724
|
+
values: Record<string, number>;
|
|
2725
|
+
}
|
|
2726
|
+
export interface PluginOperationalBarChartWidget {
|
|
2727
|
+
categories: PluginOperationalChartCategory[];
|
|
2728
|
+
description?: string;
|
|
2729
|
+
emptyText?: string;
|
|
2730
|
+
id: string;
|
|
2731
|
+
series: PluginOperationalChartSeries[];
|
|
2732
|
+
timeRangeDays?: Array<1 | 7 | 30 | 90>;
|
|
2733
|
+
title: string;
|
|
2734
|
+
type: "bar_chart";
|
|
2735
|
+
}
|
|
2736
|
+
export interface PluginOperationalReportContent {
|
|
2737
|
+
generatedAt?: string;
|
|
2738
|
+
metrics?: PluginOperationalMetric[];
|
|
2739
|
+
recordSets?: PluginOperationalRecordSet[];
|
|
2740
|
+
title?: string;
|
|
2741
|
+
widgets?: PluginOperationalBarChartWidget[];
|
|
2742
|
+
}
|
|
2743
|
+
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
2744
|
+
pluginName: string;
|
|
2745
|
+
}
|
|
2746
|
+
export interface OperationalReportHookContext extends PluginContext {
|
|
2747
|
+
eventStats: PluginConversationEventStats;
|
|
2748
|
+
nowMs: number;
|
|
2749
|
+
state: PluginReadState;
|
|
2750
|
+
}
|
|
2751
|
+
/** Read-only context for one person-scoped plugin report on a profile page. */
|
|
2752
|
+
export interface ProfileReportHookContext extends PluginContext {
|
|
2753
|
+
nowMs: number;
|
|
2754
|
+
state: PluginReadState;
|
|
2755
|
+
/** Canonical user for the profile being viewed. */
|
|
2756
|
+
subject: User;
|
|
2757
|
+
/** Canonical user for the authenticated viewer. */
|
|
2758
|
+
viewer: User;
|
|
2759
|
+
}
|
|
2760
|
+
export type PluginRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "ALL";
|
|
2761
|
+
export type PluginRouteHandler = {
|
|
2762
|
+
bivarianceHack(request: Request): Promise<Response> | Response;
|
|
2763
|
+
}["bivarianceHack"];
|
|
2764
|
+
export interface PluginRoute {
|
|
2765
|
+
handler: PluginRouteHandler;
|
|
2766
|
+
method?: PluginRouteMethod | PluginRouteMethod[];
|
|
2767
|
+
path: string;
|
|
2768
|
+
}
|
|
2769
|
+
/** Fetch-compatible plugin HTTP app mounted by Junior. */
|
|
2770
|
+
export type PluginRouteApp = {
|
|
2771
|
+
fetch(request: Request, context?: PluginApiRouteRequestContext): Promise<Response> | Response;
|
|
2772
|
+
};
|
|
2773
|
+
export interface RouteRegistrationHookContext extends PluginContext {
|
|
2774
|
+
annotations: PluginConversationAnnotations;
|
|
2775
|
+
/** Provider-neutral write boundary for Junior's native code index. */
|
|
2776
|
+
codeChanges: CodeChangePublisher;
|
|
2777
|
+
/** Core-owned delivery boundary for provider webhook events. */
|
|
2778
|
+
events: EventPublisher;
|
|
2779
|
+
/** Review desk items that the plugin adds and closes from its events. */
|
|
2780
|
+
reviewItems: PluginConversationReviewItems;
|
|
2781
|
+
/** Plugin-namespaced state, the same as in heartbeats. */
|
|
2782
|
+
state: PluginState;
|
|
2783
|
+
users: {
|
|
2784
|
+
/**
|
|
2785
|
+
* Read one stored identity and the user it links to now, with every
|
|
2786
|
+
* identity of that user. A plugin that saved an identity id uses this to
|
|
2787
|
+
* find the person's other linked accounts later.
|
|
2788
|
+
*/
|
|
2789
|
+
readIdentity(identityId: string): Promise<{
|
|
2790
|
+
identity: Identity;
|
|
2791
|
+
user?: User;
|
|
2792
|
+
} | undefined>;
|
|
2793
|
+
};
|
|
2794
|
+
}
|
|
2795
|
+
export interface ApiRouteRegistrationHookContext extends PluginContext {
|
|
2796
|
+
conversationEvents: PluginConversationEventReader;
|
|
2797
|
+
eventStats: PluginConversationEventStats;
|
|
2798
|
+
users: {
|
|
2799
|
+
/** Resolve or create the canonical user for one verified email. */
|
|
2800
|
+
resolve(email: string): Promise<User | undefined>;
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
/** Per-request context Junior passes to authenticated plugin product API routes. */
|
|
2804
|
+
export declare const pluginApiRouteRequestContextSchema: z.ZodObject<{
|
|
2805
|
+
auth: z.ZodObject<{
|
|
2806
|
+
user: z.ZodObject<{
|
|
2807
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2808
|
+
emailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
2809
|
+
isAdmin: z.ZodBoolean;
|
|
2810
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2811
|
+
}, z.core.$strict>;
|
|
2812
|
+
}, z.core.$strict>;
|
|
2813
|
+
pluginName: z.ZodString;
|
|
2814
|
+
}, z.core.$strict>;
|
|
2815
|
+
export type PluginApiRouteRequestContext = z.output<typeof pluginApiRouteRequestContextSchema>;
|
|
2816
|
+
export interface SlackConversationLink {
|
|
2817
|
+
url: string;
|
|
2818
|
+
}
|
|
2819
|
+
export interface SlackConversationLinkHookContext extends PluginContext {
|
|
2820
|
+
conversationId: string;
|
|
2821
|
+
}
|
|
2752
2822
|
/**
|
|
2753
2823
|
* Deny provider egress when a plugin policy does not allow the request.
|
|
2754
2824
|
*
|
package/dist/index.js
CHANGED
|
@@ -148,6 +148,10 @@ function objectIconPath(icon) {
|
|
|
148
148
|
return `/_junior/dashboard/object-icons/v1/${icon}.png`;
|
|
149
149
|
}
|
|
150
150
|
// src/object-annotations.ts
|
|
151
|
+
/** Return whether facts fit an object type. Deployment facts also fit an item. */
|
|
152
|
+
function objectFactsMatchType(facts, objectType) {
|
|
153
|
+
return facts.type === "deployment" ? objectType === "deployment" || objectType === "item" : facts.type === objectType;
|
|
154
|
+
}
|
|
151
155
|
/**
|
|
152
156
|
* Verified facts shared by Conversation annotations and Message cards.
|
|
153
157
|
* Plugins select small facts from responses they already have. Each surface owns
|
|
@@ -174,7 +178,7 @@ const objectAnnotationSchema = z.object({
|
|
|
174
178
|
displayType: z.string().trim().min(1).max(80).optional(),
|
|
175
179
|
sourceUpdatedAt: z.iso.datetime({ offset: true }).optional(),
|
|
176
180
|
facts: objectFactsSchema.refine((facts) => new TextEncoder().encode(JSON.stringify(facts)).length <= 4096, "Object facts must not exceed 4 KiB").optional()
|
|
177
|
-
}).strict().refine((annotation) => !annotation.facts || (annotation.facts
|
|
181
|
+
}).strict().refine((annotation) => !annotation.facts || objectFactsMatchType(annotation.facts, annotation.objectType), "Object facts must match the object type");
|
|
178
182
|
/** A saved object snapshot with its trusted owner. */
|
|
179
183
|
const ownedObjectAnnotationSchema = objectAnnotationSchema.safeExtend({ plugin: z.string().min(1) });
|
|
180
184
|
// src/object-icons.ts
|
|
@@ -1833,4 +1837,4 @@ const pluginUserPageInputSchema = z.object({
|
|
|
1833
1837
|
limit: z.number().int().min(1).max(50),
|
|
1834
1838
|
query: pluginUserPageQuerySchema
|
|
1835
1839
|
}).strict();
|
|
1836
|
-
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, 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, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsSchema, objectIconPath, objectIconPaths, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
|
|
1840
|
+
export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, 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, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsMatchType, objectFactsSchema, objectIconPath, objectIconPaths, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
|