frely-cli 0.6.10 → 0.8.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.
Files changed (104) hide show
  1. package/README.md +97 -293
  2. package/README.zh-CN.md +230 -0
  3. package/dist/agent/agent-service.d.ts +77 -0
  4. package/dist/agent/agent-service.js +348 -0
  5. package/dist/agent/agent-service.js.map +1 -0
  6. package/dist/agent/app-install.d.ts +49 -0
  7. package/dist/agent/app-install.js +133 -0
  8. package/dist/agent/app-install.js.map +1 -0
  9. package/dist/agent/app-key.d.ts +14 -0
  10. package/dist/agent/app-key.js +46 -0
  11. package/dist/agent/app-key.js.map +1 -0
  12. package/dist/agent/compose.d.ts +23 -0
  13. package/dist/agent/compose.js +42 -0
  14. package/dist/agent/compose.js.map +1 -0
  15. package/dist/agent/ops-server.d.ts +18 -0
  16. package/dist/agent/ops-server.js +175 -0
  17. package/dist/agent/ops-server.js.map +1 -0
  18. package/dist/agent/ops-stdio.d.ts +5 -0
  19. package/dist/agent/ops-stdio.js +47 -0
  20. package/dist/agent/ops-stdio.js.map +1 -0
  21. package/dist/agent/ops.d.ts +25 -0
  22. package/dist/agent/ops.js +82 -0
  23. package/dist/agent/ops.js.map +1 -0
  24. package/dist/agent/protocol.d.ts +72 -0
  25. package/dist/agent/protocol.js +195 -0
  26. package/dist/agent/protocol.js.map +1 -0
  27. package/dist/agent/supervisor.d.ts +80 -0
  28. package/dist/agent/supervisor.js +278 -0
  29. package/dist/agent/supervisor.js.map +1 -0
  30. package/dist/agent/task-store.d.ts +82 -0
  31. package/dist/agent/task-store.js +220 -0
  32. package/dist/agent/task-store.js.map +1 -0
  33. package/dist/agent/tool-executor.d.ts +28 -0
  34. package/dist/agent/tool-executor.js +113 -0
  35. package/dist/agent/tool-executor.js.map +1 -0
  36. package/dist/agent/worktrees.d.ts +35 -0
  37. package/dist/agent/worktrees.js +143 -0
  38. package/dist/agent/worktrees.js.map +1 -0
  39. package/dist/agent-help.d.ts +200 -176
  40. package/dist/agent-help.js +65 -32
  41. package/dist/agent-help.js.map +1 -1
  42. package/dist/auth.d.ts +3 -0
  43. package/dist/auth.js +52 -14
  44. package/dist/auth.js.map +1 -1
  45. package/dist/cloud.d.ts +1 -1
  46. package/dist/cloud.js +6 -13
  47. package/dist/cloud.js.map +1 -1
  48. package/dist/device/protocol.d.ts +11 -2
  49. package/dist/device/protocol.js +18 -2
  50. package/dist/device/protocol.js.map +1 -1
  51. package/dist/device/relay-client.d.ts +19 -2
  52. package/dist/device/relay-client.js +65 -13
  53. package/dist/device/relay-client.js.map +1 -1
  54. package/dist/diagnostics.js +12 -4
  55. package/dist/diagnostics.js.map +1 -1
  56. package/dist/index.js +203 -173
  57. package/dist/index.js.map +1 -1
  58. package/dist/key-budget.js +2 -2
  59. package/dist/key-budget.js.map +1 -1
  60. package/dist/mcp-authorization.js +9 -7
  61. package/dist/mcp-authorization.js.map +1 -1
  62. package/dist/mcp-command.d.ts +12 -4
  63. package/dist/mcp-command.js +54 -25
  64. package/dist/mcp-command.js.map +1 -1
  65. package/dist/provider/state.d.ts +2 -0
  66. package/dist/provider/state.js +1 -0
  67. package/dist/provider/state.js.map +1 -1
  68. package/dist/runtime/mcp-lease.js +1 -1
  69. package/dist/runtime/mcp-lease.js.map +1 -1
  70. package/dist/runtime/mcp.d.ts +139 -0
  71. package/dist/runtime/mcp.js +88 -29
  72. package/dist/runtime/mcp.js.map +1 -1
  73. package/dist/runtime/process-manager.d.ts +1 -1
  74. package/dist/runtime/process-manager.js +4 -2
  75. package/dist/runtime/process-manager.js.map +1 -1
  76. package/dist/runtime/relay-agent.d.ts +25 -0
  77. package/dist/runtime/relay-agent.js +63 -0
  78. package/dist/runtime/relay-agent.js.map +1 -0
  79. package/dist/runtime/relay-mcp.d.ts +5 -2
  80. package/dist/runtime/relay-mcp.js +6 -1
  81. package/dist/runtime/relay-mcp.js.map +1 -1
  82. package/dist/runtime/relay-session.d.ts +47 -0
  83. package/dist/runtime/relay-session.js +56 -0
  84. package/dist/runtime/relay-session.js.map +1 -0
  85. package/dist/runtime/sandbox.d.ts +16 -0
  86. package/dist/runtime/sandbox.js +149 -0
  87. package/dist/runtime/sandbox.js.map +1 -0
  88. package/dist/runtime/workspace-registry.d.ts +5 -0
  89. package/dist/runtime/workspace-registry.js +87 -0
  90. package/dist/runtime/workspace-registry.js.map +1 -0
  91. package/dist/runtime/workspace-router.d.ts +5 -0
  92. package/dist/runtime/workspace-router.js +32 -0
  93. package/dist/runtime/workspace-router.js.map +1 -0
  94. package/dist/runtime/workspace.js +3 -1
  95. package/dist/runtime/workspace.js.map +1 -1
  96. package/dist/skill/access.d.ts +4 -2
  97. package/dist/skill/access.js +7 -3
  98. package/dist/skill/access.js.map +1 -1
  99. package/dist/upgrade/installation.js +1 -1
  100. package/dist/upgrade/installation.js.map +1 -1
  101. package/dist/workspace-command.d.ts +8 -0
  102. package/dist/workspace-command.js +36 -0
  103. package/dist/workspace-command.js.map +1 -0
  104. package/package.json +2 -1
