@voltius/plugin-types 0.75.1 → 0.76.1
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 +43 -0
- package/package.json +1 -1
- package/ui.d.ts +1 -0
package/index.d.ts
CHANGED
|
@@ -656,6 +656,46 @@ export interface SftpAPI {
|
|
|
656
656
|
disconnect(target: FileTarget): Promise<void>;
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
+
// ─── Host commands ─────────────────────────────────────────────────────────
|
|
660
|
+
|
|
661
|
+
export interface HostExecOptions {
|
|
662
|
+
/** Default 30 000 for `exec`, unlimited for `stream`; 0 means no limit. */
|
|
663
|
+
timeoutMs?: number;
|
|
664
|
+
/** `exec` only: cap per output stream, default 1 MiB, at most 64 MiB. */
|
|
665
|
+
maxBytes?: number;
|
|
666
|
+
stdin?: string;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export interface HostExecResult {
|
|
670
|
+
stdout: string;
|
|
671
|
+
stderr: string;
|
|
672
|
+
/** Null when the command was stopped or ended without reporting a status. */
|
|
673
|
+
code: number | null;
|
|
674
|
+
timedOut: boolean;
|
|
675
|
+
/** Output passed `maxBytes`; the command was stopped there. */
|
|
676
|
+
truncated: boolean;
|
|
677
|
+
cancelled: boolean;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export interface HostStreamHandlers {
|
|
681
|
+
/** Always whole lines, except possibly the last chunk. */
|
|
682
|
+
onStdout?(chunk: string): void;
|
|
683
|
+
onStderr?(chunk: string): void;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export interface HostStreamHandle {
|
|
687
|
+
/** Settles once the command ends; stdout/stderr are empty, they went to the handlers. */
|
|
688
|
+
done: Promise<HostExecResult>;
|
|
689
|
+
cancel(): void;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Commands on a session's machine, on their own channel. GATED (host:exec).
|
|
693
|
+
* Remote: the login shell parses it. Local: `sh -c`, or the session's shell on Windows. */
|
|
694
|
+
export interface HostAPI {
|
|
695
|
+
exec(sessionId: string, command: string, opts?: HostExecOptions): Promise<HostExecResult>;
|
|
696
|
+
stream(sessionId: string, command: string, handlers: HostStreamHandlers, opts?: HostExecOptions): HostStreamHandle;
|
|
697
|
+
}
|
|
698
|
+
|
|
659
699
|
export type PluginTheme = AppTheme;
|
|
660
700
|
|
|
661
701
|
// ─── Notification types ────────────────────────────────────────────────────
|
|
@@ -1441,6 +1481,9 @@ export interface PluginAPI {
|
|
|
1441
1481
|
// sftp:read (list/stat/readText) / sftp:write (everything that mutates).
|
|
1442
1482
|
sftp: SftpAPI;
|
|
1443
1483
|
|
|
1484
|
+
// Commands on a session's machine — GATED (host:exec).
|
|
1485
|
+
host: HostAPI;
|
|
1486
|
+
|
|
1444
1487
|
proxmox: ProxmoxAPI;
|
|
1445
1488
|
|
|
1446
1489
|
// Docker container/image/volume/network/stack management — GATED, split
|
package/package.json
CHANGED
package/ui.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare module "@voltius/ui" {
|
|
|
21
21
|
}>;
|
|
22
22
|
export function useAutosave<T>(value: T, save: (v: T) => void | Promise<void>, delayMs?: number): void;
|
|
23
23
|
export function useCopiedFlash(durationMs: number): { copied: boolean; flash: (persist?: boolean) => void };
|
|
24
|
+
export function writeClipboard(text: string): Promise<void>;
|
|
24
25
|
export function useT(api: PluginAPI): PluginAPI["i18n"]["t"];
|
|
25
26
|
export function useSessionById(api: PluginAPI, sessionId: string): PluginSession | null;
|
|
26
27
|
export function useActiveSession(api: PluginAPI | null): PluginSession | null;
|