@voltius/plugin-types 0.22.0 → 0.23.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 +167 -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,77 @@ 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
|
+
|
|
206
280
|
/**
|
|
207
281
|
* A SAVED port-forwarding rule: a shape, not a live listener. Opening one is
|
|
208
282
|
* `portForwards.start`, which needs an open session to hang the tunnel on.
|
|
@@ -447,8 +521,11 @@ export interface SftpAPI {
|
|
|
447
521
|
rename(target: FileTarget, from: string, to: string): Promise<void>;
|
|
448
522
|
delete(target: FileTarget, path: string): Promise<void>;
|
|
449
523
|
/** 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
|
-
|
|
524
|
+
* directories. Host→host streams directly and never lands on this machine.
|
|
525
|
+
* `transferId` defaults to a fresh one; a caller that already has an id to
|
|
526
|
+
* subscribe progress under (the transfer queue) can pass its own so the
|
|
527
|
+
* backend's `sftp-progress-<id>` events reach it instead of going nowhere. */
|
|
528
|
+
transfer(src: FileEndpoint, dst: FileEndpoint, transferId?: string): Promise<void>;
|
|
452
529
|
/** Release the handle held for `target`, if any. */
|
|
453
530
|
disconnect(target: FileTarget): Promise<void>;
|
|
454
531
|
}
|
|
@@ -817,7 +894,7 @@ export interface PluginAPI {
|
|
|
817
894
|
delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
|
|
818
895
|
};
|
|
819
896
|
|
|
820
|
-
// Saved snippets (requires snippets:read / snippets:write)
|
|
897
|
+
// Saved snippets (requires snippets:read / snippets:write, and snippets:run for `run`)
|
|
821
898
|
snippets: {
|
|
822
899
|
list(): Promise<PluginSnippet[]>;
|
|
823
900
|
create(input: PluginSnippetInput): Promise<PluginSnippet>;
|
|
@@ -825,6 +902,82 @@ export interface PluginAPI {
|
|
|
825
902
|
update(id: string, patch: Partial<PluginSnippetInput>): Promise<void>;
|
|
826
903
|
/** Rejects a team vault. */
|
|
827
904
|
delete(id: string): Promise<void>;
|
|
905
|
+
/**
|
|
906
|
+
* Run a saved snippet against open sessions or saved connections (requires
|
|
907
|
+
* the gated snippets:run). Script steps are injected into a terminal, so the
|
|
908
|
+
* result carries per-target ok/error, not command output — read that with
|
|
909
|
+
* the session verbs, including on `opened_session_ids`. A user variable the
|
|
910
|
+
* snippet needs and `variables` does not supply is a rejection, not a prompt.
|
|
911
|
+
*/
|
|
912
|
+
run(input: {
|
|
913
|
+
snippetId: string;
|
|
914
|
+
targets: PluginSnippetTargetRef[];
|
|
915
|
+
/** The snippet's own user variables. Keys that name a dynamic variable
|
|
916
|
+
* ({{connection.host}}, {{clipboard}}, …) are ignored — those resolve per
|
|
917
|
+
* target and cannot be supplied. */
|
|
918
|
+
variables?: Record<string, string>;
|
|
919
|
+
/** Report the steps that would run, without running anything. */
|
|
920
|
+
dryRun?: boolean;
|
|
921
|
+
}): Promise<PluginSnippetRunResult>;
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* The trust-on-first-use host key store (requires the gated
|
|
926
|
+
* known_hosts:read / known_hosts:write).
|
|
927
|
+
*/
|
|
928
|
+
knownHosts: {
|
|
929
|
+
list(filter?: { host?: string; port?: number }): Promise<PluginKnownHost[]>;
|
|
930
|
+
delete(id: string): Promise<void>;
|
|
931
|
+
/**
|
|
932
|
+
* `replace` supersedes the stored keys for this host:port. Without it, a
|
|
933
|
+
* host that already has a stored key is rejected — a second key would be
|
|
934
|
+
* accepted alongside the first. Rejects a team vault.
|
|
935
|
+
*/
|
|
936
|
+
trust(input: {
|
|
937
|
+
host: string; port: number; fingerprint: string; vaultId?: string; replace?: boolean;
|
|
938
|
+
}): Promise<PluginTrustResult>;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Command lines the user typed in a terminal (requires the gated history:read).
|
|
943
|
+
* Persisted, capped at 500 entries by the store.
|
|
944
|
+
*/
|
|
945
|
+
history: {
|
|
946
|
+
search(filter: {
|
|
947
|
+
query?: string; connectionId?: string; sessionId?: string; limit?: number;
|
|
948
|
+
}): PluginHistoryEntry[];
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* File transfers in the app's queue — the user's own and any an MCP client
|
|
953
|
+
* started (requires the gated transfers:read / transfers:write). The list is
|
|
954
|
+
* capped at 30 entries by the store and is not persisted across restarts.
|
|
955
|
+
*/
|
|
956
|
+
transfers: {
|
|
957
|
+
list(): PluginTransfer[];
|
|
958
|
+
/** False when the id is unknown, or the transfer is not currently running. */
|
|
959
|
+
cancel(id: string): boolean;
|
|
960
|
+
/** False when the id is unknown, or the transfer is still running, already done,
|
|
961
|
+
* or not yet settled (a just-cancelled row still winding down). */
|
|
962
|
+
retry(id: string): boolean;
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Host reachability as last observed by the app's own polling (requires the
|
|
967
|
+
* gated health:read). Reading NEVER triggers a probe: issue #90 was a probe
|
|
968
|
+
* storm that tripped `ufw limit` and locked users out of their own hosts.
|
|
969
|
+
*/
|
|
970
|
+
health: {
|
|
971
|
+
pingStatus(): PluginHostPing[];
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* The state of the user's own configuration sync (requires sync:read).
|
|
976
|
+
* Distinct from the plugin-scoped `sync` domain above, which is a plugin's
|
|
977
|
+
* own blob storage and gist sync — this is the app's own cross-device sync.
|
|
978
|
+
*/
|
|
979
|
+
appSync: {
|
|
980
|
+
status(): PluginSyncState;
|
|
828
981
|
};
|
|
829
982
|
|
|
830
983
|
/**
|
|
@@ -1007,8 +1160,13 @@ export interface PluginAPI {
|
|
|
1007
1160
|
onActivated(cb: (session: PluginSession) => void): () => void;
|
|
1008
1161
|
/** Send a command to a session. Runtime appends \n. Requires sessions:write. */
|
|
1009
1162
|
sendCommand(sessionId: string, cmd: string): Promise<void>;
|
|
1010
|
-
/**
|
|
1011
|
-
|
|
1163
|
+
/** Write text to a session's terminal VERBATIM — no newline, no wrapper.
|
|
1164
|
+
* Use for keystrokes and control bytes; use sendCommand to run a line.
|
|
1165
|
+
* Requires terminal:write. */
|
|
1166
|
+
sendInput(sessionId: string, data: string): Promise<void>;
|
|
1167
|
+
/** Open (connect) a saved connection by id. Resolves to the new sessionId. Requires sessions:write.
|
|
1168
|
+
* `background: true` opens the tab without stealing the user's active one. */
|
|
1169
|
+
open(connectionId: string, options?: { background?: boolean }): Promise<string>;
|
|
1012
1170
|
/** Close (disconnect) a session by id. Requires sessions:write. */
|
|
1013
1171
|
close(sessionId: string): Promise<void>;
|
|
1014
1172
|
};
|
|
@@ -1021,6 +1179,10 @@ export interface PluginAPI {
|
|
|
1021
1179
|
readSelection(sessionId: string): string;
|
|
1022
1180
|
/** Subscribe to live decoded output for a session. Resolves to an unsubscribe fn. */
|
|
1023
1181
|
onOutput(sessionId: string, cb: (text: string) => void): Promise<() => void>;
|
|
1182
|
+
/** Whether the session's terminal is in application-cursor-keys mode
|
|
1183
|
+
* (DECCKM): arrows must be sent as ESC O x rather than ESC [ x.
|
|
1184
|
+
* False when the session has no mounted terminal. Requires terminal:read. */
|
|
1185
|
+
appCursorMode(sessionId: string): boolean;
|
|
1024
1186
|
};
|
|
1025
1187
|
|
|
1026
1188
|
// Keychain — GATED (first-party only). OS-local, never synced.
|