package/README.md CHANGED
@@ -1,114 +1,44 @@
1
1
  # frely-cli
2
2
 
3
- 设备 MCP 的产品定义与通用客户端接入见 [`docs/device-mcp.md`](docs/device-mcp.md)。
3
+ [English](README.md) · [简体中文](README.zh-CN.md)
4
4
 
5
- `frely-cli` includes FrelyMCP: let agents access your device from any location. Browser agents and command-line agents such as Codex and Claude Code use MCP to access the files, commands and processes on the computer you authorize. Invoking Frely-hosted Agents and sharing local model Providers are optional CLI features with their own setup and authorization.
5
+ `frely-cli` turns the computer you choose into a secure remote device that AI agents can operate. Browser agents (ChatGPT, Codex) and command-line agents (Claude Code, pi) connect through Model Context Protocol (MCP) and access the files, commands and processes inside the workspace you authorize — from anywhere.
6
6
 
7
- **Release boundary (checked 2026-09-17):** npm `frely-cli@latest` resolves to
8
- `0.6.2`. The published tarball includes device MCP, Provider commands,
9
- `frely skill install` and `frely agent invoke`. Agent examples below apply to that
10
- release. Package contents establish command availability; service deployment,
11
- account or API-key access and client connections need their own verification.
7
+ Two optional features, each with its own setup and authorization:
8
+
9
+ - **Remote Agent Skill** — install a published Frely Agent as a local trigger Skill and invoke it from automation.
10
+ - **Local model sharing** — publish a local Ollama / OpenAI-compatible runtime as your personal Frely Provider.
11
+
12
+ This repository contains the open-source Frely client and local MCP runtime. The hosted Frely Relay control plane remains a separate service dependency. There is no separate `friday-local` project; local MCP execution belongs to `frely-cli`.
12
13
 
13
14
  ```text
14
- Remote Agent Skill: install -> frely login -> frely skill install -> frely agent invoke
15
+ Remote Agent Skill: install -> frely login -> frely agent install -> frely agent run
15
16
  Device MCP: install on target computer -> frely login -> frely mcp -> add MCP URL to client -> OAuth authorize
16
17
  ```
17
18
 
18
- `frely skill install` installs a local trigger Skill. It does not install a model or change the user's current model Provider/Base URL. `frely mcp` provisions local file, shell, process, and workspace execution; consuming a remote Frely Agent does not require that local execution authorization.
19
-
20
- There is no separate `friday-local` project. Local MCP execution belongs to `frely-cli`.
21
-
22
- This repository contains the open-source Frely client and local MCP runtime.
23
- The hosted Friday Relay control plane remains a separate service dependency.
24
- See [`CONTRIBUTING.md`](CONTRIBUTING.md) for development guidance and
25
- [`SECURITY.md`](SECURITY.md) for private vulnerability reporting.
26
-
27
- ## Landing page
28
-
29
- The open-source CLI landing page lives in [`site/`](site/README.md), alongside
30
- the CLI under the same Apache-2.0 license and trademark policy. It is prepared
31
- for `cli.frely.cloud` and deploys independently as a static site. Website assets
32
- are excluded from the npm package.
19
+ ## Install
33
20
 
34
- ## Quick install
35
-
36
- After the standalone artifacts and installer are released, Frely can serve `install.sh` as:
21
+ The standalone installers select the platform executable, verify a SHA-256 checksum and install into the user directory. They do not require Node.js, npm or a keyring.
37
22
 
38
23
  ```sh
39
- curl -fsSL https://app.frely.cloud/install.sh | sh
24
+ # macOS / Linux
25
+ curl -fsSL https://frely.cloud/install.sh | sh
40
26
  ```
41
27
 
42
- The standalone installers (`install.sh` and `install.ps1`) select a platform executable, verify its SHA-256 checksum and install in the user directory. They do not require Node.js, npm or a keyring. The npm package requires Node.js 22 or newer. Tagged releases publish the npm package and standalone GitHub Release assets after cross-platform verification. See [credential and installation boundaries](docs/credential-storage.md).
43
-
44
- ## Install or update with npm
28
+ ```powershell
29
+ # Windows
30
+ irm https://github.com/FrelyHQ/frely-cli/releases/latest/download/install.ps1 | iex
31
+ ```
45
32
 
