agentrejoin-agent 0.1.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 +661 -0
- package/README.md +190 -0
- package/bin/agentrejoin-agent.mjs +38 -0
- package/dist/index.cjs +1393 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1391 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# AgentRejoin control CLI
|
|
2
|
+
|
|
3
|
+
CLI client for controlling AgentRejoin sessions remotely.
|
|
4
|
+
|
|
5
|
+
Unlike `agentrejoin-cli` which both runs and controls agents, `agentrejoin-agent` only controls them — listing machines, spawning sessions on a machine, creating sessions, sending messages, reading history, monitoring state, and stopping sessions.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
From the monorepo:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn workspace agentrejoin-agent build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or link globally:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd packages/agentrejoin-agent && npm link
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Authentication
|
|
22
|
+
|
|
23
|
+
The control CLI uses account authentication via QR code, the same flow as linking a device in the AgentRejoin app.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Authenticate by scanning the QR code with AgentRejoin
|
|
27
|
+
agentrejoin-agent auth login
|
|
28
|
+
|
|
29
|
+
# Check authentication status
|
|
30
|
+
agentrejoin-agent auth status
|
|
31
|
+
|
|
32
|
+
# Clear stored credentials
|
|
33
|
+
agentrejoin-agent auth logout
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Credentials are stored at `~/.agentrejoin/agent.key`.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
### List sessions
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# List all sessions
|
|
44
|
+
agentrejoin-agent list
|
|
45
|
+
|
|
46
|
+
# List only active sessions
|
|
47
|
+
agentrejoin-agent list --active
|
|
48
|
+
|
|
49
|
+
# Output as JSON
|
|
50
|
+
agentrejoin-agent list --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### List machines
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# List all machines
|
|
57
|
+
agentrejoin-agent machines
|
|
58
|
+
|
|
59
|
+
# List only active machines
|
|
60
|
+
agentrejoin-agent machines --active
|
|
61
|
+
|
|
62
|
+
# Output as JSON
|
|
63
|
+
agentrejoin-agent machines --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Spawn on a machine
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Spawn a session on a specific machine
|
|
70
|
+
agentrejoin-agent spawn --machine <machine-id> --path ~/project
|
|
71
|
+
|
|
72
|
+
# Let the daemon create the directory if needed
|
|
73
|
+
agentrejoin-agent spawn --machine <machine-id> --path ~/new-project --create-dir
|
|
74
|
+
|
|
75
|
+
# Choose a specific agent
|
|
76
|
+
agentrejoin-agent spawn --machine <machine-id> --path ~/project --agent codex
|
|
77
|
+
|
|
78
|
+
# Output as JSON
|
|
79
|
+
agentrejoin-agent spawn --machine <machine-id> --path ~/project --json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Session status
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Get live session state (supports ID prefix matching)
|
|
86
|
+
agentrejoin-agent status <session-id>
|
|
87
|
+
|
|
88
|
+
# Output as JSON
|
|
89
|
+
agentrejoin-agent status <session-id> --json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Create a session
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Create a new session with a tag
|
|
96
|
+
agentrejoin-agent create --tag my-project
|
|
97
|
+
|
|
98
|
+
# Specify a working directory
|
|
99
|
+
agentrejoin-agent create --tag my-project --path /home/user/project
|
|
100
|
+
|
|
101
|
+
# Output as JSON
|
|
102
|
+
agentrejoin-agent create --tag my-project --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Send a message
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Send a message to a session
|
|
109
|
+
agentrejoin-agent send <session-id> "Fix the login bug"
|
|
110
|
+
|
|
111
|
+
# Send with yolo permissions
|
|
112
|
+
agentrejoin-agent send <session-id> "Ship it" --yolo
|
|
113
|
+
|
|
114
|
+
# Send and wait for the agent to finish
|
|
115
|
+
agentrejoin-agent send <session-id> "Run the tests" --wait
|
|
116
|
+
|
|
117
|
+
# Output as JSON
|
|
118
|
+
agentrejoin-agent send <session-id> "Hello" --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Message history
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# View message history
|
|
125
|
+
agentrejoin-agent history <session-id>
|
|
126
|
+
|
|
127
|
+
# Limit to last N messages
|
|
128
|
+
agentrejoin-agent history <session-id> --limit 10
|
|
129
|
+
|
|
130
|
+
# Output as JSON
|
|
131
|
+
agentrejoin-agent history <session-id> --json
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Stop a session
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
agentrejoin-agent stop <session-id>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Wait for idle
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Wait for agent to become idle (default 300s timeout)
|
|
144
|
+
agentrejoin-agent wait <session-id>
|
|
145
|
+
|
|
146
|
+
# Custom timeout
|
|
147
|
+
agentrejoin-agent wait <session-id> --timeout 60
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Exit code 0 when agent becomes idle, 1 on timeout.
|
|
151
|
+
|
|
152
|
+
## Environment Variables
|
|
153
|
+
|
|
154
|
+
- `AGENTREJOIN_SERVER_URL` - API server URL (default: `https://agentrejoin.zhandj.com`)
|
|
155
|
+
- `AGENTREJOIN_HOME_DIR` - Home directory for credential storage (default: `~/.agentrejoin`)
|
|
156
|
+
|
|
157
|
+
## Session ID Matching
|
|
158
|
+
|
|
159
|
+
All commands that accept a `<session-id>` support prefix matching. You can provide the first few characters of a session ID and the CLI will resolve the full ID.
|
|
160
|
+
|
|
161
|
+
Machine-aware commands such as `spawn --machine <machine-id>` also support ID prefix matching.
|
|
162
|
+
|
|
163
|
+
## Encryption
|
|
164
|
+
|
|
165
|
+
All machine and session data is end-to-end encrypted. New records use AES-256-GCM with per-record keys. Existing records created by other clients are decrypted using the appropriate key scheme (AES-256-GCM or legacy NaCl secretbox).
|
|
166
|
+
|
|
167
|
+
## Requirements
|
|
168
|
+
|
|
169
|
+
- Node.js >= 20.0.0
|
|
170
|
+
- An AgentRejoin account for authentication
|
|
171
|
+
|
|
172
|
+
## Publishing to npm
|
|
173
|
+
|
|
174
|
+
Maintainers can publish a new version:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
yarn release # From repo root: choose library to release
|
|
178
|
+
# or directly:
|
|
179
|
+
yarn workspace agentrejoin-agent release
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This flow:
|
|
183
|
+
- runs tests/build checks via `prepublishOnly`
|
|
184
|
+
- creates a release commit and `agentrejoin-agent-vX.Y.Z` tag
|
|
185
|
+
- creates a GitHub release with generated notes
|
|
186
|
+
- publishes `agentrejoin-agent` to npm
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
GNU AGPL v3 - see the repository root [LICENSE](../../LICENSE).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { join, dirname } from 'path';
|
|
6
|
+
|
|
7
|
+
// Check if we're already running with the flags
|
|
8
|
+
const hasNoWarnings = process.execArgv.includes('--no-warnings');
|
|
9
|
+
const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
|
|
10
|
+
|
|
11
|
+
if (!hasNoWarnings || !hasNoDeprecation) {
|
|
12
|
+
// Get path to the actual CLI entrypoint
|
|
13
|
+
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const entrypoint = join(projectRoot, 'dist', 'index.mjs');
|
|
15
|
+
|
|
16
|
+
// Execute the actual CLI directly with the correct flags
|
|
17
|
+
try {
|
|
18
|
+
execFileSync(process.execPath, [
|
|
19
|
+
'--no-warnings',
|
|
20
|
+
'--no-deprecation',
|
|
21
|
+
entrypoint,
|
|
22
|
+
...process.argv.slice(2)
|
|
23
|
+
], {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
env: process.env
|
|
26
|
+
});
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// execFileSync throws if the process exits with non-zero
|
|
29
|
+
// If there's no exit status, this is a spawn error (e.g. ENOENT) - show the message
|
|
30
|
+
if (error.status == null) {
|
|
31
|
+
console.error(error.message);
|
|
32
|
+
}
|
|
33
|
+
process.exit(error.status ?? 1);
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
// We're running Node with the flags we wanted, import the CLI entrypoint
|
|
37
|
+
import("../dist/index.mjs");
|
|
38
|
+
}
|