frely-cli 0.7.1 → 0.8.4

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 (91) hide show
  1. package/README.md +25 -35
  2. package/README.zh-CN.md +25 -35
  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 +198 -210
  40. package/dist/agent-help.js +47 -62
  41. package/dist/agent-help.js.map +1 -1
  42. package/dist/cloud.d.ts +1 -1
  43. package/dist/cloud.js +6 -13
  44. package/dist/cloud.js.map +1 -1
  45. package/dist/device/protocol.d.ts +11 -2
  46. package/dist/device/protocol.js +18 -2
  47. package/dist/device/protocol.js.map +1 -1
  48. package/dist/device/relay-client.d.ts +10 -1
  49. package/dist/device/relay-client.js +38 -11
  50. package/dist/device/relay-client.js.map +1 -1
  51. package/dist/diagnostics.js +12 -4
  52. package/dist/diagnostics.js.map +1 -1
  53. package/dist/index.js +195 -141
  54. package/dist/index.js.map +1 -1
  55. package/dist/key-budget.js +2 -2
  56. package/dist/key-budget.js.map +1 -1
  57. package/dist/mcp-authorization.js +9 -7
  58. package/dist/mcp-authorization.js.map +1 -1
  59. package/dist/mcp-command.d.ts +12 -4
  60. package/dist/mcp-command.js +54 -48
  61. package/dist/mcp-command.js.map +1 -1
  62. package/dist/provider/state.d.ts +2 -0
  63. package/dist/provider/state.js +1 -0
  64. package/dist/provider/state.js.map +1 -1
  65. package/dist/runtime/mcp-lease.js +1 -1
  66. package/dist/runtime/mcp-lease.js.map +1 -1
  67. package/dist/runtime/mcp.d.ts +139 -0
  68. package/dist/runtime/mcp.js +30 -0
  69. package/dist/runtime/mcp.js.map +1 -1
  70. package/dist/runtime/relay-agent.d.ts +25 -0
  71. package/dist/runtime/relay-agent.js +63 -0
  72. package/dist/runtime/relay-agent.js.map +1 -0
  73. package/dist/runtime/relay-mcp.d.ts +3 -1
  74. package/dist/runtime/relay-mcp.js +6 -1
  75. package/dist/runtime/relay-mcp.js.map +1 -1
  76. package/dist/runtime/relay-session.d.ts +2 -2
  77. package/dist/runtime/relay-session.js +1 -1
  78. package/dist/runtime/relay-session.js.map +1 -1
  79. package/dist/runtime/sandbox.d.ts +2 -0
  80. package/dist/runtime/sandbox.js +13 -0
  81. package/dist/runtime/sandbox.js.map +1 -1
  82. package/dist/runtime/workspace-registry.js +1 -1
  83. package/dist/skill/access.d.ts +4 -2
  84. package/dist/skill/access.js +7 -3
  85. package/dist/skill/access.js.map +1 -1
  86. package/dist/upgrade/installation.js +1 -1
  87. package/dist/upgrade/installation.js.map +1 -1
  88. package/dist/workspace-command.d.ts +1 -1
  89. package/dist/workspace-command.js +2 -2
  90. package/dist/workspace-command.js.map +1 -1
  91. package/package.json +1 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@ Two optional features, each with its own setup and authorization:
12
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`.
13
13
 
14
14
  ```text
15
- 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
16
16
  Device MCP: install on target computer -> frely login -> frely mcp -> add MCP URL to client -> OAuth authorize
17
17
  ```
18
18
 
@@ -75,15 +75,9 @@ On the computer to control, enable file, shell and process access:
75
75
  frely mcp --workspace /path/to/project
76
76
  ```
77
77
 
78
- `frely login` requests a restricted account session through browser device authorization. `frely mcp` initializes a separate secure MCP key, requests browser approval for this device and workspace, and installs the user-level Device Relay service (macOS LaunchAgent, Linux systemd user unit, or Windows Task Scheduler). The default authorization is 90 days; `--days 1..180` selects a duration.
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.
79
79
 
80
- Print the URL to add to an MCP client:
81
-
82
- ```sh
83
- frely mcp url
84
- ```
85
-
86
- 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. 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.
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.
87
81
 
