heyvm 1.0.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/LICENSE +21 -0
- package/README.md +621 -0
- package/bin/file-browser +0 -0
- package/bin/heyvm +0 -0
- package/bin/heyvm-core +0 -0
- package/bin/heyvm.js +61 -0
- package/core/README.md +51 -0
- package/core/cmd/heyvm-core/main.go +73 -0
- package/core/go.mod +25 -0
- package/core/go.sum +47 -0
- package/core/internal/auth/errors.go +29 -0
- package/core/internal/auth/password.go +187 -0
- package/core/internal/auth/provider.go +33 -0
- package/core/internal/auth/ssh_key.go +142 -0
- package/core/internal/config/config.go +111 -0
- package/core/internal/ipc/actions.go +738 -0
- package/core/internal/ipc/handler.go +281 -0
- package/core/internal/ipc/protocol.go +126 -0
- package/core/internal/sftp/errors.go +29 -0
- package/core/internal/sftp/manager.go +303 -0
- package/core/internal/sftp/types.go +30 -0
- package/core/internal/ssh/errors.go +23 -0
- package/core/internal/ssh/manager.go +226 -0
- package/core/internal/ssh/session.go +105 -0
- package/core/internal/vm/errors.go +35 -0
- package/core/internal/vm/models.go +84 -0
- package/core/internal/vm/registry.go +240 -0
- package/package.json +59 -0
- package/scripts/install.js +100 -0
- package/ui/README.md +43 -0
- package/ui/dist/App.d.ts +3 -0
- package/ui/dist/App.d.ts.map +1 -0
- package/ui/dist/App.js +142 -0
- package/ui/dist/App.js.map +1 -0
- package/ui/dist/components/ConfirmDialog.d.ts +9 -0
- package/ui/dist/components/ConfirmDialog.d.ts.map +1 -0
- package/ui/dist/components/ConfirmDialog.js +22 -0
- package/ui/dist/components/ConfirmDialog.js.map +1 -0
- package/ui/dist/components/ErrorMessage.d.ts +8 -0
- package/ui/dist/components/ErrorMessage.d.ts.map +1 -0
- package/ui/dist/components/ErrorMessage.js +10 -0
- package/ui/dist/components/ErrorMessage.js.map +1 -0
- package/ui/dist/components/Header.d.ts +8 -0
- package/ui/dist/components/Header.d.ts.map +1 -0
- package/ui/dist/components/Header.js +10 -0
- package/ui/dist/components/Header.js.map +1 -0
- package/ui/dist/components/LoadingSpinner.d.ts +7 -0
- package/ui/dist/components/LoadingSpinner.d.ts.map +1 -0
- package/ui/dist/components/LoadingSpinner.js +7 -0
- package/ui/dist/components/LoadingSpinner.js.map +1 -0
- package/ui/dist/components/StatusBar.d.ts +11 -0
- package/ui/dist/components/StatusBar.d.ts.map +1 -0
- package/ui/dist/components/StatusBar.js +11 -0
- package/ui/dist/components/StatusBar.js.map +1 -0
- package/ui/dist/core/ipc.d.ts +96 -0
- package/ui/dist/core/ipc.d.ts.map +1 -0
- package/ui/dist/core/ipc.js +310 -0
- package/ui/dist/core/ipc.js.map +1 -0
- package/ui/dist/core/types.d.ts +45 -0
- package/ui/dist/core/types.d.ts.map +1 -0
- package/ui/dist/core/types.js +3 -0
- package/ui/dist/core/types.js.map +1 -0
- package/ui/dist/hooks/useFiles.d.ts +14 -0
- package/ui/dist/hooks/useFiles.d.ts.map +1 -0
- package/ui/dist/hooks/useFiles.js +102 -0
- package/ui/dist/hooks/useFiles.js.map +1 -0
- package/ui/dist/hooks/useVM.d.ts +10 -0
- package/ui/dist/hooks/useVM.d.ts.map +1 -0
- package/ui/dist/hooks/useVM.js +54 -0
- package/ui/dist/hooks/useVM.js.map +1 -0
- package/ui/dist/hooks/useVMList.d.ts +10 -0
- package/ui/dist/hooks/useVMList.d.ts.map +1 -0
- package/ui/dist/hooks/useVMList.js +56 -0
- package/ui/dist/hooks/useVMList.js.map +1 -0
- package/ui/dist/index.d.ts +3 -0
- package/ui/dist/index.d.ts.map +1 -0
- package/ui/dist/index.js +7488 -0
- package/ui/dist/index.js.map +1 -0
- package/ui/dist/keybindings.d.ts +146 -0
- package/ui/dist/keybindings.d.ts.map +1 -0
- package/ui/dist/keybindings.js +96 -0
- package/ui/dist/keybindings.js.map +1 -0
- package/ui/dist/screens/AddVMScreen.d.ts +9 -0
- package/ui/dist/screens/AddVMScreen.d.ts.map +1 -0
- package/ui/dist/screens/AddVMScreen.js +163 -0
- package/ui/dist/screens/AddVMScreen.js.map +1 -0
- package/ui/dist/screens/VMDetailScreen.d.ts +12 -0
- package/ui/dist/screens/VMDetailScreen.d.ts.map +1 -0
- package/ui/dist/screens/VMDetailScreen.js +96 -0
- package/ui/dist/screens/VMDetailScreen.js.map +1 -0
- package/ui/dist/screens/VMListScreen.d.ts +12 -0
- package/ui/dist/screens/VMListScreen.d.ts.map +1 -0
- package/ui/dist/screens/VMListScreen.js +158 -0
- package/ui/dist/screens/VMListScreen.js.map +1 -0
- package/ui/dist/screens/tabs/FilesTab.d.ts +9 -0
- package/ui/dist/screens/tabs/FilesTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/FilesTab.js +374 -0
- package/ui/dist/screens/tabs/FilesTab.js.map +1 -0
- package/ui/dist/screens/tabs/OverviewTab.d.ts +10 -0
- package/ui/dist/screens/tabs/OverviewTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/OverviewTab.js +110 -0
- package/ui/dist/screens/tabs/OverviewTab.js.map +1 -0
- package/ui/dist/screens/tabs/TerminalTab.d.ts +9 -0
- package/ui/dist/screens/tabs/TerminalTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/TerminalTab.js +270 -0
- package/ui/dist/screens/tabs/TerminalTab.js.map +1 -0
- package/ui/dist/utils/terminalEmulator.d.ts +49 -0
- package/ui/dist/utils/terminalEmulator.d.ts.map +1 -0
- package/ui/dist/utils/terminalEmulator.js +88 -0
- package/ui/dist/utils/terminalEmulator.js.map +1 -0
- package/ui/package.json +34 -0
- package/ui/scripts/start-with-core.js +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,kBAAkB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,qBAoBzF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text, useInput } from 'ink';
|
|
3
|
+
export default function ConfirmDialog({ message, onConfirm, onCancel }) {
|
|
4
|
+
useInput((input, key) => {
|
|
5
|
+
if (input === 'y' || input === 'Y') {
|
|
6
|
+
onConfirm();
|
|
7
|
+
}
|
|
8
|
+
if (input === 'n' || input === 'N' || key.escape) {
|
|
9
|
+
onCancel();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return (React.createElement(Box, { flexDirection: "column", borderStyle: "double", borderColor: "magenta", padding: 1 },
|
|
13
|
+
React.createElement(Text, null, message),
|
|
14
|
+
React.createElement(Box, { marginTop: 1 },
|
|
15
|
+
React.createElement(Text, { dimColor: true },
|
|
16
|
+
"Press ",
|
|
17
|
+
React.createElement(Text, { bold: true }, "Y"),
|
|
18
|
+
" to confirm, ",
|
|
19
|
+
React.createElement(Text, { bold: true }, "N"),
|
|
20
|
+
" to cancel"))));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../src/components/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAQ1C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB;IACzF,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACvB,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACpC,SAAS,EAAE,CAAC;QACb,CAAC;QACD,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAClD,QAAQ,EAAE,CAAC;QACZ,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,CACN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,SAAS,EAAC,OAAO,EAAE,CAAC;QAChF,oBAAC,IAAI,QAAE,OAAO,CAAQ;QACtB,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YAChB,oBAAC,IAAI,IAAC,QAAQ;;gBACP,oBAAC,IAAI,IAAC,IAAI,cAAS;;gBAAa,oBAAC,IAAI,IAAC,IAAI,cAAS;6BACnD,CACF,CACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ErrorMessageProps {
|
|
3
|
+
message: string;
|
|
4
|
+
onDismiss?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export default function ErrorMessage({ message, onDismiss }: ErrorMessageProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ErrorMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessage.d.ts","sourceRoot":"","sources":["../../src/components/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,iBAAiB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,iBAAiB,qBAS7E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
export default function ErrorMessage({ message, onDismiss }) {
|
|
4
|
+
return (React.createElement(Box, { marginBottom: 1, borderStyle: "single", borderColor: "red", paddingX: 1 },
|
|
5
|
+
React.createElement(Text, { color: "red" },
|
|
6
|
+
"\u2715 Error: ",
|
|
7
|
+
message),
|
|
8
|
+
onDismiss && (React.createElement(Text, { dimColor: true }, " (Press any key to dismiss)"))));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessage.js","sourceRoot":"","sources":["../../src/components/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAOhC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAqB;IAC7E,OAAO,CACN,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC,EAAE,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,KAAK,EAAC,QAAQ,EAAE,CAAC;QACvE,oBAAC,IAAI,IAAC,KAAK,EAAC,KAAK;;YAAW,OAAO,CAAQ;QAC1C,SAAS,IAAI,CACb,oBAAC,IAAI,IAAC,QAAQ,wCAAmC,CACjD,CACI,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,WAAW;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,qBAW9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
export default function Header({ title, subtitle }) {
|
|
4
|
+
return (React.createElement(Box, { marginBottom: 1 },
|
|
5
|
+
React.createElement(Text, { bold: true, color: "magenta" }, title),
|
|
6
|
+
subtitle && (React.createElement(Text, { dimColor: true },
|
|
7
|
+
" ",
|
|
8
|
+
subtitle))));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAOhC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAe;IAC9D,OAAO,CACN,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;QACnB,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,SAAS,IACxB,KAAK,CACA;QACN,QAAQ,IAAI,CACZ,oBAAC,IAAI,IAAC,QAAQ;;YAAG,QAAQ,CAAQ,CACjC,CACI,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.d.ts","sourceRoot":"","sources":["../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,mBAAmB;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,OAAsB,EAAE,EAAE,mBAAmB,qBAMrF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
export default function LoadingSpinner({ message = 'Loading...' }) {
|
|
4
|
+
return (React.createElement(Box, null,
|
|
5
|
+
React.createElement(Text, { color: "yellow" }, message)));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=LoadingSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAMhC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,OAAO,GAAG,YAAY,EAAuB;IACrF,OAAO,CACN,oBAAC,GAAG;QACH,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,OAAO,CAAQ,CAChC,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Keybinding {
|
|
3
|
+
key: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
interface StatusBarProps {
|
|
7
|
+
keybindings: Keybinding[];
|
|
8
|
+
}
|
|
9
|
+
export default function StatusBar({ keybindings }: StatusBarProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=StatusBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../src/components/StatusBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,UAAU;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAc;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,WAAW,EAAE,EAAE,cAAc,qBAahE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
export default function StatusBar({ keybindings }) {
|
|
4
|
+
return (React.createElement(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1 },
|
|
5
|
+
React.createElement(Text, { dimColor: true }, keybindings.map((binding, index) => (React.createElement(React.Fragment, { key: index },
|
|
6
|
+
index > 0 && ' • ',
|
|
7
|
+
React.createElement(Text, { bold: true }, binding.key),
|
|
8
|
+
" ",
|
|
9
|
+
binding.description))))));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=StatusBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../src/components/StatusBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAWhC,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,WAAW,EAAkB;IAChE,OAAO,CACN,oBAAC,GAAG,IAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC;QACvD,oBAAC,IAAI,IAAC,QAAQ,UACZ,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CACpC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,KAAK;YACxB,KAAK,GAAG,CAAC,IAAI,KAAK;YACnB,oBAAC,IAAI,IAAC,IAAI,UAAE,OAAO,CAAC,GAAG,CAAQ;;YAAE,OAAO,CAAC,WAAW,CACpC,CACjB,CAAC,CACI,CACF,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { IPCRequest, IPCResponse, VM, FileInfo } from './types.js';
|
|
2
|
+
import { Readable, Writable } from 'stream';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
declare global {
|
|
5
|
+
var heyvmCore: {
|
|
6
|
+
stdin: Writable;
|
|
7
|
+
stdout: Readable;
|
|
8
|
+
process: any;
|
|
9
|
+
} | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class IPCClient extends EventEmitter {
|
|
12
|
+
private requestId;
|
|
13
|
+
private pendingRequests;
|
|
14
|
+
private responseBuffer;
|
|
15
|
+
constructor();
|
|
16
|
+
private setupResponseHandler;
|
|
17
|
+
private handleResponse;
|
|
18
|
+
/**
|
|
19
|
+
* Send a fire-and-forget message (no response expected)
|
|
20
|
+
*/
|
|
21
|
+
send(message: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Send a request to the backend and wait for response
|
|
24
|
+
*/
|
|
25
|
+
sendRequest<T = unknown>(request: IPCRequest): Promise<IPCResponse<T>>;
|
|
26
|
+
/**
|
|
27
|
+
* List all VMs
|
|
28
|
+
*/
|
|
29
|
+
listVMs(): Promise<VM[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Add a new VM
|
|
32
|
+
*/
|
|
33
|
+
addVM(vm: Partial<VM>): Promise<VM>;
|
|
34
|
+
/**
|
|
35
|
+
* Remove a VM
|
|
36
|
+
*/
|
|
37
|
+
removeVM(vmId: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Connect to a VM
|
|
40
|
+
*/
|
|
41
|
+
connectVM(vmId: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Disconnect from a VM
|
|
44
|
+
*/
|
|
45
|
+
disconnectVM(vmId: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a command on a VM
|
|
48
|
+
*/
|
|
49
|
+
executeCommand(vmId: string, command: string): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* List files in a directory on a VM
|
|
52
|
+
*/
|
|
53
|
+
listFiles(vmId: string, path: string): Promise<FileInfo[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Upload a file to a VM
|
|
56
|
+
*/
|
|
57
|
+
uploadFile(vmId: string, localPath: string, remotePath: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Download a file from a VM
|
|
60
|
+
*/
|
|
61
|
+
downloadFile(vmId: string, remotePath: string, localPath: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a file on a VM
|
|
64
|
+
*/
|
|
65
|
+
deleteFile(vmId: string, path: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Rename a file on a VM
|
|
68
|
+
*/
|
|
69
|
+
renameFile(vmId: string, oldPath: string, newPath: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Store a password in the keychain
|
|
72
|
+
*/
|
|
73
|
+
storePassword(vmId: string, password: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Test connection to a VM
|
|
76
|
+
*/
|
|
77
|
+
testConnection(vm: Partial<VM>, password?: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Start a PTY session (fire-and-forget, emits PTY_READY event)
|
|
80
|
+
*/
|
|
81
|
+
startPTY(vmId: string, rows?: number, cols?: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Write data to a PTY session (fire-and-forget, non-blocking)
|
|
84
|
+
*/
|
|
85
|
+
writeToPTY(vmId: string, sessionId: string, data: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Resize a PTY session
|
|
88
|
+
*/
|
|
89
|
+
resizePTY(vmId: string, sessionId: string, rows: number, cols: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* Close a PTY session
|
|
92
|
+
*/
|
|
93
|
+
closePTY(vmId: string, sessionId: string): void;
|
|
94
|
+
}
|
|
95
|
+
export declare const ipcClient: IPCClient;
|
|
96
|
+
//# sourceMappingURL=ipc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["../../src/core/ipc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,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;CAM/C;AAGD,eAAO,MAAM,SAAS,WAAkB,CAAC"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
export class IPCClient extends EventEmitter {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
5
|
+
this.requestId = 0;
|
|
6
|
+
this.pendingRequests = new Map();
|
|
7
|
+
this.responseBuffer = '';
|
|
8
|
+
// Set up response handler if core process is available
|
|
9
|
+
if (global.heyvmCore) {
|
|
10
|
+
this.setupResponseHandler();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
setupResponseHandler() {
|
|
14
|
+
const stdout = global.heyvmCore.stdout;
|
|
15
|
+
stdout.on('data', (chunk) => {
|
|
16
|
+
this.responseBuffer += chunk.toString();
|
|
17
|
+
// Try to parse complete JSON responses
|
|
18
|
+
const lines = this.responseBuffer.split('\n');
|
|
19
|
+
this.responseBuffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
20
|
+
for (const line of lines) {
|
|
21
|
+
if (!line.trim())
|
|
22
|
+
continue;
|
|
23
|
+
try {
|
|
24
|
+
const response = JSON.parse(line);
|
|
25
|
+
this.handleResponse(response);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error('[IPC] Failed to parse response:', line, err);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
stdout.on('error', (err) => {
|
|
33
|
+
console.error('[IPC] Stdout error:', err);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
handleResponse(response) {
|
|
37
|
+
// Check if this is an event (no request_id)
|
|
38
|
+
if (response.event) {
|
|
39
|
+
this.emit(response.event, response.data);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Match response to request by ID
|
|
43
|
+
const requestId = response.request_id;
|
|
44
|
+
if (requestId !== undefined && this.pendingRequests.has(requestId)) {
|
|
45
|
+
const pending = this.pendingRequests.get(requestId);
|
|
46
|
+
this.pendingRequests.delete(requestId);
|
|
47
|
+
pending.resolve(response);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.warn('[IPC] Received response with no matching request:', response);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Send a fire-and-forget message (no response expected)
|
|
55
|
+
*/
|
|
56
|
+
send(message) {
|
|
57
|
+
if (!global.heyvmCore) {
|
|
58
|
+
console.warn('[IPC] Core process not available');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const messageStr = JSON.stringify(message) + '\n';
|
|
62
|
+
global.heyvmCore.stdin.write(messageStr, (err) => {
|
|
63
|
+
if (err) {
|
|
64
|
+
console.error('[IPC] Failed to send message:', err);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Send a request to the backend and wait for response
|
|
70
|
+
*/
|
|
71
|
+
async sendRequest(request) {
|
|
72
|
+
// If core process not available, return mock response
|
|
73
|
+
if (!global.heyvmCore) {
|
|
74
|
+
console.warn('[IPC] Core process not available, using mock response');
|
|
75
|
+
return {
|
|
76
|
+
status: 'success',
|
|
77
|
+
message: `Mock response for ${request.action}`,
|
|
78
|
+
data: {}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const id = this.requestId++;
|
|
83
|
+
this.pendingRequests.set(id, { resolve, reject });
|
|
84
|
+
// Add request ID to the request
|
|
85
|
+
const requestWithId = {
|
|
86
|
+
...request,
|
|
87
|
+
request_id: id
|
|
88
|
+
};
|
|
89
|
+
// Write request to core stdin
|
|
90
|
+
const requestStr = JSON.stringify(requestWithId) + '\n';
|
|
91
|
+
global.heyvmCore.stdin.write(requestStr, (err) => {
|
|
92
|
+
if (err) {
|
|
93
|
+
this.pendingRequests.delete(id);
|
|
94
|
+
reject(new Error(`Failed to send IPC request: ${err.message}`));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// Timeout after 30 seconds
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
if (this.pendingRequests.has(id)) {
|
|
100
|
+
this.pendingRequests.delete(id);
|
|
101
|
+
reject(new Error('IPC request timeout'));
|
|
102
|
+
}
|
|
103
|
+
}, 30000);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* List all VMs
|
|
108
|
+
*/
|
|
109
|
+
async listVMs() {
|
|
110
|
+
const response = await this.sendRequest({
|
|
111
|
+
action: 'list_vms'
|
|
112
|
+
});
|
|
113
|
+
if (response.status === 'error') {
|
|
114
|
+
throw new Error(response.message || 'Failed to list VMs');
|
|
115
|
+
}
|
|
116
|
+
return response.data || [];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Add a new VM
|
|
120
|
+
*/
|
|
121
|
+
async addVM(vm) {
|
|
122
|
+
const response = await this.sendRequest({
|
|
123
|
+
action: 'add_vm',
|
|
124
|
+
params: { vm }
|
|
125
|
+
});
|
|
126
|
+
if (response.status === 'error') {
|
|
127
|
+
throw new Error(response.message || 'Failed to add VM');
|
|
128
|
+
}
|
|
129
|
+
if (!response.data) {
|
|
130
|
+
throw new Error('No VM data returned');
|
|
131
|
+
}
|
|
132
|
+
return response.data;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Remove a VM
|
|
136
|
+
*/
|
|
137
|
+
async removeVM(vmId) {
|
|
138
|
+
const response = await this.sendRequest({
|
|
139
|
+
action: 'remove_vm',
|
|
140
|
+
params: { vm_id: vmId }
|
|
141
|
+
});
|
|
142
|
+
if (response.status === 'error') {
|
|
143
|
+
throw new Error(response.message || 'Failed to remove VM');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Connect to a VM
|
|
148
|
+
*/
|
|
149
|
+
async connectVM(vmId) {
|
|
150
|
+
const response = await this.sendRequest({
|
|
151
|
+
action: 'connect_vm',
|
|
152
|
+
params: { vm_id: vmId }
|
|
153
|
+
});
|
|
154
|
+
if (response.status === 'error') {
|
|
155
|
+
throw new Error(response.message || 'Failed to connect to VM');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Disconnect from a VM
|
|
160
|
+
*/
|
|
161
|
+
async disconnectVM(vmId) {
|
|
162
|
+
const response = await this.sendRequest({
|
|
163
|
+
action: 'disconnect_vm',
|
|
164
|
+
params: { vm_id: vmId }
|
|
165
|
+
});
|
|
166
|
+
if (response.status === 'error') {
|
|
167
|
+
throw new Error(response.message || 'Failed to disconnect from VM');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Execute a command on a VM
|
|
172
|
+
*/
|
|
173
|
+
async executeCommand(vmId, command) {
|
|
174
|
+
const response = await this.sendRequest({
|
|
175
|
+
action: 'execute_command',
|
|
176
|
+
params: { vm_id: vmId, command }
|
|
177
|
+
});
|
|
178
|
+
if (response.status === 'error') {
|
|
179
|
+
throw new Error(response.message || 'Failed to execute command');
|
|
180
|
+
}
|
|
181
|
+
return response.data?.output || '';
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* List files in a directory on a VM
|
|
185
|
+
*/
|
|
186
|
+
async listFiles(vmId, path) {
|
|
187
|
+
const response = await this.sendRequest({
|
|
188
|
+
action: 'list_files',
|
|
189
|
+
params: { vm_id: vmId, path }
|
|
190
|
+
});
|
|
191
|
+
if (response.status === 'error') {
|
|
192
|
+
throw new Error(response.message || 'Failed to list files');
|
|
193
|
+
}
|
|
194
|
+
return response.data || [];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Upload a file to a VM
|
|
198
|
+
*/
|
|
199
|
+
async uploadFile(vmId, localPath, remotePath) {
|
|
200
|
+
const response = await this.sendRequest({
|
|
201
|
+
action: 'upload_file',
|
|
202
|
+
params: { vm_id: vmId, local_path: localPath, remote_path: remotePath }
|
|
203
|
+
});
|
|
204
|
+
if (response.status === 'error') {
|
|
205
|
+
throw new Error(response.message || 'Failed to upload file');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Download a file from a VM
|
|
210
|
+
*/
|
|
211
|
+
async downloadFile(vmId, remotePath, localPath) {
|
|
212
|
+
const response = await this.sendRequest({
|
|
213
|
+
action: 'download_file',
|
|
214
|
+
params: { vm_id: vmId, remote_path: remotePath, local_path: localPath }
|
|
215
|
+
});
|
|
216
|
+
if (response.status === 'error') {
|
|
217
|
+
throw new Error(response.message || 'Failed to download file');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Delete a file on a VM
|
|
222
|
+
*/
|
|
223
|
+
async deleteFile(vmId, path) {
|
|
224
|
+
const response = await this.sendRequest({
|
|
225
|
+
action: 'delete_file',
|
|
226
|
+
params: { vm_id: vmId, path }
|
|
227
|
+
});
|
|
228
|
+
if (response.status === 'error') {
|
|
229
|
+
throw new Error(response.message || 'Failed to delete file');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Rename a file on a VM
|
|
234
|
+
*/
|
|
235
|
+
async renameFile(vmId, oldPath, newPath) {
|
|
236
|
+
const response = await this.sendRequest({
|
|
237
|
+
action: 'rename_file',
|
|
238
|
+
params: { vm_id: vmId, old_path: oldPath, new_path: newPath }
|
|
239
|
+
});
|
|
240
|
+
if (response.status === 'error') {
|
|
241
|
+
throw new Error(response.message || 'Failed to rename file');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Store a password in the keychain
|
|
246
|
+
*/
|
|
247
|
+
async storePassword(vmId, password) {
|
|
248
|
+
const response = await this.sendRequest({
|
|
249
|
+
action: 'store_password',
|
|
250
|
+
params: { vm_id: vmId, password }
|
|
251
|
+
});
|
|
252
|
+
if (response.status === 'error') {
|
|
253
|
+
throw new Error(response.message || 'Failed to store password');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Test connection to a VM
|
|
258
|
+
*/
|
|
259
|
+
async testConnection(vm, password) {
|
|
260
|
+
const response = await this.sendRequest({
|
|
261
|
+
action: 'test_connection',
|
|
262
|
+
params: {
|
|
263
|
+
vm,
|
|
264
|
+
password // Pass password for testing, won't be stored
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
if (response.status === 'error') {
|
|
268
|
+
throw new Error(response.message || 'Failed to test connection');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Start a PTY session (fire-and-forget, emits PTY_READY event)
|
|
273
|
+
*/
|
|
274
|
+
startPTY(vmId, rows = 24, cols = 80) {
|
|
275
|
+
this.send({
|
|
276
|
+
action: 'start_pty',
|
|
277
|
+
params: { vm_id: vmId, rows, cols }
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Write data to a PTY session (fire-and-forget, non-blocking)
|
|
282
|
+
*/
|
|
283
|
+
writeToPTY(vmId, sessionId, data) {
|
|
284
|
+
this.send({
|
|
285
|
+
action: 'write_to_pty',
|
|
286
|
+
params: { vm_id: vmId, session_id: sessionId, data }
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Resize a PTY session
|
|
291
|
+
*/
|
|
292
|
+
resizePTY(vmId, sessionId, rows, cols) {
|
|
293
|
+
this.send({
|
|
294
|
+
action: 'resize_pty',
|
|
295
|
+
params: { vm_id: vmId, session_id: sessionId, rows, cols }
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Close a PTY session
|
|
300
|
+
*/
|
|
301
|
+
closePTY(vmId, sessionId) {
|
|
302
|
+
this.send({
|
|
303
|
+
action: 'close_pty',
|
|
304
|
+
params: { vm_id: vmId, session_id: sessionId }
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Singleton instance
|
|
309
|
+
export const ipcClient = new IPCClient();
|
|
310
|
+
//# sourceMappingURL=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AE,SAAS,EAAE;SAC9C,CAAC,CAAC;IACJ,CAAC;CACD;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type VMStatus = 'unknown' | 'connected' | 'disconnected' | 'connecting' | 'error';
|
|
2
|
+
export type AuthType = 'key' | 'password';
|
|
3
|
+
export interface AuthConfig {
|
|
4
|
+
type: AuthType;
|
|
5
|
+
keyPath?: string;
|
|
6
|
+
rememberPassword: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface VM {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
host: string;
|
|
12
|
+
port: number;
|
|
13
|
+
username: string;
|
|
14
|
+
auth: AuthConfig;
|
|
15
|
+
lastSeen: string;
|
|
16
|
+
status: VMStatus;
|
|
17
|
+
}
|
|
18
|
+
export interface FileInfo {
|
|
19
|
+
name: string;
|
|
20
|
+
size: number;
|
|
21
|
+
mode: number;
|
|
22
|
+
modTime: string;
|
|
23
|
+
isDir: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface TransferProgress {
|
|
26
|
+
vm_id: string;
|
|
27
|
+
file: string;
|
|
28
|
+
direction: 'upload' | 'download';
|
|
29
|
+
bytes_transferred: number;
|
|
30
|
+
total_bytes: number;
|
|
31
|
+
percent: number;
|
|
32
|
+
}
|
|
33
|
+
export interface IPCRequest {
|
|
34
|
+
request_id?: number;
|
|
35
|
+
action: string;
|
|
36
|
+
params?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export interface IPCResponse<T = unknown> {
|
|
39
|
+
request_id?: number;
|
|
40
|
+
status: 'success' | 'error';
|
|
41
|
+
message?: string;
|
|
42
|
+
data?: T;
|
|
43
|
+
}
|
|
44
|
+
export type Tab = 'overview' | 'terminal' | 'files';
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;CACT;AAGD,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,8CAA8C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VM, FileInfo, TransferProgress } from '../core/types.js';
|
|
2
|
+
export declare function useFiles(vm: VM): {
|
|
3
|
+
files: FileInfo[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
transferring: boolean;
|
|
6
|
+
transferProgress: TransferProgress;
|
|
7
|
+
error: string;
|
|
8
|
+
listFiles: (path: string) => Promise<FileInfo[]>;
|
|
9
|
+
uploadFile: (localPath: string, remotePath: string) => Promise<void>;
|
|
10
|
+
downloadFile: (remotePath: string, localPath: string) => Promise<void>;
|
|
11
|
+
deleteFile: (path: string) => Promise<void>;
|
|
12
|
+
renameFile: (oldPath: string, newPath: string) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFiles.d.ts","sourceRoot":"","sources":["../../src/hooks/useFiles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGvE,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE;;;;;;sBAsBa,MAAM;4BAeA,MAAM,cAAc,MAAM;+BAevB,MAAM,aAAa,MAAM;uBAejC,MAAM;0BAUH,MAAM,WAAW,MAAM;EAsBtE"}
|