@evident-ai/cli 3.0.1-dev.82a8d1e → 3.0.1-dev.86f51e3
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 +131 -87
- package/dist/index.js +651 -260
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,166 +1,207 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @evident-ai/cli
|
|
2
2
|
|
|
3
|
-
Run OpenCode locally and connect it to the
|
|
3
|
+
Run OpenCode locally and connect it to the [Evident](https://evident.run) platform.
|
|
4
|
+
|
|
5
|
+
The `evident` CLI starts (or attaches to) `opencode serve` on your machine and
|
|
6
|
+
exposes it to Evident over a secure tunnel. Your code, secrets, and tools stay
|
|
7
|
+
local — only the messages you send travel through Evident. Once connected, you
|
|
8
|
+
can reach your agent from the web and from Slack.
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
|
-
npm install -g @
|
|
13
|
+
npm install -g @evident-ai/cli
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
Or run directly with npx:
|
|
16
|
+
Or run it directly with npx:
|
|
12
17
|
|
|
13
18
|
```bash
|
|
14
|
-
npx @
|
|
19
|
+
npx @evident-ai/cli@latest <command>
|
|
15
20
|
```
|
|
16
21
|
|
|
22
|
+
The installed binary is named `evident`.
|
|
23
|
+
|
|
17
24
|
## Commands
|
|
18
25
|
|
|
19
|
-
### `
|
|
26
|
+
### `evident login`
|
|
20
27
|
|
|
21
|
-
Authenticate with
|
|
28
|
+
Authenticate with Evident. By default this uses the browser-based device flow
|
|
29
|
+
(ADR-0018): the CLI shows a one-time code and opens your browser to confirm it.
|
|
22
30
|
|
|
23
31
|
```bash
|
|
24
|
-
|
|
32
|
+
evident login
|
|
25
33
|
```
|
|
26
34
|
|
|
27
35
|
Options:
|
|
28
36
|
|
|
29
|
-
- `--no-browser`
|
|
30
|
-
- `--token`
|
|
37
|
+
- `--no-browser` — Don't open the browser automatically (visit the URL manually).
|
|
38
|
+
- `--token` — Use token-based authentication instead of the device flow (for
|
|
39
|
+
CI/CD); paste a token when prompted.
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
Sessions are stored per endpoint, so you can stay logged in to more than one
|
|
42
|
+
backend at the same time (e.g. production and a preview environment).
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
### `evident logout`
|
|
45
|
+
|
|
46
|
+
Remove stored credentials. By default this signs you out of the current endpoint
|
|
47
|
+
only (the one selected by `--endpoint` / `EVIDENT_API_URL`, otherwise
|
|
48
|
+
production).
|
|
35
49
|
|
|
36
50
|
```bash
|
|
37
|
-
|
|
51
|
+
evident logout
|
|
38
52
|
```
|
|
39
53
|
|
|
40
|
-
|
|
54
|
+
Options:
|
|
55
|
+
|
|
56
|
+
- `--all` — Remove stored credentials for every endpoint.
|
|
57
|
+
|
|
58
|
+
### `evident whoami`
|
|
41
59
|
|
|
42
|
-
Show the currently authenticated user.
|
|
60
|
+
Show the currently authenticated user for the current endpoint.
|
|
43
61
|
|
|
44
62
|
```bash
|
|
45
|
-
|
|
63
|
+
evident whoami
|
|
46
64
|
```
|
|
47
65
|
|
|
48
|
-
### `
|
|
66
|
+
### `evident run`
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
Connect to Evident and serve your agent. `evident run` authenticates, resolves
|
|
69
|
+
which agent to run, ensures `opencode serve` is running on loopback, opens the
|
|
70
|
+
streaming tunnel (which transparently proxies the agent's web surface), and
|
|
71
|
+
delivers any channel messages (e.g. Slack) to your local OpenCode.
|
|
51
72
|
|
|
52
73
|
```bash
|
|
53
|
-
|
|
74
|
+
# Interactive: connect a specific agent
|
|
75
|
+
evident run --agent <agent-id>
|
|
76
|
+
|
|
77
|
+
# Drive a single conversation
|
|
78
|
+
evident run --agent <agent-id> --conversation <conversation-id>
|
|
79
|
+
|
|
80
|
+
# CI: exit after 30s with no work
|
|
81
|
+
evident run --agent <agent-id> --idle-timeout 30
|
|
54
82
|
```
|
|
55
83
|
|
|
56
84
|
Options:
|
|
57
85
|
|
|
58
|
-
- `-
|
|
59
|
-
|
|
86
|
+
- `-a, --agent [id]` — Agent ID to connect to. Optional when `EVIDENT_AGENT_KEY`
|
|
87
|
+
is set (the agent is then resolved automatically from the key).
|
|
88
|
+
- `-p, --port <port>` — OpenCode port (default: `4096`).
|
|
89
|
+
- `-v, --verbose` — Show detailed request/response information.
|
|
90
|
+
- `-c, --conversation <id>` — Process only this specific conversation.
|
|
91
|
+
- `--idle-timeout <seconds>` — Exit after N seconds with no pending work (useful
|
|
92
|
+
in CI to avoid polling indefinitely).
|
|
93
|
+
- `--json` — Output in JSON format (forces non-interactive mode).
|
|
60
94
|
|
|
61
|
-
##
|
|
95
|
+
## Global flags
|
|
62
96
|
|
|
63
|
-
|
|
97
|
+
These apply to every command and select which backend the CLI talks to. The CLI
|
|
98
|
+
targets the **production** Evident platform by default.
|
|
64
99
|
|
|
65
|
-
|
|
100
|
+
- `--endpoint <url>` — Evident REST API base URL (e.g. `http://localhost:3001`).
|
|
101
|
+
A trailing `/v1` is optional — it's added automatically.
|
|
102
|
+
- `--tunnel <url>` — Tunnel WebSocket URL (e.g. `ws://localhost:8787`).
|
|
66
103
|
|
|
67
|
-
|
|
68
|
-
# Install OpenCode
|
|
69
|
-
npm install -g opencode-ai
|
|
104
|
+
## Environment variables
|
|
70
105
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
106
|
+
- `EVIDENT_AGENT_KEY` — An agent key. When set, `evident run` authenticates as
|
|
107
|
+
that agent and resolves the agent ID automatically, so `--agent` is not
|
|
108
|
+
required. Ideal for CI/CD.
|
|
109
|
+
- `EVIDENT_TOKEN` — A user token used for authentication (alternative to a
|
|
110
|
+
keychain login from `evident login`).
|
|
111
|
+
- `EVIDENT_API_URL` — Override the API base URL (equivalent to `--endpoint`).
|
|
112
|
+
- `EVIDENT_TUNNEL_URL` — Override the tunnel relay URL (equivalent to `--tunnel`).
|
|
113
|
+
|
|
114
|
+
Authentication precedence for `run`: `EVIDENT_AGENT_KEY` → `EVIDENT_TOKEN` →
|
|
115
|
+
credentials stored by `evident login`. For the URL flags, an explicit
|
|
116
|
+
`--endpoint` / `--tunnel` flag wins over the matching environment variable, which
|
|
117
|
+
in turn overrides the production default.
|
|
75
118
|
|
|
76
|
-
|
|
119
|
+
## Getting started
|
|
77
120
|
|
|
78
|
-
|
|
121
|
+
### 1. Install and authenticate
|
|
79
122
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
123
|
+
```bash
|
|
124
|
+
npm install -g @evident-ai/cli
|
|
125
|
+
evident login
|
|
126
|
+
```
|
|
83
127
|
|
|
84
|
-
|
|
128
|
+
### 2. Create an agent
|
|
85
129
|
|
|
86
|
-
|
|
130
|
+
In the Evident web app, create an agent (it runs in local mode). Note its agent
|
|
131
|
+
ID.
|
|
87
132
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
### 3. Run it on your machine
|
|
134
|
+
|
|
135
|
+
From your project directory, start the agent:
|
|
91
136
|
|
|
92
|
-
|
|
93
|
-
|
|
137
|
+
```bash
|
|
138
|
+
evident run --agent <agent-id>
|
|
94
139
|
```
|
|
95
140
|
|
|
96
|
-
|
|
141
|
+
`evident run` ensures `opencode serve` is running on `127.0.0.1:4096` (starting
|
|
142
|
+
it if needed) and connects the tunnel. Once connected, the web shows the agent as
|
|
143
|
+
online and you can open its chat.
|
|
144
|
+
|
|
145
|
+
For CI or unattended use, set `EVIDENT_AGENT_KEY` and omit `--agent`:
|
|
97
146
|
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
147
|
+
```bash
|
|
148
|
+
EVIDENT_AGENT_KEY=<agent-key> evident run --idle-timeout 30
|
|
149
|
+
```
|
|
101
150
|
|
|
102
|
-
## How
|
|
151
|
+
## How it works
|
|
103
152
|
|
|
104
153
|
```
|
|
105
154
|
+-------------------+ +-------------------+ +-------------------+
|
|
106
|
-
| Your
|
|
155
|
+
| Your machine | | Cloudflare edge | | Evident API |
|
|
107
156
|
| | | | | |
|
|
108
|
-
|
|
|
157
|
+
| opencode serve <--+---->| Tunnel relay (DO) |<--->| API worker |
|
|
158
|
+
| (127.0.0.1:4096) | | (WebSocket) | | |
|
|
109
159
|
| | | | | |
|
|
110
|
-
|
|
|
160
|
+
| evident run ------+---->| | | Web + Slack |
|
|
111
161
|
+-------------------+ +-------------------+ +-------------------+
|
|
112
162
|
```
|
|
113
163
|
|
|
114
|
-
1.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
164
|
+
1. `evident run` ensures `opencode serve` is listening on loopback
|
|
165
|
+
(`127.0.0.1`).
|
|
166
|
+
2. It opens an outbound WebSocket to the Evident tunnel relay.
|
|
167
|
+
3. Evident routes web traffic and channel (e.g. Slack) messages through the
|
|
168
|
+
tunnel to your local OpenCode; responses flow back the same way.
|
|
169
|
+
4. Only one running copy of an agent is active at a time — starting a second copy
|
|
170
|
+
takes over.
|
|
118
171
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
### "OpenCode not found on port 4096"
|
|
172
|
+
See [ADR-0039](../../docs/decisions/0039-reuse-opencode-web-ui.md) and
|
|
173
|
+
[`docs/architecture.md`](../../docs/architecture.md) for the full design.
|
|
122
174
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
opencode serve --port 4096
|
|
127
|
-
```
|
|
175
|
+
## Troubleshooting
|
|
128
176
|
|
|
129
|
-
###
|
|
177
|
+
### Not logged in / authentication failed
|
|
130
178
|
|
|
131
179
|
Re-authenticate:
|
|
132
180
|
|
|
133
181
|
```bash
|
|
134
|
-
|
|
135
|
-
|
|
182
|
+
evident logout
|
|
183
|
+
evident login
|
|
136
184
|
```
|
|
137
185
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
The CLI will automatically reconnect. If issues persist:
|
|
141
|
-
|
|
142
|
-
1. Check your internet connection
|
|
143
|
-
2. Verify OpenCode is still running
|
|
144
|
-
3. Try restarting the tunnel
|
|
186
|
+
In CI, make sure `EVIDENT_AGENT_KEY` (or `EVIDENT_TOKEN`) is set.
|
|
145
187
|
|
|
146
|
-
|
|
188
|
+
### OpenCode isn't reachable
|
|
147
189
|
|
|
148
|
-
|
|
190
|
+
`evident run` starts `opencode serve` on the port from `--port` (default `4096`)
|
|
191
|
+
if it isn't already running. If you start it yourself, bind it to `127.0.0.1`
|
|
192
|
+
(loopback IPv4) on that port.
|
|
149
193
|
|
|
150
|
-
|
|
151
|
-
- Windows: `%APPDATA%\connected\`
|
|
194
|
+
### Tunnel disconnected
|
|
152
195
|
|
|
153
|
-
|
|
154
|
-
|
|
196
|
+
The CLI reconnects on its own. If problems persist, check your internet
|
|
197
|
+
connection and that OpenCode is still running, then restart `evident run`.
|
|
155
198
|
|
|
156
|
-
|
|
157
|
-
A trailing `/v1` is optional — it's added automatically.
|
|
158
|
-
- `--tunnel <url>` - Tunnel WebSocket URL (e.g. `ws://localhost:8787`).
|
|
199
|
+
## Configuration
|
|
159
200
|
|
|
160
|
-
|
|
201
|
+
Configuration and credentials are stored under:
|
|
161
202
|
|
|
162
|
-
- `
|
|
163
|
-
-
|
|
203
|
+
- `$XDG_CONFIG_HOME/evident/` if `XDG_CONFIG_HOME` is set
|
|
204
|
+
- otherwise `~/.config/evident/`
|
|
164
205
|
|
|
165
206
|
## Development
|
|
166
207
|
|
|
@@ -171,11 +212,14 @@ pnpm install
|
|
|
171
212
|
# Build
|
|
172
213
|
pnpm build
|
|
173
214
|
|
|
174
|
-
# Run
|
|
175
|
-
pnpm
|
|
215
|
+
# Run from source
|
|
216
|
+
pnpm dev:run <command>
|
|
176
217
|
|
|
177
218
|
# Type check
|
|
178
219
|
pnpm typecheck
|
|
220
|
+
|
|
221
|
+
# Test
|
|
222
|
+
pnpm test
|
|
179
223
|
```
|
|
180
224
|
|
|
181
225
|
## License
|