46
- To install or update to the latest release, use:
33
+ Or with npm (Node.js 22 or newer required):
47
34
 
48
35
  ```sh
49
36
  npm install --global --ignore-scripts frely-cli@latest
50
37
  ```
51
38
 
52
- To install or update to a specific release, replace `latest` with the release version. For example:
39
+ To install a specific release, replace `latest` with the version. Tagged releases publish the npm package and standalone GitHub Release assets after cross-platform verification.
53
40
 
54
- ```sh
55
- npm install --global frely-cli@0.3.6
56
- ```
57
-
58
- ## Update an existing installation
59
-
60
- ```sh
61
- frely doctor
62
- frely upgrade
63
- ```
64
-
65
- `doctor` reports the installation path, distribution and latest stable version.
66
- Release lookup has a timeout; offline version checks do not fail other diagnostics.
67
- Use `doctor --json` for structured results. `upgrade` has no options and never
68
- changes to a different installer, edits PATH or downgrades a newer installation.
69
-
70
- On macOS/Linux, `upgrade` updates the current standalone, npm-global or Bun-global
71
- installation. Standalone downloads are checksum-checked and tested before the
72
- installed executable is replaced. npm/Bun keep their original global directory
73
- and run with `--ignore-scripts`. Unknown installations, local links, source
74
- checkouts and temporary runners are left unchanged.
75
-
76
- A matching, running Device Relay service is paused for maintenance, restarted
77
- and checked after installation. Credentials, device identity, MCP URL, workspace
78
- and authorization expiry are preserved. Stopped or uninstalled services stay
79
- that way. If requests or managed processes are still running, the upgrade exits
80
- without stopping them. Finish those tasks and run the command in a local terminal;
81
- an upgrade invoked inside the MCP service being upgraded is itself active work.
82
- The connection may disconnect during the service restart. Installation, runtime
83
- version and Relay connectivity are reported separately.
84
-
85
- On Windows, `upgrade` prints a PowerShell command for the detected installation.
86
- Run it in a local terminal after finishing Frely tasks, then run `frely doctor`.
87
- The CLI does not launch an update helper or schedule a background replacement.
88
-
89
- For an already-running macOS/Linux service with automatic refresh support,
90
- updating the same installation with npm, Bun or the standalone installer also
91
- loads the new version without manual service commands. The service checks local
92
- installation files every five seconds, waits for two stable observations and
93
- checks that the new CLI starts. Active calls, managed processes and buffered
94
- responses defer the switch; calls remain available while work finishes.
95
- It uses the existing service supervisor and does not download updates itself.
96
- The MCP address, credentials, workspace and authorization expiry stay unchanged.
97
-
98
- A service that is stopped or not installed is never started by this watcher.
99
- Foreground sessions, source/link installs, changes of installation path and
100
- Windows replacement remain outside automatic refresh. A short reconnection
101
- window is possible; failed or outcome-unknown calls are not replayed.
102
-
103
- Versions predating the upgrade/refresh support require a one-time transition;
104
- see [service maintenance and legacy upgrades](docs/service-maintenance.md).
105
- Manual pause/resume commands remain in maintenance help.
106
-
107
- If more than one `frely` is installed, check the path shown by `doctor` before
108
- upgrading. The CLI does not remove other installations or choose one by changing
109
- shell configuration. See [the self-upgrade contract](docs/self-upgrade.md).
110
-
111
- ## Install from a local checkout
41
+ ### Install from a local checkout
112
42
 
113
43
  To install the current source checkout with Bun:
114
44
 
@@ -119,45 +49,54 @@ bun run build
119
49
  bun install --global "$PWD"
120
50
  ```
121
51
 
122
- Use the absolute `$PWD` path in the global install command. Bun installs the `frely` executable in its global bin directory. If the command is not found, add that directory to your `PATH`:
52
+ Use the absolute `$PWD` path in the global install command. If `frely` is not found, add the Bun global bin to your `PATH`:
123
53
 
124
54
  ```sh
125
55
  export PATH="$(bun pm bin -g):$PATH"
126
56
  ```
127
57
 
128
- This source revision has no keytar dependency or native npm build step. Dependency installation supports `npm ci --ignore-scripts` and `bun install --ignore-scripts`. Do not add a lifecycle-script trust exception for an old keytar installation.
129
-
130
- The repository uses npm as the canonical package manager for CI and releases
131
- and commits `package-lock.json`. Bun can be used for local development; keep
132
- the lockfiles synchronized when changing dependencies.
58
+ This source revision has no keytar dependency or native npm build step. Dependency installation supports `npm ci --ignore-scripts` and `bun install --ignore-scripts`. The repository uses npm as the canonical package manager for CI and releases and commits `package-lock.json`; Bun is for local development — keep the lockfiles synchronized when changing dependencies.
133
59
 
134
60
  ## First use
135
61
 
136
- Sign in once when the consumer uses their own Frely account:
62
+ Sign in once with the Frely account the consumer uses:
137
63
 
138
64
  ```sh
139
65
  frely login
