@voltius/plugin-types 0.22.0 → 0.24.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/index.d.ts +209 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -94,6 +94,9 @@ export type PluginAuditAction =
|
|
|
94
94
|
| "agent.session_opened"
|
|
95
95
|
| "agent.session_closed"
|
|
96
96
|
| "agent.command_run"
|
|
97
|
+
// Real keystrokes, not a shell line: a TUI interaction is not a command run,
|
|
98
|
+
// and a reviewer must be able to tell a C-c from an rm -rf.
|
|
99
|
+
| "agent.keys_sent"
|
|
97
100
|
| "agent.action_denied"
|
|
98
101
|
| "agent.file_created"
|
|
99
102
|
| "agent.file_written"
|
|
@@ -203,6 +206,103 @@ export interface PluginSnippetInput {
|
|
|
203
206
|
vault_id?: string;
|
|
204
207
|
}
|
|
205
208
|
|
|
209
|
+
/** One target for a snippet run: an open session, or a saved connection the run
|
|
210
|
+
* connects on the fly. */
|
|
211
|
+
export interface PluginSnippetTargetRef {
|
|
212
|
+
session_id?: string;
|
|
213
|
+
connection_id?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface PluginSnippetRunResult {
|
|
217
|
+
targets: { label: string; ok: boolean; error?: string }[];
|
|
218
|
+
flatten_errors: string[];
|
|
219
|
+
/** Sessions this run opened for saved-connection targets, for reading back. */
|
|
220
|
+
opened_session_ids: string[];
|
|
221
|
+
/** Only on a dry run: the steps that would execute, per target, with the
|
|
222
|
+
* variables resolved. A variable nobody supplied stays as its `{{name}}`. */
|
|
223
|
+
steps?: { label: string; steps: unknown[] }[];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface PluginKnownHost {
|
|
227
|
+
id: string;
|
|
228
|
+
host: string;
|
|
229
|
+
port: number;
|
|
230
|
+
fingerprint: string;
|
|
231
|
+
vault_id: string;
|
|
232
|
+
created_at: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface PluginTrustResult {
|
|
236
|
+
entry: PluginKnownHost;
|
|
237
|
+
superseded: PluginKnownHost[];
|
|
238
|
+
/** True when `replace` soft-deleted existing entries for this host:port. */
|
|
239
|
+
replaced: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface PluginHistoryEntry {
|
|
243
|
+
id: string;
|
|
244
|
+
command: string;
|
|
245
|
+
/** Epoch milliseconds. */
|
|
246
|
+
timestamp: number;
|
|
247
|
+
session_id: string;
|
|
248
|
+
session_name: string;
|
|
249
|
+
connection_id: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface PluginTransfer {
|
|
253
|
+
id: string;
|
|
254
|
+
label: string;
|
|
255
|
+
direction: "→" | "←";
|
|
256
|
+
status: "running" | "done" | "cancelled" | "error";
|
|
257
|
+
transferred: number;
|
|
258
|
+
total: number;
|
|
259
|
+
speed?: number;
|
|
260
|
+
eta?: number;
|
|
261
|
+
error?: string;
|
|
262
|
+
/** Name of the MCP client that started it; absent for the user's own. */
|
|
263
|
+
owner?: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface PluginSyncState {
|
|
267
|
+
status: "idle" | "syncing" | "success" | "error" | "offline";
|
|
268
|
+
lastSync: string | null;
|
|
269
|
+
error: string | null;
|
|
270
|
+
cloudActive: boolean;
|
|
271
|
+
blobSizeBytes: number | null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface PluginHostPing {
|
|
275
|
+
connectionId: string;
|
|
276
|
+
status: "up" | "down" | "unknown";
|
|
277
|
+
latencyMs?: number;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export type PluginPanePosition = "left" | "right" | "top" | "bottom";
|
|
281
|
+
|
|
282
|
+
export interface PluginPane {
|
|
283
|
+
paneId: string;
|
|
284
|
+
sessionId: string;
|
|
285
|
+
connectionName: string;
|
|
286
|
+
active: boolean;
|
|
287
|
+
maximized: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** A titlebar item: a split tab with one entry per pane, or a standalone
|
|
291
|
+
* session projected as a single-pane tab so callers read one uniform list. */
|
|
292
|
+
export interface PluginPaneTab {
|
|
293
|
+
tabId: string;
|
|
294
|
+
kind: "split" | "session";
|
|
295
|
+
active: boolean;
|
|
296
|
+
panes: PluginPane[];
|
|
297
|
+
broadcastActive: boolean;
|
|
298
|
+
layout: PaneNode | null;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** `tab` is null when the write left no tab behind (the last split collapsed). */
|
|
302
|
+
export type PluginPaneResult =
|
|
303
|
+
| { ok: true; tab: PluginPaneTab | null }
|
|
304
|
+
| { ok: false; error: string };
|
|
305
|
+
|
|
206
306
|
/**
|
|
207
307
|
* A SAVED port-forwarding rule: a shape, not a live listener. Opening one is
|
|
208
308
|
* `portForwards.start`, which needs an open session to hang the tunnel on.
|
|
@@ -447,8 +547,11 @@ export interface SftpAPI {
|
|
|
447
547
|
rename(target: FileTarget, from: string, to: string): Promise<void>;
|
|
448
548
|
delete(target: FileTarget, path: string): Promise<void>;
|
|
449
549
|
/** Copy one path between any two targets, in any direction, files or
|
|
450
|
-
* directories. Host→host streams directly and never lands on this machine.
|
|
451
|
-
|
|
550
|
+
* directories. Host→host streams directly and never lands on this machine.
|
|
551
|
+
* `transferId` defaults to a fresh one; a caller that already has an id to
|
|
552
|
+
* subscribe progress under (the transfer queue) can pass its own so the
|
|
553
|
+
* backend's `sftp-progress-<id>` events reach it instead of going nowhere. */
|
|
554
|
+
transfer(src: FileEndpoint, dst: FileEndpoint, transferId?: string): Promise<void>;
|
|
452
555
|
/** Release the handle held for `target`, if any. */
|
|
453
556
|
disconnect(target: FileTarget): Promise<void>;
|
|
454
557
|
}
|
|
@@ -817,7 +920,7 @@ export interface PluginAPI {
|
|
|
817
920
|
delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
|
|
818
921
|
};
|
|
819
922
|
|
|
820
|
-
// Saved snippets (requires snippets:read / snippets:write)
|
|
923
|
+
// Saved snippets (requires snippets:read / snippets:write, and snippets:run for `run`)
|
|
821
924
|
snippets: {
|
|
822
925
|
list(): Promise<PluginSnippet[]>;
|
|
823
926
|
create(input: PluginSnippetInput): Promise<PluginSnippet>;
|
|
@@ -825,6 +928,98 @@ export interface PluginAPI {
|
|
|
825
928
|
update(id: string, patch: Partial<PluginSnippetInput>): Promise<void>;
|
|
826
929
|
/** Rejects a team vault. */
|
|
827
930
|
delete(id: string): Promise<void>;
|
|
931
|
+
/**
|
|
932
|
+
* Run a saved snippet against open sessions or saved connections (requires
|
|
933
|
+
* the gated snippets:run). Script steps are injected into a terminal, so the
|
|
934
|
+
* result carries per-target ok/error, not command output — read that with
|
|
935
|
+
* the session verbs, including on `opened_session_ids`. A user variable the
|
|
936
|
+
* snippet needs and `variables` does not supply is a rejection, not a prompt.
|
|
937
|
+
*/
|
|
938
|
+
run(input: {
|
|
939
|
+
snippetId: string;
|
|
940
|
+
targets: PluginSnippetTargetRef[];
|
|
941
|
+
/** The snippet's own user variables. Keys that name a dynamic variable
|
|
942
|
+
* ({{connection.host}}, {{clipboard}}, …) are ignored — those resolve per
|
|
943
|
+
* target and cannot be supplied. */
|
|
944
|
+
variables?: Record<string, string>;
|
|
945
|
+
/** Report the steps that would run, without running anything. */
|
|
946
|
+
dryRun?: boolean;
|
|
947
|
+
}): Promise<PluginSnippetRunResult>;
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* The trust-on-first-use host key store (requires the gated
|
|
952
|
+
* known_hosts:read / known_hosts:write).
|
|
953
|
+
*/
|
|
954
|
+
knownHosts: {
|
|
955
|
+
list(filter?: { host?: string; port?: number }): Promise<PluginKnownHost[]>;
|
|
956
|
+
delete(id: string): Promise<void>;
|
|
957
|
+
/**
|
|
958
|
+
* `replace` supersedes the stored keys for this host:port. Without it, a
|
|
959
|
+
* host that already has a stored key is rejected — a second key would be
|
|
960
|
+
* accepted alongside the first. Rejects a team vault.
|
|
961
|
+
*/
|
|
962
|
+
trust(input: {
|
|
963
|
+
host: string; port: number; fingerprint: string; vaultId?: string; replace?: boolean;
|
|
964
|
+
}): Promise<PluginTrustResult>;
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Command lines the user typed in a terminal (requires the gated history:read).
|
|
969
|
+
* Persisted, capped at 500 entries by the store.
|
|
970
|
+
*/
|
|
971
|
+
history: {
|
|
972
|
+
search(filter: {
|
|
973
|
+
query?: string; connectionId?: string; sessionId?: string; limit?: number;
|
|
974
|
+
}): PluginHistoryEntry[];
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* File transfers in the app's queue — the user's own and any an MCP client
|
|
979
|
+
* started (requires the gated transfers:read / transfers:write). The list is
|
|
980
|
+
* capped at 30 entries by the store and is not persisted across restarts.
|
|
981
|
+
*/
|
|
982
|
+
transfers: {
|
|
983
|
+
list(): PluginTransfer[];
|
|
984
|
+
/** False when the id is unknown, or the transfer is not currently running. */
|
|
985
|
+
cancel(id: string): boolean;
|
|
986
|
+
/** False when the id is unknown, or the transfer is still running, already done,
|
|
987
|
+
* or not yet settled (a just-cancelled row still winding down). */
|
|
988
|
+
retry(id: string): boolean;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Host reachability as last observed by the app's own polling (requires the
|
|
993
|
+
* gated health:read). Reading NEVER triggers a probe: issue #90 was a probe
|
|
994
|
+
* storm that tripped `ufw limit` and locked users out of their own hosts.
|
|
995
|
+
*/
|
|
996
|
+
health: {
|
|
997
|
+
pingStatus(): PluginHostPing[];
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* The terminal tab and pane layout (requires panes:read / panes:write).
|
|
1002
|
+
*
|
|
1003
|
+
* Ungated deliberately: these rearrange tabs and destroy nothing, which is
|
|
1004
|
+
* strictly less than the ungated sessions:write, and detaching a pane leaves
|
|
1005
|
+
* the session open. Writes never throw — they return a PluginPaneResult whose
|
|
1006
|
+
* `error` says why, because every underlying store method fails silently.
|
|
1007
|
+
*/
|
|
1008
|
+
panes: {
|
|
1009
|
+
list(): PluginPaneTab[];
|
|
1010
|
+
split(input: { sessionId: string; targetSessionId: string; position: PluginPanePosition }): PluginPaneResult;
|
|
1011
|
+
move(input: { sessionId: string; targetSessionId: string; position: PluginPanePosition }): PluginPaneResult;
|
|
1012
|
+
detach(sessionId: string): PluginPaneResult;
|
|
1013
|
+
focus(sessionId: string, maximize?: boolean): PluginPaneResult;
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* The state of the user's own configuration sync (requires sync:read).
|
|
1018
|
+
* Distinct from the plugin-scoped `sync` domain above, which is a plugin's
|
|
1019
|
+
* own blob storage and gist sync — this is the app's own cross-device sync.
|
|
1020
|
+
*/
|
|
1021
|
+
appSync: {
|
|
1022
|
+
status(): PluginSyncState;
|
|
828
1023
|
};
|
|
829
1024
|
|
|
830
1025
|
/**
|
|
@@ -1007,8 +1202,13 @@ export interface PluginAPI {
|
|
|
1007
1202
|
onActivated(cb: (session: PluginSession) => void): () => void;
|
|
1008
1203
|
/** Send a command to a session. Runtime appends \n. Requires sessions:write. */
|
|
1009
1204
|
sendCommand(sessionId: string, cmd: string): Promise<void>;
|
|
1010
|
-
/**
|
|
1011
|
-
|
|
1205
|
+
/** Write text to a session's terminal VERBATIM — no newline, no wrapper.
|
|
1206
|
+
* Use for keystrokes and control bytes; use sendCommand to run a line.
|
|
1207
|
+
* Requires terminal:write. */
|
|
1208
|
+
sendInput(sessionId: string, data: string): Promise<void>;
|
|
1209
|
+
/** Open (connect) a saved connection by id. Resolves to the new sessionId. Requires sessions:write.
|
|
1210
|
+
* `background: true` opens the tab without stealing the user's active one. */
|
|
1211
|
+
open(connectionId: string, options?: { background?: boolean }): Promise<string>;
|
|
1012
1212
|
/** Close (disconnect) a session by id. Requires sessions:write. */
|
|
1013
1213
|
close(sessionId: string): Promise<void>;
|
|
1014
1214
|
};
|
|
@@ -1021,6 +1221,10 @@ export interface PluginAPI {
|
|
|
1021
1221
|
readSelection(sessionId: string): string;
|
|
1022
1222
|
/** Subscribe to live decoded output for a session. Resolves to an unsubscribe fn. */
|
|
1023
1223
|
onOutput(sessionId: string, cb: (text: string) => void): Promise<() => void>;
|
|
1224
|
+
/** Whether the session's terminal is in application-cursor-keys mode
|
|
1225
|
+
* (DECCKM): arrows must be sent as ESC O x rather than ESC [ x.
|
|
1226
|
+
* False when the session has no mounted terminal. Requires terminal:read. */
|
|
1227
|
+
appCursorMode(sessionId: string): boolean;
|
|
1024
1228
|
};
|
|
1025
1229
|
|
|
1026
1230
|
// Keychain — GATED (first-party only). OS-local, never synced.
|