88
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.
89
83
 
@@ -95,14 +89,14 @@ claude mcp add --transport http frely-computer "<MCP_URL>"
95
89
 
96
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.
97
91
 
98
- Authorization lifecycle: `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. Manage your devices in Frely → **Device MCP** (`/user/account/connections`). A bare `frely mcp` uses the current directory.
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`).
99
93
 
100
94
  ### Invoke a Frely-hosted Agent
101
95
 
102
- Use a published Agent with account or restricted API-key access. To install it as a local trigger Skill:
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):
103
97
 
104
98
  ```sh
105
- frely skill install https://frely.cloud/api/public/virtual-models/<distribution-id> \
99
+ frely agent install <distribution-id> \
106
100
  --host pi \
107
101
  --scope global \
108
102
  --json
@@ -112,7 +106,7 @@ A Creator can also provide an existing model-scoped, quota-limited API key for a
112
106
 
113
107
  ```sh
114
108
  printf '%s' "$FRELY_AGENT_KEY" | \
115
- frely skill install https://frely.cloud/api/public/virtual-models/<distribution-id> \
109
+ frely agent install <distribution-id> \
116
110
  --host chatgpt \
117
111
  --scope global \
118
112
  --api-key-stdin \
@@ -125,9 +119,11 @@ The generated Skill calls the published Agent through Frely's model-scoped MCP e
125
119
 
126
120
  ```sh
127
121
  printf '%s' 'Your complete task' | \
128
- frely agent invoke '<distribution-id>' --input-stdin --json
122
+ frely agent run '<distribution-id>' --input-stdin --json
129
123
  ```
130
124
 
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.
126
+
131
127
  ## Local model sharing
132
128
 
133
129
  Publish a loopback OpenAI-compatible runtime as a Frely personal Provider. Ollama is the default driver:
@@ -150,19 +146,18 @@ Requirements: Frely login, one empty active personal Provider slot, loopback HTT
150
146
 
151
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.
152
148
 
153
- Provider inspection and recovery:
149
+ Provider inspection:
154
150
 
155
151
  ```sh
156
152
  frely provider list
157
- frely provider finalize <provider-id>
158
153
  ```
159
154
 
160
- `finalize` resumes CPA setup for a Provider left in a prepared state.
155
+ If setup stops after the Provider was prepared, run `frely provider share` again: it resumes that Provider instead of creating a new one.
161
156
 
162
157
  ## Update and diagnostics
163
158
 
164
159
  ```sh
165
- frely doctor # installation path, distribution, latest stable, local account/MCP/service state
160
+ frely doctor # signed-in account, installation path, distribution, latest stable, MCP/service state
166
161
  frely doctor -v # + config paths, runtime details, authorization expiry, last heartbeat, sanitized errors
167
162
  frely upgrade # updates the running installation in place
168
163
  ```
@@ -197,37 +192,32 @@ Storage, migration, service injection, release requirements and threat boundarie
197
192
  - Device Relay transport: subprotocol, connection grant, reconnection, fallback state machine: [docs/device-transport.md](docs/device-transport.md)
198
193
  - Relay OAuth 2.1 Authorization Code + PKCE, discovery and token endpoints: [docs/mcp-oauth-relay-contract.md](docs/mcp-oauth-relay-contract.md)
199
194
  - Cloud commands and authorization: [docs/cloud.md](docs/cloud.md)
200
- - Frely Network commands (unreleased): [docs/frely-network.md](docs/frely-network.md)
195
+ - Frely Network commands (preview, not listed in `frely --help`): [docs/frely-network.md](docs/frely-network.md)
201
196
 
202
- The public MCP URL is the canonical resource returned by Relay, for example `https://connect.frely.cloud/mcp/<device-id>`. Use `frely mcp url`; do not derive the URL from the control-plane hostname. The URL contains no bearer secret.
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.
203
198
 
204
199
  ## Commands
205
200
 
