@kdlbs/plugin-sdk 0.0.0-stage → 0.2.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/LICENSE +661 -0
- package/README.md +68 -2
- package/package.json +32 -4
- package/sdk-release.json +11 -0
- package/src/index.ts +1522 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,1522 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public, runtime-free frontend contract for Kandev plugins.
|
|
3
|
+
*
|
|
4
|
+
* This package deliberately has no imports from React, the Kandev web
|
|
5
|
+
* application, Zustand, or host UI implementation modules. Plugins receive
|
|
6
|
+
* all runtime values during initialize and use these structural types at
|
|
7
|
+
* compile time only.
|
|
8
|
+
*/
|
|
9
|
+
export type HostNode = unknown;
|
|
10
|
+
// `any` is deliberate at these two React compatibility seams. Reproducing
|
|
11
|
+
// React's overloaded createElement and recursive ReactNode types would make
|
|
12
|
+
// this runtime-free package depend on React's private type graph again.
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
export type ElementFactory = (...args: any[]) => HostNode;
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
export type Component<Props = {}> = (props: Props) => any;
|
|
17
|
+
export type HostComponent = unknown;
|
|
18
|
+
|
|
19
|
+
/** A subset of the real host button that preserves pointer capture for plugins. */
|
|
20
|
+
export interface PluginActionElement extends EventTarget {
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
click(): void;
|
|
23
|
+
focus(options?: FocusOptions): void;
|
|
24
|
+
blur(): void;
|
|
25
|
+
setPointerCapture(pointerId: number): void;
|
|
26
|
+
releasePointerCapture(pointerId: number): void;
|
|
27
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PluginActionEvent<Target extends PluginActionElement = PluginActionElement> {
|
|
31
|
+
currentTarget: Target;
|
|
32
|
+
target: EventTarget;
|
|
33
|
+
preventDefault(): void;
|
|
34
|
+
stopPropagation(): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PluginActionMouseEvent extends PluginActionEvent {
|
|
38
|
+
button: number;
|
|
39
|
+
buttons: number;
|
|
40
|
+
clientX: number;
|
|
41
|
+
clientY: number;
|
|
42
|
+
altKey: boolean;
|
|
43
|
+
ctrlKey: boolean;
|
|
44
|
+
metaKey: boolean;
|
|
45
|
+
shiftKey: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PluginActionPointerEvent extends PluginActionMouseEvent {
|
|
49
|
+
pointerId: number;
|
|
50
|
+
pointerType: string;
|
|
51
|
+
isPrimary: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface PluginActionKeyboardEvent extends PluginActionEvent {
|
|
55
|
+
key: string;
|
|
56
|
+
code: string;
|
|
57
|
+
repeat: boolean;
|
|
58
|
+
altKey: boolean;
|
|
59
|
+
ctrlKey: boolean;
|
|
60
|
+
metaKey: boolean;
|
|
61
|
+
shiftKey: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface PluginActionFocusEvent extends PluginActionEvent {
|
|
65
|
+
relatedTarget: EventTarget | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type PluginActionEventHandler<Event extends PluginActionEvent> = {
|
|
69
|
+
bivarianceHack(event: Event): void;
|
|
70
|
+
}["bivarianceHack"];
|
|
71
|
+
|
|
72
|
+
export type PluginActionRef =
|
|
73
|
+
| {
|
|
74
|
+
bivarianceHack(instance: PluginActionElement | null): void;
|
|
75
|
+
}["bivarianceHack"]
|
|
76
|
+
| { readonly current: PluginActionElement | null };
|
|
77
|
+
|
|
78
|
+
/** Props accepted by the host-owned action control in supported plugin slots. */
|
|
79
|
+
export interface PluginActionProps {
|
|
80
|
+
/** Localized, stable accessible name. */
|
|
81
|
+
label: string;
|
|
82
|
+
/** Decorative icon or custom glyph, rendered inside the host-owned icon box. */
|
|
83
|
+
icon?: HostNode;
|
|
84
|
+
/** Optional visible value or short label. */
|
|
85
|
+
text?: string;
|
|
86
|
+
/** Optional short decorative badge. */
|
|
87
|
+
badge?: string;
|
|
88
|
+
tone?: "neutral" | "success" | "warning" | "danger";
|
|
89
|
+
pressed?: boolean;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
/** Shows activity feedback but does not disable the action. */
|
|
92
|
+
busy?: boolean;
|
|
93
|
+
/** Empty disables the host tooltip. Icon-only actions default to `label`. */
|
|
94
|
+
tooltip?: string;
|
|
95
|
+
ref?: PluginActionRef;
|
|
96
|
+
id?: string;
|
|
97
|
+
"aria-expanded"?: boolean;
|
|
98
|
+
"aria-controls"?: string;
|
|
99
|
+
"aria-haspopup"?: boolean | "menu" | "listbox" | "tree" | "grid" | "dialog";
|
|
100
|
+
"aria-describedby"?: string;
|
|
101
|
+
"data-testid"?: string;
|
|
102
|
+
"data-state"?: string;
|
|
103
|
+
"data-side"?: "top" | "right" | "bottom" | "left";
|
|
104
|
+
"data-align"?: "start" | "center" | "end";
|
|
105
|
+
"data-disabled"?: boolean | string;
|
|
106
|
+
onClick?: PluginActionEventHandler<PluginActionMouseEvent>;
|
|
107
|
+
onFocus?: PluginActionEventHandler<PluginActionFocusEvent>;
|
|
108
|
+
onBlur?: PluginActionEventHandler<PluginActionFocusEvent>;
|
|
109
|
+
onKeyDown?: PluginActionEventHandler<PluginActionKeyboardEvent>;
|
|
110
|
+
onPointerDown?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
111
|
+
onPointerUp?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
112
|
+
onPointerCancel?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
113
|
+
onPointerEnter?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
114
|
+
onPointerMove?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
115
|
+
onPointerLeave?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
116
|
+
onLostPointerCapture?: PluginActionEventHandler<PluginActionPointerEvent>;
|
|
117
|
+
onMouseEnter?: PluginActionEventHandler<PluginActionMouseEvent>;
|
|
118
|
+
onMouseLeave?: PluginActionEventHandler<PluginActionMouseEvent>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Immutable task identity passed to a task-create completion handler. */
|
|
122
|
+
export interface PluginTaskCreatedIdentity {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly workspace_id: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Handler invoked after its owning create dialog successfully creates a task. */
|
|
128
|
+
export type PluginTaskCreatedHandler = (task: PluginTaskCreatedIdentity) => void | Promise<void>;
|
|
129
|
+
|
|
130
|
+
/** Registers a task-created handler for the lifetime of its slot contribution. */
|
|
131
|
+
export type RegisterPluginTaskCreatedHandler = (handler: PluginTaskCreatedHandler) => () => void;
|
|
132
|
+
|
|
133
|
+
export type PluginComposerSurface = "task-chat" | "quick-chat" | "task-create" | "new-session";
|
|
134
|
+
|
|
135
|
+
export type PluginComposerSubmitResult =
|
|
136
|
+
| { status: "submitted" }
|
|
137
|
+
| { status: "blocked"; reason?: string }
|
|
138
|
+
| { status: "unavailable" };
|
|
139
|
+
|
|
140
|
+
export interface PluginComposerCapability {
|
|
141
|
+
insertText(text: string): { status: "inserted" | "ignored" | "unavailable" };
|
|
142
|
+
focus(): { status: "focused" | "unavailable" };
|
|
143
|
+
submit(): Promise<PluginComposerSubmitResult>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Typed context passed to native composer action slots. */
|
|
147
|
+
export interface PluginComposerSlotProps {
|
|
148
|
+
surface: PluginComposerSurface;
|
|
149
|
+
presentation: "desktop" | "mobile";
|
|
150
|
+
taskId: string | null;
|
|
151
|
+
taskTitle?: string;
|
|
152
|
+
activeSessionId: string | null;
|
|
153
|
+
sessionIds: string[];
|
|
154
|
+
disabled: boolean;
|
|
155
|
+
submittable: boolean;
|
|
156
|
+
disabledReason?: string;
|
|
157
|
+
composer: PluginComposerCapability;
|
|
158
|
+
/**
|
|
159
|
+
* Present only on create-mode `task-create-input-actions`. The returned
|
|
160
|
+
* cleanup unregisters the callback when the slot contribution unmounts.
|
|
161
|
+
*/
|
|
162
|
+
registerTaskCreatedHandler?: RegisterPluginTaskCreatedHandler;
|
|
163
|
+
}
|
|
164
|
+
export interface PluginActionGroupProps {
|
|
165
|
+
children?: HostNode;
|
|
166
|
+
label?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface PluginIconProps {
|
|
170
|
+
className?: string;
|
|
171
|
+
"aria-hidden"?: boolean | "true" | "false";
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Curated host icon name or a plugin-owned component rendered with host React. */
|
|
175
|
+
export type PluginIcon = string | Component<PluginIconProps>;
|
|
176
|
+
|
|
177
|
+
/** Placement for a registered nav item; see `PluginRegistry.registerNavItem`. */
|
|
178
|
+
export type PluginNavSection = "main" | "settings" | "integrations" | "sidebar-footer";
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Context for the `main-top-bar` slot. Phone listing contributions live in the
|
|
182
|
+
* menu with 44px touch targets; interactions retain the slot's local state.
|
|
183
|
+
* On phones with task controls, the same plugin's chat-top-bar replaces this
|
|
184
|
+
* slot once it renders content. Null-rendering task controls retain this
|
|
185
|
+
* fallback. Listings and archived tasks retain the workspace toolbar.
|
|
186
|
+
*/
|
|
187
|
+
export interface MainTopBarSlotProps {
|
|
188
|
+
workspaceId: string | null;
|
|
189
|
+
workspaceLabel?: string;
|
|
190
|
+
currentPage: "kanban" | "tasks";
|
|
191
|
+
presentation: "desktop" | "mobile";
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Context for the `chat-top-bar` slot. Phone task contributions live in the
|
|
196
|
+
* shared menu; tablet and desktop contributions remain inline in the top bar.
|
|
197
|
+
* When task controls are present, every registration in this slot renders
|
|
198
|
+
* instead of the same plugin's main-top-bar registrations in the phone menu.
|
|
199
|
+
*/
|
|
200
|
+
export interface ChatTopBarSlotProps {
|
|
201
|
+
/** Task the top bar belongs to, or null before one exists. */
|
|
202
|
+
taskId: string | null;
|
|
203
|
+
/** Display title of the task, when known. */
|
|
204
|
+
taskTitle?: string;
|
|
205
|
+
/** Workspace the task lives in, when known. */
|
|
206
|
+
workspaceId: string | null;
|
|
207
|
+
/** Session the top bar is currently bound to, or null before one exists. */
|
|
208
|
+
activeSessionId: string | null;
|
|
209
|
+
/** Every Kandev session id on the task, including `activeSessionId`. */
|
|
210
|
+
sessionIds: string[];
|
|
211
|
+
/** Host surface that mounted the contribution. */
|
|
212
|
+
presentation: "desktop" | "mobile";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Context passed to components registered for the `chat-submit-decoration`
|
|
217
|
+
* slot, which renders *over* the chat composer's send button rather than
|
|
218
|
+
* beside it. The host positions the layer against the button's box and makes
|
|
219
|
+
* it `pointer-events-none`. Keep decorations inert when possible; hover or
|
|
220
|
+
* focus disclosure can observe the host button from an effect. A decoration
|
|
221
|
+
* renders inside the layer, not beside the button, and `pointer-events-auto`
|
|
222
|
+
* is a last resort for a separate hit target that does not obstruct send.
|
|
223
|
+
*/
|
|
224
|
+
export interface ChatSubmitDecorationSlotProps {
|
|
225
|
+
/** Task the composer belongs to, or null for task-less quick chat. */
|
|
226
|
+
taskId: string | null;
|
|
227
|
+
/** Display title of the task, when known. */
|
|
228
|
+
taskTitle?: string;
|
|
229
|
+
/** Session the composer is currently bound to, or null before one exists. */
|
|
230
|
+
activeSessionId: string | null;
|
|
231
|
+
/** Every kandev session id on the task (includes `activeSessionId`). */
|
|
232
|
+
sessionIds: string[];
|
|
233
|
+
presentation: "desktop" | "mobile";
|
|
234
|
+
/** True while the composer is dispatching the current message. */
|
|
235
|
+
isSending: boolean;
|
|
236
|
+
/** True when the agent is mid-turn, so the next send queues behind it. */
|
|
237
|
+
isAgentBusy: boolean;
|
|
238
|
+
/** True when the send button itself is disabled. */
|
|
239
|
+
disabled: boolean;
|
|
240
|
+
/** True when plan mode is on (the button sends a plan request). */
|
|
241
|
+
planModeEnabled: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export type StateUpdater<Value> = Value | ((previous: Value) => Value);
|
|
245
|
+
export type StateSetter<Value> = (value: StateUpdater<Value>) => void;
|
|
246
|
+
|
|
247
|
+
export interface MutableRef<Value> {
|
|
248
|
+
current: Value;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface ResponsiveBreakpoint {
|
|
252
|
+
isMobile: boolean;
|
|
253
|
+
usesDesktopWorkbench?: boolean;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** React-compatible primitives supplied by the host; no React package is required to consume them. */
|
|
257
|
+
export interface HostReact {
|
|
258
|
+
readonly Fragment: HostComponent;
|
|
259
|
+
createElement: ElementFactory;
|
|
260
|
+
useState<Value>(initialValue: Value | (() => Value)): [Value, StateSetter<Value>];
|
|
261
|
+
useEffect(effect: () => void | (() => void), dependencies?: readonly unknown[]): void;
|
|
262
|
+
useLayoutEffect(effect: () => void | (() => void), dependencies?: readonly unknown[]): void;
|
|
263
|
+
useMemo<Value>(factory: () => Value, dependencies: readonly unknown[]): Value;
|
|
264
|
+
useCallback<Callback extends (...args: never[]) => unknown>(
|
|
265
|
+
callback: Callback,
|
|
266
|
+
dependencies: readonly unknown[],
|
|
267
|
+
): Callback;
|
|
268
|
+
useRef<Value>(initialValue: Value): MutableRef<Value>;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface ActionInput {
|
|
272
|
+
workspaceId?: string;
|
|
273
|
+
taskId?: string;
|
|
274
|
+
sessionId?: string;
|
|
275
|
+
repositoryId?: string;
|
|
276
|
+
body?: unknown;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface PluginHostRepository {
|
|
280
|
+
id: string;
|
|
281
|
+
workspace_id: string;
|
|
282
|
+
name: string;
|
|
283
|
+
provider: string;
|
|
284
|
+
source_type?: string;
|
|
285
|
+
provider_repo_id?: string;
|
|
286
|
+
provider_host?: string;
|
|
287
|
+
provider_scope?: string;
|
|
288
|
+
provider_owner?: string;
|
|
289
|
+
provider_name?: string;
|
|
290
|
+
remote_url?: string;
|
|
291
|
+
default_branch?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface TaskCreationStep {
|
|
295
|
+
id: string;
|
|
296
|
+
title: string;
|
|
297
|
+
events?: Record<string, unknown>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface TaskCreationContext {
|
|
301
|
+
workspaceId: string;
|
|
302
|
+
workflowId: string;
|
|
303
|
+
defaultStepId: string;
|
|
304
|
+
steps: readonly TaskCreationStep[];
|
|
305
|
+
repositories: readonly PluginHostRepository[];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface RepositoryIdentityInput {
|
|
309
|
+
workspaceId: string;
|
|
310
|
+
providerId: string;
|
|
311
|
+
providerScope: string;
|
|
312
|
+
providerRepositoryId: string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** Provider-neutral reads that replace knowledge of Kandev's private app store. */
|
|
316
|
+
export interface PluginContextApi {
|
|
317
|
+
getActiveWorkspaceId(): string | undefined;
|
|
318
|
+
subscribeActiveWorkspace(listener: (workspaceId: string | undefined) => void): () => void;
|
|
319
|
+
/** Returns the ids of all workspaces currently available to the user. */
|
|
320
|
+
getWorkspaceIds(): readonly string[];
|
|
321
|
+
/** Notifies the plugin when the available workspace ids change. */
|
|
322
|
+
subscribeWorkspaces(listener: (workspaceIds: readonly string[]) => void): () => void;
|
|
323
|
+
getTaskCreationContext(workspaceId: string): TaskCreationContext | null;
|
|
324
|
+
subscribeTaskCreationContext(
|
|
325
|
+
workspaceId: string,
|
|
326
|
+
listener: (context: TaskCreationContext | null) => void,
|
|
327
|
+
): () => void;
|
|
328
|
+
resolveRepositoryId(identity: RepositoryIdentityInput): string | undefined;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface RepositoryInspection {
|
|
332
|
+
providerId: string;
|
|
333
|
+
providerHost: string;
|
|
334
|
+
providerScope?: string;
|
|
335
|
+
ownerOrProject: string;
|
|
336
|
+
repositoryId: string;
|
|
337
|
+
repositoryName: string;
|
|
338
|
+
cloneUrl: string;
|
|
339
|
+
defaultBranch?: string;
|
|
340
|
+
baseBranch?: string;
|
|
341
|
+
headBranch?: string;
|
|
342
|
+
pullRequest?: { number: number; title: string };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface RepositoryProviderRegistration {
|
|
346
|
+
id: string;
|
|
347
|
+
label: string;
|
|
348
|
+
icon?: PluginIcon;
|
|
349
|
+
listRepositories(context: {
|
|
350
|
+
workspaceId: string;
|
|
351
|
+
query?: string;
|
|
352
|
+
cursor?: string;
|
|
353
|
+
limit?: number;
|
|
354
|
+
signal: AbortSignal;
|
|
355
|
+
}): Promise<
|
|
356
|
+
RepositoryInspection[] | { repositories: RepositoryInspection[]; nextCursor?: string }
|
|
357
|
+
>;
|
|
358
|
+
/** Optional cheap hint only; inspectURL is the ownership authority. */
|
|
359
|
+
matchesURL?(url: string): boolean;
|
|
360
|
+
listBranches(context: {
|
|
361
|
+
workspaceId: string;
|
|
362
|
+
repository: RepositoryInspection;
|
|
363
|
+
signal: AbortSignal;
|
|
364
|
+
}): Promise<Array<{ name: string }>>;
|
|
365
|
+
inspectURL(context: {
|
|
366
|
+
workspaceId: string;
|
|
367
|
+
url: string;
|
|
368
|
+
signal: AbortSignal;
|
|
369
|
+
}): Promise<RepositoryInspection | null>;
|
|
370
|
+
supportsDraft?: boolean;
|
|
371
|
+
createChangeRequest?(context: {
|
|
372
|
+
workspaceId: string;
|
|
373
|
+
taskId: string;
|
|
374
|
+
sessionId: string;
|
|
375
|
+
repositoryId: string;
|
|
376
|
+
repository: PluginHostRepository;
|
|
377
|
+
title: string;
|
|
378
|
+
body: string;
|
|
379
|
+
baseBranch?: string;
|
|
380
|
+
draft: boolean;
|
|
381
|
+
signal: AbortSignal;
|
|
382
|
+
}): Promise<{
|
|
383
|
+
url: string;
|
|
384
|
+
provider?: string;
|
|
385
|
+
output?: string;
|
|
386
|
+
linked?: boolean;
|
|
387
|
+
associationError?: string;
|
|
388
|
+
}>;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface TaskContext {
|
|
392
|
+
workspaceId: string;
|
|
393
|
+
taskId: string;
|
|
394
|
+
repositories: readonly PluginHostRepository[];
|
|
395
|
+
pathname: string;
|
|
396
|
+
presentation: "desktop" | "mobile";
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export type ReviewTaskPipelineState = "success" | "failure" | "pending" | "neutral";
|
|
400
|
+
|
|
401
|
+
export interface ReviewTaskStatusCheck {
|
|
402
|
+
id: string;
|
|
403
|
+
label: string;
|
|
404
|
+
state: ReviewTaskPipelineState;
|
|
405
|
+
detail?: string;
|
|
406
|
+
url?: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface ReviewTaskStatus {
|
|
410
|
+
number: number | string;
|
|
411
|
+
state: "open" | "merged" | "closed" | "draft";
|
|
412
|
+
pipelineState: ReviewTaskPipelineState;
|
|
413
|
+
checks: readonly ReviewTaskStatusCheck[];
|
|
414
|
+
review?: {
|
|
415
|
+
state: "approved" | "changes_requested" | "pending";
|
|
416
|
+
approved: number;
|
|
417
|
+
required?: number;
|
|
418
|
+
requested?: number;
|
|
419
|
+
};
|
|
420
|
+
unresolvedComments?: number;
|
|
421
|
+
loading?: boolean;
|
|
422
|
+
error?: string;
|
|
423
|
+
updatedAt?: number;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface ReviewSummary {
|
|
427
|
+
providerId: string;
|
|
428
|
+
reviewKey: string;
|
|
429
|
+
title: string;
|
|
430
|
+
url: string;
|
|
431
|
+
connectionScope: string;
|
|
432
|
+
repositoryId: string;
|
|
433
|
+
changeRequestNumber: string | number;
|
|
434
|
+
state: string;
|
|
435
|
+
statusBadge?: { label: string; tone?: string };
|
|
436
|
+
taskStatus?: ReviewTaskStatus;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface ReviewTaskAssociation {
|
|
440
|
+
providerId: string;
|
|
441
|
+
taskId: string;
|
|
442
|
+
reviewKey: string;
|
|
443
|
+
connectionScope: string;
|
|
444
|
+
repositoryId: string;
|
|
445
|
+
changeRequestNumber: string | number;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface QueryState<T> {
|
|
449
|
+
data: T | null;
|
|
450
|
+
loading: boolean;
|
|
451
|
+
error: string | null;
|
|
452
|
+
lastFetchedAt: Date | null;
|
|
453
|
+
refresh(): void;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export interface PluginPageChrome {
|
|
457
|
+
title?: string;
|
|
458
|
+
subtitle?: string;
|
|
459
|
+
icon?: PluginIcon;
|
|
460
|
+
backHref?: string;
|
|
461
|
+
backLabel?: string;
|
|
462
|
+
actions?: Component;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export interface PluginRouteOptions {
|
|
466
|
+
topbar?: boolean | PluginPageChrome;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export type PluginSessionKind = "managed" | "passthrough" | null;
|
|
470
|
+
export type PluginConversationAuthor = "user" | "agent";
|
|
471
|
+
export type PluginConversationSort = "asc" | "desc";
|
|
472
|
+
|
|
473
|
+
export interface PluginConversationMessage {
|
|
474
|
+
id: string;
|
|
475
|
+
taskId: string | null;
|
|
476
|
+
sessionId: string;
|
|
477
|
+
turnId?: string;
|
|
478
|
+
authorType: PluginConversationAuthor;
|
|
479
|
+
type: string;
|
|
480
|
+
content: string;
|
|
481
|
+
createdAt: string;
|
|
482
|
+
updatedAt: string;
|
|
483
|
+
promptIndex?: number;
|
|
484
|
+
senderTaskId?: string;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface PluginConversationTurn {
|
|
488
|
+
id: string;
|
|
489
|
+
taskId: string | null;
|
|
490
|
+
sessionId: string;
|
|
491
|
+
startedAt: string;
|
|
492
|
+
completedAt?: string;
|
|
493
|
+
updatedAt: string;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface PluginSessionMessagesQuery {
|
|
497
|
+
sessionId: string | null;
|
|
498
|
+
taskId?: string | null;
|
|
499
|
+
authorTypes?: readonly PluginConversationAuthor[];
|
|
500
|
+
sort?: PluginConversationSort;
|
|
501
|
+
pageSize?: number;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export type PluginConversationErrorCode =
|
|
505
|
+
| "unauthenticated"
|
|
506
|
+
| "not_found"
|
|
507
|
+
| "invalid_query"
|
|
508
|
+
| "upstream_failure";
|
|
509
|
+
|
|
510
|
+
export interface PluginConversationError {
|
|
511
|
+
code: PluginConversationErrorCode;
|
|
512
|
+
message: string;
|
|
513
|
+
retryable: boolean;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export interface PluginSessionMessagesState {
|
|
517
|
+
messages: readonly PluginConversationMessage[];
|
|
518
|
+
loading: boolean;
|
|
519
|
+
hydrated: boolean;
|
|
520
|
+
loadingMore: boolean;
|
|
521
|
+
error: PluginConversationError | null;
|
|
522
|
+
hasMore: boolean;
|
|
523
|
+
removed: boolean;
|
|
524
|
+
loadMore(): Promise<number>;
|
|
525
|
+
retry(): void;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export interface PluginSessionTurnsState {
|
|
529
|
+
turns: readonly PluginConversationTurn[];
|
|
530
|
+
loading: boolean;
|
|
531
|
+
hydrated: boolean;
|
|
532
|
+
error: PluginConversationError | null;
|
|
533
|
+
removed: boolean;
|
|
534
|
+
retry(): void;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface PluginConversationApi {
|
|
538
|
+
useSessionMessages(query: PluginSessionMessagesQuery): PluginSessionMessagesState;
|
|
539
|
+
useSessionTurns(sessionId: string | null, taskId?: string | null): PluginSessionTurnsState;
|
|
540
|
+
useMessageFavorite(sessionId: string | null, messageId: string): boolean;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface PluginTaskStatusSnapshot {
|
|
544
|
+
taskId: string;
|
|
545
|
+
title: string;
|
|
546
|
+
state: string;
|
|
547
|
+
workflowStepId?: string;
|
|
548
|
+
statusSummary?: {
|
|
549
|
+
revision: number;
|
|
550
|
+
foregroundActivity?: string;
|
|
551
|
+
activeSubagentCount?: number;
|
|
552
|
+
queuedPromptCount?: number;
|
|
553
|
+
completionGate?: { verifiedCount: number; criteriaCount: number; blocked: boolean };
|
|
554
|
+
activeError?: { preview: string; category?: string };
|
|
555
|
+
} | null;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface PluginTaskUsageSnapshot {
|
|
559
|
+
taskId: string;
|
|
560
|
+
sessionId?: string;
|
|
561
|
+
tokensIn: number;
|
|
562
|
+
tokensCachedRead: number;
|
|
563
|
+
tokensCachedWrite: number;
|
|
564
|
+
tokensOut: number;
|
|
565
|
+
tokensThought: number;
|
|
566
|
+
tokensTotal: number;
|
|
567
|
+
/** Hundredths of a cent, as returned by Kandev's task usage API. */
|
|
568
|
+
costSubcents: number;
|
|
569
|
+
eventCount: number;
|
|
570
|
+
estimatedEventCount: number;
|
|
571
|
+
unpricedEventCount: number;
|
|
572
|
+
outputTokensComplete: boolean;
|
|
573
|
+
firstEventAt?: string | null;
|
|
574
|
+
lastEventAt?: string | null;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export interface PluginQueryState<Value> {
|
|
578
|
+
data: Value | null;
|
|
579
|
+
loading: boolean;
|
|
580
|
+
error: string | null;
|
|
581
|
+
refetch(): Promise<void>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export interface PluginHostQueriesApi {
|
|
585
|
+
useTaskStatus(taskId: string | null): PluginQueryState<PluginTaskStatusSnapshot>;
|
|
586
|
+
useTaskUsage(
|
|
587
|
+
taskId: string | null,
|
|
588
|
+
sessionId?: string | null,
|
|
589
|
+
): PluginQueryState<PluginTaskUsageSnapshot>;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export type PluginManagedConversationState =
|
|
593
|
+
| "loading"
|
|
594
|
+
| "ready"
|
|
595
|
+
| "paused"
|
|
596
|
+
| "disconnected"
|
|
597
|
+
| "revoked"
|
|
598
|
+
| "unsupported"
|
|
599
|
+
| "unavailable"
|
|
600
|
+
| "detached";
|
|
601
|
+
|
|
602
|
+
export interface PluginManagedConversationOption {
|
|
603
|
+
id: string;
|
|
604
|
+
label: string;
|
|
605
|
+
description?: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export interface PluginManagedConversationQuestion {
|
|
609
|
+
id: string;
|
|
610
|
+
title: string;
|
|
611
|
+
prompt?: string;
|
|
612
|
+
options?: readonly PluginManagedConversationOption[];
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export interface PluginManagedConversationClarificationAnswer {
|
|
616
|
+
questionId: string;
|
|
617
|
+
selectedOptions?: readonly string[];
|
|
618
|
+
customText?: string;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export interface PluginManagedConversationInteraction {
|
|
622
|
+
id: string;
|
|
623
|
+
kind: "permission" | "clarification";
|
|
624
|
+
title: string;
|
|
625
|
+
context?: string;
|
|
626
|
+
expectedResourceVersion: string;
|
|
627
|
+
options?: readonly PluginManagedConversationOption[];
|
|
628
|
+
questions?: readonly PluginManagedConversationQuestion[];
|
|
629
|
+
agentDisconnected?: boolean;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export interface PluginManagedConversationSnapshot {
|
|
633
|
+
workspaceId: string;
|
|
634
|
+
instanceKey: string;
|
|
635
|
+
taskId: string;
|
|
636
|
+
sessionId: string | null;
|
|
637
|
+
/** Host conversation revision for managed input and lifecycle commands. */
|
|
638
|
+
revision: number;
|
|
639
|
+
/** Current session resource version used by safe execution recovery. */
|
|
640
|
+
sessionResourceVersion: string;
|
|
641
|
+
executionId?: string;
|
|
642
|
+
sessionState?: string;
|
|
643
|
+
state: PluginManagedConversationState;
|
|
644
|
+
readOnly?: boolean;
|
|
645
|
+
statusReason?: string;
|
|
646
|
+
recoverySupported?: boolean;
|
|
647
|
+
recoveryReason?: string;
|
|
648
|
+
pendingInteractions: readonly PluginManagedConversationInteraction[];
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export interface PluginManagedConversationInputIntent {
|
|
652
|
+
requestId: string;
|
|
653
|
+
idempotencyKey: string;
|
|
654
|
+
occurrenceKey: string;
|
|
655
|
+
origin: "human";
|
|
656
|
+
payload: string;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export interface PluginManagedConversationController {
|
|
660
|
+
getStatus(): Promise<PluginManagedConversationSnapshot>;
|
|
661
|
+
listInputs(input: { sequenceCursor: number; limit: number }): Promise<{
|
|
662
|
+
inputs: readonly PluginHostV2ManagedAgentInputReceipt[];
|
|
663
|
+
nextSequenceCursor: number;
|
|
664
|
+
hasMore: boolean;
|
|
665
|
+
}>;
|
|
666
|
+
enqueue(
|
|
667
|
+
input: PluginManagedConversationInputIntent & { expectedConversationRevision: number },
|
|
668
|
+
): Promise<{
|
|
669
|
+
receipt: PluginHostV2ManagedAgentInputReceipt;
|
|
670
|
+
}>;
|
|
671
|
+
cancelInput(input: {
|
|
672
|
+
requestId: string;
|
|
673
|
+
idempotencyKey: string;
|
|
674
|
+
expectedConversationRevision: number;
|
|
675
|
+
hostInputId: string;
|
|
676
|
+
expectedExecutionId?: string;
|
|
677
|
+
}): Promise<{ receipt: PluginHostV2ManagedAgentInputReceipt }>;
|
|
678
|
+
setPaused(input: {
|
|
679
|
+
requestId: string;
|
|
680
|
+
idempotencyKey: string;
|
|
681
|
+
expectedConversationRevision: number;
|
|
682
|
+
paused: boolean;
|
|
683
|
+
}): Promise<PluginManagedConversationSnapshot>;
|
|
684
|
+
recover(input: {
|
|
685
|
+
requestId: string;
|
|
686
|
+
idempotencyKey: string;
|
|
687
|
+
expectedConversationRevision: number;
|
|
688
|
+
expectedSessionResourceVersion: string;
|
|
689
|
+
expectedExecutionId: string;
|
|
690
|
+
}): Promise<PluginManagedConversationSnapshot>;
|
|
691
|
+
respondToPermission(input: {
|
|
692
|
+
requestId: string;
|
|
693
|
+
interactionId: string;
|
|
694
|
+
expectedResourceVersion: string;
|
|
695
|
+
optionId?: string;
|
|
696
|
+
cancelled?: boolean;
|
|
697
|
+
humanResponseReceiptId: string;
|
|
698
|
+
}): Promise<void>;
|
|
699
|
+
answerClarification(input: {
|
|
700
|
+
requestId: string;
|
|
701
|
+
interactionId: string;
|
|
702
|
+
expectedResourceVersion: string;
|
|
703
|
+
answers: readonly PluginManagedConversationClarificationAnswer[];
|
|
704
|
+
humanResponseReceiptId: string;
|
|
705
|
+
}): Promise<void>;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export interface PluginManagedConversationInstance {
|
|
709
|
+
key: string;
|
|
710
|
+
label: string;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export interface PluginWorkspaceAgentChatProps {
|
|
714
|
+
conversation: PluginManagedConversationSnapshot;
|
|
715
|
+
controller: PluginManagedConversationController;
|
|
716
|
+
instances?: readonly PluginManagedConversationInstance[];
|
|
717
|
+
onSelectInstance?(instanceKey: string): void;
|
|
718
|
+
tasksPanel?: HostNode;
|
|
719
|
+
outcomesPanel?: HostNode;
|
|
720
|
+
onStatus?(status: PluginManagedConversationSnapshot): void;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export interface PluginHumanInteractionResponseInput {
|
|
724
|
+
workspaceId: string;
|
|
725
|
+
interactionId: string;
|
|
726
|
+
expectedResourceVersion: string;
|
|
727
|
+
response:
|
|
728
|
+
| { kind: "permission"; optionId: string; cancelled?: false }
|
|
729
|
+
| { kind: "permission"; optionId?: never; cancelled: true }
|
|
730
|
+
| {
|
|
731
|
+
kind: "clarification";
|
|
732
|
+
answers: readonly PluginManagedConversationClarificationAnswer[];
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
export interface PluginHostInteractionsApi {
|
|
737
|
+
/** Issues a short-lived receipt for an authenticated human response. */
|
|
738
|
+
issueResponseReceipt(input: PluginHumanInteractionResponseInput): Promise<{
|
|
739
|
+
id: string;
|
|
740
|
+
interactionId: string;
|
|
741
|
+
resourceVersion: string;
|
|
742
|
+
expiresAt: string;
|
|
743
|
+
}>;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export interface PluginWorkspaceTaskSurfaceProps {
|
|
747
|
+
taskId: string;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export interface PluginWorkspaceTaskUsageProps extends PluginWorkspaceTaskSurfaceProps {
|
|
751
|
+
sessionId?: string | null;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export type PluginOpenMessageResult = { status: "accepted" | "unavailable" };
|
|
755
|
+
|
|
756
|
+
export interface PluginTaskPanelConversationCapability {
|
|
757
|
+
openMessage(messageId: string): PluginOpenMessageResult;
|
|
758
|
+
history: PluginConversationApi;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export interface PluginTaskPanelContext {
|
|
762
|
+
taskId: string;
|
|
763
|
+
sessionId: string | null;
|
|
764
|
+
sessionKind: PluginSessionKind;
|
|
765
|
+
presentation: "desktop" | "mobile";
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
export interface PluginTaskPanelProps extends PluginTaskPanelContext {
|
|
769
|
+
panelId: string;
|
|
770
|
+
conversation: PluginTaskPanelConversationCapability;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface TaskPanelRegistration {
|
|
774
|
+
id: string;
|
|
775
|
+
title: string;
|
|
776
|
+
titleKey?: string;
|
|
777
|
+
icon?: PluginIcon;
|
|
778
|
+
Component: Component<PluginTaskPanelProps>;
|
|
779
|
+
mobileEnabled?: boolean;
|
|
780
|
+
visible?(context: PluginTaskPanelContext): boolean;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export interface PluginTaskMenuContext {
|
|
784
|
+
workspaceId: string;
|
|
785
|
+
taskId: string;
|
|
786
|
+
taskTitle: string;
|
|
787
|
+
workflowStepId: string | null;
|
|
788
|
+
presentation: "desktop" | "mobile";
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* One child of a task menu action that declares `items`. Unlike the parent
|
|
793
|
+
* action, an item is never registered on its own: it exists only inside its
|
|
794
|
+
* parent's submenu, so it has no `group`, no `visible`, and its own nesting is
|
|
795
|
+
* not supported (one level deep).
|
|
796
|
+
*/
|
|
797
|
+
export interface TaskMenuSubItemRegistration {
|
|
798
|
+
/** Unique within the parent action; contributes to the menu entry's React key. */
|
|
799
|
+
id: string;
|
|
800
|
+
label: string;
|
|
801
|
+
icon?: PluginIcon;
|
|
802
|
+
disabled?: boolean;
|
|
803
|
+
run(context: PluginTaskMenuContext): void | Promise<void>;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export interface TaskMenuActionRegistration {
|
|
807
|
+
id: string;
|
|
808
|
+
label: string;
|
|
809
|
+
icon?: PluginIcon;
|
|
810
|
+
group: "edit" | "primary";
|
|
811
|
+
visible?(context: PluginTaskMenuContext): boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Declaring this turns the action into a submenu: the host renders `label`
|
|
814
|
+
* as an unselectable submenu trigger and calls `items(context)` to get its
|
|
815
|
+
* children, in the returned order. It must be synchronous and cheap: the
|
|
816
|
+
* host cannot await a menu item, and it builds a card's or row's entries on
|
|
817
|
+
* every render — a card's dropdown and context variants are built from one
|
|
818
|
+
* evaluation, whether or not a menu is open — so an implementation that
|
|
819
|
+
* scans or sorts should memoize on the state it reads.
|
|
820
|
+
*
|
|
821
|
+
* `run` then serves as the fallback for a host that predates submenus (it
|
|
822
|
+
* ignores this field and renders the flat item) and for a build where
|
|
823
|
+
* `items` yields nothing usable: an empty list, or a throw (caught,
|
|
824
|
+
* logged, and treated as empty). Either way the action stays reachable
|
|
825
|
+
* instead of becoming a trigger with no children.
|
|
826
|
+
*/
|
|
827
|
+
items?(context: PluginTaskMenuContext): readonly TaskMenuSubItemRegistration[];
|
|
828
|
+
/** A rejection is caught and logged; the menu closes either way. */
|
|
829
|
+
run(context: PluginTaskMenuContext): void | Promise<void>;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export interface PluginTaskFilterOption {
|
|
833
|
+
value: string;
|
|
834
|
+
label: string;
|
|
835
|
+
color?: string;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export interface TaskFilterRegistration {
|
|
839
|
+
id: string;
|
|
840
|
+
label: string;
|
|
841
|
+
getOptions(): PluginTaskFilterOption[];
|
|
842
|
+
matches(context: { taskId: string }, selected: string[]): boolean;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
export interface TaskListFacetValue {
|
|
846
|
+
value: string;
|
|
847
|
+
label: string;
|
|
848
|
+
color?: string;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export interface TaskListFacetContext {
|
|
852
|
+
taskId: string;
|
|
853
|
+
workspaceId?: string;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/** A synchronous, page-local facet contribution for the host task list. */
|
|
857
|
+
export interface TaskListFacetRegistration {
|
|
858
|
+
id: string;
|
|
859
|
+
label: string;
|
|
860
|
+
getValues(context: TaskListFacetContext): readonly TaskListFacetValue[];
|
|
861
|
+
subscribe?(listener: () => void): () => void;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export type PluginStorageScope = "instance" | "workspace" | "task" | "session" | "repository";
|
|
865
|
+
|
|
866
|
+
export interface PluginStorageEntry {
|
|
867
|
+
key: string;
|
|
868
|
+
value: unknown;
|
|
869
|
+
updatedAt: string;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export interface PluginUserStateChange {
|
|
873
|
+
scope: PluginStorageScope;
|
|
874
|
+
scopeId: string;
|
|
875
|
+
key: string;
|
|
876
|
+
updatedAt: string;
|
|
877
|
+
deleted?: boolean;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
export interface PluginStorageApi {
|
|
881
|
+
get(
|
|
882
|
+
scope: PluginStorageScope,
|
|
883
|
+
scopeId: string,
|
|
884
|
+
key: string,
|
|
885
|
+
options?: { signal?: AbortSignal },
|
|
886
|
+
): Promise<PluginStorageEntry | undefined>;
|
|
887
|
+
set(
|
|
888
|
+
scope: PluginStorageScope,
|
|
889
|
+
scopeId: string,
|
|
890
|
+
key: string,
|
|
891
|
+
value: unknown,
|
|
892
|
+
options?: { signal?: AbortSignal; writerId?: string; ifUnmodifiedSince?: string },
|
|
893
|
+
): Promise<{ updatedAt: string }>;
|
|
894
|
+
delete(
|
|
895
|
+
scope: PluginStorageScope,
|
|
896
|
+
scopeId: string,
|
|
897
|
+
key: string,
|
|
898
|
+
options?: { signal?: AbortSignal; writerId?: string },
|
|
899
|
+
): Promise<void>;
|
|
900
|
+
list(
|
|
901
|
+
scope: PluginStorageScope,
|
|
902
|
+
scopeId: string,
|
|
903
|
+
options?: { signal?: AbortSignal },
|
|
904
|
+
): Promise<PluginStorageEntry[]>;
|
|
905
|
+
subscribe(
|
|
906
|
+
filter: { scope?: PluginStorageScope; scopeId?: string; key?: string; writerId?: string },
|
|
907
|
+
listener: (change: PluginUserStateChange) => void,
|
|
908
|
+
): () => void;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/** Named host components. Values are runtime-owned and rendered through host.jsx. */
|
|
912
|
+
interface PluginUIShape {
|
|
913
|
+
Accordion: unknown;
|
|
914
|
+
AccordionContent: unknown;
|
|
915
|
+
AccordionItem: unknown;
|
|
916
|
+
AccordionTrigger: unknown;
|
|
917
|
+
Alert: unknown;
|
|
918
|
+
AlertDescription: unknown;
|
|
919
|
+
AlertTitle: unknown;
|
|
920
|
+
Badge: unknown;
|
|
921
|
+
Button: unknown;
|
|
922
|
+
Action: Component<PluginActionProps>;
|
|
923
|
+
ActionGroup: Component<PluginActionGroupProps>;
|
|
924
|
+
Card: unknown;
|
|
925
|
+
CardAction: unknown;
|
|
926
|
+
CardContent: unknown;
|
|
927
|
+
CardDescription: unknown;
|
|
928
|
+
CardFooter: unknown;
|
|
929
|
+
CardHeader: unknown;
|
|
930
|
+
CardTitle: unknown;
|
|
931
|
+
ChartContainer: unknown;
|
|
932
|
+
ChartLegend: unknown;
|
|
933
|
+
ChartLegendContent: unknown;
|
|
934
|
+
ChartStyle: unknown;
|
|
935
|
+
ChartTooltip: unknown;
|
|
936
|
+
ChartTooltipContent: unknown;
|
|
937
|
+
Checkbox: unknown;
|
|
938
|
+
Collapsible: unknown;
|
|
939
|
+
CollapsibleContent: unknown;
|
|
940
|
+
CollapsibleTrigger: unknown;
|
|
941
|
+
ChangeRequestDetail: unknown;
|
|
942
|
+
ChangeRequestList: unknown;
|
|
943
|
+
ChangeRequestRow: unknown;
|
|
944
|
+
Dialog: unknown;
|
|
945
|
+
DialogClose: unknown;
|
|
946
|
+
DialogContent: unknown;
|
|
947
|
+
DialogDescription: unknown;
|
|
948
|
+
DialogFooter: unknown;
|
|
949
|
+
DialogHeader: unknown;
|
|
950
|
+
DialogTitle: unknown;
|
|
951
|
+
DialogTrigger: unknown;
|
|
952
|
+
Drawer: unknown;
|
|
953
|
+
DrawerClose: unknown;
|
|
954
|
+
DrawerContent: unknown;
|
|
955
|
+
DrawerDescription: unknown;
|
|
956
|
+
DrawerFooter: unknown;
|
|
957
|
+
DrawerHeader: unknown;
|
|
958
|
+
DrawerOverlay: unknown;
|
|
959
|
+
DrawerPortal: unknown;
|
|
960
|
+
DrawerTitle: unknown;
|
|
961
|
+
DrawerTrigger: unknown;
|
|
962
|
+
DropdownMenu: unknown;
|
|
963
|
+
DropdownMenuContent: unknown;
|
|
964
|
+
DropdownMenuItem: unknown;
|
|
965
|
+
DropdownMenuSeparator: unknown;
|
|
966
|
+
DropdownMenuTrigger: unknown;
|
|
967
|
+
Empty: unknown;
|
|
968
|
+
EmptyContent: unknown;
|
|
969
|
+
EmptyDescription: unknown;
|
|
970
|
+
EmptyHeader: unknown;
|
|
971
|
+
EmptyMedia: unknown;
|
|
972
|
+
EmptyTitle: unknown;
|
|
973
|
+
Input: unknown;
|
|
974
|
+
IntegrationCursorPagination: unknown;
|
|
975
|
+
IntegrationChangeRequestStatus: unknown;
|
|
976
|
+
IntegrationIcon: unknown;
|
|
977
|
+
IntegrationListToolbar: unknown;
|
|
978
|
+
IntegrationRepositoryFilter: unknown;
|
|
979
|
+
IntegrationSaveQueryDialog: unknown;
|
|
980
|
+
IntegrationScopeBar: unknown;
|
|
981
|
+
IntegrationStartTaskMenu: unknown;
|
|
982
|
+
Kbd: unknown;
|
|
983
|
+
KbdGroup: unknown;
|
|
984
|
+
Label: unknown;
|
|
985
|
+
PageTopbar: unknown;
|
|
986
|
+
Pagination: unknown;
|
|
987
|
+
PaginationContent: unknown;
|
|
988
|
+
PaginationEllipsis: unknown;
|
|
989
|
+
PaginationItem: unknown;
|
|
990
|
+
PaginationLink: unknown;
|
|
991
|
+
PaginationNext: unknown;
|
|
992
|
+
PaginationPrevious: unknown;
|
|
993
|
+
Popover: unknown;
|
|
994
|
+
PopoverAnchor: unknown;
|
|
995
|
+
PopoverContent: unknown;
|
|
996
|
+
PopoverDescription: unknown;
|
|
997
|
+
PopoverHeader: unknown;
|
|
998
|
+
PopoverTitle: unknown;
|
|
999
|
+
PopoverTrigger: unknown;
|
|
1000
|
+
Progress: unknown;
|
|
1001
|
+
PromptMentionText: Component<{ text: string; interactive?: boolean }>;
|
|
1002
|
+
RichTextEditor: unknown;
|
|
1003
|
+
RichTextReadOnly: unknown;
|
|
1004
|
+
ScrollArea: unknown;
|
|
1005
|
+
Select: unknown;
|
|
1006
|
+
SelectContent: unknown;
|
|
1007
|
+
SelectItem: unknown;
|
|
1008
|
+
SelectTrigger: unknown;
|
|
1009
|
+
SelectValue: unknown;
|
|
1010
|
+
Separator: unknown;
|
|
1011
|
+
Sheet: unknown;
|
|
1012
|
+
SheetClose: unknown;
|
|
1013
|
+
SheetContent: unknown;
|
|
1014
|
+
SheetDescription: unknown;
|
|
1015
|
+
SheetFooter: unknown;
|
|
1016
|
+
SheetHeader: unknown;
|
|
1017
|
+
SheetTitle: unknown;
|
|
1018
|
+
SheetTrigger: unknown;
|
|
1019
|
+
Skeleton: unknown;
|
|
1020
|
+
Spinner: unknown;
|
|
1021
|
+
Switch: unknown;
|
|
1022
|
+
Table: unknown;
|
|
1023
|
+
TableBody: unknown;
|
|
1024
|
+
TableCell: unknown;
|
|
1025
|
+
TableHead: unknown;
|
|
1026
|
+
TableHeader: unknown;
|
|
1027
|
+
TableRow: unknown;
|
|
1028
|
+
Tabs: unknown;
|
|
1029
|
+
TabsContent: unknown;
|
|
1030
|
+
TabsList: unknown;
|
|
1031
|
+
TabsTrigger: unknown;
|
|
1032
|
+
TaskCreateDialog: unknown;
|
|
1033
|
+
TaskRowIndicator: unknown;
|
|
1034
|
+
Textarea: unknown;
|
|
1035
|
+
Tooltip: unknown;
|
|
1036
|
+
TooltipContent: unknown;
|
|
1037
|
+
TooltipProvider: unknown;
|
|
1038
|
+
TooltipTrigger: unknown;
|
|
1039
|
+
Combobox: unknown;
|
|
1040
|
+
IntegrationAuthStatusBanner: unknown;
|
|
1041
|
+
IntegrationEnabledControl: unknown;
|
|
1042
|
+
SettingsSection: unknown;
|
|
1043
|
+
SettingsCard: unknown;
|
|
1044
|
+
WorkspaceScopedSection: unknown;
|
|
1045
|
+
WorkspaceAgentChat: Component<PluginWorkspaceAgentChatProps>;
|
|
1046
|
+
WorkspaceTaskStatus: Component<PluginWorkspaceTaskSurfaceProps>;
|
|
1047
|
+
WorkspaceTaskUsage: Component<PluginWorkspaceTaskUsageProps>;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
export type SettingsSaveRevision = string | number;
|
|
1051
|
+
|
|
1052
|
+
export type SettingsSaveContributor = {
|
|
1053
|
+
id: string;
|
|
1054
|
+
order?: number;
|
|
1055
|
+
revision: SettingsSaveRevision;
|
|
1056
|
+
isDirty: boolean;
|
|
1057
|
+
canSave?: boolean;
|
|
1058
|
+
invalidReason?: string;
|
|
1059
|
+
save: (revision: SettingsSaveRevision) => Promise<void> | void;
|
|
1060
|
+
discard: (revision?: SettingsSaveRevision) => Promise<void> | void;
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
export type PluginUIApi = {
|
|
1064
|
+
readonly [Name in keyof PluginUIShape]: PluginUIShape[Name] extends Component<infer Props>
|
|
1065
|
+
? Component<Props>
|
|
1066
|
+
: HostComponent;
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
export interface PluginToastApi {
|
|
1070
|
+
(message: string, options?: Record<string, unknown>): string | number;
|
|
1071
|
+
success(message: string, options?: Record<string, unknown>): string | number;
|
|
1072
|
+
error(message: string, options?: Record<string, unknown>): string | number;
|
|
1073
|
+
warning(message: string, options?: Record<string, unknown>): string | number;
|
|
1074
|
+
info(message: string, options?: Record<string, unknown>): string | number;
|
|
1075
|
+
dismiss(id?: string | number): unknown;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
export type PluginTranslationValues = Readonly<Record<string, string | number>>;
|
|
1079
|
+
|
|
1080
|
+
export type PluginTranslationOptions = {
|
|
1081
|
+
defaultValue?: string;
|
|
1082
|
+
count?: number;
|
|
1083
|
+
values?: PluginTranslationValues;
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
export type PluginTranslationCatalogs = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1087
|
+
|
|
1088
|
+
export interface PluginI18nApi {
|
|
1089
|
+
readonly locale: string;
|
|
1090
|
+
t(key: string, options?: PluginTranslationOptions): string;
|
|
1091
|
+
useTranslation(): {
|
|
1092
|
+
readonly locale: string;
|
|
1093
|
+
t(key: string, options?: PluginTranslationOptions): string;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/** Exact backend Host operations advertised for one approved installation. */
|
|
1098
|
+
export interface PluginHostV2OperationSupport {
|
|
1099
|
+
method: string;
|
|
1100
|
+
capabilityId: string;
|
|
1101
|
+
description: string;
|
|
1102
|
+
supported: boolean;
|
|
1103
|
+
authorized: boolean;
|
|
1104
|
+
unavailableReason: string;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/** Workspace-scoped v2 feature discovery returned by the Go pluginsdk. */
|
|
1108
|
+
export interface PluginHostV2CapabilityContext {
|
|
1109
|
+
installationId: string;
|
|
1110
|
+
workspaceId: string;
|
|
1111
|
+
manifestDigest: string;
|
|
1112
|
+
approvalRevision: number;
|
|
1113
|
+
approvalState: string;
|
|
1114
|
+
operations: readonly PluginHostV2OperationSupport[];
|
|
1115
|
+
limits: Readonly<Record<string, number>>;
|
|
1116
|
+
supportedProviders: readonly string[];
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export type PluginHostV2CommandStatus =
|
|
1120
|
+
| "APPLIED"
|
|
1121
|
+
| "ALREADY_APPLIED"
|
|
1122
|
+
| "NO_CHANGE"
|
|
1123
|
+
| "CONFLICT"
|
|
1124
|
+
| "DENIED"
|
|
1125
|
+
| "NOT_FOUND"
|
|
1126
|
+
| "INVALID"
|
|
1127
|
+
| "UNSUPPORTED"
|
|
1128
|
+
| "RATE_LIMITED"
|
|
1129
|
+
| "UNAVAILABLE"
|
|
1130
|
+
| "PARTIAL"
|
|
1131
|
+
| "UNCERTAIN";
|
|
1132
|
+
|
|
1133
|
+
/** Durable result metadata returned by an exact backend Host command. */
|
|
1134
|
+
export interface PluginHostV2CommandReceipt {
|
|
1135
|
+
id: string;
|
|
1136
|
+
operationId: string;
|
|
1137
|
+
status: PluginHostV2CommandStatus;
|
|
1138
|
+
targetId: string;
|
|
1139
|
+
resourceVersion: string;
|
|
1140
|
+
approvalRevision: number;
|
|
1141
|
+
createdAt: string;
|
|
1142
|
+
updatedAt: string;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
export interface PluginHostV2CommandResult {
|
|
1146
|
+
status: PluginHostV2CommandStatus;
|
|
1147
|
+
reason?: string;
|
|
1148
|
+
receipt?: PluginHostV2CommandReceipt;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/** The exact task patch supported by the first Host v2 command. */
|
|
1152
|
+
export interface PluginHostV2TaskUpdate {
|
|
1153
|
+
requestId: string;
|
|
1154
|
+
workspaceId: string;
|
|
1155
|
+
taskId: string;
|
|
1156
|
+
idempotencyKey: string;
|
|
1157
|
+
expectedResourceVersion: string;
|
|
1158
|
+
approvalRevision: number;
|
|
1159
|
+
manifestDigest: string;
|
|
1160
|
+
title?: string;
|
|
1161
|
+
description?: string;
|
|
1162
|
+
state?: string;
|
|
1163
|
+
priority?: string;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export interface PluginHostV2TaskCommandContext {
|
|
1167
|
+
requestId: string;
|
|
1168
|
+
workspaceId: string;
|
|
1169
|
+
taskId: string;
|
|
1170
|
+
idempotencyKey: string;
|
|
1171
|
+
expectedResourceVersion: string;
|
|
1172
|
+
approvalRevision: number;
|
|
1173
|
+
manifestDigest: string;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/** Exact task label replacement projected by a plugin backend to its UI. */
|
|
1177
|
+
export interface PluginHostV2TaskLabels extends PluginHostV2TaskCommandContext {
|
|
1178
|
+
labels: readonly string[];
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/** Human assignee update. Agent assignment uses a separate native command. */
|
|
1182
|
+
export interface PluginHostV2TaskAssignment extends PluginHostV2TaskCommandContext {
|
|
1183
|
+
assigneeUserId: string;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/** Workflow move projected by a plugin backend to its UI. */
|
|
1187
|
+
export interface PluginHostV2TaskMove extends PluginHostV2TaskCommandContext {
|
|
1188
|
+
workflowId?: string;
|
|
1189
|
+
workflowStepId: string;
|
|
1190
|
+
position: number;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/** Native task archive request projected by a plugin backend to its UI. */
|
|
1194
|
+
export interface PluginHostV2TaskArchive extends PluginHostV2TaskCommandContext {}
|
|
1195
|
+
|
|
1196
|
+
export type PluginHostV2TaskCompletionEvidenceKind =
|
|
1197
|
+
| "task_revision"
|
|
1198
|
+
| "execution"
|
|
1199
|
+
| "artifact_revision"
|
|
1200
|
+
| "github_pr_head";
|
|
1201
|
+
|
|
1202
|
+
export interface PluginHostV2TaskCompletionEvidenceSubject {
|
|
1203
|
+
kind: PluginHostV2TaskCompletionEvidenceKind;
|
|
1204
|
+
id: string;
|
|
1205
|
+
revision?: string;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
export interface PluginHostV2TaskCompletionEvidence {
|
|
1209
|
+
subject: PluginHostV2TaskCompletionEvidenceSubject;
|
|
1210
|
+
summary?: string;
|
|
1211
|
+
reference?: string;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
export interface PluginHostV2TaskCompletionCriterion {
|
|
1215
|
+
id: string;
|
|
1216
|
+
description: string;
|
|
1217
|
+
evidenceSubject: PluginHostV2TaskCompletionEvidenceSubject;
|
|
1218
|
+
criterionRevision: number;
|
|
1219
|
+
verifiedRevision: number;
|
|
1220
|
+
evidence?: PluginHostV2TaskCompletionEvidence;
|
|
1221
|
+
verifierKind?: string;
|
|
1222
|
+
verifierId?: string;
|
|
1223
|
+
verifiedAt?: string;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export interface PluginHostV2TaskCompletionBlocker {
|
|
1227
|
+
criterionId: string;
|
|
1228
|
+
reason: string;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** Bounded task-owned completion snapshot projected by a plugin backend. */
|
|
1232
|
+
export interface PluginHostV2TaskCompletionGateSnapshot {
|
|
1233
|
+
taskId: string;
|
|
1234
|
+
workspaceId: string;
|
|
1235
|
+
revision: number;
|
|
1236
|
+
criteria: readonly PluginHostV2TaskCompletionCriterion[];
|
|
1237
|
+
blockers: readonly PluginHostV2TaskCompletionBlocker[];
|
|
1238
|
+
blocked: boolean;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
export type PluginHostV2ManagedAgentInputOrigin =
|
|
1242
|
+
| "human"
|
|
1243
|
+
| "automation"
|
|
1244
|
+
| "periodic"
|
|
1245
|
+
| "interaction";
|
|
1246
|
+
|
|
1247
|
+
export type PluginHostV2ManagedAgentInputState =
|
|
1248
|
+
| "accepted"
|
|
1249
|
+
| "running"
|
|
1250
|
+
| "completed"
|
|
1251
|
+
| "failed"
|
|
1252
|
+
| "cancelled"
|
|
1253
|
+
| "uncertain";
|
|
1254
|
+
|
|
1255
|
+
export type PluginHostV2ManagedDispatchStatus = "busy" | "started" | "sent";
|
|
1256
|
+
|
|
1257
|
+
/** Host-owned receipt for one durably admitted managed conversation input. */
|
|
1258
|
+
export interface PluginHostV2ManagedAgentInputReceipt {
|
|
1259
|
+
hostInputId: string;
|
|
1260
|
+
occurrenceKey: string;
|
|
1261
|
+
sequence: number;
|
|
1262
|
+
origin: PluginHostV2ManagedAgentInputOrigin;
|
|
1263
|
+
payload: string;
|
|
1264
|
+
coalesceKey: string;
|
|
1265
|
+
conversationRevision: number;
|
|
1266
|
+
state: PluginHostV2ManagedAgentInputState;
|
|
1267
|
+
createdAt: string;
|
|
1268
|
+
updatedAt: string;
|
|
1269
|
+
queueEntryId: string;
|
|
1270
|
+
executionId: string;
|
|
1271
|
+
turnId: string;
|
|
1272
|
+
supersededBy: string;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/** Exact authorization and idempotency metadata for durable input admission. */
|
|
1276
|
+
export interface PluginHostV2ManagedAgentInputEnqueue {
|
|
1277
|
+
requestId: string;
|
|
1278
|
+
idempotencyKey: string;
|
|
1279
|
+
workspaceId: string;
|
|
1280
|
+
instanceKey: string;
|
|
1281
|
+
expectedConversationRevision: number;
|
|
1282
|
+
approvalRevision: number;
|
|
1283
|
+
manifestDigest: string;
|
|
1284
|
+
occurrenceKey: string;
|
|
1285
|
+
origin: PluginHostV2ManagedAgentInputOrigin;
|
|
1286
|
+
payload: string;
|
|
1287
|
+
/** Only periodic input may use a non-empty coalescing key. */
|
|
1288
|
+
coalesceKey?: string;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
export interface PluginHostV2ManagedAgentInputQuery {
|
|
1292
|
+
workspaceId: string;
|
|
1293
|
+
instanceKey: string;
|
|
1294
|
+
hostInputId: string;
|
|
1295
|
+
approvalRevision: number;
|
|
1296
|
+
manifestDigest: string;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
export interface PluginHostV2ManagedAgentInputListQuery {
|
|
1300
|
+
workspaceId: string;
|
|
1301
|
+
instanceKey: string;
|
|
1302
|
+
sequenceCursor: number;
|
|
1303
|
+
/** The Host enforces the maximum page size. */
|
|
1304
|
+
limit: number;
|
|
1305
|
+
approvalRevision: number;
|
|
1306
|
+
manifestDigest: string;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export interface PluginHostV2ManagedAgentInputPage {
|
|
1310
|
+
inputs: readonly PluginHostV2ManagedAgentInputReceipt[];
|
|
1311
|
+
nextSequenceCursor: number;
|
|
1312
|
+
hasMore: boolean;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
export interface PluginHostV2ManagedAgentInputCancel {
|
|
1316
|
+
requestId: string;
|
|
1317
|
+
idempotencyKey: string;
|
|
1318
|
+
workspaceId: string;
|
|
1319
|
+
instanceKey: string;
|
|
1320
|
+
hostInputId: string;
|
|
1321
|
+
expectedConversationRevision: number;
|
|
1322
|
+
/** Required after start; empty only when the input is still accepted. */
|
|
1323
|
+
expectedExecutionId: string;
|
|
1324
|
+
approvalRevision: number;
|
|
1325
|
+
manifestDigest: string;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/** Immediate dispatch never queues; a busy session is reported as "busy". */
|
|
1329
|
+
export interface PluginHostV2ManagedConversationDispatch {
|
|
1330
|
+
requestId: string;
|
|
1331
|
+
idempotencyKey: string;
|
|
1332
|
+
workspaceId: string;
|
|
1333
|
+
instanceKey: string;
|
|
1334
|
+
expectedConversationRevision: number;
|
|
1335
|
+
approvalRevision: number;
|
|
1336
|
+
manifestDigest: string;
|
|
1337
|
+
occurrenceKey: string;
|
|
1338
|
+
origin: PluginHostV2ManagedAgentInputOrigin;
|
|
1339
|
+
payload: string;
|
|
1340
|
+
coalesceKey?: string;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
export interface PluginHostApi {
|
|
1344
|
+
pluginId: string;
|
|
1345
|
+
React: HostReact;
|
|
1346
|
+
jsx: ElementFactory;
|
|
1347
|
+
ui: PluginUIApi;
|
|
1348
|
+
conversation: PluginConversationApi;
|
|
1349
|
+
/** Optional on older runtimes; check before using this host read facade. */
|
|
1350
|
+
queries?: PluginHostQueriesApi;
|
|
1351
|
+
/** Optional on older runtimes; check before requesting human response receipts. */
|
|
1352
|
+
interactions?: PluginHostInteractionsApi;
|
|
1353
|
+
i18n: PluginI18nApi;
|
|
1354
|
+
context: PluginContextApi;
|
|
1355
|
+
api: {
|
|
1356
|
+
readonly baseUrl: string;
|
|
1357
|
+
fetch(path: string, init?: RequestInit): Promise<Response>;
|
|
1358
|
+
invokeAction<T>(
|
|
1359
|
+
key: string,
|
|
1360
|
+
input?: ActionInput,
|
|
1361
|
+
options?: { signal?: AbortSignal },
|
|
1362
|
+
): Promise<T>;
|
|
1363
|
+
};
|
|
1364
|
+
useResponsiveBreakpoint(): ResponsiveBreakpoint;
|
|
1365
|
+
readonly theme: "light" | "dark";
|
|
1366
|
+
onThemeChange(listener: (theme: "light" | "dark") => void): () => void;
|
|
1367
|
+
navigate(href: string, options?: { replace?: boolean }): void;
|
|
1368
|
+
openModal(options: {
|
|
1369
|
+
title?: string;
|
|
1370
|
+
description?: string;
|
|
1371
|
+
content: Component;
|
|
1372
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
1373
|
+
presentation?: "dialog" | "drawer";
|
|
1374
|
+
dismissible?: boolean;
|
|
1375
|
+
}): { close(): void };
|
|
1376
|
+
openTaskLinkDialog(options: {
|
|
1377
|
+
title: string;
|
|
1378
|
+
description: string;
|
|
1379
|
+
inputLabel: string;
|
|
1380
|
+
placeholder?: string;
|
|
1381
|
+
emptyError: string;
|
|
1382
|
+
failureMessage: string;
|
|
1383
|
+
successMessage: string;
|
|
1384
|
+
inputTestId?: string;
|
|
1385
|
+
errorTestId?: string;
|
|
1386
|
+
submitTestId?: string;
|
|
1387
|
+
onSubmit(reference: string, signal: AbortSignal): Promise<void>;
|
|
1388
|
+
}): { close(): void };
|
|
1389
|
+
openTaskReview(
|
|
1390
|
+
options:
|
|
1391
|
+
| {
|
|
1392
|
+
providerId: string;
|
|
1393
|
+
reviewKey: string;
|
|
1394
|
+
connectionScope: string;
|
|
1395
|
+
repositoryId: string;
|
|
1396
|
+
changeRequestNumber: string | number;
|
|
1397
|
+
title: string;
|
|
1398
|
+
presentation: "desktop";
|
|
1399
|
+
sessionId?: string;
|
|
1400
|
+
}
|
|
1401
|
+
| {
|
|
1402
|
+
providerId: string;
|
|
1403
|
+
reviewKey: string;
|
|
1404
|
+
connectionScope: string;
|
|
1405
|
+
repositoryId: string;
|
|
1406
|
+
changeRequestNumber: string | number;
|
|
1407
|
+
title: string;
|
|
1408
|
+
presentation: "mobile";
|
|
1409
|
+
sessionId: string;
|
|
1410
|
+
},
|
|
1411
|
+
): void;
|
|
1412
|
+
toast: PluginToastApi;
|
|
1413
|
+
utils: {
|
|
1414
|
+
cn(...inputs: unknown[]): string;
|
|
1415
|
+
generateUUID(): string;
|
|
1416
|
+
formatRelativeTime(value: string | number | Date): string;
|
|
1417
|
+
integrationStatusRefreshMs: number;
|
|
1418
|
+
};
|
|
1419
|
+
useSettingsSaveContributor(contributor: SettingsSaveContributor): void;
|
|
1420
|
+
/**
|
|
1421
|
+
* Publishes this plugin integration's enabled state for one workspace.
|
|
1422
|
+
* Drives the host sidebar's "Enabled" badge (per workspace) reactively;
|
|
1423
|
+
* persist the durable value yourself (e.g. `host.storage`) — this call
|
|
1424
|
+
* only updates live UI state.
|
|
1425
|
+
*/
|
|
1426
|
+
setIntegrationEnabled(integrationId: string, workspaceId: string, enabled: boolean): void;
|
|
1427
|
+
storage: PluginStorageApi;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
export type IntegrationSettingsActionSurface = "detail" | "index";
|
|
1431
|
+
|
|
1432
|
+
export interface IntegrationSettingsActionProps {
|
|
1433
|
+
workspaceId?: string;
|
|
1434
|
+
/** Identifies the native integration surface that mounted the action. */
|
|
1435
|
+
surface: IntegrationSettingsActionSurface;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
export interface PluginRegistry {
|
|
1439
|
+
registerTranslations(catalogs: PluginTranslationCatalogs): void;
|
|
1440
|
+
registerRoute(path: string, component: Component, options?: PluginRouteOptions): void;
|
|
1441
|
+
registerNavItem(item: {
|
|
1442
|
+
id: string;
|
|
1443
|
+
label: string;
|
|
1444
|
+
path: string;
|
|
1445
|
+
icon?: PluginIcon;
|
|
1446
|
+
section?: PluginNavSection;
|
|
1447
|
+
}): void;
|
|
1448
|
+
registerSettingsRoute(path: string, component: Component): void;
|
|
1449
|
+
registerComponent<Props = { slotProps?: unknown }>(
|
|
1450
|
+
slot: string,
|
|
1451
|
+
component: Component<Props>,
|
|
1452
|
+
): void;
|
|
1453
|
+
registerWsHandler(action: string, handler: (payload: unknown) => void): void;
|
|
1454
|
+
registerKeybinding(id: string, handler: (event: KeyboardEvent) => void): void;
|
|
1455
|
+
registerIntegrationSettings(settings: {
|
|
1456
|
+
id: string;
|
|
1457
|
+
label: string;
|
|
1458
|
+
description: string;
|
|
1459
|
+
icon?: PluginIcon;
|
|
1460
|
+
Component: Component<{ workspaceId?: string }>;
|
|
1461
|
+
/** Optional action rendered in the detail section header and index card.
|
|
1462
|
+
* Receives the routed workspace and the native surface that mounted it. */
|
|
1463
|
+
action?: Component<IntegrationSettingsActionProps>;
|
|
1464
|
+
}): void;
|
|
1465
|
+
registerRepositoryProvider(provider: RepositoryProviderRegistration): void;
|
|
1466
|
+
registerTaskAction(action: {
|
|
1467
|
+
id: string;
|
|
1468
|
+
label: string;
|
|
1469
|
+
icon?: PluginIcon;
|
|
1470
|
+
placement: "link";
|
|
1471
|
+
group?: string;
|
|
1472
|
+
visible?(context: TaskContext): boolean;
|
|
1473
|
+
singleTaskOnly?: boolean;
|
|
1474
|
+
run(context: TaskContext): Promise<void>;
|
|
1475
|
+
}): void;
|
|
1476
|
+
registerReviewProvider(provider: {
|
|
1477
|
+
id: string;
|
|
1478
|
+
label: string;
|
|
1479
|
+
icon?: PluginIcon;
|
|
1480
|
+
changeRequestNoun: string;
|
|
1481
|
+
order: number;
|
|
1482
|
+
getSnapshot(taskId: string): readonly ReviewSummary[];
|
|
1483
|
+
subscribe(taskId: string, listener: () => void): () => void;
|
|
1484
|
+
refresh(taskId: string, signal: AbortSignal): Promise<void>;
|
|
1485
|
+
getAssociationSnapshot?(workspaceId: string): readonly ReviewTaskAssociation[];
|
|
1486
|
+
subscribeAssociations?(workspaceId: string, listener: () => void): () => void;
|
|
1487
|
+
refreshAssociations?(workspaceId: string, signal: AbortSignal): Promise<void>;
|
|
1488
|
+
unlink?(context: {
|
|
1489
|
+
workspaceId: string;
|
|
1490
|
+
taskId: string;
|
|
1491
|
+
reviewKey: string;
|
|
1492
|
+
connectionScope: string;
|
|
1493
|
+
repositoryId: string;
|
|
1494
|
+
changeRequestNumber: string | number;
|
|
1495
|
+
signal: AbortSignal;
|
|
1496
|
+
}): Promise<void>;
|
|
1497
|
+
ReviewPanel: Component<{
|
|
1498
|
+
panelId: string;
|
|
1499
|
+
presentation: "desktop" | "mobile";
|
|
1500
|
+
workspaceId: string;
|
|
1501
|
+
taskId: string;
|
|
1502
|
+
sessionId?: string;
|
|
1503
|
+
reviewKey: string;
|
|
1504
|
+
connectionScope: string;
|
|
1505
|
+
repositoryId: string;
|
|
1506
|
+
changeRequestNumber: string | number;
|
|
1507
|
+
}>;
|
|
1508
|
+
Selector?: Component;
|
|
1509
|
+
EmptyState?: Component;
|
|
1510
|
+
}): void;
|
|
1511
|
+
registerTaskPanel(registration: TaskPanelRegistration): void;
|
|
1512
|
+
registerTaskMenuAction(registration: TaskMenuActionRegistration): void;
|
|
1513
|
+
registerTaskFilter(registration: TaskFilterRegistration): void;
|
|
1514
|
+
registerTaskListFacet(registration: TaskListFacetRegistration): void;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
export type PluginHost = PluginHostApi;
|
|
1518
|
+
|
|
1519
|
+
export interface KandevPlugin {
|
|
1520
|
+
initialize(registry: PluginRegistry, host: PluginHostApi): void | Promise<void>;
|
|
1521
|
+
destroy?(): void;
|
|
1522
|
+
}
|