@burdenoff/vibe-plugin-ssh 1.0.1 → 2.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/README.md CHANGED
@@ -31,18 +31,18 @@ vibe plugin list # verify it shows up
31
31
 
32
32
  Once installed, the plugin registers these routes on the agent:
33
33
 
34
- | Method | Path | Description |
35
- |--------|------|-------------|
36
- | GET | `/api/ssh/connections` | List all SSH connections |
37
- | POST | `/api/ssh/connections` | Create a new SSH connection |
38
- | POST | `/api/ssh/execute` | Execute a remote command |
39
- | POST | `/api/ssh/test/:id` | Test an SSH connection |
40
- | DELETE | `/api/ssh/connections/:id` | Delete a connection |
41
- | GET | `/api/port-forward/` | List all port forwards |
42
- | POST | `/api/port-forward/` | Create a port forward |
43
- | POST | `/api/port-forward/:id/start` | Start forwarding |
44
- | POST | `/api/port-forward/:id/stop` | Stop forwarding |
45
- | DELETE | `/api/port-forward/:id` | Delete a forward |
34
+ | Method | Path | Description |
35
+ | ------ | ----------------------------- | --------------------------- |
36
+ | GET | `/api/ssh/connections` | List all SSH connections |
37
+ | POST | `/api/ssh/connections` | Create a new SSH connection |
38
+ | POST | `/api/ssh/execute` | Execute a remote command |
39
+ | POST | `/api/ssh/test/:id` | Test an SSH connection |
40
+ | DELETE | `/api/ssh/connections/:id` | Delete a connection |
41
+ | GET | `/api/port-forward/` | List all port forwards |
42
+ | POST | `/api/port-forward/` | Create a port forward |
43
+ | POST | `/api/port-forward/:id/start` | Start forwarding |
44
+ | POST | `/api/port-forward/:id/stop` | Stop forwarding |
45
+ | DELETE | `/api/port-forward/:id` | Delete a forward |
46
46
 
47
47
  ## CLI Commands
48
48
 
package/dist/index.d.ts CHANGED
@@ -1,25 +1,17 @@
1
- import type { FastifyInstance } from "fastify";
2
- import type { Command } from "commander";
3
1
  /**
4
- * @burdenoff/vibe-plugin-ssh
2
+ * @burdenoff/vibe-plugin-ssh v2.0.0
5
3
  *
6
4
  * SSH connections, remote command execution, and port forwarding plugin
7
- * for the VibeControls Agent. This plugin registers:
5
+ * for the VibeControls Agent (Bun / Elysia / KV storage).
8
6
  *
9
- * - Fastify routes: /api/ssh/*, /api/port-forward/*
10
- * - CLI commands: vibe ssh list|add|remove|test|exec
11
- * vibe forward list|create|start|stop|delete
7
+ * Registers:
8
+ * - Elysia routes: /api/ssh/*, /api/port-forward/*
9
+ * - CLI stub: (SSH CLI commands to be implemented later)
12
10
  *
13
11
  * Install: vibe plugin install @burdenoff/vibe-plugin-ssh
14
12
  */
15
- export interface VibePlugin {
16
- name: string;
17
- version: string;
18
- description?: string;
19
- onCliSetup?: (program: Command) => void | Promise<void>;
20
- onServerStart?: (app: FastifyInstance) => void | Promise<void>;
21
- onServerStop?: (app: FastifyInstance) => void | Promise<void>;
22
- }
13
+ import type { VibePlugin } from "./types.js";
14
+ export type { VibePlugin, HostServices, StorageProvider, EventBus, ServiceRegistry, SSHConnection, PortForward, } from "./types.js";
23
15
  export declare const vibePlugin: VibePlugin;
24
16
  export default vibePlugin;