206
201
  ```text
207
202
  frely login [--relay <https-url>] [--no-browser]
208
203
  frely logout
209
- frely whoami
210
204
  frely doctor [-v] [--json]
211
205
  frely upgrade
212
- frely skill install <manifest-url> [--host chatgpt|codex|claude-code|pi|generic] [--scope global|project] [--api-key-stdin] [--json]
213
- frely skill status <distribution-id> [--json]
214
- frely skill remove <distribution-id> [--json]
215
- frely agent invoke <distribution-id> (--input <text>|--input-stdin) [--json]
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]
216
213
  frely provider share [ollama|openai-compatible] [--url <loopback-v1-url>] [--models <a,b>] [--slot <slot-id>] [--name <name>]
217
214
  frely provider list [--json]
218
- frely provider finalize <provider-id>
219
- frely mcp [--workspace <path>] [--days 1..180]
220
- frely mcp renew [--days 1..180]
221
- frely mcp url [--json]
222
- frely mcp serve [--workspace <path>]
223
- frely mcp service start|stop|uninstall
224
- frely mcp revoke
225
- frely mcp stdio [--workspace <path>]
215
+ frely cloud list|describe|call
226
216
  ```
227
217
 
228
- `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.
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.
229
219
 
230
- `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.
220
+ `frely logout` removes the account session, revokes Cloud authorization and attempts to stop the background service.
231
221
 
232
222
  ## Landing page
233
223
 
package/README.zh-CN.md CHANGED
@@ -12,7 +12,7 @@
12
12
  本仓库包含开源的 Frely 客户端与本地 MCP 运行时;托管的 Frely Relay 控制面是独立的服务依赖。不存在独立的 `friday-local` 项目,本地 MCP 执行属于 `frely-cli`。
13
13
 
14
14
  ```text
15
- Remote Agent Skill: 安装 -> frely login -> frely skill install -> frely agent invoke
15
+ Remote Agent Skill: 安装 -> frely login -> frely agent install -> frely agent run
16
16
  Device MCP: 在被控电脑安装 -> frely login -> frely mcp -> 客户端添加 MCP URL -> OAuth 授权
17
17
  ```
18
18
 
@@ -75,15 +75,9 @@ frely login
75
75
  frely mcp --workspace /path/to/project
76
76
  ```
77
77
 
78
- `frely login` 通过浏览器设备授权获取受限账号会话。`frely mcp` 初始化独立的 MCP 安全密钥、请求浏览器批准该设备与工作区,并安装用户级 Device Relay 服务(macOS LaunchAgent、Linux systemd 用户单元或 Windows 任务计划程序)。默认授权 90 天,`--days 1..180` 可选时长。
78
+ `frely login` 通过浏览器设备授权获取受限账号会话。首次运行 `frely mcp` 会初始化独立的 MCP 安全密钥、请求浏览器批准该设备与工作区(省略 `--workspace` 时为当前目录)、安装用户级 Device Relay 服务(macOS LaunchAgent、Linux systemd 用户单元或 Windows 任务计划程序),并打印 MCP URL。默认授权 90 天,`--days 1..180` 可选时长。
79
79
 
80
- 打印要添加到 MCP 客户端的 URL:
81
-
82
- ```sh
83
- frely mcp url
84
- ```
85
-
86
- 如果 MCP 尚未配置,`frely mcp url` 会自动执行等价的 `frely mcp setup --workspace ~`:请求浏览器批准家目录(默认 90 天),然后安装后台服务并打印 URL。请先运行 `frely login`。安装提示走 stderr,stdout 保持单一 URL(或 `--json` 时一个 JSON 对象);批准或安装失败则不打印 URL。
80
+ `frely mcp` 是幂等的:启用后再次运行只打印同一个 URL,需要地址时直接再运行即可。提示走 stderr,stdout 保持单一 URL(或 `--json` 时一个 JSON 对象);批准或安装失败则不打印 URL。要开放更多目录,用 `frely mcp workspace add <path>`;`frely mcp workspace` 列出所有目录。
87
81
 
88
82
  把打印的完整 URL 添加到支持 OAuth 的远程 MCP 客户端,选择 OAuth 并完成授权。保持电脑在线。验证首次连接:让客户端只列出所选工作区的顶层名称,不写文件、不跑 shell 命令——返回与目录一致的结果即连通。
89
83
 
@@ -95,14 +89,14 @@ claude mcp add --transport http frely-computer "<MCP_URL>"
95
89
 
96
90
  在 Claude Code 中打开 `/mcp` 完成 OAuth 授权。每台设备使用不同的服务器名。让 Agent 用 Frely 工具做远程工作;它自带的 shell 仍跑在调用端电脑。同一设备的客户端共享其工作区与托管进程。
97
91
 
98
- 授权生命周期:`frely mcp renew --days 180` 需要新的批准并轮换 MCP 执行密钥。MCP URL 始终绑定该设备。登录刷新、OAuth 刷新、重启与重复配置都不延长授权。在 Frely → **Device MCP**(`/user/account/connections`)管理你的设备。不带参数的 `frely mcp` 使用当前目录。
92
+ 授权生命周期:授权过期后,`frely mcp` 会请求新的批准并轮换 MCP 执行密钥;`frely mcp --days 180` 可提前续期。MCP URL 始终绑定该设备。登录刷新、OAuth 刷新与重启都不延长授权。`frely mcp stop|start` 暂停或恢复后台服务;`frely mcp remove` 撤销所有客户端的访问并卸载服务(本机有本地 Provider 时服务改为仅 Provider 模式继续运行)。在 Frely → **Device MCP**(`/user/account/connections`)管理你的设备。
99
93
 
100
94
  ### 调用 Frely 托管的 Agent
101
95
 
102
- 使用有账号或受限 API-key 访问权限的已发布 Agent。安装为本地触发 Skill:
96
+ 使用有账号或受限 API-key 访问权限的已发布 Agent。安装为本地触发 Skill(也可以用完整 manifest URL 代替 id):
103
97
 
104
98
  ```sh