140
66
  ```
141
67
 
142
- To choose another browser or Frely account, disable automatic browser opening:
68
+ The browser opens automatically. To choose another browser or Frely account, run `frely login --no-browser` and open the printed URL only in the browser signed in to the account you want to use. Visiting a device authorization URL while signed in can bind that code to the account before you click Approve — if the default browser already opened it with another account, press Ctrl+C, run `frely login --no-browser` again, and use the **new URL**. Signing in again or reusing the old URL does not switch its account. Keep `--relay <url>` when using a custom Relay. `FRELY_NO_BROWSER=1` remains supported.
69
+
70
+ ### Device MCP: control this computer from a remote client
71
+
72
+ On the computer to control, enable file, shell and process access:
143
73
 
144
74
  ```sh
145
- frely login --no-browser
75
+ frely mcp --workspace /path/to/project
146
76
  ```
147
77
 
148
- Open the printed URL only in the browser signed in to the account you want to use. Visiting a device authorization URL while signed in can bind that code to the account before you click Approve. If the default browser already opened it with another account, press Ctrl+C, run `frely login --no-browser` again, and use the **new URL**. Signing in again or reusing the old URL does not switch its account. Keep `--relay <url>` when using a custom Relay.
78
+ `frely login` requests a restricted account session through browser device authorization. The first `frely mcp` initializes a separate secure MCP key, requests browser approval for this device and workspace (the current directory when `--workspace` is omitted), installs the user-level Device Relay service (macOS LaunchAgent, Linux systemd user unit, or Windows Task Scheduler), and prints the MCP URL. The default authorization is 90 days; `--days 1..180` selects a duration.
149
79
 
150
- `FRELY_NO_BROWSER=1` remains supported for scripts and existing setups. `frely login --help` lists the available options.
80
+ `frely mcp` is idempotent: once enabled it only prints the same URL, so run it again whenever you need the address. Prompts go to stderr, so stdout remains a single URL or, with `--json`, a JSON object. No URL is printed if approval or service installation fails. To expose more directories, use `frely mcp workspace add <path>`; `frely mcp workspace` lists them.
151
81
 
152
- ### Invoke a Frely-hosted Agent
82
+ Add the exact printed URL to a remote MCP client with OAuth support, choose OAuth and complete authorization. Keep the computer online. Verify the first connection by asking the client to list the top-level names in your selected workspace, without writing files or running shell commands — a returned result that matches the folder confirms connectivity.
83
+
84
+ For Claude Code on the calling computer:
85
+
86
+ ```sh
87
+ claude mcp add --transport http frely-computer "<MCP_URL>"
88
+ ```
153
89
 
154
- The verified npm release `0.6.2` includes the Agent installation and invocation
155
- commands below. Use a published Agent with account or restricted API-key access.
90
+ Open `/mcp` in Claude Code to complete OAuth authorization. Use a distinct server name per device. Ask the Agent to use Frely tools for remote work; its built-in shell still runs on the calling computer. Clients of the same device share its workspace and managed processes.
156
91
 
157
- To install a published Frely Agent as a local trigger Skill:
92
+ Authorization lifecycle: when the authorization has expired, `frely mcp` asks for a new approval and rotates the MCP execution key; `frely mcp --days 180` renews early. The MCP URL remains bound to the device. Login refresh, OAuth refresh and restart do not extend authorization. `frely mcp stop|start` pauses or resumes the background service; `frely mcp remove` revokes access for every client and uninstalls the service (it keeps running provider-only when local Providers exist). Manage your devices in Frely → **Device MCP** (`/user/account/connections`).
93
+
94
+ ### Invoke a Frely-hosted Agent
95
+
96
+ Use a published Agent with account or restricted API-key access. To install it as a local trigger Skill (a full manifest URL is also accepted in place of the id):
158
97
 
159
98
  ```sh
160
- frely skill install https://app.frely.cloud/api/public/virtual-models/<distribution-id> \
99
+ frely agent install <distribution-id> \
161
100
  --host pi \
162
101
  --scope global \
163
102
  --json
@@ -167,7 +106,7 @@ A Creator can also provide an existing model-scoped, quota-limited API key for a
167
106
 
168
107
  ```sh
169
108
  printf '%s' "$FRELY_AGENT_KEY" | \
170
- frely skill install https://app.frely.cloud/api/public/virtual-models/<distribution-id> \
109
+ frely agent install <distribution-id> \
171
110
  --host chatgpt \
172
111
  --scope global \
173
112
  --api-key-stdin \
@@ -180,63 +119,19 @@ The generated Skill calls the published Agent through Frely's model-scoped MCP e
180
119
 
181
120
  ```sh
182
121
  printf '%s' 'Your complete task' | \
