@voltius/plugin-types 0.21.1 → 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.
Files changed (2) hide show
  1. package/index.d.ts +296 -7
  2. 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"
@@ -114,7 +117,21 @@ export type PluginAuditAction =
114
117
 
115
118
  // ─── Types exposés aux plugins ─────────────────────────────────────────────
116
119
 
117
- export interface PluginConnection {
120
+ /**
121
+ * Where a vault object is filed. Carried by every object a read verb returns and
122
+ * by everything the create verbs hand back, so a caller that relocated something
123
+ * with `objects.move` can observe where it landed — before this nothing could.
124
+ *
125
+ * `vault_id` is a `vaults.list()` id, "personal" when the object is in no other
126
+ * vault; `folder_id` is null at that vault's root. Both feed straight back into
127
+ * `PluginObjectMoveInput`.
128
+ */
129
+ export interface PluginObjectPlacement {
130
+ vault_id?: string;
131
+ folder_id?: string | null;
132
+ }
133
+
134
+ export interface PluginConnection extends PluginObjectPlacement {
118
135
  id: string;
119
136
  name?: string;
120
137
  host: string;
@@ -150,14 +167,14 @@ export interface PluginConnectionInput {
150
167
  jump_hosts?: JumpHost[];
151
168
  }
152
169
 
153
- export interface PluginKey {
170
+ export interface PluginKey extends PluginObjectPlacement {
154
171
  id: string;
155
172
  name?: string;
156
173
  key_type?: string;
157
174
  tags: string[];
158
175
  }
159
176
 
160
- export interface PluginIdentity {
177
+ export interface PluginIdentity extends PluginObjectPlacement {
161
178
  id: string;
162
179
  name?: string;
163
180
  username: string;
@@ -165,6 +182,147 @@ export interface PluginIdentity {
165
182
  tags: string[];
166
183
  }
167
184
 
185
+ export interface PluginSnippet extends PluginObjectPlacement {
186
+ id: string;
187
+ name: string;
188
+ steps: import("@/types").SnippetStep[];
189
+ description?: string;
190
+ tags: string[];
191
+ favorite: boolean;
192
+ /** Empty means the snippet offers itself everywhere. */
193
+ only_for_connection_tags: string[];
194
+ only_for_distros: string[];
195
+ }
196
+
197
+ export interface PluginSnippetInput {
198
+ name: string;
199
+ steps: import("@/types").SnippetStep[];
200
+ description?: string;
201
+ tags?: string[];
202
+ favorite?: boolean;
203
+ only_for_connection_tags?: string[];
204
+ only_for_distros?: string[];
205
+ folder_id?: string;
206
+ vault_id?: string;
207
+ }
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
+ /**
281
+ * A SAVED port-forwarding rule: a shape, not a live listener. Opening one is
282
+ * `portForwards.start`, which needs an open session to hang the tunnel on.
283
+ */
284
+ export interface PluginPortForward extends PluginObjectPlacement {
285
+ id: string;
286
+ name: string;
287
+ local_port: number;
288
+ remote_port: number;
289
+ remote_host: string;
290
+ tunnel_type: import("@/types").TunnelType;
291
+ bind_host: string;
292
+ target_host: string;
293
+ description?: string;
294
+ /** Connections this rule offers itself on. Empty means all of them. */
295
+ connection_ids: string[];
296
+ }
297
+
298
+ export interface PluginPortForwardInput {
299
+ name: string;
300
+ local_port: number;
301
+ remote_port: number;
302
+ remote_host: string;
303
+ tunnel_type: import("@/types").TunnelType;
304
+ bind_host?: string;
305
+ target_host?: string;
306
+ description?: string;
307
+ connection_ids?: string[];
308
+ folder_id?: string;
309
+ vault_id?: string;
310
+ }
311
+
312
+ /** A tunnel that is open right now on one session. Dies with the session. */
313
+ export interface PluginActiveTunnel {
314
+ id: string;
315
+ tunnel_type: import("@/types").TunnelType;
316
+ local_port: number;
317
+ remote_port: number;
318
+ remote_host: string;
319
+ bind_host?: string;
320
+ target_host?: string;
321
+ /** "active", or the error it failed with. */
322
+ state: import("@/types").TunnelState;
323
+ bytes_transferred: number;
324
+ }
325
+
168
326
  /** A vault the user organizes objects into. Unrelated to `api.vault`, which is plugin storage. */
169
327
  export interface PluginVault {
170
328
  id: string;
@@ -209,6 +367,17 @@ export interface PluginObjectMoveOutcome {
209
367
  created: number;
210
368
  /** Ids that no longer exist, or objects already where the call would put them. */
211
369
  skipped: number;
370
+ /**
371
+ * Where the objects ended up, so a move confirms itself without a follow-up
372
+ * read. `folder_id` is null at the destination vault's root.
373
+ *
374
+ * `vault_id` is null only when the call named no destination vault and no
375
+ * destination folder to take one from — every object kept the vault it had,
376
+ * and there is no single id to report. It is the adapter's own resolved
377
+ * target, not an echo of the request.
378
+ */
379
+ vault_id: string | null;
380
+ folder_id: string | null;
212
381
  }
213
382
 
214
383
  export interface OmniCommand {
@@ -352,8 +521,11 @@ export interface SftpAPI {
352
521
  rename(target: FileTarget, from: string, to: string): Promise<void>;
353
522
  delete(target: FileTarget, path: string): Promise<void>;
354
523
  /** Copy one path between any two targets, in any direction, files or
355
- * directories. Host→host streams directly and never lands on this machine. */
356
- transfer(src: FileEndpoint, dst: FileEndpoint): Promise<void>;
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>;
357
529
  /** Release the handle held for `target`, if any. */
358
530
  disconnect(target: FileTarget): Promise<void>;
359
531
  }
@@ -722,6 +894,114 @@ export interface PluginAPI {
722
894
  delete(id: string, opts?: { cascade?: boolean }): Promise<void>;
723
895
  };
724
896
 
897
+ // Saved snippets (requires snippets:read / snippets:write, and snippets:run for `run`)
898
+ snippets: {
899
+ list(): Promise<PluginSnippet[]>;
900
+ create(input: PluginSnippetInput): Promise<PluginSnippet>;
901
+ /** Only the fields given are altered. Rejects a team vault. */
902
+ update(id: string, patch: Partial<PluginSnippetInput>): Promise<void>;
903
+ /** Rejects a team vault. */
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;
981
+ };
982
+
983
+ /**
984
+ * Saved port-forwarding rules, and the tunnels open right now.
985
+ *
986
+ * A rule is a vault object; a tunnel is a live listening socket bound to one
987
+ * SSH session and gone when that session closes. `start` is what turns the
988
+ * first into the second (requires port_forwarding:read / port_forwarding:write,
989
+ * and sessions:read for the tunnel methods).
990
+ */
991
+ portForwards: {
992
+ list(): Promise<PluginPortForward[]>;
993
+ create(input: PluginPortForwardInput): Promise<PluginPortForward>;
994
+ /** Only the fields given are altered. Rejects a team vault. */
995
+ update(id: string, patch: Partial<PluginPortForwardInput>): Promise<void>;
996
+ /** Rejects a team vault. */
997
+ delete(id: string): Promise<void>;
998
+ /** Tunnels open on one session. */
999
+ tunnels(sessionId: string): Promise<PluginActiveTunnel[]>;
1000
+ /** Opens a saved rule's tunnel on an open session. */
1001
+ start(ruleId: string, sessionId: string): Promise<PluginActiveTunnel>;
1002
+ stop(sessionId: string, tunnelId: string): Promise<void>;
1003
+ };
1004
+
725
1005
  // Folders across all four trees (requires the gated folders:*)
726
1006
  folders: {
727
1007
  list(kind?: PluginFolderKind): PluginFolder[];
@@ -880,8 +1160,13 @@ export interface PluginAPI {
880
1160
  onActivated(cb: (session: PluginSession) => void): () => void;
881
1161
  /** Send a command to a session. Runtime appends \n. Requires sessions:write. */
882
1162
  sendCommand(sessionId: string, cmd: string): Promise<void>;
883
- /** Open (connect) a saved connection by id. Resolves to the new sessionId. Requires sessions:write. */
884
- open(connectionId: string): Promise<string>;
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>;
885
1170
  /** Close (disconnect) a session by id. Requires sessions:write. */
886
1171
  close(sessionId: string): Promise<void>;
887
1172
  };
@@ -894,6 +1179,10 @@ export interface PluginAPI {
894
1179
  readSelection(sessionId: string): string;
895
1180
  /** Subscribe to live decoded output for a session. Resolves to an unsubscribe fn. */
896
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;
897
1186
  };
898
1187
 
899
1188
  // Keychain — GATED (first-party only). OS-local, never synced.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltius/plugin-types",
3
- "version": "0.21.1",
3
+ "version": "0.23.0",
4
4
  "description": "TypeScript definitions for the Voltius plugin API",
5
5
  "types": "index.d.ts",
6
6
  "files": [