105
- frely skill install https://frely.cloud/api/public/virtual-models/<distribution-id> \
99
+ frely agent install <distribution-id> \
106
100
  --host pi \
107
101
  --scope global \
108
102
  --json
@@ -112,7 +106,7 @@ Creator 也可以提供一个现成的模型级、限额 API key 用于赞助/
112
106
 
113
107
  ```sh
114
108
  printf '%s' "$FRELY_AGENT_KEY" | \
115
- frely skill install https://frely.cloud/api/public/virtual-models/<distribution-id> \
109
+ frely agent install <distribution-id> \
116
110
  --host chatgpt \
117
111
  --scope global \
118
112
  --api-key-stdin \
@@ -125,9 +119,11 @@ CLI 会用目标模型级 MCP `tools/list` 端点验证 key,存入安全凭证
125
119
 
126
120
  ```sh
127
121
  printf '%s' '你的完整任务' | \
128
- frely agent invoke '<distribution-id>' --input-stdin --json
122
+ frely agent run '<distribution-id>' --input-stdin --json
129
123
  ```
130
124
 
125
+ `frely agent status <distribution-id>` 查看已安装的 Skill,API-key 安装时同时显示该 Key 的预算。`frely agent remove <distribution-id>` 删除 Skill 及其保存的 key。
126
+
131
127
  ## 本地模型共享
132
128
 
133
129
  把回环(loopback)OpenAI 兼容运行时发布为 Frely 个人 Provider,Ollama 是默认驱动:
@@ -150,19 +146,18 @@ frely provider share openai-compatible \
150
146
 
151
147
  该命令创建服务端管理的 `openai-compatible` 个人 Provider,把本地端点存入仅属主可读的 CLI 状态,启动 Device Relay 服务,用设备 Ed25519 key 签署 Provider 凭证,配置 CPA 并启用声明的模型。现有 Frely Access Point 与 API-key 流程即可消费该 Provider。
152
148
 
153
- Provider 检查与恢复:
149
+ Provider 检查:
154
150
 
155
151
  ```sh
156
152
  frely provider list
157
- frely provider finalize <provider-id>
158
153
  ```
159
154
 
160
- `finalize` 为停留在 prepared 状态的 Provider 续跑 CPA 配置。
155
+ 如果 Provider 已准备但设置中途失败,再运行一次 `frely provider share` 即可:它会续完该 Provider,而不是新建一个。
161
156
 
162
157
  ## 升级与诊断
163
158
 
164
159
  ```sh