25
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;;;;GAWG;AAGH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,UAAU,EAAE,UAsBxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,YAAY,CAAC;AAG3D,YAAY,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AAYpB,eAAO,MAAM,UAAU,EAAE,UAwCxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,51 @@
1
+ /**
2
+ * @burdenoff/vibe-plugin-ssh v2.0.0
3
+ *
4
+ * SSH connections, remote command execution, and port forwarding plugin
5
+ * for the VibeControls Agent (Bun / Elysia / KV storage).
6
+ *
7
+ * Registers:
8
+ * - Elysia routes: /api/ssh/*, /api/port-forward/*
9
+ * - CLI stub: (SSH CLI commands to be implemented later)
10
+ *
11
+ * Install: vibe plugin install @burdenoff/vibe-plugin-ssh
12
+ */
13
+ // ---------------------------------------------------------------------------
14
+ // Module-level reference so onServerStop can clean up
15
+ // ---------------------------------------------------------------------------
16
+ let cleanupFn;
17
+ // ---------------------------------------------------------------------------
18
+ // Plugin definition
19
+ // ---------------------------------------------------------------------------
1
20
  export const vibePlugin = {
2
21
  name: "ssh",
3
- version: "1.0.0",
4
- description: "SSH connections & port forwarding for VibeControls Agent",
5
- async onServerStart(app) {
6
- // Dynamically import ssh2 — this is the whole point of the plugin:
7
- // ssh2 (with native cpu-features) is only loaded when the plugin is installed.
8
- const { sshRoutes } = await import("./routes/ssh.js");
9
- const { portForwardRoutes } = await import("./routes/port-forward.js");
10
- await app.register(sshRoutes, { prefix: "/api/ssh" });
11
- await app.register(portForwardRoutes, { prefix: "/api/port-forward" });
12
- console.log(" 🔌 Plugin 'ssh' registered routes: /api/ssh, /api/port-forward");
22
+ version: "2.0.0",
23
+ description: "SSH connection management and port forwarding",
24
+ tags: ["backend", "cli", "integration"],
25
+ cliCommand: "ssh",
26
+ apiPrefix: "/api/ssh",
27
+ async onServerStart(app, hostServices) {
28
+ // Dynamically import route modules ssh2 native deps only load when
29
+ // the plugin is actually activated.
30
+ const { createSSHRoutes } = await import("./routes/ssh.js");
31
+ const { createPortForwardRoutes, cleanupAllTunnels } = await import("./routes/port-forward.js");
32
+ app.use(createSSHRoutes(hostServices));
33
+ app.use(createPortForwardRoutes(hostServices));
34
+ // Stash the cleanup function for onServerStop
35
+ cleanupFn = cleanupAllTunnels;
36
+ console.log(" Plugin 'ssh' registered routes: /api/ssh, /api/port-forward");
13
37
  },
14
- onCliSetup(program) {
15
- // SSH CLI commands are registered by the agent's built-in CLI for now.
16
- // In a future version, the CLI commands will also move into this plugin.
17
- // For now, the plugin only contributes server-side routes.
38
+ async onServerStop() {
39
+ // Tear down every active SSH tunnel and connection
40
+ if (cleanupFn) {
41
+ cleanupFn();
42
+ cleanupFn = undefined;
43
+ }
44
+ console.log(" Plugin 'ssh' cleaned up active connections");
45
+ },
46
+ onCliSetup(_program) {
47
+ // SSH CLI commands to be implemented in a future version.
48
+ // The plugin currently only contributes server-side routes.
18
49
  },
19
50
  };
20
51
  export default vibePlugin;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,0DAA0D;IAEvE,KAAK,CAAC,aAAa,CAAC,GAAoB;QACtC,mEAAmE;QACnE,+EAA+E;QAC/E,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACtD,MAAM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C,CAAC;QAE/C,8CAA8C;QAC9C,SAAS,GAAG,iBAAiB,CAAC;QAE9B,OAAO,CAAC,GAAG,CACT,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,mDAAmD;QACnD,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,EAAE,CAAC;YACZ,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC9D,CAAC;IAED,UAAU,CAAC,QAAiB;QAC1B,0DAA0D;QAC1D,4DAA4D;IAC9D,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,3 +1,190 @@
1
- import { FastifyPluginAsync } from "fastify";
2
- export declare const portForwardRoutes: FastifyPluginAsync;
1
+ /**
2
+ * Port-forwarding routes (Elysia + KV storage).
3
+ *
4
+ * Namespace: "ssh"
5
+ * Keys:
6
+ * "connections" → JSON array of SSHConnection objects (read-only here)
7
+ * "port-forwards" → JSON array of PortForward objects
8
+ */
9
+ import { Elysia } from "elysia";
10
+ import type { HostServices, PortForward } from "../types.js";
11
+ export declare function cleanupAllTunnels(): void;
12
+ export declare function createPortForwardRoutes(hostServices: HostServices): Elysia<"/api/port-forward", {
13
+ decorator: {};
14
+ store: {};
15
+ derive: {};
16
+ resolve: {};
17
+ }, {
18
+ typebox: {};
19
+ error: {};
20
+ }, {
21
+ schema: {};
22
+ standaloneSchema: {};
23
+ macro: {};
24
+ macroFn: {};
25
+ parser: {};
26
+ response: {};
27
+ }, {
28
+ api: {
29
+ "port-forward": {
30
+ get: {
31
+ body: unknown;
32
+ params: {};
33
+ query: unknown;
34
+ headers: unknown;
35
+ response: {
36
+ 200: {
37
+ portForwards: PortForward[];
38
+ };
39
+ };
40
+ };
41
+ };
42
+ };
43
+ } & {
44
+ api: {
45
+ "port-forward": {
46
+ post: {
47
+ body: unknown;
48
+ params: {};
49
+ query: unknown;
50
+ headers: unknown;
51
+ response: {
52
+ 200: {
53
+ error: string;
54
+ portForward?: undefined;
55
+ details?: undefined;
56
+ } | {
57
+ portForward: PortForward;
58
+ error?: undefined;
59
+ details?: undefined;
60
+ } | {
61
+ error: string;
62
+ details: string;
63
+ portForward?: undefined;
64
+ };
65
+ };
66
+ };
67
+ };
68
+ };
69
+ } & {
70
+ api: {
71
+ "port-forward": {
72
+ ":id": {
73
+ start: {
74
+ post: {
75
+ body: unknown;
76
+ params: {
77
+ id: string;
78
+ } & {};
79
+ query: unknown;
80
+ headers: unknown;
81
+ response: {
82
+ 422: {
83
+ type: "validation";
84
+ on: string;
85
+ summary?: string;
86
+ message?: string;
87
+ found?: unknown;
88
+ property?: string;
89
+ expected?: string;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ };
95
+ };
96
+ };
97
+ } & {
98
+ api: {
99
+ "port-forward": {
100
+ ":id": {
101
+ stop: {
102
+ post: {
103
+ body: unknown;
104
+ params: {
105
+ id: string;
106
+ } & {};
107
+ query: unknown;
108
+ headers: unknown;
109
+ response: {
110
+ 200: {
111
+ error: string;
112
+ success?: undefined;
113
+ details?: undefined;
114
+ } | {
115
+ success: boolean;
116
+ error?: undefined;
117
+ details?: undefined;
118
+ } | {
119
+ error: string;
120
+ details: string;
121
+ success?: undefined;
122
+ };
123
+ 422: {
124
+ type: "validation";
125
+ on: string;
126
+ summary?: string;
127
+ message?: string;
128
+ found?: unknown;
129
+ property?: string;
130
+ expected?: string;
131
+ };
132
+ };
133
+ };
134
+ };
135
+ };
136
+ };
137
+ };
138
+ } & {
139
+ api: {
140
+ "port-forward": {
141
+ ":id": {
142
+ delete: {
143
+ body: unknown;
144
+ params: {
145
+ id: string;
146
+ } & {};
147
+ query: unknown;
148
+ headers: unknown;
149
+ response: {
150
+ 200: {
151
+ error: string;
152
+ success?: undefined;
153
+ details?: undefined;
154
+ } | {
155
+ success: boolean;
156
+ error?: undefined;
157
+ details?: undefined;
158
+ } | {
159
+ error: string;
160
+ details: string;
161
+ success?: undefined;
162
+ };
163
+ 422: {
164
+ type: "validation";
165
+ on: string;
166
+ summary?: string;
167
+ message?: string;
168
+ found?: unknown;
169
+ property?: string;
170
+ expected?: string;
171
+ };
172
+ };
173
+ };
174
+ };
175
+ };
176
+ };
177
+ }, {
178
+ derive: {};
179
+ resolve: {};
180
+ schema: {};
181
+ standaloneSchema: {};
182
+ response: {};
183
+ }, {
184
+ derive: {};
185
+ resolve: {};
186
+ schema: {};
187
+ standaloneSchema: {};
188
+ response: {};
189
+ }>;
3
190
  //# sourceMappingURL=port-forward.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"port-forward.d.ts","sourceRoot":"","sources":["../../src/routes/port-forward.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgB7C,eAAO,MAAM,iBAAiB,EAAE,kBAuP/B,CAAC"}
1
+ {"version":3,"file":"port-forward.d.ts","sourceRoot":"","sources":["../../src/routes/port-forward.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,KAAK,EACV,YAAY,EAEZ,WAAW,EAEZ,MAAM,aAAa,CAAC;AAkHrB,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAMD,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgQjE"}