183
- frely agent invoke '<distribution-id>' --input-stdin --json
184
- ```
185
-
186
- ### Device MCP: control this computer from a remote client
187
-
188
- Frely CLI turns the target computer into a personal device MCP service. ChatGPT in a browser, Claude Code on another computer, and other remote HTTP MCP clients with OAuth use the same endpoint. Install and run Frely CLI on the computer to control; the calling computer only needs its MCP client.
189
-
190
- Enable file, shell and process access on the target computer:
191
-
192
- ```sh
193
- frely mcp --workspace /path/to/project
122
+ frely agent run '<distribution-id>' --input-stdin --json
194
123
  ```
195
124
 
196
- `frely login` requests a restricted account session through browser device authorization. Basic sessions use private plaintext files, not the OS credential store. Legacy account cookies do not migrate to this store. Basic features and Network commands do not initialize MCP credentials.
197
-
198
- `frely mcp` initializes a separate secure MCP key, requests browser approval for this device and workspace, and installs the user-level Device Relay service. The default authorization is 90 days; `--days 1..180` selects a duration. `frely mcp renew --days 180` requires a new approval and rotates the MCP execution key. The MCP URL remains bound to the device. Login refresh, OAuth refresh, restart and repeated setup do not extend authorization.
199
-
200
- Services use macOS LaunchAgents, Linux systemd user units, or Windows Task Scheduler for the logged-on user. Windows implementation needs native acceptance testing. Linux MCP secure storage can require Secret Service or an injected key; basic installation does not.
201
-
202
- You can print the URL again with:
203
-
204
- ```sh
205
- frely mcp url
206
- ```
207
-
208
- If MCP has not been configured, `frely mcp url` automatically runs the equivalent of `frely mcp setup --workspace ~`: it requests browser approval for your home directory (90 days by default), then installs the background service and prints the URL. Run `frely login` first. To select a project directory instead, run `frely mcp --workspace /path/to/project` before requesting the URL. Existing workspaces are preserved; expired authorization still requires `frely mcp renew`. Setup prompts go to stderr, so stdout remains a single URL or, with `--json`, a JSON object. No URL is printed if approval or service installation fails.
209
-
210
- Add the exact printed URL to a remote MCP client with OAuth support, choose
211
- OAuth and complete authorization. Keep the computer online. Ask the client to
212
- list the top-level names in your selected workspace, without writing files or
213
- running shell commands. A returned result that matches the folder verifies the
214
- first connection. `frely doctor` shows whether the running relay has a recent heartbeat; it does not complete client OAuth authorization or execute a tool through that client.
215
-
216
- Use `frely doctor` for a quick overview. If a call fails, run `frely doctor -v` for detailed diagnostics.
217
-
218
- For Claude Code on the calling computer, replace the placeholder with the URL printed on the target computer:
219
-
220
- ```sh
221
- claude mcp add --transport http frely-computer "<MCP_URL>"
222
- ```
223
-
224
- Open `/mcp` in Claude Code to complete OAuth authorization. Use a distinct server name per device. Ask the Agent to use Frely tools for remote work; its built-in shell still runs on the calling computer. Clients of the same device share its workspace and managed processes. Unknown-outcome writes must not be replayed.
225
-
226
- Manage your devices in Frely → **Device MCP** (`/user/account/connections`). The page shows execution permission and connection history, not a live online indicator. Client OAuth authorization and device execution permission have separate lifecycles.
227
-
228
- `frely mcp setup` and `frely mcp chatgpt` remain compatibility aliases. The latter prints the same connection details; it does not create a ChatGPT-specific service. A bare `frely mcp` uses the current directory.
125
+ `frely agent status <distribution-id>` shows the installed Skill and, for API-key installs, the Key's budget. `frely agent remove <distribution-id>` removes the Skill and its saved key.
229
126
 
230
127
  ## Local model sharing
231
128
 
232
- `frely-cli` can publish a loopback OpenAI-compatible runtime as a Frely personal Provider. Ollama is the default driver.
129
+ Publish a loopback OpenAI-compatible runtime as a Frely personal Provider. Ollama is the default driver:
233
130
 
234
131
  ```sh
235
132
  frely provider share ollama
236
133
  ```
237
134
 
238
- Default Ollama endpoint: `http://127.0.0.1:11434/v1`.
239
-
240
135
  Custom endpoint and model selection:
241
136
 
242
137
  ```sh
@@ -247,180 +142,89 @@ frely provider share openai-compatible \
247
142
  --name "Local GPU"
248
143
  ```
249
144
 
250
- Requirements: Frely login, one empty active personal Provider slot, loopback HTTP, OpenAI-compatible `/v1`. Model names cannot contain whitespace or `/`.
145
+ Requirements: Frely login, one empty active personal Provider slot, loopback HTTP, OpenAI-compatible `/v1` (default Ollama endpoint `http://127.0.0.1:11434/v1`). Model names cannot contain whitespace or `/`.
251
146
 
252
147
  The command creates a server-managed `openai-compatible` personal Provider, stores the local endpoint in owner-only CLI state, starts the Device Relay service, signs a Provider credential with the device Ed25519 key, configures CPA, and enables the declared models. Existing Frely Access Point and API-key flows consume the Provider.
253
148
 
254
- Provider inspection and recovery:
149
+ Provider inspection:
255
150
 
256
151
  ```sh
257
152
  frely provider list
258
- frely provider finalize <provider-id>
259
153
  ```
260
154
 