165
- frely doctor # 安装路径、发行形态、最新稳定版、本地账号/MCP/服务状态
160
+ frely doctor # 当前账号、安装路径、发行形态、最新稳定版、MCP/服务状态
166
161
  frely doctor -v # 另加配置路径、运行时细节、授权到期、最近心跳、脱敏错误
167
162
  frely upgrade # 原地升级当前正在运行的安装
168
163
  ```
@@ -197,37 +192,32 @@ MCP 密钥使用 AES-256-GCM 文件,主密钥存 macOS Keychain、Windows 凭
197
192
  - Device Relay 传输:子协议、连接 grant、重连、回退状态机:[docs/device-transport.md](docs/device-transport.md)
198
193
  - Relay OAuth 2.1 Authorization Code + PKCE、发现与 token 端点:[docs/mcp-oauth-relay-contract.md](docs/mcp-oauth-relay-contract.md)
199
194
  - Cloud 命令与授权:[docs/cloud.md](docs/cloud.md)
200
- - Frely Network 命令(未发布):[docs/frely-network.md](docs/frely-network.md)
195
+ - Frely Network 命令(预览,不在 `frely --help` 中列出):[docs/frely-network.md](docs/frely-network.md)
201
196
 
202
- 公网 MCP URL 是 Relay 返回的规范资源,例如 `https://connect.frely.cloud/mcp/<device-id>`。请使用 `frely mcp url`,不要从控制面域名推导。URL 不含 bearer secret。
197
+ 公网 MCP URL 是 Relay 返回的规范资源,例如 `https://connect.frely.cloud/mcp/<device-id>`。请使用 `frely mcp` 输出的地址,不要从控制面域名推导。URL 不含 bearer secret。
203
198
 
204
199
  ## 命令
205
200
 
206
201
  ```text
207
202
  frely login [--relay <https-url>] [--no-browser]
208
203
  frely logout
209
- frely whoami
210
204
  frely doctor [-v] [--json]
211
205
  frely upgrade
212
- frely skill install <manifest-url> [--host chatgpt|codex|claude-code|pi|generic] [--scope global|project] [--api-key-stdin] [--json]
213
- frely skill status <distribution-id> [--json]
214
- frely skill remove <distribution-id> [--json]
215
- frely agent invoke <distribution-id> (--input <text>|--input-stdin) [--json]
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]
216
213
  frely provider share [ollama|openai-compatible] [--url <loopback-v1-url>] [--models <a,b>] [--slot <slot-id>] [--name <name>]
217
214
  frely provider list [--json]
218
- frely provider finalize <provider-id>
219
- frely mcp [--workspace <path>] [--days 1..180]
220
- frely mcp renew [--days 1..180]
221
- frely mcp url [--json]
222
- frely mcp serve [--workspace <path>]
223
- frely mcp service start|stop|uninstall
224
- frely mcp revoke
225
- frely mcp stdio [--workspace <path>]
215
+ frely cloud list|describe|call
226
216
  ```
227
217
 
228
- `frely mcp serve` 是 Device Relay 客户端的前台形式。远程执行需要已批准的工作区与 MCP 租约;只有 Provider 的连接不开启 MCP。
218
+ 以下命令不在 `frely --help` 中列出,但在 `frely help --agent --json` 中:`frely mcp stdio [--workspace <path>]` 通过 stdio 为本地 MCP 客户端提供工具;`frely mcp serve` 是后台服务运行的前台 Device Relay 客户端;`frely network` 是 Network 预览。
229
219
 
230
- `frely logout` 删除账号会话并尝试停止后台服务。`frely mcp revoke` 撤销 MCP 租约并删除其安全凭证;保留 Provider 设备与服务。
220
+ `frely logout` 删除账号会话、撤销 Cloud 授权并尝试停止后台服务。
231
221
 
232
222
  ## 落地页
233
223
 
