@jangmanj/pi-mcp-ext 0.0.0-stage → 0.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/src/types.ts ADDED
@@ -0,0 +1,574 @@
1
+ /**
2
+ * Shared contract of pi-mcp-ext: MCP 2026-07-28 wire types (SEP-2575, SEP-3415, SEP-2663, SEP-2243)
3
+ * and the internal seams between modules. Every other module imports from here; nothing here runs.
4
+ */
5
+
6
+ // ---------------------------------------------------------------------------------------------
7
+ // Protocol constants
8
+ // ---------------------------------------------------------------------------------------------
9
+
10
+ export const PROTOCOL_VERSION = "2026-07-28";
11
+ export const EXT_EVENTS = "io.modelcontextprotocol/events";
12
+ export const EXT_TASKS = "io.modelcontextprotocol/tasks";
13
+ export const META_PROTOCOL_VERSION = "io.modelcontextprotocol/protocolVersion";
14
+ export const META_CLIENT_CAPABILITIES = "io.modelcontextprotocol/clientCapabilities";
15
+ export const META_CLIENT_INFO = "io.modelcontextprotocol/clientInfo";
16
+ export const META_SERVER_INFO = "io.modelcontextprotocol/serverInfo";
17
+ export const META_SUBSCRIPTION_ID = "io.modelcontextprotocol/subscriptionId";
18
+ export const CLIENT_INFO = { name: "pi-mcp-ext", version: "0.1.0" } as const;
19
+
20
+ /** JSON-RPC and MCP error codes this package acts on. */
21
+ export const ErrorCode = {
22
+ ParseError: -32700,
23
+ InvalidRequest: -32600,
24
+ MethodNotFound: -32601,
25
+ InvalidParams: -32602,
26
+ InternalError: -32603,
27
+ HeaderMismatch: -32020,
28
+ MissingRequiredClientCapability: -32021,
29
+ UnsupportedProtocolVersion: -32022,
30
+ NotFound: -32023,
31
+ Forbidden: -32024,
32
+ ResourceExhausted: -32025,
33
+ Unsupported: -32026,
34
+ } as const;
35
+
36
+ /** Codes that prove a server speaks 2026-07-28-era MCP even when it rejects the request. */
37
+ export const MODERN_ERROR_CODES: readonly number[] = [
38
+ ErrorCode.HeaderMismatch,
39
+ ErrorCode.MissingRequiredClientCapability,
40
+ ErrorCode.UnsupportedProtocolVersion,
41
+ ];
42
+
43
+ // ---------------------------------------------------------------------------------------------
44
+ // JSON-RPC 2.0
45
+ // ---------------------------------------------------------------------------------------------
46
+
47
+ export type RequestId = string | number;
48
+ export type JsonObject = Record<string, unknown>;
49
+
50
+ export interface JSONRPCRequest {
51
+ jsonrpc: "2.0";
52
+ id: RequestId;
53
+ method: string;
54
+ params?: JsonObject & { _meta?: JsonObject };
55
+ }
56
+
57
+ export interface JSONRPCNotification {
58
+ jsonrpc: "2.0";
59
+ method: string;
60
+ params?: JsonObject & { _meta?: JsonObject };
61
+ }
62
+
63
+ export interface JSONRPCResultResponse {
64
+ jsonrpc: "2.0";
65
+ id: RequestId;
66
+ result: JsonObject;
67
+ }
68
+
69
+ export interface JSONRPCErrorObject {
70
+ code: number;
71
+ message: string;
72
+ data?: unknown;
73
+ }
74
+
75
+ export interface JSONRPCErrorResponse {
76
+ jsonrpc: "2.0";
77
+ id: RequestId | null;
78
+ error: JSONRPCErrorObject;
79
+ }
80
+
81
+ export type JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse;
82
+ export type JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResponse;
83
+
84
+ export function isResponse(msg: unknown): msg is JSONRPCResponse {
85
+ return typeof msg === "object" && msg !== null && "id" in msg && ("result" in msg || "error" in msg);
86
+ }
87
+ export function isNotification(msg: unknown): msg is JSONRPCNotification {
88
+ return typeof msg === "object" && msg !== null && "method" in msg && !("id" in msg);
89
+ }
90
+ export function isErrorResponse(msg: JSONRPCResponse): msg is JSONRPCErrorResponse {
91
+ return "error" in msg;
92
+ }
93
+ /** `params._meta["io.modelcontextprotocol/subscriptionId"]` of a notification, if any. */
94
+ export function subscriptionIdOf(msg: JSONRPCNotification): RequestId | undefined {
95
+ const id = (msg.params?._meta as JsonObject | undefined)?.[META_SUBSCRIPTION_ID];
96
+ return typeof id === "string" || typeof id === "number" ? id : undefined;
97
+ }
98
+
99
+ /** A JSON-RPC error returned by a server. */
100
+ export class McpRpcError extends Error {
101
+ readonly code: number;
102
+ readonly data?: unknown;
103
+ constructor(error: JSONRPCErrorObject) {
104
+ super(error.message);
105
+ this.name = "McpRpcError";
106
+ this.code = error.code;
107
+ this.data = error.data;
108
+ }
109
+ }
110
+
111
+ export type TransportErrorKind =
112
+ | "timeout" // per-request timer fired
113
+ | "closed" // transport closed or process exited
114
+ | "interrupted" // SSE / stream ended before the response for the request id
115
+ | "http" // non-2xx HTTP status without a JSON-RPC error body
116
+ | "network" // fetch failed
117
+ | "needs-auth" // HTTP 401 that survived the mcp-auth.json re-read
118
+ | "protocol" // unparseable or invalid response
119
+ | "aborted"; // caller's AbortSignal
120
+
121
+ /** A failure below JSON-RPC: the server never produced a JSON-RPC response. */
122
+ export class McpTransportError extends Error {
123
+ readonly kind: TransportErrorKind;
124
+ readonly status?: number;
125
+ constructor(kind: TransportErrorKind, message: string, status?: number) {
126
+ super(message);
127
+ this.name = "McpTransportError";
128
+ this.kind = kind;
129
+ this.status = status;
130
+ }
131
+ }
132
+
133
+ // ---------------------------------------------------------------------------------------------
134
+ // SEP-2575 stateless framing
135
+ // ---------------------------------------------------------------------------------------------
136
+
137
+ export interface Implementation {
138
+ name: string;
139
+ version: string;
140
+ title?: string;
141
+ }
142
+
143
+ export interface ClientCapabilities {
144
+ extensions: Record<string, JsonObject>;
145
+ roots?: JsonObject;
146
+ elicitation?: { form?: JsonObject; url?: JsonObject };
147
+ }
148
+
149
+ export interface ServerCapabilities {
150
+ extensions?: Record<string, unknown>;
151
+ tools?: JsonObject;
152
+ resources?: JsonObject;
153
+ prompts?: JsonObject;
154
+ [key: string]: unknown;
155
+ }
156
+
157
+ export interface DiscoverResult {
158
+ resultType: "complete";
159
+ supportedVersions: string[];
160
+ capabilities: ServerCapabilities;
161
+ instructions?: string;
162
+ ttlMs?: number;
163
+ cacheScope?: "public" | "private";
164
+ _meta?: { [META_SERVER_INFO]?: Implementation } & JsonObject;
165
+ }
166
+
167
+ /** Filter of `subscriptions/listen` and of its acknowledgment. False/empty fields are omitted on the wire. */
168
+ export interface ListenFilter {
169
+ eventsListChanged?: boolean;
170
+ taskIds?: string[];
171
+ }
172
+
173
+ // ---------------------------------------------------------------------------------------------
174
+ // SEP-3415 events
175
+ // ---------------------------------------------------------------------------------------------
176
+
177
+ export type DeliveryMode = "poll" | "push" | "webhook";
178
+
179
+ export interface EventDescriptor {
180
+ name: string;
181
+ description?: string;
182
+ delivery: DeliveryMode[];
183
+ inputSchema?: JsonObject;
184
+ payloadSchema?: JsonObject;
185
+ _meta?: JsonObject;
186
+ }
187
+
188
+ export interface ListEventsResult {
189
+ resultType: "complete";
190
+ events: EventDescriptor[];
191
+ nextCursor?: string;
192
+ }
193
+
194
+ export interface EventOccurrence {
195
+ eventId: string;
196
+ name: string;
197
+ timestamp: string;
198
+ data: JsonObject;
199
+ /** Push per-event cursor; absent === null. */
200
+ cursor?: string | null;
201
+ _meta?: JsonObject;
202
+ }
203
+
204
+ export interface PollEventsParams {
205
+ name: string;
206
+ arguments?: JsonObject;
207
+ cursor: string | null;
208
+ maxAgeMs?: number;
209
+ maxEvents?: number;
210
+ }
211
+
212
+ export interface PollEventsResult {
213
+ resultType: "complete";
214
+ events: EventOccurrence[];
215
+ cursor?: string | null;
216
+ truncated?: boolean;
217
+ hasMore: boolean;
218
+ nextPollMs?: number;
219
+ }
220
+
221
+ export interface StreamEventsParams {
222
+ name: string;
223
+ arguments?: JsonObject;
224
+ cursor?: string | null;
225
+ maxAgeMs?: number;
226
+ }
227
+
228
+ // ---------------------------------------------------------------------------------------------
229
+ // SEP-2663 tasks
230
+ // ---------------------------------------------------------------------------------------------
231
+
232
+ export type TaskStatus = "working" | "input_required" | "completed" | "cancelled" | "failed";
233
+ export const TERMINAL_STATUSES: readonly TaskStatus[] = ["completed", "cancelled", "failed"];
234
+
235
+ export interface Task {
236
+ taskId: string;
237
+ status: TaskStatus;
238
+ statusMessage?: string;
239
+ createdAt: string;
240
+ lastUpdatedAt: string;
241
+ ttlMs: number | null;
242
+ pollIntervalMs?: number;
243
+ }
244
+
245
+ export interface CreateTaskResult extends Task {
246
+ resultType: "task";
247
+ _meta?: JsonObject;
248
+ }
249
+
250
+ /** An MRTR request a server asks the client to fulfil (`elicitation/create`, `sampling/createMessage`, `roots/list`). */
251
+ export interface ServerClientRequest {
252
+ method: string;
253
+ params?: JsonObject;
254
+ }
255
+
256
+ export type WorkingTask = Task & { status: "working" };
257
+ export type InputRequiredTask = Task & { status: "input_required"; inputRequests: Record<string, ServerClientRequest> };
258
+ export type CompletedTask = Task & { status: "completed"; result: JsonObject };
259
+ export type FailedTask = Task & { status: "failed"; error: JSONRPCErrorObject };
260
+ export type CancelledTask = Task & { status: "cancelled" };
261
+ export type DetailedTask = WorkingTask | InputRequiredTask | CompletedTask | FailedTask | CancelledTask;
262
+
263
+ export interface CallToolResult {
264
+ resultType?: "complete";
265
+ content: Array<JsonObject & { type: string }>;
266
+ structuredContent?: JsonObject;
267
+ isError?: boolean;
268
+ _meta?: JsonObject;
269
+ }
270
+
271
+ export interface InputRequiredResult {
272
+ resultType: "input_required";
273
+ inputRequests?: Record<string, ServerClientRequest>;
274
+ requestState?: string;
275
+ }
276
+
277
+ export type ToolCallOutcome = CallToolResult | InputRequiredResult | CreateTaskResult;
278
+
279
+ // ---------------------------------------------------------------------------------------------
280
+ // Transport seam (spec §3)
281
+ // ---------------------------------------------------------------------------------------------
282
+
283
+ export interface TransportRequestOptions {
284
+ signal?: AbortSignal;
285
+ /** undefined disables the per-request timer (used for open streams). */
286
+ timeoutMs?: number;
287
+ onNotification?: (msg: JSONRPCNotification) => void;
288
+ /** HTTP only: extra headers, e.g. `Mcp-Param-*` (SEP-2243). Ignored by stdio. */
289
+ headers?: Record<string, string>;
290
+ }
291
+
292
+ export interface OpenStreamHandle {
293
+ readonly requestId: RequestId;
294
+ /** Resolves with the final result (graceful close), or undefined when the stream ended without one. Rejects on JSON-RPC error. */
295
+ readonly done: Promise<JSONRPCResultResponse | undefined>;
296
+ cancel(reason?: string): Promise<void>;
297
+ }
298
+
299
+ export interface Mcp2026Transport {
300
+ readonly kind: "stdio" | "http";
301
+ /** Resolves with the JSON-RPC response (including error responses); rejects with McpTransportError. */
302
+ request(msg: JSONRPCRequest, opts?: TransportRequestOptions): Promise<JSONRPCResponse>;
303
+ openStream(
304
+ msg: JSONRPCRequest,
305
+ onNotification: (msg: JSONRPCNotification) => void,
306
+ opts?: { signal?: AbortSignal; headers?: Record<string, string> },
307
+ ): Promise<OpenStreamHandle>;
308
+ onUnexpectedClose(listener: (err?: Error) => void): () => void;
309
+ close(): Promise<void>;
310
+ }
311
+
312
+ // ---------------------------------------------------------------------------------------------
313
+ // Configuration seam (spec §2.2, §2.3, §3.1)
314
+ // ---------------------------------------------------------------------------------------------
315
+
316
+ export type ConfigScope = "global" | "project" | "session";
317
+
318
+ interface ResolvedServerBase {
319
+ name: string;
320
+ /** `"mcp__" + name.replace(/-/g, "_")` */
321
+ namespace: string;
322
+ scope: ConfigScope;
323
+ enabled: boolean;
324
+ /** `config.timeout` (seconds, default 60) in ms. */
325
+ timeoutMs: number;
326
+ }
327
+
328
+ export interface ResolvedStdioServer extends ResolvedServerBase {
329
+ transport: "stdio";
330
+ command: string;
331
+ args: string[];
332
+ /** Raw values; expanded with resolveConfigValue on each connect. */
333
+ env: Record<string, string>;
334
+ cwd?: string;
335
+ }
336
+
337
+ export interface ResolvedHttpServer extends ResolvedServerBase {
338
+ transport: "http";
339
+ url: string;
340
+ /** Raw values; expanded with resolveConfigValue on each request. */
341
+ headers: Record<string, string>;
342
+ /** Set only when allowed (global or session scope, https or loopback URL). */
343
+ authProvider?: string;
344
+ }
345
+
346
+ export type ResolvedServer = ResolvedStdioServer | ResolvedHttpServer;
347
+
348
+ export interface ConfigWarning {
349
+ scope: ConfigScope;
350
+ server?: string;
351
+ message: string;
352
+ }
353
+
354
+ export interface ConfigLoadResult {
355
+ servers: ResolvedServer[];
356
+ warnings: ConfigWarning[];
357
+ }
358
+
359
+ export interface ConfigLoadOptions {
360
+ cwd: string;
361
+ isProjectTrusted: boolean;
362
+ /** Servers from `pi.getMcpServers()`: `{ name, config }` with the raw mcp.json-shaped config. */
363
+ sessionServers: Array<{ name: string; config: JsonObject }>;
364
+ }
365
+
366
+ /** Per-request `Authorization` for one HTTP server (spec §2.3). Never writes anything. */
367
+ export interface AuthResolver {
368
+ /** Resolved `Authorization` value or undefined. */
369
+ authorization(): Promise<string | undefined>;
370
+ /**
371
+ * After a 401: wait 250 ms, re-read mcp-auth.json, and return true when the token changed
372
+ * (the caller retries once). False means the server needs sign-in.
373
+ */
374
+ refreshAfterUnauthorized(): Promise<boolean>;
375
+ }
376
+
377
+ /** Resolves a provider token through Pi (`ctx.modelRegistry.getProviderAuth(provider)`). */
378
+ export type ProviderTokenLookup = (provider: string) => Promise<string | undefined>;
379
+
380
+ // ---------------------------------------------------------------------------------------------
381
+ // Client seam (spec §4)
382
+ // ---------------------------------------------------------------------------------------------
383
+
384
+ export type ServerEra =
385
+ | "unknown" // not probed yet
386
+ | "probing"
387
+ | "modern" // 2026-07-28 with events and/or tasks
388
+ | "modern-dormant" // 2026-07-28 without events or tasks
389
+ | "unsupported-modern-version"
390
+ | "legacy" // builtin:mcp owns it
391
+ | "needs-auth"
392
+ | "error" // config resolution or transport failure (message in ServerState.error)
393
+ | "disabled";
394
+
395
+ export interface ServerState {
396
+ name: string;
397
+ transport: "stdio" | "http";
398
+ era: ServerEra;
399
+ error?: string;
400
+ supportedVersions?: string[];
401
+ /** `capabilities.extensions["io.modelcontextprotocol/events"]` present. */
402
+ events: boolean;
403
+ /** `listChanged === true` on the events extension settings. */
404
+ eventsListChanged: boolean;
405
+ /** `capabilities.extensions["io.modelcontextprotocol/tasks"]` present. */
406
+ tasks: boolean;
407
+ serverInfo?: Implementation;
408
+ instructions?: string;
409
+ }
410
+
411
+ export interface ClientRequestOptions {
412
+ signal?: AbortSignal;
413
+ /** Default: the server's timeoutMs. */
414
+ timeoutMs?: number;
415
+ onNotification?: (msg: JSONRPCNotification) => void;
416
+ /** HTTP only: extra headers (Mcp-Param-*). */
417
+ headers?: Record<string, string>;
418
+ }
419
+
420
+ /** Interest a module registers in the server's single `subscriptions/listen` stream. */
421
+ export type ListenOwner = "events" | "tasks";
422
+
423
+ export interface ServerClient {
424
+ readonly name: string;
425
+ readonly config: ResolvedServer;
426
+ readonly state: ServerState;
427
+ /** Probe with `server/discover` and classify (spec §4.3). Never throws. */
428
+ discover(): Promise<ServerState>;
429
+ /**
430
+ * Send one request with the stateless `_meta` merged into `params._meta`. Resolves with `result`;
431
+ * rejects with McpRpcError (JSON-RPC error) or McpTransportError. Read-only methods are retried once
432
+ * on transient HTTP errors by the transport.
433
+ */
434
+ request<T = JsonObject>(method: string, params?: JsonObject, opts?: ClientRequestOptions): Promise<T>;
435
+ /** Open a long-lived stream request (`events/stream`); `_meta` is added. */
436
+ openStream(
437
+ method: string,
438
+ params: JsonObject,
439
+ onNotification: (msg: JSONRPCNotification) => void,
440
+ opts?: { signal?: AbortSignal; headers?: Record<string, string> },
441
+ ): Promise<OpenStreamHandle>;
442
+ /**
443
+ * Set one owner's share of the `subscriptions/listen` filter. The client unions all owners, holds at
444
+ * most one stream, replaces it atomically when the union changes, and closes it when the union is empty.
445
+ */
446
+ setListenInterest(owner: ListenOwner, filter: ListenFilter): void;
447
+ /** Notifications on the listen stream after acknowledgment (`notifications/tasks`, `notifications/events/list_changed`). */
448
+ onListenNotification(listener: (msg: JSONRPCNotification) => void): () => void;
449
+ /** Fires with the honored filter on every acknowledgment, and with undefined when the stream drops or closes. */
450
+ onListenState(listener: (honored: ListenFilter | undefined) => void): () => void;
451
+ /** Cancel streams and close the transport. Idempotent. */
452
+ close(): Promise<void>;
453
+ }
454
+
455
+ // ---------------------------------------------------------------------------------------------
456
+ // Engine seams (spec §5.3, §6) — events.ts and tasks.ts depend only on these, index.ts wires them.
457
+ // ---------------------------------------------------------------------------------------------
458
+
459
+ export const CUSTOM_SUBSCRIPTIONS = "mcp-ext:subscriptions";
460
+ export const CUSTOM_CURSORS = "mcp-ext:cursors";
461
+ export const CUSTOM_TASKS = "mcp-ext:tasks";
462
+ export const MESSAGE_EVENT = "mcp-event";
463
+ export const MESSAGE_TASK = "mcp-task";
464
+
465
+ export type DeliveryPreference = "auto" | "push" | "poll";
466
+
467
+ export interface SubscriptionRecord {
468
+ subKey: string;
469
+ server: string;
470
+ name: string;
471
+ arguments?: JsonObject;
472
+ delivery: DeliveryPreference;
473
+ maxAgeMs?: number;
474
+ holdSettle: boolean;
475
+ }
476
+
477
+ export type SubscriptionEntry =
478
+ | { op: "upsert"; subscription: SubscriptionRecord; cursor?: string | null }
479
+ | { op: "remove"; subKey: string; server: string };
480
+
481
+ export interface CursorEntry {
482
+ server: string;
483
+ subKey: string;
484
+ cursor: string | null;
485
+ truncated?: boolean;
486
+ recentEventIds: string[];
487
+ updatedAt: string;
488
+ }
489
+
490
+ export interface TaskRecord {
491
+ server: string;
492
+ taskId: string;
493
+ toolName: string;
494
+ status: TaskStatus | "expired" | "not_found_or_expired";
495
+ statusMessage?: string;
496
+ createdAt: string;
497
+ lastUpdatedAt: string;
498
+ ttlMs: number | null;
499
+ pollIntervalMs?: number;
500
+ surfacedInputKeys: string[];
501
+ answeredInputKeys: string[];
502
+ /** Set when cancelled locally through tasks/cancel. */
503
+ locallyCancelled?: boolean;
504
+ }
505
+
506
+ /** Host services the engines use; index.ts implements it over the Pi API. */
507
+ export interface EngineHost {
508
+ /** Client of a server, or undefined when unknown/not modern. */
509
+ getClient(server: string): ServerClient | undefined;
510
+ /** `pi.appendEntry(customType, data)`. */
511
+ appendEntry(customType: string, data: unknown): void;
512
+ /** Steer a wake message: `pi.sendMessage({customType, content, display: true, details}, {triggerTurn: true, deliverAs: "steer"})`. */
513
+ wake(customType: typeof MESSAGE_EVENT | typeof MESSAGE_TASK, content: string, details: unknown): void;
514
+ /** Footer status / diagnostics; may be a no-op. */
515
+ log(level: "info" | "warn" | "error", message: string): void;
516
+ /** Aborted on session_shutdown. */
517
+ readonly signal: AbortSignal;
518
+ }
519
+
520
+ /** A batch of event occurrences ready for the model (after dedup), one per subscription per batch. */
521
+ export interface EventDelivery {
522
+ server: string;
523
+ subKey: string;
524
+ name: string;
525
+ truncated: boolean;
526
+ occurrences: EventOccurrence[];
527
+ }
528
+
529
+ export interface SubscribeRequest {
530
+ server: string;
531
+ name: string;
532
+ arguments?: JsonObject;
533
+ delivery?: DeliveryPreference;
534
+ /** undefined = use persisted cursor; null = from now. */
535
+ cursor?: string | null;
536
+ maxAgeMs?: number;
537
+ holdSettle?: boolean;
538
+ }
539
+
540
+ export interface EventsEngineApi {
541
+ /** Rebuild subscriptions and cursors from session entries (active branch + all entries), then start them. */
542
+ restore(branch: readonly unknown[], allEntries: readonly unknown[]): void;
543
+ /** A server became modern with events: (re)start its subscriptions. */
544
+ serverReady(server: string): void;
545
+ list(server: string): Promise<EventDescriptor[]>;
546
+ subscribe(req: SubscribeRequest): Promise<SubscriptionRecord>;
547
+ unsubscribe(server: string, name: string, args?: JsonObject): Promise<boolean>;
548
+ subscriptions(): Array<SubscriptionRecord & { cursor: string | null; active: boolean; mode?: "push" | "poll" }>;
549
+ /** One-shot `events/poll` without a subscription. */
550
+ poll(server: string, params: PollEventsParams): Promise<PollEventsResult>;
551
+ /** Whether a subscription with holdSettle is active. */
552
+ holdsSettle(): boolean;
553
+ /** Count of open push streams (for the footer). */
554
+ activeStreams(): number;
555
+ /** Notifies after each wake (for settle hold). */
556
+ onWake(listener: () => void): () => void;
557
+ /** Stop all streams/timers and flush dirty cursors. */
558
+ shutdown(): Promise<void>;
559
+ }
560
+
561
+ export interface TasksEngineApi {
562
+ restore(allEntries: readonly unknown[]): void;
563
+ serverReady(server: string): void;
564
+ /** `tools/call` with tasks in _meta; tracks a returned task. Returns the raw outcome. */
565
+ call(server: string, tool: string, args?: JsonObject, signal?: AbortSignal): Promise<ToolCallOutcome>;
566
+ get(server: string, taskId: string): Promise<DetailedTask>;
567
+ update(server: string, taskId: string, inputResponses: JsonObject): Promise<void>;
568
+ cancel(server: string, taskId: string): Promise<void>;
569
+ active(): TaskRecord[];
570
+ /** Whether any task is working or input_required. */
571
+ hasPending(): boolean;
572
+ onWake(listener: () => void): () => void;
573
+ shutdown(): Promise<void>;
574
+ }