261
- `finalize` resumes CPA setup for a Provider left in a prepared state.
262
-
263
- ## Frely Cloud
264
-
265
- Use `frely cloud` to discover and call cloud business operations. See [Cloud commands and authorization](docs/cloud.md).
266
-
267
- ## Commands
268
-
269
- ```text
270
- frely login [--relay <https-url>] [--no-browser]
271
- frely logout
272
- frely whoami
273
- frely doctor [-v] [--json]
274
- frely upgrade
275
- frely skill install <manifest-url> [--host chatgpt|codex|claude-code|pi|generic] [--scope global|project] [--api-key-stdin] [--json]
276
- frely skill status <distribution-id> [--json]
277
- frely skill remove <distribution-id> [--json]
278
- frely agent invoke <distribution-id> (--input <text>|--input-stdin) [--json]
279
- frely provider share [ollama|openai-compatible] [--url <loopback-v1-url>] [--models <a,b>] [--slot <slot-id>] [--name <name>]
280
- frely provider list [--json]
281
- frely provider finalize <provider-id>
282
- frely mcp [--workspace <path>] [--days 1..180]
283
- frely mcp renew [--days 1..180]
284
- frely mcp url [--json]
285
- frely mcp serve [--workspace <path>]
286
- frely mcp service start|stop|uninstall
287
- frely mcp revoke
288
- frely mcp stdio [--workspace <path>]
289
- ```
290
-
291
- `frely mcp serve` is the foreground form of the Device Relay client. Remote execution requires the approved workspace and MCP lease. A Provider-only connection does not enable MCP.
292
-
293
- `frely logout` removes the account session and attempts to stop the background service. `frely mcp revoke` revokes the MCP lease and removes its secure credential; it retains the Provider device and service.
294
-
295
- ## MCP provisioning contract
296
-
297
- The CLI expects Frely Relay to expose these authenticated user endpoints:
298
-
299
- ```text
300
- POST /api/user/device-relay/enroll
301
- POST /api/user/device-relay/connect
302
- POST /api/user/device-relay/revoke
303
- ```
304
-
305
- Enrollment returns:
306
-
307
- ```json
308
- {
309
- "deviceId": "..."
310
- }
311
- ```
155
+ If setup stops after the Provider was prepared, run `frely provider share` again: it resumes that Provider instead of creating a new one.
312
156
 
313
- The public MCP URL is the canonical resource returned by Relay, for example
314
- `https://connect.frely.cloud/mcp/<device-id>`. Use `frely mcp url`; do not derive the URL
315
- from the control-plane hostname. The URL contains no bearer secret. Remote MCP clients use OAuth 2.1 Authorization Code + PKCE. OAuth access tokens bind to the exact MCP resource URL and do not extend the 90/180-day local execution authorization. Relay OAuth requirements are defined in [`docs/mcp-oauth-relay-contract.md`](docs/mcp-oauth-relay-contract.md).
157
+ ## Update and diagnostics
316
158
 