@@ -0,0 +1,77 @@
1
+ import { type DiagnosticLog } from "../runtime/diagnostics.js";
2
+ import { AgentHostSupervisor, type HostRequest } from "./supervisor.js";
3
+ import { AgentStoreError, type AgentTaskRecord, type AgentTaskSource, TaskStore, type StoredAgentEvent } from "./task-store.js";
4
+ import { type AgentHostTaskEvent } from "./protocol.js";
5
+ import { branchNameForTask } from "./worktrees.js";
6
+ export declare class AgentServiceError extends Error {
7
+ readonly code: AgentServiceErrorCode;
8
+ constructor(code: AgentServiceErrorCode, message?: string);
9
+ }
10
+ export type AgentServiceErrorCode = "invalid_args" | "task_not_found" | "workspace_not_git_repo" | "workspace_dirty" | "too_many_tasks" | "rate_limited" | "invalid_state" | "budget_exceeded" | "remote_control_disabled" | "app_not_installed" | "host_unavailable" | "internal";
11
+ export type AgentRuntimeConfig = {
12
+ schemaVersion: 1;
13
+ remoteControlEnabled: boolean;
14
+ defaultMaxCostUsd: number;
15
+ maxCostUsdLimit: number;
16
+ maxConcurrentTasks: number;
17
+ };
18
+ export declare const DEFAULT_AGENT_CONFIG: AgentRuntimeConfig;
19
+ export declare function loadAgentConfig(env?: NodeJS.ProcessEnv): Promise<AgentRuntimeConfig>;
20
+ export declare function saveAgentConfig(config: AgentRuntimeConfig, env?: NodeJS.ProcessEnv): Promise<void>;
21
+ export type StartTaskInput = {
22
+ workspace: string;
23
+ goal: string;
24
+ model?: string;
25
+ maxCostUsd?: number;
26
+ source: AgentTaskSource;
27
+ };
28
+ export declare class AgentService {
29
+ private readonly deps;
30
+ private readonly executors;
31
+ private readonly scheduler;
32
+ private credentialsSent;
33
+ private budgetCancels;
34
+ private _supervisor;
35
+ constructor(deps: {
36
+ store: TaskStore;
37
+ resolveSupervisor: () => AgentHostSupervisor;
38
+ modelCredentials?: () => {
39
+ apiKey: string;
40
+ baseUrl: string;
41
+ model: string;
42
+ } | null;
43
+ config?: () => Promise<AgentRuntimeConfig>;
44
+ log?: DiagnosticLog;
45
+ });
46
+ supervisor(): AgentHostSupervisor;
47
+ startTask(input: StartTaskInput): Promise<AgentTaskRecord>;
48
+ listTasks(workspace?: string): Promise<AgentTaskRecord[]>;
49
+ getTask(id: string): Promise<AgentTaskRecord>;
50
+ getEvents(id: string, cursor?: number): Promise<{
51
+ events: StoredAgentEvent[];
52
+ nextCursor: number | null;
53
+ }>;
54
+ sendMessage(id: string, message: string): Promise<void>;
55
+ cancelTask(id: string): Promise<AgentTaskRecord>;
56
+ private settleCancelled;
57
+ getDiff(id: string, path?: string): Promise<{
58
+ diff: string;
59
+ truncated: boolean;
60
+ }>;
61
+ requestMerge(id: string, note?: string): Promise<AgentTaskRecord>;
62
+ approveMerge(id: string, approvedBy: "gui" | "web"): Promise<AgentTaskRecord>;
63
+ discardTask(id: string): Promise<AgentTaskRecord>;
64
+ stopHost(): Promise<void>;
65
+ status(): {
66
+ host: ReturnType<AgentHostSupervisor["status"]>;
67
+ };
68
+ private ensureHostWithCredentials;
69
+ private debug;
70
+ private eventsQueue;
71
+ readonly onTaskEvent: (taskId: string, event: AgentHostTaskEvent) => void;
72
+ private handleTaskEvent;
73
+ readonly onHostLost: (error?: Error) => void;
74
+ private failRunningTasks;
75
+ readonly onToolRequest: (request: HostRequest, args: Record<string, unknown>, taskId: string) => Promise<unknown>;
76
+ }
77
+ export { TaskStore, AgentStoreError, branchNameForTask };