@vagarylabs/plugin-sdk 1.1.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/README.md +1224 -0
- package/dist/bundlers.d.ts +57 -0
- package/dist/bundlers.d.ts.map +1 -0
- package/dist/bundlers.js +106 -0
- package/dist/bundlers.js.map +1 -0
- package/dist/define-plugin.d.ts +266 -0
- package/dist/define-plugin.d.ts.map +1 -0
- package/dist/define-plugin.js +85 -0
- package/dist/define-plugin.js.map +1 -0
- package/dist/dev-cli.d.ts +3 -0
- package/dist/dev-cli.d.ts.map +1 -0
- package/dist/dev-cli.js +49 -0
- package/dist/dev-cli.js.map +1 -0
- package/dist/dev-server.d.ts +34 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +194 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/host-client-factory.d.ts +312 -0
- package/dist/host-client-factory.d.ts.map +1 -0
- package/dist/host-client-factory.js +623 -0
- package/dist/host-client-factory.js.map +1 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +1556 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +369 -0
- package/dist/protocol.js.map +1 -0
- package/dist/testing.d.ts +183 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +2265 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +1621 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/components.d.ts +517 -0
- package/dist/ui/components.d.ts.map +1 -0
- package/dist/ui/components.js +135 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/hooks.d.ts +155 -0
- package/dist/ui/hooks.d.ts.map +1 -0
- package/dist/ui/hooks.js +195 -0
- package/dist/ui/hooks.js.map +1 -0
- package/dist/ui/index.d.ts +54 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +51 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/runtime.d.ts +3 -0
- package/dist/ui/runtime.d.ts.map +1 -0
- package/dist/ui/runtime.js +30 -0
- package/dist/ui/runtime.js.map +1 -0
- package/dist/ui/types.d.ts +400 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +17 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/worker-rpc-host.d.ts +128 -0
- package/dist/worker-rpc-host.d.ts.map +1 -0
- package/dist/worker-rpc-host.js +1510 -0
- package/dist/worker-rpc-host.js.map +1 -0
- package/package.json +128 -0
|
@@ -0,0 +1,1556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-RPC 2.0 message types and protocol helpers for the host ↔ worker IPC
|
|
3
|
+
* channel.
|
|
4
|
+
*
|
|
5
|
+
* The Paperclip plugin runtime uses JSON-RPC 2.0 over stdio to communicate
|
|
6
|
+
* between the host process and each plugin worker process. This module defines:
|
|
7
|
+
*
|
|
8
|
+
* - Core JSON-RPC 2.0 envelope types (request, response, notification, error)
|
|
9
|
+
* - Standard and plugin-specific error codes
|
|
10
|
+
* - Typed method maps for host→worker and worker→host calls
|
|
11
|
+
* - Helper functions for creating well-formed messages
|
|
12
|
+
*
|
|
13
|
+
* @see PLUGIN_SPEC.md §12.1 — Process Model
|
|
14
|
+
* @see PLUGIN_SPEC.md §13 — Host-Worker Protocol
|
|
15
|
+
* @see https://www.jsonrpc.org/specification
|
|
16
|
+
*/
|
|
17
|
+
import type { VagrisPluginManifestV1, PluginLauncherBounds, PluginLauncherRenderContextSnapshot, PluginStateScopeKind, Company, Project, Issue, IssueComment, IssueDocument, IssueDocumentSummary, IssueAssigneeAdapterOverrides, IssueThreadInteraction, CreateIssueThreadInteraction, PluginManagedAgentResolution, PluginManagedProjectResolution, PluginManagedRoutineResolution, PluginManagedSkillResolution, Routine, RoutineRun, Agent, Goal, PluginLocalFolderDeclaration, PrincipalPermissionGrant } from "@vagris/shared";
|
|
18
|
+
export type { PluginLauncherRenderContextSnapshot } from "@vagris/shared";
|
|
19
|
+
import type { PluginEvent, PluginIssueCheckoutOwnership, PluginIssueOrchestrationSummary, PluginIssueRelationSummary, PluginIssueSubtree, PluginIssueWakeupBatchResult, PluginIssueWakeupResult, PluginJobContext, PluginExecutionWorkspaceMetadata, PluginWorkspace, ToolRunContext, ToolResult, PluginLocalFolderListing, PluginLocalFolderStatus, PluginAccessInvite, PluginAccessMember, PluginAssignmentPreviewInput, PluginAuthorizationAuditEntry, PluginAuthorizationDecisionResult, PluginAuthorizationPolicyRecord, PluginAuthorizationPolicySummary } from "./types.js";
|
|
20
|
+
import type { PluginHealthDiagnostics, PluginApiRequestInput, PluginApiResponse, PluginConfigValidationResult, PluginWebhookInput } from "./define-plugin.js";
|
|
21
|
+
/** The JSON-RPC protocol version. Always `"2.0"`. */
|
|
22
|
+
export declare const JSONRPC_VERSION: "2.0";
|
|
23
|
+
/**
|
|
24
|
+
* A unique request identifier. JSON-RPC 2.0 allows strings or numbers;
|
|
25
|
+
* we use strings (UUIDs or monotonic counters) for all Paperclip messages.
|
|
26
|
+
*/
|
|
27
|
+
export type JsonRpcId = string | number;
|
|
28
|
+
/**
|
|
29
|
+
* Host-owned scope attached to a host→worker invocation. Workers may echo the
|
|
30
|
+
* invocation id on nested worker→host calls, but they never author this scope.
|
|
31
|
+
*/
|
|
32
|
+
export interface JsonRpcInvocationScope {
|
|
33
|
+
readonly companyId?: string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface JsonRpcInvocationContext {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly scope: JsonRpcInvocationScope;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A JSON-RPC 2.0 request message.
|
|
41
|
+
*
|
|
42
|
+
* The host sends requests to the worker (or vice versa) and expects a
|
|
43
|
+
* matching response with the same `id`.
|
|
44
|
+
*/
|
|
45
|
+
export interface JsonRpcRequest<TMethod extends string = string, TParams = unknown> {
|
|
46
|
+
readonly jsonrpc: typeof JSONRPC_VERSION;
|
|
47
|
+
/** Unique request identifier. Must be echoed in the response. */
|
|
48
|
+
readonly id: JsonRpcId;
|
|
49
|
+
/** The RPC method name to invoke. */
|
|
50
|
+
readonly method: TMethod;
|
|
51
|
+
/** Structured parameters for the method call. */
|
|
52
|
+
readonly params: TParams;
|
|
53
|
+
/**
|
|
54
|
+
* Host-issued metadata for the top-level plugin invocation that is currently
|
|
55
|
+
* executing. The worker treats this as opaque and echoes only the id on
|
|
56
|
+
* worker→host calls made from the same async execution context.
|
|
57
|
+
*/
|
|
58
|
+
readonly paperclipInvocation?: PluginInvocationContext;
|
|
59
|
+
/** Opaque top-level invocation id echoed by worker→host requests. */
|
|
60
|
+
readonly paperclipInvocationId?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A JSON-RPC 2.0 success response.
|
|
64
|
+
*/
|
|
65
|
+
export interface JsonRpcSuccessResponse<TResult = unknown> {
|
|
66
|
+
readonly jsonrpc: typeof JSONRPC_VERSION;
|
|
67
|
+
/** Echoed request identifier. */
|
|
68
|
+
readonly id: JsonRpcId;
|
|
69
|
+
/** The method return value. */
|
|
70
|
+
readonly result: TResult;
|
|
71
|
+
readonly error?: never;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A JSON-RPC 2.0 error object embedded in an error response.
|
|
75
|
+
*/
|
|
76
|
+
export interface JsonRpcError<TData = unknown> {
|
|
77
|
+
/** Machine-readable error code. */
|
|
78
|
+
readonly code: number;
|
|
79
|
+
/** Human-readable error message. */
|
|
80
|
+
readonly message: string;
|
|
81
|
+
/** Optional structured error data. */
|
|
82
|
+
readonly data?: TData;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A JSON-RPC 2.0 error response.
|
|
86
|
+
*/
|
|
87
|
+
export interface JsonRpcErrorResponse<TData = unknown> {
|
|
88
|
+
readonly jsonrpc: typeof JSONRPC_VERSION;
|
|
89
|
+
/** Echoed request identifier. */
|
|
90
|
+
readonly id: JsonRpcId | null;
|
|
91
|
+
readonly result?: never;
|
|
92
|
+
/** The error object. */
|
|
93
|
+
readonly error: JsonRpcError<TData>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A JSON-RPC 2.0 response — either success or error.
|
|
97
|
+
*/
|
|
98
|
+
export type JsonRpcResponse<TResult = unknown, TData = unknown> = JsonRpcSuccessResponse<TResult> | JsonRpcErrorResponse<TData>;
|
|
99
|
+
/**
|
|
100
|
+
* A JSON-RPC 2.0 notification (a request with no `id`).
|
|
101
|
+
*
|
|
102
|
+
* Notifications are fire-and-forget — no response is expected.
|
|
103
|
+
*/
|
|
104
|
+
export interface JsonRpcNotification<TMethod extends string = string, TParams = unknown> {
|
|
105
|
+
readonly jsonrpc: typeof JSONRPC_VERSION;
|
|
106
|
+
readonly id?: never;
|
|
107
|
+
/** The notification method name. */
|
|
108
|
+
readonly method: TMethod;
|
|
109
|
+
/** Structured parameters for the notification. */
|
|
110
|
+
readonly params: TParams;
|
|
111
|
+
/**
|
|
112
|
+
* Host-issued metadata for host→worker push notifications such as events.
|
|
113
|
+
* Worker→host notifications echo only `paperclipInvocationId`.
|
|
114
|
+
*/
|
|
115
|
+
readonly paperclipInvocation?: PluginInvocationContext;
|
|
116
|
+
/** Opaque top-level invocation id echoed by worker→host notifications. */
|
|
117
|
+
readonly paperclipInvocationId?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Any well-formed JSON-RPC 2.0 message (request, response, or notification).
|
|
121
|
+
*/
|
|
122
|
+
export type JsonRpcMessage = JsonRpcRequest | JsonRpcResponse | JsonRpcNotification;
|
|
123
|
+
/**
|
|
124
|
+
* Standard JSON-RPC 2.0 error codes.
|
|
125
|
+
*
|
|
126
|
+
* @see https://www.jsonrpc.org/specification#error_object
|
|
127
|
+
*/
|
|
128
|
+
export declare const JSONRPC_ERROR_CODES: {
|
|
129
|
+
/** Invalid JSON was received by the server. */
|
|
130
|
+
readonly PARSE_ERROR: -32700;
|
|
131
|
+
/** The JSON sent is not a valid Request object. */
|
|
132
|
+
readonly INVALID_REQUEST: -32600;
|
|
133
|
+
/** The method does not exist or is not available. */
|
|
134
|
+
readonly METHOD_NOT_FOUND: -32601;
|
|
135
|
+
/** Invalid method parameter(s). */
|
|
136
|
+
readonly INVALID_PARAMS: -32602;
|
|
137
|
+
/** Internal JSON-RPC error. */
|
|
138
|
+
readonly INTERNAL_ERROR: -32603;
|
|
139
|
+
};
|
|
140
|
+
export type JsonRpcErrorCode = (typeof JSONRPC_ERROR_CODES)[keyof typeof JSONRPC_ERROR_CODES];
|
|
141
|
+
/**
|
|
142
|
+
* Paperclip plugin-specific error codes.
|
|
143
|
+
*
|
|
144
|
+
* These live in the JSON-RPC "server error" reserved range (-32000 to -32099)
|
|
145
|
+
* as specified by JSON-RPC 2.0 for implementation-defined server errors.
|
|
146
|
+
*
|
|
147
|
+
* @see PLUGIN_SPEC.md §19.7 — Error Propagation Through The Bridge
|
|
148
|
+
*/
|
|
149
|
+
export declare const PLUGIN_RPC_ERROR_CODES: {
|
|
150
|
+
/** The worker process is not running or not reachable. */
|
|
151
|
+
readonly WORKER_UNAVAILABLE: -32000;
|
|
152
|
+
/** The plugin does not have the required capability for this operation. */
|
|
153
|
+
readonly CAPABILITY_DENIED: -32001;
|
|
154
|
+
/** The worker reported an unhandled error during method execution. */
|
|
155
|
+
readonly WORKER_ERROR: -32002;
|
|
156
|
+
/** The method call timed out waiting for the worker response. */
|
|
157
|
+
readonly TIMEOUT: -32003;
|
|
158
|
+
/** The worker does not implement the requested optional method. */
|
|
159
|
+
readonly METHOD_NOT_IMPLEMENTED: -32004;
|
|
160
|
+
/** The worker→host call attempted to escape the current invocation company scope. */
|
|
161
|
+
readonly INVOCATION_SCOPE_DENIED: -32005;
|
|
162
|
+
/** A catch-all for errors that do not fit other categories. */
|
|
163
|
+
readonly UNKNOWN: -32099;
|
|
164
|
+
};
|
|
165
|
+
export type PluginRpcErrorCode = (typeof PLUGIN_RPC_ERROR_CODES)[keyof typeof PLUGIN_RPC_ERROR_CODES];
|
|
166
|
+
/**
|
|
167
|
+
* Company scope attached by the host to one top-level plugin invocation.
|
|
168
|
+
* Absence of this metadata means the invocation is instance/global scoped.
|
|
169
|
+
*/
|
|
170
|
+
export interface PluginInvocationScope {
|
|
171
|
+
companyId: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Opaque invocation metadata generated by the host. Workers must not derive or
|
|
175
|
+
* mutate this. They only echo the id on nested worker→host RPC calls.
|
|
176
|
+
*/
|
|
177
|
+
export interface PluginInvocationContext {
|
|
178
|
+
id: string;
|
|
179
|
+
scope: PluginInvocationScope;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Context provided to host-side worker→host handlers after the worker echoes a
|
|
183
|
+
* host-issued invocation id.
|
|
184
|
+
*/
|
|
185
|
+
export interface WorkerHostCallContext {
|
|
186
|
+
invocationScope?: PluginInvocationScope | null;
|
|
187
|
+
invalidInvocationScope?: boolean;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Input for the `initialize` RPC method.
|
|
191
|
+
*
|
|
192
|
+
* @see PLUGIN_SPEC.md §13.1 — `initialize`
|
|
193
|
+
*/
|
|
194
|
+
export interface InitializeParams {
|
|
195
|
+
/** Full plugin manifest snapshot. */
|
|
196
|
+
manifest: VagrisPluginManifestV1;
|
|
197
|
+
/** Resolved operator configuration (validated against `instanceConfigSchema`). */
|
|
198
|
+
config: Record<string, unknown>;
|
|
199
|
+
/** Instance-level metadata. */
|
|
200
|
+
instanceInfo: {
|
|
201
|
+
/** UUID of this Paperclip instance. */
|
|
202
|
+
instanceId: string;
|
|
203
|
+
/** Semver version of the running Paperclip host. */
|
|
204
|
+
hostVersion: string;
|
|
205
|
+
};
|
|
206
|
+
/** Host API version. */
|
|
207
|
+
apiVersion: number;
|
|
208
|
+
/** Host-derived plugin database namespace, when the manifest declares database access. */
|
|
209
|
+
databaseNamespace?: string | null;
|
|
210
|
+
/**
|
|
211
|
+
* Per-method field lists this HOST accepts, keyed by worker→host method name.
|
|
212
|
+
*
|
|
213
|
+
* `apiVersion` is a single integer, so it can only say "the protocol changed"; it cannot say
|
|
214
|
+
* "this host build predates the field you are about to send". A plugin built against a newer SDK
|
|
215
|
+
* sends a field an older host neither destructures nor forwards, and the field is dropped in
|
|
216
|
+
* silence — nothing throws, nothing logs, and the caller's issue simply lacks it. This is the
|
|
217
|
+
* observability channel for that skew.
|
|
218
|
+
*
|
|
219
|
+
* ABSENT (an older host, or an unlisted method) means UNKNOWN, never "unsupported" — the worker
|
|
220
|
+
* assumes support and stays silent, so no existing plugin gains a warning it cannot act on.
|
|
221
|
+
*
|
|
222
|
+
* @see HOST_SUPPORTED_REQUEST_FIELDS — what a current host sends here.
|
|
223
|
+
*/
|
|
224
|
+
supportedRequestFields?: Record<string, readonly string[]>;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Result returned by the `initialize` RPC method.
|
|
228
|
+
*/
|
|
229
|
+
export interface InitializeResult {
|
|
230
|
+
/** Whether initialization succeeded. */
|
|
231
|
+
ok: boolean;
|
|
232
|
+
/** Optional methods the worker has implemented (e.g. "validateConfig", "onEvent"). */
|
|
233
|
+
supportedMethods?: string[];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Input for the `configChanged` RPC method.
|
|
237
|
+
*
|
|
238
|
+
* @see PLUGIN_SPEC.md §13.4 — `configChanged`
|
|
239
|
+
*/
|
|
240
|
+
export interface ConfigChangedParams {
|
|
241
|
+
/** The newly resolved configuration. */
|
|
242
|
+
config: Record<string, unknown>;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Input for the `validateConfig` RPC method.
|
|
246
|
+
*
|
|
247
|
+
* @see PLUGIN_SPEC.md §13.3 — `validateConfig`
|
|
248
|
+
*/
|
|
249
|
+
export interface ValidateConfigParams {
|
|
250
|
+
/** The configuration to validate. */
|
|
251
|
+
config: Record<string, unknown>;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Input for the `onEvent` RPC method.
|
|
255
|
+
*
|
|
256
|
+
* @see PLUGIN_SPEC.md §13.5 — `onEvent`
|
|
257
|
+
*/
|
|
258
|
+
export interface OnEventParams {
|
|
259
|
+
/** The domain event to deliver. */
|
|
260
|
+
event: PluginEvent;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Input for the `runJob` RPC method.
|
|
264
|
+
*
|
|
265
|
+
* @see PLUGIN_SPEC.md §13.6 — `runJob`
|
|
266
|
+
*/
|
|
267
|
+
export interface RunJobParams {
|
|
268
|
+
/** Job execution context. */
|
|
269
|
+
job: PluginJobContext;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Input for the `getData` RPC method.
|
|
273
|
+
*
|
|
274
|
+
* @see PLUGIN_SPEC.md §13.8 — `getData`
|
|
275
|
+
*/
|
|
276
|
+
export interface GetDataParams {
|
|
277
|
+
/** Plugin-defined data key (e.g. `"sync-health"`). */
|
|
278
|
+
key: string;
|
|
279
|
+
/** Host-authorized active company scope, when this bridge call is company-scoped. */
|
|
280
|
+
companyId?: string | null;
|
|
281
|
+
/** Context and query parameters from the UI. */
|
|
282
|
+
params: Record<string, unknown>;
|
|
283
|
+
/** Optional launcher/container metadata from the host render environment. */
|
|
284
|
+
renderEnvironment?: PluginLauncherRenderContextSnapshot | null;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Input for the `performAction` RPC method.
|
|
288
|
+
*
|
|
289
|
+
* @see PLUGIN_SPEC.md §13.9 — `performAction`
|
|
290
|
+
*/
|
|
291
|
+
export type PluginPerformActionActorType = "user" | "agent" | "system";
|
|
292
|
+
export interface PluginPerformActionActorContext {
|
|
293
|
+
/** Authenticated principal type resolved by the Paperclip host. */
|
|
294
|
+
type: PluginPerformActionActorType;
|
|
295
|
+
/** Authenticated board user id when `type === "user"`, otherwise null. */
|
|
296
|
+
userId: string | null;
|
|
297
|
+
/** Authenticated agent id when `type === "agent"`, otherwise null. */
|
|
298
|
+
agentId: string | null;
|
|
299
|
+
/** Authenticated heartbeat/run id when available. */
|
|
300
|
+
runId: string | null;
|
|
301
|
+
/** Company id authorized by the host bridge for this action, when applicable. */
|
|
302
|
+
companyId: string | null;
|
|
303
|
+
}
|
|
304
|
+
export interface PluginPerformActionContext {
|
|
305
|
+
/** Immutable authenticated actor context supplied by the host. */
|
|
306
|
+
actor: Readonly<PluginPerformActionActorContext>;
|
|
307
|
+
/** Convenience alias for `actor.companyId`. */
|
|
308
|
+
companyId: string | null;
|
|
309
|
+
}
|
|
310
|
+
export interface PerformActionParams {
|
|
311
|
+
/** Plugin-defined action key (e.g. `"resync"`). */
|
|
312
|
+
key: string;
|
|
313
|
+
/** Host-authorized active company scope, when this bridge call is company-scoped. */
|
|
314
|
+
companyId?: string | null;
|
|
315
|
+
/** Action parameters from the UI. */
|
|
316
|
+
params: Record<string, unknown>;
|
|
317
|
+
/** Authenticated actor context resolved by the host, never by caller params. */
|
|
318
|
+
actorContext?: PluginPerformActionActorContext | null;
|
|
319
|
+
/** Optional launcher/container metadata from the host render environment. */
|
|
320
|
+
renderEnvironment?: PluginLauncherRenderContextSnapshot | null;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Input for the `executeTool` RPC method.
|
|
324
|
+
*
|
|
325
|
+
* @see PLUGIN_SPEC.md §13.10 — `executeTool`
|
|
326
|
+
*/
|
|
327
|
+
export interface ExecuteToolParams {
|
|
328
|
+
/** Tool name (without plugin namespace prefix). */
|
|
329
|
+
toolName: string;
|
|
330
|
+
/** Parsed parameters matching the tool's declared schema. */
|
|
331
|
+
parameters: unknown;
|
|
332
|
+
/** Agent run context. */
|
|
333
|
+
runContext: ToolRunContext;
|
|
334
|
+
}
|
|
335
|
+
export interface PluginEnvironmentDiagnostic {
|
|
336
|
+
severity: "info" | "warning" | "error";
|
|
337
|
+
message: string;
|
|
338
|
+
code?: string;
|
|
339
|
+
details?: Record<string, unknown>;
|
|
340
|
+
}
|
|
341
|
+
export interface PluginEnvironmentDriverBaseParams {
|
|
342
|
+
driverKey: string;
|
|
343
|
+
companyId: string;
|
|
344
|
+
environmentId: string;
|
|
345
|
+
issueId?: string | null;
|
|
346
|
+
config: Record<string, unknown>;
|
|
347
|
+
}
|
|
348
|
+
export interface PluginEnvironmentValidateConfigParams {
|
|
349
|
+
driverKey: string;
|
|
350
|
+
config: Record<string, unknown>;
|
|
351
|
+
}
|
|
352
|
+
export interface PluginEnvironmentValidationResult {
|
|
353
|
+
ok: boolean;
|
|
354
|
+
warnings?: string[];
|
|
355
|
+
errors?: string[];
|
|
356
|
+
normalizedConfig?: Record<string, unknown>;
|
|
357
|
+
}
|
|
358
|
+
export interface PluginEnvironmentProbeParams extends PluginEnvironmentDriverBaseParams {
|
|
359
|
+
}
|
|
360
|
+
export interface PluginEnvironmentProbeResult {
|
|
361
|
+
ok: boolean;
|
|
362
|
+
summary?: string;
|
|
363
|
+
diagnostics?: PluginEnvironmentDiagnostic[];
|
|
364
|
+
metadata?: Record<string, unknown>;
|
|
365
|
+
}
|
|
366
|
+
export interface PluginEnvironmentLease {
|
|
367
|
+
providerLeaseId: string | null;
|
|
368
|
+
metadata?: Record<string, unknown>;
|
|
369
|
+
expiresAt?: string | null;
|
|
370
|
+
}
|
|
371
|
+
export interface PluginEnvironmentAcquireLeaseParams extends PluginEnvironmentDriverBaseParams {
|
|
372
|
+
runId: string;
|
|
373
|
+
workspaceMode?: string;
|
|
374
|
+
requestedCwd?: string;
|
|
375
|
+
}
|
|
376
|
+
export interface PluginEnvironmentResumeLeaseParams extends PluginEnvironmentDriverBaseParams {
|
|
377
|
+
providerLeaseId: string;
|
|
378
|
+
leaseMetadata?: Record<string, unknown>;
|
|
379
|
+
}
|
|
380
|
+
export interface PluginEnvironmentReleaseLeaseParams extends PluginEnvironmentDriverBaseParams {
|
|
381
|
+
providerLeaseId: string | null;
|
|
382
|
+
leaseMetadata?: Record<string, unknown>;
|
|
383
|
+
}
|
|
384
|
+
export interface PluginEnvironmentDestroyLeaseParams extends PluginEnvironmentReleaseLeaseParams {
|
|
385
|
+
}
|
|
386
|
+
export interface PluginEnvironmentRealizeWorkspaceParams extends PluginEnvironmentDriverBaseParams {
|
|
387
|
+
lease: PluginEnvironmentLease;
|
|
388
|
+
workspace: {
|
|
389
|
+
localPath?: string;
|
|
390
|
+
remotePath?: string;
|
|
391
|
+
mode?: string;
|
|
392
|
+
metadata?: Record<string, unknown>;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
export interface PluginEnvironmentRealizeWorkspaceResult {
|
|
396
|
+
cwd: string;
|
|
397
|
+
metadata?: Record<string, unknown>;
|
|
398
|
+
}
|
|
399
|
+
export interface PluginEnvironmentExecuteParams extends PluginEnvironmentDriverBaseParams {
|
|
400
|
+
lease: PluginEnvironmentLease;
|
|
401
|
+
command: string;
|
|
402
|
+
args?: string[];
|
|
403
|
+
cwd?: string;
|
|
404
|
+
env?: Record<string, string>;
|
|
405
|
+
stdin?: string;
|
|
406
|
+
timeoutMs?: number;
|
|
407
|
+
}
|
|
408
|
+
export interface PluginEnvironmentExecuteResult {
|
|
409
|
+
exitCode: number | null;
|
|
410
|
+
signal?: string | null;
|
|
411
|
+
timedOut: boolean;
|
|
412
|
+
stdout: string;
|
|
413
|
+
stderr: string;
|
|
414
|
+
metadata?: Record<string, unknown>;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Bounds request issued by a plugin UI running inside a host-managed launcher
|
|
418
|
+
* container such as a modal, drawer, or popover.
|
|
419
|
+
*/
|
|
420
|
+
export interface PluginModalBoundsRequest {
|
|
421
|
+
/** High-level size preset requested from the host. */
|
|
422
|
+
bounds: PluginLauncherBounds;
|
|
423
|
+
/** Optional explicit width override in CSS pixels. */
|
|
424
|
+
width?: number;
|
|
425
|
+
/** Optional explicit height override in CSS pixels. */
|
|
426
|
+
height?: number;
|
|
427
|
+
/** Optional lower bounds for host resizing decisions. */
|
|
428
|
+
minWidth?: number;
|
|
429
|
+
minHeight?: number;
|
|
430
|
+
/** Optional upper bounds for host resizing decisions. */
|
|
431
|
+
maxWidth?: number;
|
|
432
|
+
maxHeight?: number;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Reason metadata supplied by host-managed close lifecycle callbacks.
|
|
436
|
+
*/
|
|
437
|
+
export interface PluginRenderCloseEvent {
|
|
438
|
+
reason: "escapeKey" | "backdrop" | "hostNavigation" | "programmatic" | "submit" | "unknown";
|
|
439
|
+
nativeEvent?: unknown;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Map of host→worker RPC method names to their `[params, result]` types.
|
|
443
|
+
*
|
|
444
|
+
* This type is the single source of truth for all methods the host can call
|
|
445
|
+
* on a worker. Used by both the host dispatcher and the worker handler to
|
|
446
|
+
* ensure type safety across the IPC boundary.
|
|
447
|
+
*/
|
|
448
|
+
export interface HostToWorkerMethods {
|
|
449
|
+
/** @see PLUGIN_SPEC.md §13.1 */
|
|
450
|
+
initialize: [params: InitializeParams, result: InitializeResult];
|
|
451
|
+
/** @see PLUGIN_SPEC.md §13.2 */
|
|
452
|
+
health: [params: Record<string, never>, result: PluginHealthDiagnostics];
|
|
453
|
+
/** @see PLUGIN_SPEC.md §12.5 */
|
|
454
|
+
shutdown: [params: Record<string, never>, result: void];
|
|
455
|
+
/** @see PLUGIN_SPEC.md §13.3 */
|
|
456
|
+
validateConfig: [params: ValidateConfigParams, result: PluginConfigValidationResult];
|
|
457
|
+
/** @see PLUGIN_SPEC.md §13.4 */
|
|
458
|
+
configChanged: [params: ConfigChangedParams, result: void];
|
|
459
|
+
/** @see PLUGIN_SPEC.md §13.5 */
|
|
460
|
+
onEvent: [params: OnEventParams, result: void];
|
|
461
|
+
/** @see PLUGIN_SPEC.md §13.6 */
|
|
462
|
+
runJob: [params: RunJobParams, result: void];
|
|
463
|
+
/** @see PLUGIN_SPEC.md §13.7 */
|
|
464
|
+
handleWebhook: [params: PluginWebhookInput, result: void];
|
|
465
|
+
/** Scoped plugin API route dispatch. */
|
|
466
|
+
handleApiRequest: [params: PluginApiRequestInput, result: PluginApiResponse];
|
|
467
|
+
/** @see PLUGIN_SPEC.md §13.8 */
|
|
468
|
+
getData: [params: GetDataParams, result: unknown];
|
|
469
|
+
/** @see PLUGIN_SPEC.md §13.9 */
|
|
470
|
+
performAction: [params: PerformActionParams, result: unknown];
|
|
471
|
+
/** @see PLUGIN_SPEC.md §13.10 */
|
|
472
|
+
executeTool: [params: ExecuteToolParams, result: ToolResult];
|
|
473
|
+
environmentValidateConfig: [
|
|
474
|
+
params: PluginEnvironmentValidateConfigParams,
|
|
475
|
+
result: PluginEnvironmentValidationResult
|
|
476
|
+
];
|
|
477
|
+
environmentProbe: [
|
|
478
|
+
params: PluginEnvironmentProbeParams,
|
|
479
|
+
result: PluginEnvironmentProbeResult
|
|
480
|
+
];
|
|
481
|
+
environmentAcquireLease: [
|
|
482
|
+
params: PluginEnvironmentAcquireLeaseParams,
|
|
483
|
+
result: PluginEnvironmentLease
|
|
484
|
+
];
|
|
485
|
+
environmentResumeLease: [
|
|
486
|
+
params: PluginEnvironmentResumeLeaseParams,
|
|
487
|
+
result: PluginEnvironmentLease
|
|
488
|
+
];
|
|
489
|
+
environmentReleaseLease: [
|
|
490
|
+
params: PluginEnvironmentReleaseLeaseParams,
|
|
491
|
+
result: void
|
|
492
|
+
];
|
|
493
|
+
environmentDestroyLease: [
|
|
494
|
+
params: PluginEnvironmentDestroyLeaseParams,
|
|
495
|
+
result: void
|
|
496
|
+
];
|
|
497
|
+
environmentRealizeWorkspace: [
|
|
498
|
+
params: PluginEnvironmentRealizeWorkspaceParams,
|
|
499
|
+
result: PluginEnvironmentRealizeWorkspaceResult
|
|
500
|
+
];
|
|
501
|
+
environmentExecute: [
|
|
502
|
+
params: PluginEnvironmentExecuteParams,
|
|
503
|
+
result: PluginEnvironmentExecuteResult
|
|
504
|
+
];
|
|
505
|
+
}
|
|
506
|
+
/** Union of all host→worker method names. */
|
|
507
|
+
export type HostToWorkerMethodName = keyof HostToWorkerMethods;
|
|
508
|
+
/** Required methods the worker MUST implement. */
|
|
509
|
+
export declare const HOST_TO_WORKER_REQUIRED_METHODS: readonly HostToWorkerMethodName[];
|
|
510
|
+
/** Optional methods the worker MAY implement. */
|
|
511
|
+
export declare const HOST_TO_WORKER_OPTIONAL_METHODS: readonly HostToWorkerMethodName[];
|
|
512
|
+
/**
|
|
513
|
+
* Map of worker→host RPC method names to their `[params, result]` types.
|
|
514
|
+
*
|
|
515
|
+
* These represent the SDK client calls that the worker makes back to the
|
|
516
|
+
* host to access platform services (state, entities, config, etc.).
|
|
517
|
+
*/
|
|
518
|
+
export interface WorkerToHostMethods {
|
|
519
|
+
"config.get": [params: Record<string, never>, result: Record<string, unknown>];
|
|
520
|
+
"localFolders.declarations": [
|
|
521
|
+
params: Record<string, never>,
|
|
522
|
+
result: PluginLocalFolderDeclaration[]
|
|
523
|
+
];
|
|
524
|
+
"localFolders.configure": [
|
|
525
|
+
params: {
|
|
526
|
+
companyId: string;
|
|
527
|
+
folderKey: string;
|
|
528
|
+
path: string;
|
|
529
|
+
access?: "read" | "readWrite";
|
|
530
|
+
requiredDirectories?: string[];
|
|
531
|
+
requiredFiles?: string[];
|
|
532
|
+
},
|
|
533
|
+
result: PluginLocalFolderStatus
|
|
534
|
+
];
|
|
535
|
+
"localFolders.status": [
|
|
536
|
+
params: {
|
|
537
|
+
companyId: string;
|
|
538
|
+
folderKey: string;
|
|
539
|
+
},
|
|
540
|
+
result: PluginLocalFolderStatus
|
|
541
|
+
];
|
|
542
|
+
"localFolders.list": [
|
|
543
|
+
params: {
|
|
544
|
+
companyId: string;
|
|
545
|
+
folderKey: string;
|
|
546
|
+
relativePath?: string | null;
|
|
547
|
+
recursive?: boolean;
|
|
548
|
+
maxEntries?: number;
|
|
549
|
+
},
|
|
550
|
+
result: PluginLocalFolderListing
|
|
551
|
+
];
|
|
552
|
+
"localFolders.readText": [
|
|
553
|
+
params: {
|
|
554
|
+
companyId: string;
|
|
555
|
+
folderKey: string;
|
|
556
|
+
relativePath: string;
|
|
557
|
+
},
|
|
558
|
+
result: string
|
|
559
|
+
];
|
|
560
|
+
"localFolders.writeTextAtomic": [
|
|
561
|
+
params: {
|
|
562
|
+
companyId: string;
|
|
563
|
+
folderKey: string;
|
|
564
|
+
relativePath: string;
|
|
565
|
+
contents: string;
|
|
566
|
+
},
|
|
567
|
+
result: PluginLocalFolderStatus
|
|
568
|
+
];
|
|
569
|
+
"localFolders.deleteFile": [
|
|
570
|
+
params: {
|
|
571
|
+
companyId: string;
|
|
572
|
+
folderKey: string;
|
|
573
|
+
relativePath: string;
|
|
574
|
+
},
|
|
575
|
+
result: PluginLocalFolderStatus
|
|
576
|
+
];
|
|
577
|
+
"state.get": [
|
|
578
|
+
params: {
|
|
579
|
+
scopeKind: string;
|
|
580
|
+
scopeId?: string;
|
|
581
|
+
namespace?: string;
|
|
582
|
+
stateKey: string;
|
|
583
|
+
},
|
|
584
|
+
result: unknown
|
|
585
|
+
];
|
|
586
|
+
"state.set": [
|
|
587
|
+
params: {
|
|
588
|
+
scopeKind: string;
|
|
589
|
+
scopeId?: string;
|
|
590
|
+
namespace?: string;
|
|
591
|
+
stateKey: string;
|
|
592
|
+
value: unknown;
|
|
593
|
+
},
|
|
594
|
+
result: void
|
|
595
|
+
];
|
|
596
|
+
"state.delete": [
|
|
597
|
+
params: {
|
|
598
|
+
scopeKind: string;
|
|
599
|
+
scopeId?: string;
|
|
600
|
+
namespace?: string;
|
|
601
|
+
stateKey: string;
|
|
602
|
+
},
|
|
603
|
+
result: void
|
|
604
|
+
];
|
|
605
|
+
"db.namespace": [
|
|
606
|
+
params: Record<string, never>,
|
|
607
|
+
result: string
|
|
608
|
+
];
|
|
609
|
+
"db.query": [
|
|
610
|
+
params: {
|
|
611
|
+
sql: string;
|
|
612
|
+
params?: unknown[];
|
|
613
|
+
},
|
|
614
|
+
result: unknown[]
|
|
615
|
+
];
|
|
616
|
+
"db.execute": [
|
|
617
|
+
params: {
|
|
618
|
+
sql: string;
|
|
619
|
+
params?: unknown[];
|
|
620
|
+
},
|
|
621
|
+
result: {
|
|
622
|
+
rowCount: number;
|
|
623
|
+
}
|
|
624
|
+
];
|
|
625
|
+
"entities.upsert": [
|
|
626
|
+
params: {
|
|
627
|
+
entityType: string;
|
|
628
|
+
scopeKind: PluginStateScopeKind;
|
|
629
|
+
scopeId?: string;
|
|
630
|
+
externalId?: string;
|
|
631
|
+
title?: string;
|
|
632
|
+
status?: string;
|
|
633
|
+
data: Record<string, unknown>;
|
|
634
|
+
},
|
|
635
|
+
result: {
|
|
636
|
+
id: string;
|
|
637
|
+
entityType: string;
|
|
638
|
+
scopeKind: PluginStateScopeKind;
|
|
639
|
+
scopeId: string | null;
|
|
640
|
+
externalId: string | null;
|
|
641
|
+
title: string | null;
|
|
642
|
+
status: string | null;
|
|
643
|
+
data: Record<string, unknown>;
|
|
644
|
+
createdAt: string;
|
|
645
|
+
updatedAt: string;
|
|
646
|
+
}
|
|
647
|
+
];
|
|
648
|
+
"entities.list": [
|
|
649
|
+
params: {
|
|
650
|
+
entityType?: string;
|
|
651
|
+
scopeKind?: PluginStateScopeKind;
|
|
652
|
+
scopeId?: string;
|
|
653
|
+
externalId?: string;
|
|
654
|
+
limit?: number;
|
|
655
|
+
offset?: number;
|
|
656
|
+
},
|
|
657
|
+
result: Array<{
|
|
658
|
+
id: string;
|
|
659
|
+
entityType: string;
|
|
660
|
+
scopeKind: PluginStateScopeKind;
|
|
661
|
+
scopeId: string | null;
|
|
662
|
+
externalId: string | null;
|
|
663
|
+
title: string | null;
|
|
664
|
+
status: string | null;
|
|
665
|
+
data: Record<string, unknown>;
|
|
666
|
+
createdAt: string;
|
|
667
|
+
updatedAt: string;
|
|
668
|
+
}>
|
|
669
|
+
];
|
|
670
|
+
"events.emit": [
|
|
671
|
+
params: {
|
|
672
|
+
name: string;
|
|
673
|
+
companyId: string;
|
|
674
|
+
payload: unknown;
|
|
675
|
+
},
|
|
676
|
+
result: void
|
|
677
|
+
];
|
|
678
|
+
"events.subscribe": [
|
|
679
|
+
params: {
|
|
680
|
+
eventPattern: string;
|
|
681
|
+
filter?: Record<string, unknown> | null;
|
|
682
|
+
},
|
|
683
|
+
result: void
|
|
684
|
+
];
|
|
685
|
+
"http.fetch": [
|
|
686
|
+
params: {
|
|
687
|
+
url: string;
|
|
688
|
+
init?: Record<string, unknown>;
|
|
689
|
+
},
|
|
690
|
+
result: {
|
|
691
|
+
status: number;
|
|
692
|
+
statusText: string;
|
|
693
|
+
headers: Record<string, string>;
|
|
694
|
+
body: string;
|
|
695
|
+
}
|
|
696
|
+
];
|
|
697
|
+
"secrets.resolve": [
|
|
698
|
+
params: {
|
|
699
|
+
secretRef: string;
|
|
700
|
+
},
|
|
701
|
+
result: string
|
|
702
|
+
];
|
|
703
|
+
"activity.log": [
|
|
704
|
+
params: {
|
|
705
|
+
companyId: string;
|
|
706
|
+
message: string;
|
|
707
|
+
entityType?: string;
|
|
708
|
+
entityId?: string;
|
|
709
|
+
metadata?: Record<string, unknown>;
|
|
710
|
+
},
|
|
711
|
+
result: void
|
|
712
|
+
];
|
|
713
|
+
"metrics.write": [
|
|
714
|
+
params: {
|
|
715
|
+
name: string;
|
|
716
|
+
value: number;
|
|
717
|
+
tags?: Record<string, string>;
|
|
718
|
+
},
|
|
719
|
+
result: void
|
|
720
|
+
];
|
|
721
|
+
"telemetry.track": [
|
|
722
|
+
params: {
|
|
723
|
+
eventName: string;
|
|
724
|
+
dimensions?: Record<string, string | number | boolean>;
|
|
725
|
+
},
|
|
726
|
+
result: void
|
|
727
|
+
];
|
|
728
|
+
"log": [
|
|
729
|
+
params: {
|
|
730
|
+
level: "info" | "warn" | "error" | "debug";
|
|
731
|
+
message: string;
|
|
732
|
+
meta?: Record<string, unknown>;
|
|
733
|
+
},
|
|
734
|
+
result: void
|
|
735
|
+
];
|
|
736
|
+
"companies.list": [
|
|
737
|
+
params: {
|
|
738
|
+
limit?: number;
|
|
739
|
+
offset?: number;
|
|
740
|
+
},
|
|
741
|
+
result: Company[]
|
|
742
|
+
];
|
|
743
|
+
"companies.get": [
|
|
744
|
+
params: {
|
|
745
|
+
companyId: string;
|
|
746
|
+
},
|
|
747
|
+
result: Company | null
|
|
748
|
+
];
|
|
749
|
+
"projects.list": [
|
|
750
|
+
params: {
|
|
751
|
+
companyId: string;
|
|
752
|
+
limit?: number;
|
|
753
|
+
offset?: number;
|
|
754
|
+
},
|
|
755
|
+
result: Project[]
|
|
756
|
+
];
|
|
757
|
+
"projects.get": [
|
|
758
|
+
params: {
|
|
759
|
+
projectId: string;
|
|
760
|
+
companyId: string;
|
|
761
|
+
},
|
|
762
|
+
result: Project | null
|
|
763
|
+
];
|
|
764
|
+
"projects.listWorkspaces": [
|
|
765
|
+
params: {
|
|
766
|
+
projectId: string;
|
|
767
|
+
companyId: string;
|
|
768
|
+
},
|
|
769
|
+
result: PluginWorkspace[]
|
|
770
|
+
];
|
|
771
|
+
"projects.getPrimaryWorkspace": [
|
|
772
|
+
params: {
|
|
773
|
+
projectId: string;
|
|
774
|
+
companyId: string;
|
|
775
|
+
},
|
|
776
|
+
result: PluginWorkspace | null
|
|
777
|
+
];
|
|
778
|
+
"projects.getWorkspaceForIssue": [
|
|
779
|
+
params: {
|
|
780
|
+
issueId: string;
|
|
781
|
+
companyId: string;
|
|
782
|
+
},
|
|
783
|
+
result: PluginWorkspace | null
|
|
784
|
+
];
|
|
785
|
+
"executionWorkspaces.get": [
|
|
786
|
+
params: {
|
|
787
|
+
workspaceId: string;
|
|
788
|
+
companyId: string;
|
|
789
|
+
},
|
|
790
|
+
result: PluginExecutionWorkspaceMetadata | null
|
|
791
|
+
];
|
|
792
|
+
"projects.managed.get": [
|
|
793
|
+
params: {
|
|
794
|
+
projectKey: string;
|
|
795
|
+
companyId: string;
|
|
796
|
+
},
|
|
797
|
+
result: PluginManagedProjectResolution
|
|
798
|
+
];
|
|
799
|
+
"projects.managed.reconcile": [
|
|
800
|
+
params: {
|
|
801
|
+
projectKey: string;
|
|
802
|
+
companyId: string;
|
|
803
|
+
},
|
|
804
|
+
result: PluginManagedProjectResolution
|
|
805
|
+
];
|
|
806
|
+
"projects.managed.reset": [
|
|
807
|
+
params: {
|
|
808
|
+
projectKey: string;
|
|
809
|
+
companyId: string;
|
|
810
|
+
},
|
|
811
|
+
result: PluginManagedProjectResolution
|
|
812
|
+
];
|
|
813
|
+
"routines.managed.get": [
|
|
814
|
+
params: {
|
|
815
|
+
routineKey: string;
|
|
816
|
+
companyId: string;
|
|
817
|
+
},
|
|
818
|
+
result: PluginManagedRoutineResolution
|
|
819
|
+
];
|
|
820
|
+
"routines.managed.reconcile": [
|
|
821
|
+
params: {
|
|
822
|
+
routineKey: string;
|
|
823
|
+
companyId: string;
|
|
824
|
+
assigneeAgentId?: string | null;
|
|
825
|
+
projectId?: string | null;
|
|
826
|
+
},
|
|
827
|
+
result: PluginManagedRoutineResolution
|
|
828
|
+
];
|
|
829
|
+
"routines.managed.reset": [
|
|
830
|
+
params: {
|
|
831
|
+
routineKey: string;
|
|
832
|
+
companyId: string;
|
|
833
|
+
assigneeAgentId?: string | null;
|
|
834
|
+
projectId?: string | null;
|
|
835
|
+
},
|
|
836
|
+
result: PluginManagedRoutineResolution
|
|
837
|
+
];
|
|
838
|
+
"routines.managed.update": [
|
|
839
|
+
params: {
|
|
840
|
+
routineKey: string;
|
|
841
|
+
companyId: string;
|
|
842
|
+
status?: string;
|
|
843
|
+
},
|
|
844
|
+
result: Routine
|
|
845
|
+
];
|
|
846
|
+
"routines.managed.run": [
|
|
847
|
+
params: {
|
|
848
|
+
routineKey: string;
|
|
849
|
+
companyId: string;
|
|
850
|
+
assigneeAgentId?: string | null;
|
|
851
|
+
projectId?: string | null;
|
|
852
|
+
},
|
|
853
|
+
result: RoutineRun
|
|
854
|
+
];
|
|
855
|
+
"skills.managed.get": [
|
|
856
|
+
params: {
|
|
857
|
+
skillKey: string;
|
|
858
|
+
companyId: string;
|
|
859
|
+
},
|
|
860
|
+
result: PluginManagedSkillResolution
|
|
861
|
+
];
|
|
862
|
+
"skills.managed.reconcile": [
|
|
863
|
+
params: {
|
|
864
|
+
skillKey: string;
|
|
865
|
+
companyId: string;
|
|
866
|
+
},
|
|
867
|
+
result: PluginManagedSkillResolution
|
|
868
|
+
];
|
|
869
|
+
"skills.managed.reset": [
|
|
870
|
+
params: {
|
|
871
|
+
skillKey: string;
|
|
872
|
+
companyId: string;
|
|
873
|
+
},
|
|
874
|
+
result: PluginManagedSkillResolution
|
|
875
|
+
];
|
|
876
|
+
"issues.list": [
|
|
877
|
+
params: {
|
|
878
|
+
companyId: string;
|
|
879
|
+
projectId?: string;
|
|
880
|
+
assigneeAgentId?: string;
|
|
881
|
+
originKind?: string;
|
|
882
|
+
originKindPrefix?: string;
|
|
883
|
+
originId?: string;
|
|
884
|
+
status?: string;
|
|
885
|
+
includePluginOperations?: boolean;
|
|
886
|
+
limit?: number;
|
|
887
|
+
offset?: number;
|
|
888
|
+
},
|
|
889
|
+
result: Issue[]
|
|
890
|
+
];
|
|
891
|
+
"issues.get": [
|
|
892
|
+
params: {
|
|
893
|
+
issueId: string;
|
|
894
|
+
companyId: string;
|
|
895
|
+
},
|
|
896
|
+
result: Issue | null
|
|
897
|
+
];
|
|
898
|
+
"issues.create": [
|
|
899
|
+
params: {
|
|
900
|
+
companyId: string;
|
|
901
|
+
projectId?: string;
|
|
902
|
+
goalId?: string;
|
|
903
|
+
parentId?: string;
|
|
904
|
+
inheritExecutionWorkspaceFromIssueId?: string;
|
|
905
|
+
title: string;
|
|
906
|
+
description?: string;
|
|
907
|
+
status?: string;
|
|
908
|
+
priority?: string;
|
|
909
|
+
assigneeAgentId?: string;
|
|
910
|
+
assigneeUserId?: string | null;
|
|
911
|
+
requestDepth?: number;
|
|
912
|
+
billingCode?: string | null;
|
|
913
|
+
assigneeAdapterOverrides?: IssueAssigneeAdapterOverrides | null;
|
|
914
|
+
surfaceVisibility?: string | null;
|
|
915
|
+
originKind?: string | null;
|
|
916
|
+
originId?: string | null;
|
|
917
|
+
originRunId?: string | null;
|
|
918
|
+
originFingerprint?: string | null;
|
|
919
|
+
blockedByIssueIds?: string[];
|
|
920
|
+
labelIds?: string[];
|
|
921
|
+
executionWorkspaceId?: string | null;
|
|
922
|
+
executionWorkspacePreference?: string | null;
|
|
923
|
+
executionWorkspaceSettings?: Record<string, unknown> | null;
|
|
924
|
+
actorAgentId?: string | null;
|
|
925
|
+
actorUserId?: string | null;
|
|
926
|
+
actorRunId?: string | null;
|
|
927
|
+
},
|
|
928
|
+
result: Issue
|
|
929
|
+
];
|
|
930
|
+
"issues.update": [
|
|
931
|
+
params: {
|
|
932
|
+
issueId: string;
|
|
933
|
+
patch: Record<string, unknown>;
|
|
934
|
+
companyId: string;
|
|
935
|
+
},
|
|
936
|
+
result: Issue
|
|
937
|
+
];
|
|
938
|
+
"issues.relations.get": [
|
|
939
|
+
params: {
|
|
940
|
+
issueId: string;
|
|
941
|
+
companyId: string;
|
|
942
|
+
},
|
|
943
|
+
result: PluginIssueRelationSummary
|
|
944
|
+
];
|
|
945
|
+
"issues.relations.setBlockedBy": [
|
|
946
|
+
params: {
|
|
947
|
+
issueId: string;
|
|
948
|
+
companyId: string;
|
|
949
|
+
blockedByIssueIds: string[];
|
|
950
|
+
actorAgentId?: string | null;
|
|
951
|
+
actorUserId?: string | null;
|
|
952
|
+
actorRunId?: string | null;
|
|
953
|
+
},
|
|
954
|
+
result: PluginIssueRelationSummary
|
|
955
|
+
];
|
|
956
|
+
"issues.relations.addBlockers": [
|
|
957
|
+
params: {
|
|
958
|
+
issueId: string;
|
|
959
|
+
companyId: string;
|
|
960
|
+
blockerIssueIds: string[];
|
|
961
|
+
actorAgentId?: string | null;
|
|
962
|
+
actorUserId?: string | null;
|
|
963
|
+
actorRunId?: string | null;
|
|
964
|
+
},
|
|
965
|
+
result: PluginIssueRelationSummary
|
|
966
|
+
];
|
|
967
|
+
"issues.relations.removeBlockers": [
|
|
968
|
+
params: {
|
|
969
|
+
issueId: string;
|
|
970
|
+
companyId: string;
|
|
971
|
+
blockerIssueIds: string[];
|
|
972
|
+
actorAgentId?: string | null;
|
|
973
|
+
actorUserId?: string | null;
|
|
974
|
+
actorRunId?: string | null;
|
|
975
|
+
},
|
|
976
|
+
result: PluginIssueRelationSummary
|
|
977
|
+
];
|
|
978
|
+
"issues.assertCheckoutOwner": [
|
|
979
|
+
params: {
|
|
980
|
+
issueId: string;
|
|
981
|
+
companyId: string;
|
|
982
|
+
actorAgentId: string;
|
|
983
|
+
actorRunId: string;
|
|
984
|
+
},
|
|
985
|
+
result: PluginIssueCheckoutOwnership
|
|
986
|
+
];
|
|
987
|
+
"issues.getSubtree": [
|
|
988
|
+
params: {
|
|
989
|
+
issueId: string;
|
|
990
|
+
companyId: string;
|
|
991
|
+
includeRoot?: boolean;
|
|
992
|
+
includeRelations?: boolean;
|
|
993
|
+
includeDocuments?: boolean;
|
|
994
|
+
includeActiveRuns?: boolean;
|
|
995
|
+
includeAssignees?: boolean;
|
|
996
|
+
},
|
|
997
|
+
result: PluginIssueSubtree
|
|
998
|
+
];
|
|
999
|
+
"issues.requestWakeup": [
|
|
1000
|
+
params: {
|
|
1001
|
+
issueId: string;
|
|
1002
|
+
companyId: string;
|
|
1003
|
+
reason?: string;
|
|
1004
|
+
contextSource?: string;
|
|
1005
|
+
idempotencyKey?: string | null;
|
|
1006
|
+
actorAgentId?: string | null;
|
|
1007
|
+
actorUserId?: string | null;
|
|
1008
|
+
actorRunId?: string | null;
|
|
1009
|
+
},
|
|
1010
|
+
result: PluginIssueWakeupResult
|
|
1011
|
+
];
|
|
1012
|
+
"issues.requestWakeups": [
|
|
1013
|
+
params: {
|
|
1014
|
+
issueIds: string[];
|
|
1015
|
+
companyId: string;
|
|
1016
|
+
reason?: string;
|
|
1017
|
+
contextSource?: string;
|
|
1018
|
+
idempotencyKeyPrefix?: string | null;
|
|
1019
|
+
actorAgentId?: string | null;
|
|
1020
|
+
actorUserId?: string | null;
|
|
1021
|
+
actorRunId?: string | null;
|
|
1022
|
+
},
|
|
1023
|
+
result: PluginIssueWakeupBatchResult[]
|
|
1024
|
+
];
|
|
1025
|
+
"issues.summaries.getOrchestration": [
|
|
1026
|
+
params: {
|
|
1027
|
+
issueId: string;
|
|
1028
|
+
companyId: string;
|
|
1029
|
+
includeSubtree?: boolean;
|
|
1030
|
+
billingCode?: string | null;
|
|
1031
|
+
},
|
|
1032
|
+
result: PluginIssueOrchestrationSummary
|
|
1033
|
+
];
|
|
1034
|
+
"issues.listComments": [
|
|
1035
|
+
params: {
|
|
1036
|
+
issueId: string;
|
|
1037
|
+
companyId: string;
|
|
1038
|
+
},
|
|
1039
|
+
result: IssueComment[]
|
|
1040
|
+
];
|
|
1041
|
+
"issues.createComment": [
|
|
1042
|
+
params: {
|
|
1043
|
+
issueId: string;
|
|
1044
|
+
body: string;
|
|
1045
|
+
companyId: string;
|
|
1046
|
+
authorAgentId?: string;
|
|
1047
|
+
},
|
|
1048
|
+
result: IssueComment
|
|
1049
|
+
];
|
|
1050
|
+
"issues.createInteraction": [
|
|
1051
|
+
params: {
|
|
1052
|
+
issueId: string;
|
|
1053
|
+
companyId: string;
|
|
1054
|
+
interaction: CreateIssueThreadInteraction;
|
|
1055
|
+
authorAgentId?: string | null;
|
|
1056
|
+
},
|
|
1057
|
+
result: IssueThreadInteraction
|
|
1058
|
+
];
|
|
1059
|
+
"issues.documents.list": [
|
|
1060
|
+
params: {
|
|
1061
|
+
issueId: string;
|
|
1062
|
+
companyId: string;
|
|
1063
|
+
},
|
|
1064
|
+
result: IssueDocumentSummary[]
|
|
1065
|
+
];
|
|
1066
|
+
"issues.documents.get": [
|
|
1067
|
+
params: {
|
|
1068
|
+
issueId: string;
|
|
1069
|
+
key: string;
|
|
1070
|
+
companyId: string;
|
|
1071
|
+
},
|
|
1072
|
+
result: IssueDocument | null
|
|
1073
|
+
];
|
|
1074
|
+
"issues.documents.upsert": [
|
|
1075
|
+
params: {
|
|
1076
|
+
issueId: string;
|
|
1077
|
+
key: string;
|
|
1078
|
+
body: string;
|
|
1079
|
+
companyId: string;
|
|
1080
|
+
title?: string;
|
|
1081
|
+
format?: string;
|
|
1082
|
+
changeSummary?: string;
|
|
1083
|
+
},
|
|
1084
|
+
result: IssueDocument
|
|
1085
|
+
];
|
|
1086
|
+
"issues.documents.delete": [
|
|
1087
|
+
params: {
|
|
1088
|
+
issueId: string;
|
|
1089
|
+
key: string;
|
|
1090
|
+
companyId: string;
|
|
1091
|
+
},
|
|
1092
|
+
result: void
|
|
1093
|
+
];
|
|
1094
|
+
"agents.list": [
|
|
1095
|
+
params: {
|
|
1096
|
+
companyId: string;
|
|
1097
|
+
status?: string;
|
|
1098
|
+
limit?: number;
|
|
1099
|
+
offset?: number;
|
|
1100
|
+
},
|
|
1101
|
+
result: Agent[]
|
|
1102
|
+
];
|
|
1103
|
+
"agents.get": [
|
|
1104
|
+
params: {
|
|
1105
|
+
agentId: string;
|
|
1106
|
+
companyId: string;
|
|
1107
|
+
},
|
|
1108
|
+
result: Agent | null
|
|
1109
|
+
];
|
|
1110
|
+
"agents.pause": [
|
|
1111
|
+
params: {
|
|
1112
|
+
agentId: string;
|
|
1113
|
+
companyId: string;
|
|
1114
|
+
},
|
|
1115
|
+
result: Agent
|
|
1116
|
+
];
|
|
1117
|
+
"agents.resume": [
|
|
1118
|
+
params: {
|
|
1119
|
+
agentId: string;
|
|
1120
|
+
companyId: string;
|
|
1121
|
+
},
|
|
1122
|
+
result: Agent
|
|
1123
|
+
];
|
|
1124
|
+
"agents.invoke": [
|
|
1125
|
+
params: {
|
|
1126
|
+
agentId: string;
|
|
1127
|
+
companyId: string;
|
|
1128
|
+
prompt: string;
|
|
1129
|
+
reason?: string;
|
|
1130
|
+
},
|
|
1131
|
+
result: {
|
|
1132
|
+
runId: string;
|
|
1133
|
+
}
|
|
1134
|
+
];
|
|
1135
|
+
"agents.managed.get": [
|
|
1136
|
+
params: {
|
|
1137
|
+
agentKey: string;
|
|
1138
|
+
companyId: string;
|
|
1139
|
+
},
|
|
1140
|
+
result: PluginManagedAgentResolution
|
|
1141
|
+
];
|
|
1142
|
+
"agents.managed.reconcile": [
|
|
1143
|
+
params: {
|
|
1144
|
+
agentKey: string;
|
|
1145
|
+
companyId: string;
|
|
1146
|
+
},
|
|
1147
|
+
result: PluginManagedAgentResolution
|
|
1148
|
+
];
|
|
1149
|
+
"agents.managed.reset": [
|
|
1150
|
+
params: {
|
|
1151
|
+
agentKey: string;
|
|
1152
|
+
companyId: string;
|
|
1153
|
+
},
|
|
1154
|
+
result: PluginManagedAgentResolution
|
|
1155
|
+
];
|
|
1156
|
+
"agents.sessions.create": [
|
|
1157
|
+
params: {
|
|
1158
|
+
agentId: string;
|
|
1159
|
+
companyId: string;
|
|
1160
|
+
taskKey?: string;
|
|
1161
|
+
reason?: string;
|
|
1162
|
+
},
|
|
1163
|
+
result: {
|
|
1164
|
+
sessionId: string;
|
|
1165
|
+
agentId: string;
|
|
1166
|
+
companyId: string;
|
|
1167
|
+
status: "active" | "closed";
|
|
1168
|
+
createdAt: string;
|
|
1169
|
+
}
|
|
1170
|
+
];
|
|
1171
|
+
"agents.sessions.list": [
|
|
1172
|
+
params: {
|
|
1173
|
+
agentId: string;
|
|
1174
|
+
companyId: string;
|
|
1175
|
+
},
|
|
1176
|
+
result: Array<{
|
|
1177
|
+
sessionId: string;
|
|
1178
|
+
agentId: string;
|
|
1179
|
+
companyId: string;
|
|
1180
|
+
status: "active" | "closed";
|
|
1181
|
+
createdAt: string;
|
|
1182
|
+
}>
|
|
1183
|
+
];
|
|
1184
|
+
"agents.sessions.sendMessage": [
|
|
1185
|
+
params: {
|
|
1186
|
+
sessionId: string;
|
|
1187
|
+
companyId: string;
|
|
1188
|
+
prompt: string;
|
|
1189
|
+
reason?: string;
|
|
1190
|
+
},
|
|
1191
|
+
result: {
|
|
1192
|
+
runId: string;
|
|
1193
|
+
}
|
|
1194
|
+
];
|
|
1195
|
+
"agents.sessions.close": [
|
|
1196
|
+
params: {
|
|
1197
|
+
sessionId: string;
|
|
1198
|
+
companyId: string;
|
|
1199
|
+
},
|
|
1200
|
+
result: void
|
|
1201
|
+
];
|
|
1202
|
+
"goals.list": [
|
|
1203
|
+
params: {
|
|
1204
|
+
companyId: string;
|
|
1205
|
+
level?: string;
|
|
1206
|
+
status?: string;
|
|
1207
|
+
limit?: number;
|
|
1208
|
+
offset?: number;
|
|
1209
|
+
},
|
|
1210
|
+
result: Goal[]
|
|
1211
|
+
];
|
|
1212
|
+
"goals.get": [
|
|
1213
|
+
params: {
|
|
1214
|
+
goalId: string;
|
|
1215
|
+
companyId: string;
|
|
1216
|
+
},
|
|
1217
|
+
result: Goal | null
|
|
1218
|
+
];
|
|
1219
|
+
"goals.create": [
|
|
1220
|
+
params: {
|
|
1221
|
+
companyId: string;
|
|
1222
|
+
title: string;
|
|
1223
|
+
description?: string;
|
|
1224
|
+
level?: string;
|
|
1225
|
+
status?: string;
|
|
1226
|
+
parentId?: string;
|
|
1227
|
+
ownerAgentId?: string;
|
|
1228
|
+
},
|
|
1229
|
+
result: Goal
|
|
1230
|
+
];
|
|
1231
|
+
"goals.update": [
|
|
1232
|
+
params: {
|
|
1233
|
+
goalId: string;
|
|
1234
|
+
patch: Record<string, unknown>;
|
|
1235
|
+
companyId: string;
|
|
1236
|
+
},
|
|
1237
|
+
result: Goal
|
|
1238
|
+
];
|
|
1239
|
+
"access.members.list": [
|
|
1240
|
+
params: {
|
|
1241
|
+
companyId: string;
|
|
1242
|
+
includeArchived?: boolean;
|
|
1243
|
+
},
|
|
1244
|
+
result: PluginAccessMember[]
|
|
1245
|
+
];
|
|
1246
|
+
"access.members.get": [
|
|
1247
|
+
params: {
|
|
1248
|
+
memberId: string;
|
|
1249
|
+
companyId: string;
|
|
1250
|
+
},
|
|
1251
|
+
result: PluginAccessMember | null
|
|
1252
|
+
];
|
|
1253
|
+
"access.members.update": [
|
|
1254
|
+
params: {
|
|
1255
|
+
memberId: string;
|
|
1256
|
+
companyId: string;
|
|
1257
|
+
patch: {
|
|
1258
|
+
membershipRole?: string | null;
|
|
1259
|
+
status?: "pending" | "active" | "suspended";
|
|
1260
|
+
};
|
|
1261
|
+
},
|
|
1262
|
+
result: PluginAccessMember
|
|
1263
|
+
];
|
|
1264
|
+
"access.invites.list": [
|
|
1265
|
+
params: {
|
|
1266
|
+
companyId: string;
|
|
1267
|
+
state?: "active" | "revoked" | "accepted" | "expired";
|
|
1268
|
+
limit?: number;
|
|
1269
|
+
offset?: number;
|
|
1270
|
+
},
|
|
1271
|
+
result: {
|
|
1272
|
+
invites: PluginAccessInvite[];
|
|
1273
|
+
nextOffset: number | null;
|
|
1274
|
+
}
|
|
1275
|
+
];
|
|
1276
|
+
"access.invites.create": [
|
|
1277
|
+
params: {
|
|
1278
|
+
companyId: string;
|
|
1279
|
+
allowedJoinTypes?: "human" | "agent" | "both";
|
|
1280
|
+
humanRole?: string | null;
|
|
1281
|
+
defaultsPayload?: Record<string, unknown> | null;
|
|
1282
|
+
agentMessage?: string | null;
|
|
1283
|
+
},
|
|
1284
|
+
result: PluginAccessInvite & {
|
|
1285
|
+
token: string;
|
|
1286
|
+
}
|
|
1287
|
+
];
|
|
1288
|
+
"access.invites.revoke": [
|
|
1289
|
+
params: {
|
|
1290
|
+
inviteId: string;
|
|
1291
|
+
companyId: string;
|
|
1292
|
+
},
|
|
1293
|
+
result: PluginAccessInvite
|
|
1294
|
+
];
|
|
1295
|
+
"authorization.grants.list": [
|
|
1296
|
+
params: {
|
|
1297
|
+
companyId: string;
|
|
1298
|
+
principalType?: string;
|
|
1299
|
+
principalId?: string;
|
|
1300
|
+
},
|
|
1301
|
+
result: PrincipalPermissionGrant[]
|
|
1302
|
+
];
|
|
1303
|
+
"authorization.grants.set": [
|
|
1304
|
+
params: {
|
|
1305
|
+
companyId: string;
|
|
1306
|
+
principalType: string;
|
|
1307
|
+
principalId: string;
|
|
1308
|
+
grants: Array<{
|
|
1309
|
+
permissionKey: string;
|
|
1310
|
+
scope?: Record<string, unknown> | null;
|
|
1311
|
+
}>;
|
|
1312
|
+
grantedByUserId?: string | null;
|
|
1313
|
+
},
|
|
1314
|
+
result: PrincipalPermissionGrant[]
|
|
1315
|
+
];
|
|
1316
|
+
"authorization.policies.summary": [
|
|
1317
|
+
params: {
|
|
1318
|
+
companyId: string;
|
|
1319
|
+
},
|
|
1320
|
+
result: PluginAuthorizationPolicySummary
|
|
1321
|
+
];
|
|
1322
|
+
"authorization.policies.get": [
|
|
1323
|
+
params: {
|
|
1324
|
+
companyId: string;
|
|
1325
|
+
resourceType: "company" | "agent" | "project" | "issue";
|
|
1326
|
+
resourceId: string;
|
|
1327
|
+
},
|
|
1328
|
+
result: PluginAuthorizationPolicyRecord | null
|
|
1329
|
+
];
|
|
1330
|
+
"authorization.policies.update": [
|
|
1331
|
+
params: {
|
|
1332
|
+
companyId: string;
|
|
1333
|
+
resourceType: "company" | "agent" | "project" | "issue";
|
|
1334
|
+
resourceId: string;
|
|
1335
|
+
policy: Record<string, unknown> | null;
|
|
1336
|
+
},
|
|
1337
|
+
result: PluginAuthorizationPolicyRecord
|
|
1338
|
+
];
|
|
1339
|
+
"authorization.policies.previewAssignment": [
|
|
1340
|
+
params: PluginAssignmentPreviewInput,
|
|
1341
|
+
result: PluginAuthorizationDecisionResult
|
|
1342
|
+
];
|
|
1343
|
+
"authorization.policies.explainAssignment": [
|
|
1344
|
+
params: PluginAssignmentPreviewInput,
|
|
1345
|
+
result: PluginAuthorizationDecisionResult
|
|
1346
|
+
];
|
|
1347
|
+
"authorization.audit.search": [
|
|
1348
|
+
params: {
|
|
1349
|
+
companyId: string;
|
|
1350
|
+
action?: string;
|
|
1351
|
+
actorType?: string;
|
|
1352
|
+
actorId?: string;
|
|
1353
|
+
entityType?: string;
|
|
1354
|
+
entityId?: string;
|
|
1355
|
+
decision?: string;
|
|
1356
|
+
limit?: number;
|
|
1357
|
+
offset?: number;
|
|
1358
|
+
},
|
|
1359
|
+
result: PluginAuthorizationAuditEntry[]
|
|
1360
|
+
];
|
|
1361
|
+
}
|
|
1362
|
+
/** Union of all worker→host method names. */
|
|
1363
|
+
export type WorkerToHostMethodName = keyof WorkerToHostMethods;
|
|
1364
|
+
/**
|
|
1365
|
+
* Typed parameter shapes for worker→host JSON-RPC notifications.
|
|
1366
|
+
*
|
|
1367
|
+
* Notifications are fire-and-forget — the worker does not wait for a response.
|
|
1368
|
+
* These are used for streaming events and logging, not for request-response RPCs.
|
|
1369
|
+
*/
|
|
1370
|
+
export interface WorkerToHostNotifications {
|
|
1371
|
+
/**
|
|
1372
|
+
* Forward a stream event to connected SSE clients.
|
|
1373
|
+
*
|
|
1374
|
+
* Emitted by the worker for each event on a stream channel. The host
|
|
1375
|
+
* publishes to the PluginStreamBus, which fans out to all SSE clients
|
|
1376
|
+
* subscribed to the (pluginId, channel, companyId) tuple.
|
|
1377
|
+
*
|
|
1378
|
+
* The `event` payload is JSON-serializable and sent as SSE `data:`.
|
|
1379
|
+
* The default SSE event type is `"message"`.
|
|
1380
|
+
*/
|
|
1381
|
+
"streams.emit": {
|
|
1382
|
+
channel: string;
|
|
1383
|
+
companyId: string;
|
|
1384
|
+
event: unknown;
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* Signal that a stream channel has been opened.
|
|
1388
|
+
*
|
|
1389
|
+
* Emitted when the worker calls `ctx.streams.open(channel, companyId)`.
|
|
1390
|
+
* UI clients may use this to display a "connected" indicator or begin
|
|
1391
|
+
* buffering input. The host tracks open channels so it can emit synthetic
|
|
1392
|
+
* close events if the worker crashes.
|
|
1393
|
+
*/
|
|
1394
|
+
"streams.open": {
|
|
1395
|
+
channel: string;
|
|
1396
|
+
companyId: string;
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* Signal that a stream channel has been closed.
|
|
1400
|
+
*
|
|
1401
|
+
* Emitted when the worker calls `ctx.streams.close(channel)`, or
|
|
1402
|
+
* synthetically by the host when a worker process exits with channels
|
|
1403
|
+
* still open. UI clients should treat this as terminal and disconnect
|
|
1404
|
+
* the SSE connection.
|
|
1405
|
+
*/
|
|
1406
|
+
"streams.close": {
|
|
1407
|
+
channel: string;
|
|
1408
|
+
companyId: string;
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
/** Union of all worker→host notification method names. */
|
|
1412
|
+
export type WorkerToHostNotificationName = keyof WorkerToHostNotifications;
|
|
1413
|
+
/**
|
|
1414
|
+
* A typed JSON-RPC request for a specific host→worker method.
|
|
1415
|
+
*/
|
|
1416
|
+
export type HostToWorkerRequest<M extends HostToWorkerMethodName> = JsonRpcRequest<M, HostToWorkerMethods[M][0]>;
|
|
1417
|
+
/**
|
|
1418
|
+
* A typed JSON-RPC success response for a specific host→worker method.
|
|
1419
|
+
*/
|
|
1420
|
+
export type HostToWorkerResponse<M extends HostToWorkerMethodName> = JsonRpcSuccessResponse<HostToWorkerMethods[M][1]>;
|
|
1421
|
+
/**
|
|
1422
|
+
* A typed JSON-RPC request for a specific worker→host method.
|
|
1423
|
+
*/
|
|
1424
|
+
export type WorkerToHostRequest<M extends WorkerToHostMethodName> = JsonRpcRequest<M, WorkerToHostMethods[M][0]>;
|
|
1425
|
+
/**
|
|
1426
|
+
* A typed JSON-RPC success response for a specific worker→host method.
|
|
1427
|
+
*/
|
|
1428
|
+
export type WorkerToHostResponse<M extends WorkerToHostMethodName> = JsonRpcSuccessResponse<WorkerToHostMethods[M][1]>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Create a JSON-RPC 2.0 request message.
|
|
1431
|
+
*
|
|
1432
|
+
* @param method - The RPC method name
|
|
1433
|
+
* @param params - Structured parameters
|
|
1434
|
+
* @param id - Optional explicit request ID (auto-generated if omitted)
|
|
1435
|
+
*/
|
|
1436
|
+
export declare function createRequest<TMethod extends string>(method: TMethod, params: unknown, id?: JsonRpcId): JsonRpcRequest<TMethod>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Create a JSON-RPC 2.0 success response.
|
|
1439
|
+
*
|
|
1440
|
+
* @param id - The request ID being responded to
|
|
1441
|
+
* @param result - The result value
|
|
1442
|
+
*/
|
|
1443
|
+
export declare function createSuccessResponse<TResult>(id: JsonRpcId, result: TResult): JsonRpcSuccessResponse<TResult>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Create a JSON-RPC 2.0 error response.
|
|
1446
|
+
*
|
|
1447
|
+
* @param id - The request ID being responded to (null if the request ID could not be determined)
|
|
1448
|
+
* @param code - Machine-readable error code
|
|
1449
|
+
* @param message - Human-readable error message
|
|
1450
|
+
* @param data - Optional structured error data
|
|
1451
|
+
*/
|
|
1452
|
+
export declare function createErrorResponse<TData = unknown>(id: JsonRpcId | null, code: number, message: string, data?: TData): JsonRpcErrorResponse<TData>;
|
|
1453
|
+
/**
|
|
1454
|
+
* Create a JSON-RPC 2.0 notification (fire-and-forget, no response expected).
|
|
1455
|
+
*
|
|
1456
|
+
* @param method - The notification method name
|
|
1457
|
+
* @param params - Structured parameters
|
|
1458
|
+
*/
|
|
1459
|
+
export declare function createNotification<TMethod extends string>(method: TMethod, params: unknown): JsonRpcNotification<TMethod>;
|
|
1460
|
+
/**
|
|
1461
|
+
* Check whether a value is a well-formed JSON-RPC 2.0 request.
|
|
1462
|
+
*
|
|
1463
|
+
* A request has `jsonrpc: "2.0"`, a string `method`, and an `id`.
|
|
1464
|
+
*/
|
|
1465
|
+
export declare function isJsonRpcRequest(value: unknown): value is JsonRpcRequest;
|
|
1466
|
+
/**
|
|
1467
|
+
* Check whether a value is a well-formed JSON-RPC 2.0 notification.
|
|
1468
|
+
*
|
|
1469
|
+
* A notification has `jsonrpc: "2.0"`, a string `method`, but no `id`.
|
|
1470
|
+
*/
|
|
1471
|
+
export declare function isJsonRpcNotification(value: unknown): value is JsonRpcNotification;
|
|
1472
|
+
/**
|
|
1473
|
+
* Check whether a value is a well-formed JSON-RPC 2.0 response (success or error).
|
|
1474
|
+
*/
|
|
1475
|
+
export declare function isJsonRpcResponse(value: unknown): value is JsonRpcResponse;
|
|
1476
|
+
/**
|
|
1477
|
+
* Check whether a JSON-RPC response is a success response.
|
|
1478
|
+
*/
|
|
1479
|
+
export declare function isJsonRpcSuccessResponse(response: JsonRpcResponse): response is JsonRpcSuccessResponse;
|
|
1480
|
+
/**
|
|
1481
|
+
* Check whether a JSON-RPC response is an error response.
|
|
1482
|
+
*/
|
|
1483
|
+
export declare function isJsonRpcErrorResponse(response: JsonRpcResponse): response is JsonRpcErrorResponse;
|
|
1484
|
+
/**
|
|
1485
|
+
* Line delimiter for JSON-RPC messages over stdio.
|
|
1486
|
+
*
|
|
1487
|
+
* Each message is a single line of JSON terminated by a newline character.
|
|
1488
|
+
* This follows the newline-delimited JSON (NDJSON) convention.
|
|
1489
|
+
*/
|
|
1490
|
+
export declare const MESSAGE_DELIMITER: "\n";
|
|
1491
|
+
/**
|
|
1492
|
+
* Serialize a JSON-RPC message to a newline-delimited string for transmission
|
|
1493
|
+
* over stdio.
|
|
1494
|
+
*
|
|
1495
|
+
* @param message - Any JSON-RPC message (request, response, or notification)
|
|
1496
|
+
* @returns The JSON string terminated with a newline
|
|
1497
|
+
*/
|
|
1498
|
+
export declare function serializeMessage(message: JsonRpcMessage): string;
|
|
1499
|
+
/**
|
|
1500
|
+
* Parse a JSON string into a JSON-RPC message.
|
|
1501
|
+
*
|
|
1502
|
+
* Returns the parsed message or throws a `JsonRpcParseError` if the input
|
|
1503
|
+
* is not valid JSON or does not conform to the JSON-RPC 2.0 structure.
|
|
1504
|
+
*
|
|
1505
|
+
* @param line - A single line of JSON text (with or without trailing newline)
|
|
1506
|
+
* @returns The parsed JSON-RPC message
|
|
1507
|
+
* @throws {JsonRpcParseError} If parsing fails
|
|
1508
|
+
*/
|
|
1509
|
+
export declare function parseMessage(line: string): JsonRpcMessage;
|
|
1510
|
+
/**
|
|
1511
|
+
* Error thrown when a JSON-RPC message cannot be parsed.
|
|
1512
|
+
*/
|
|
1513
|
+
export declare class JsonRpcParseError extends Error {
|
|
1514
|
+
readonly name = "JsonRpcParseError";
|
|
1515
|
+
constructor(message: string);
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Error thrown when a JSON-RPC call fails with a structured error response.
|
|
1519
|
+
*
|
|
1520
|
+
* Captures the full `JsonRpcError` so callers can inspect the code and data.
|
|
1521
|
+
*/
|
|
1522
|
+
export declare class JsonRpcCallError extends Error {
|
|
1523
|
+
readonly name = "JsonRpcCallError";
|
|
1524
|
+
/** The JSON-RPC error code. */
|
|
1525
|
+
readonly code: number;
|
|
1526
|
+
/** Optional structured error data from the response. */
|
|
1527
|
+
readonly data: unknown;
|
|
1528
|
+
constructor(error: JsonRpcError);
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* The `issues.create` params this protocol version defines, as a RUNTIME value.
|
|
1532
|
+
*
|
|
1533
|
+
* `WorkerToHostMethods["issues.create"][0]` is a type and is erased at runtime, so a host cannot
|
|
1534
|
+
* enumerate what it accepts without a value like this one. The two are kept in lockstep by the
|
|
1535
|
+
* compiler, not by discipline: `satisfies` rejects a name that is not a field, and the
|
|
1536
|
+
* `_issuesCreateFieldsAreComplete` assignment below fails to compile if a field is added to the
|
|
1537
|
+
* type and not to this array. A hand-maintained second copy is exactly the drift this is meant to
|
|
1538
|
+
* detect, so it is not permitted to be one.
|
|
1539
|
+
*/
|
|
1540
|
+
export declare const ISSUES_CREATE_FIELDS: readonly ["companyId", "projectId", "goalId", "parentId", "inheritExecutionWorkspaceFromIssueId", "title", "description", "status", "priority", "assigneeAgentId", "assigneeUserId", "requestDepth", "billingCode", "assigneeAdapterOverrides", "surfaceVisibility", "originKind", "originId", "originRunId", "originFingerprint", "blockedByIssueIds", "labelIds", "executionWorkspaceId", "executionWorkspacePreference", "executionWorkspaceSettings", "actorAgentId", "actorUserId", "actorRunId"];
|
|
1541
|
+
/**
|
|
1542
|
+
* What a host of THIS build advertises in {@link InitializeParams.supportedRequestFields}.
|
|
1543
|
+
*
|
|
1544
|
+
* Keyed by method so the mechanism is not `issues.create`-shaped: the worker's check lives at the
|
|
1545
|
+
* single `callHost` choke point, so covering another method is one entry here and no new call-site
|
|
1546
|
+
* code. A method absent from this map is unchecked — assumed supported — which keeps the default
|
|
1547
|
+
* silent rather than noisy.
|
|
1548
|
+
*/
|
|
1549
|
+
export declare const HOST_SUPPORTED_REQUEST_FIELDS: Readonly<Record<string, readonly string[]>>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Reset the internal request ID counter. **For testing only.**
|
|
1552
|
+
*
|
|
1553
|
+
* @internal
|
|
1554
|
+
*/
|
|
1555
|
+
export declare function _resetIdCounter(): void;
|
|
1556
|
+
//# sourceMappingURL=protocol.d.ts.map
|