317
- A Device Relay connection request uses the enrolled Ed25519 device key and returns a short-lived connection grant:
318
-
319
- ```json
320
- {
321
- "websocketUrl": "wss://...",
322
- "accessToken": "short-lived-token",
323
- "expiresAt": "..."
324
- }
159
+ ```sh
160
+ frely doctor # signed-in account, installation path, distribution, latest stable, MCP/service state
161
+ frely doctor -v # + config paths, runtime details, authorization expiry, last heartbeat, sanitized errors
162
+ frely upgrade # updates the running installation in place
325
163
  ```
326
164
 
327
- The access token is sent only in the WebSocket `Authorization` header. It is not printed and is not persisted in the MCP URL.
165
+ `frely upgrade` never changes to a different installer, edits PATH or downgrades a newer installation. Standalone downloads are checksum-checked and tested before the installed executable is replaced. npm/Bun installations keep their original global directory. A matching, running Device Relay service is paused for maintenance, restarted and checked after installation; credentials, device identity, MCP URL, workspace and authorization expiry are preserved. On Windows, `upgrade` prints a PowerShell command for the detected installation to run in a local terminal.
328
166
 
329
- ## Device Relay
167
+ `frely doctor` is the single diagnostic entry point and never restarts the service. `Connected` means the matching account/device process has received a WebSocket heartbeat within 75 seconds and the MCP authorization and workspace match the running relay. Neither mode completes client OAuth authorization or executes a tool call through the client. `frely doctor --mcp` is the recommended way to check the protected credential and server state.
330
168
 
331
- The WebSocket subprotocol is `frely.device-relay.v1`. Requests use independent request IDs and a 64-request inflight window. Read-only local operations may overlap; writes and shell operations use the local fair scheduler. This avoids LocalMCP's device-wide `busy -> 429` behavior.
169
+ Full behavior: [the self-upgrade contract](docs/self-upgrade.md) and [service maintenance and legacy upgrades](docs/service-maintenance.md). If more than one `frely` is installed, check the path shown by `doctor` before upgrading.
332
170
 
333
- The client requests a fresh short-lived connection grant for every connection attempt and reconnects with bounded exponential backoff. A renewed Frely login is picked up by the next reconnect without reinstalling the service.
334
-
335
- ## Local MCP capabilities
171
+ ## Local execution boundaries
336
172
 
337
173
  The local MCP server exposes workspace inspection, file search/read/write/patch, directory create/delete/move, shell commands, and persistent process management.
338
174
 
339
- Filesystem tools are constrained to the selected workspace, reject symlink escapes, cap normal file reads/writes at 1 MiB, use no-follow reads, and use atomic replacement for writes. `run_command` and persistent process tools execute with the current OS user's permissions; the workspace only constrains their working directory and is not a shell sandbox.
175
+ Filesystem tools are constrained to the selected workspace, reject symlink escapes, cap normal file reads/writes at 1 MiB, use no-follow reads, and use atomic replacement for writes. `run_command` and persistent process tools execute with the current OS user's permissions; the workspace only constrains their working directory and is **not** a shell sandbox.
176
+
177
+ Read-only local operations may overlap; writes and shell operations use the local fair scheduler — this avoids device-wide `busy -> 429` behavior.
340
178
 
341
179
  ## Authentication and secrets
342
180
 
343
181
  Basic account and Network sessions use private plaintext files. They cannot approve MCP authorization or invoke account-management operations outside their explicit scopes. The Provider key is separate from the MCP execution key.
344
182
 
345
- MCP secrets use AES-256-GCM files with a master key in macOS Keychain, Windows Credential Manager or Linux Secret Service. Headless deployments can inject a 32-byte key through `FRELY_CREDENTIAL_KEY` and select `FRELY_CREDENTIAL_STORE=encrypted-file`. MCP has no plaintext fallback. Secure-store failure does not stop basic features.
346
-
347
- The stable MCP URL contains no credential. Remote clients hold OAuth credentials; the CLI holds the MCP execution private key. The Relay checks OAuth resource binding and the current MCP execution lease. Expiry blocks requests and queued work and cancels managed execution. It does not undo writes or create a sandbox around arbitrary shell programs.
348
-
349
- `frely doctor` is the single diagnostic entry point. It reports the installation
350
- path and distribution, checks the latest stable release with a deadline, and reads
351
- local account, MCP authorization, service and connection state. It does not access
352
- the MCP keyring in summary mode. An unavailable release source is informational;
353
- unconfigured account/MCP features remain optional.
354
-
355
- `frely doctor -v` (also `--verbose`) adds configuration paths, runtime details,
356
- service state, authorization expiry, last received heartbeat and sanitized last
357
- connection error. It also checks session storage, the account session and any
358
- configured MCP secure key/server authorization. Add `--json` to either view for
359
- structured output. Confirmed failures and unknown connectivity for a configured
360
- relay return a nonzero exit code.
183
+ MCP secrets use AES-256-GCM files with a master key in macOS Keychain, Windows Credential Manager or Linux Secret Service. Headless deployments can inject a 32-byte key through `FRELY_CREDENTIAL_KEY` and select `FRELY_CREDENTIAL_STORE=encrypted-file`. MCP has no plaintext fallback; secure-store failure does not stop basic features.
361
184
 
362
- A running process is not proof of connectivity. Connected means the matching
363
- account/device process has received a WebSocket heartbeat within 75 seconds.
364
- The MCP authorization and workspace must also match the running relay. Missing,
365
- stale or old-runtime observations are reported as unknown. Verbose diagnostics
366
- include the running CLI version, entry path and start time. Diagnostics never
367
- restart the service or open a second relay connection. Neither mode claims
368
- to test client OAuth or an end-to-end tool call.
185
+ The stable MCP URL contains no credential. Remote clients hold OAuth credentials; the CLI holds the MCP execution private key. The Relay checks OAuth resource binding and the current MCP execution lease. Expiry blocks requests and queued work and cancels managed execution; it does not undo writes or create a sandbox around arbitrary shell programs.
369
186
 
370
- Legacy `frely status`, `frely mcp status`, `frely mcp service status` and
371
- `frely doctor --mcp` remain compatible for existing scripts, but are no longer
372
- listed as recommended diagnostic entry points. The legacy status output shapes
373
- are unchanged; `doctor --mcp` requests verbose checks and requires MCP setup.
187
+ Storage, migration, service injection, release requirements and threat boundaries: [credential and installation boundaries](docs/credential-storage.md).
374
188
 
375
- Storage, migration, service injection, release requirements and threat boundaries: [`docs/credential-storage.md`](docs/credential-storage.md).
189
+ ## Architecture
376
190
 
377
- ## Current server dependency
191
+ - Product definition and generic client integration: [docs/device-mcp.md](docs/device-mcp.md)
192
+ - Device Relay transport: subprotocol, connection grant, reconnection, fallback state machine: [docs/device-transport.md](docs/device-transport.md)
193
+ - Relay OAuth 2.1 Authorization Code + PKCE, discovery and token endpoints: [docs/mcp-oauth-relay-contract.md](docs/mcp-oauth-relay-contract.md)
194
+ - Cloud commands and authorization: [docs/cloud.md](docs/cloud.md)
195
+ - Frely Network commands (preview, not listed in `frely --help`): [docs/frely-network.md](docs/frely-network.md)
378
196
 
379
- The CLI side of installation, account login, device enrollment, MCP URL discovery, background service lifecycle, Device Relay WebSocket transport, multiplexing, reconnection, local MCP execution, local model discovery, and loopback Provider forwarding is implemented here.
197
+ The public MCP URL is the canonical resource returned by Relay, for example `https://connect.frely.cloud/mcp/<device-id>`. Use `frely mcp`; do not derive the URL from the control-plane hostname. The URL contains no bearer secret.
380
198
 
