opencode-remote-login 0.1.1 → 0.1.3
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 +37 -45
- package/package.json +1 -1
- package/src/index.ts +6 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# opencode-remote-login
|
|
2
2
|
|
|
3
|
-
Dispatch opencode sessions to remote hosts via SSH
|
|
3
|
+
Dispatch opencode sessions to remote hosts via SSH. Migrate context, execute tasks remotely, and optionally pull results back.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,17 +8,13 @@ Dispatch opencode sessions to remote hosts via SSH and continue tasks there.
|
|
|
8
8
|
opencode plug opencode-remote-login
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This adds the plugin to your `opencode.jsonc`. The `remote_login` tool becomes available immediately.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
"plugin": ["opencode-remote-login"]
|
|
16
|
-
}
|
|
17
|
-
```
|
|
13
|
+
## Configure hosts
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
Hosts are defined via a `hosts` entry in one of these locations (checked in order):
|
|
20
16
|
|
|
21
|
-
1
|
|
17
|
+
**Option 1 — `~/.config/opencode/hosts.json`**
|
|
22
18
|
|
|
23
19
|
```json
|
|
24
20
|
{
|
|
@@ -27,22 +23,14 @@ Or add to `opencode.jsonc` manually:
|
|
|
27
23
|
"host": "wenjun@192.168.100.100",
|
|
28
24
|
"agent": "build",
|
|
29
25
|
"model": "opencode/big-pickle"
|
|
30
|
-
}
|
|
31
|
-
"dev": "user@10.0.0.5"
|
|
26
|
+
}
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
29
|
```
|
|
35
30
|
|
|
36
|
-
2
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
ssh-copy-id user@192.168.1.100
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Alternative: inline config
|
|
31
|
+
**Option 2 — Inline in `opencode.jsonc`**
|
|
43
32
|
|
|
44
33
|
```jsonc
|
|
45
|
-
// opencode.jsonc
|
|
46
34
|
{
|
|
47
35
|
"plugin": [
|
|
48
36
|
["opencode-remote-login", {
|
|
@@ -54,53 +42,57 @@ ssh-copy-id user@192.168.1.100
|
|
|
54
42
|
}
|
|
55
43
|
```
|
|
56
44
|
|
|
57
|
-
|
|
45
|
+
### Host fields
|
|
46
|
+
|
|
47
|
+
| Field | Required | Description |
|
|
48
|
+
| ------- | -------- | -------------------------------------- |
|
|
49
|
+
| `host` | Yes | SSH address (`user@host`) |
|
|
50
|
+
| `agent` | No | Override agent on the remote |
|
|
51
|
+
| `model` | No | Override model in `provider/id` format |
|
|
58
52
|
|
|
59
|
-
|
|
53
|
+
Only host **names** are shown to the LLM; SSH addresses stay on disk.
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
| ------- | ---------------------------------------- |
|
|
63
|
-
| `host` | SSH address (`user@host`) |
|
|
64
|
-
| `agent` | Agent name to use on the remote (optional) |
|
|
65
|
-
| `model` | Model in `provider/id` format (optional) |
|
|
55
|
+
### SSH setup
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
```bash
|
|
58
|
+
ssh-copy-id user@192.168.100.100
|
|
59
|
+
```
|
|
68
60
|
|
|
69
61
|
## Usage
|
|
70
62
|
|
|
71
|
-
### One-way
|
|
63
|
+
### One-way
|
|
72
64
|
|
|
73
|
-
|
|
65
|
+
Hand off the session and return. The remote host picks up the task autonomously.
|
|
74
66
|
|
|
75
67
|
```
|
|
76
|
-
> call remote_login host=pi, fix the
|
|
68
|
+
> call remote_login host=pi, fix the auth bug
|
|
77
69
|
```
|
|
78
70
|
|
|
79
|
-
### Round-trip
|
|
71
|
+
### Round-trip
|
|
80
72
|
|
|
81
|
-
|
|
73
|
+
Wait for the remote to finish, then pull results back. The original agent and model are restored automatically on return.
|
|
82
74
|
|
|
83
75
|
```
|
|
84
|
-
> call remote_login mode=round-trip host=pi,
|
|
76
|
+
> call remote_login mode=round-trip host=pi, find the memory leak
|
|
85
77
|
```
|
|
86
78
|
|
|
87
|
-
###
|
|
79
|
+
### Target directory
|
|
88
80
|
|
|
89
81
|
```
|
|
90
|
-
> call remote_login host=pi directory=/home/wenjun/projects/
|
|
82
|
+
> call remote_login host=pi directory=/home/wenjun/projects/app
|
|
91
83
|
```
|
|
92
84
|
|
|
85
|
+
Omit to default to `~`.
|
|
86
|
+
|
|
93
87
|
## How it works
|
|
94
88
|
|
|
95
89
|
```
|
|
96
|
-
local
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
7. [round-trip] restore original agent/model
|
|
105
|
-
8. [round-trip] local import
|
|
90
|
+
local remote
|
|
91
|
+
───── ──────
|
|
92
|
+
export session JSON
|
|
93
|
+
patch agent/model per host config ────→ SCP + import session
|
|
94
|
+
nohup opencode run --session=<id>
|
|
95
|
+
[round-trip] poll for completion ←── export session JSON
|
|
96
|
+
[round-trip] restore agent/model
|
|
97
|
+
[round-trip] import back
|
|
106
98
|
```
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,7 +18,12 @@ function opencodeConfigDir(): string {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function loadHosts(inlineHosts: any): Record<string, HostConfig> {
|
|
21
|
-
const
|
|
21
|
+
const home = homedir()
|
|
22
|
+
const paths = [
|
|
23
|
+
join(opencodeConfigDir(), "hosts.json"),
|
|
24
|
+
join(home, ".config", "opencode", "hosts.json"),
|
|
25
|
+
join(pluginDir, "..", "hosts.json"),
|
|
26
|
+
]
|
|
22
27
|
|
|
23
28
|
const inline = parseHostsEntry(inlineHosts)
|
|
24
29
|
if (inline) return inline
|