381
- A Frely Relay deployment must implement the device provisioning endpoints, Device Relay WebSocket host, OAuth-protected MCP ingress, OAuth discovery/token endpoints, local Provider ingress, and personal Provider control flow. The MCP URL is a stable resource identifier. Local Provider credentials are device-key signatures stored by CPA. See [`docs/mcp-oauth-relay-contract.md`](docs/mcp-oauth-relay-contract.md).
382
-
383
- ## License and trademarks
384
-
385
- `frely-cli` is licensed under the Apache License 2.0; see [`LICENSE`](LICENSE).
386
- The Frely name, logos, and product names are not licensed as trademarks; see
387
- [`TRADEMARKS.md`](TRADEMARKS.md).
388
-
389
- ## Frely Network onboarding
390
-
391
- The Network commands are part of the unreleased 0.4.0 source version. The npm distribution requires Node.js 22 or newer; the standalone distribution includes its runtime. Package publication and server activation are separate release steps.
199
+ ## Commands
392
200
 
393
- ```sh
394
- frely network setup --host chatgpt --json
395
- frely network status --json
396
- frely network find --capability web3.address-risk --json
397
- frely network use --capability web3.address-risk \
398
- --input-json '{"address":"<EVM_ADDRESS>","chainId":"1"}' \
399
- --request-id '<REQUEST_UUID>' --json
400
- frely network logout --json
201
+ ```text
202
+ frely login [--relay <https-url>] [--no-browser]
203
+ frely logout
204
+ frely doctor [-v] [--json]
205
+ frely upgrade
206
+ frely mcp [--workspace <path>] [--days 1..180] [--json]
207
+ frely mcp workspace [add|remove <path>] [--json]
208
+ frely mcp stop|start|remove
209
+ frely agent install <distribution-id|manifest-url> [--host chatgpt|codex|claude-code|pi|generic] [--scope global|project] [--api-key-stdin] [--json]
210
+ frely agent run <distribution-id> (--input <text>|--input-stdin) [--json]
211
+ frely agent status (<distribution-id>|--api-key-stdin [--relay <url>]) [--json]
212
+ frely agent remove <distribution-id> [--json]
213
+ frely provider share [ollama|openai-compatible] [--url <loopback-v1-url>] [--models <a,b>] [--slot <slot-id>] [--name <name>]
214
+ frely provider list [--json]
215
+ frely cloud list|describe|call
401
216
  ```
402
217
 
403
- The examples contain placeholders. Host values are `chatgpt`, `claude-code`, `opencode` and `generic`. Setup returns a browser link and request code without waiting for a signature or requiring a TTY. The next status or capability call retrieves the authorization. ChatGPT requires an existing device-execution bridge and uses the instructions in its current conversation; setup does not add a ChatGPT connector or native Skill.
404
-
405
- `--network <HTTPS-origin>` selects a deployment. Credentials are scoped to that origin in the basic private-file store under `frely-network`; they do not share Frely account or device-relay credentials. Tokens and private device codes are excluded from command output. `logout` affects the Network session, not the existing FrelyMCP service. An unconfirmed remote revocation is reported as an error.
218
+ Not listed in `frely --help`, but in `frely help --agent --json`: `frely mcp stdio [--workspace <path>]` serves the tools over stdio for a local MCP client; `frely mcp serve` is the foreground Device Relay client the background service runs; `frely network` is the Network preview.
406
219
 
407
- Skill installation manages its own files and hash metadata. An unmanaged file, user edit or symlink causes a failure rather than a configuration overwrite. Installation paths are `.claude/skills/frely-network`, `.config/opencode/skills/frely-network` or `.agents/skills/frely-network` under the user home.
220
+ `frely logout` removes the account session, revokes Cloud authorization and attempts to stop the background service.
408
221
 
409
- The first address-risk profile requires target chain `1`; the wallet login chain does not choose the target. Service output contains source-backed risk signals and `scamProbability: null`, not a fabricated percentage. Calls use platform demo quota without granting wallet transfer permissions. Preserve the request UUID for retries; the CLI does not resend an ambiguous service call.
222
+ ## Landing page
410
223
 
411
- Source verification:
224
+ The open-source CLI landing page lives in [`site/`](site/README.md), alongside the CLI under the same Apache-2.0 license and trademark policy. It is prepared for `cli.frely.cloud` and deploys independently as a static site. Website assets are excluded from the npm package.
412
225
 
413
- ```sh
414
- npm ci
415
- npm run check
416
- npm test
417
- npm run build
418
- node dist/index.js network help --json
419
- ```
226
+ ## License and trademarks
420
227
 
421
- CLI unit tests use a fake credential store and temporary home directories. They do not verify the user's OS credential-store permissions or a deployed Network.
228
+ `frely-cli` is licensed under the Apache License 2.0; see [`LICENSE`](LICENSE). The Frely name, logos, and product names are not licensed as trademarks; see [`TRADEMARKS.md`](TRADEMARKS.md).
422
229
 
423
- The planned unified MCP entry will support wallet-funded capability use without
424
- a Frely account. Current device MCP authorization and demo Network calls do not
425
- implement that complete flow. See [Wallet access plan](docs/mcp-wallet-access-plan.md)
426
- for the accepted product boundary and remaining work.
230
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for development guidance and [`SECURITY.md`](SECURITY.md) for private vulnerability reporting.