@fastagent/cli 0.2.1 → 0.3.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/README.md CHANGED
@@ -36,6 +36,7 @@ npm install -g @fastagent/cli
36
36
 
37
37
  ```bash
38
38
  fastagent --help
39
+ fastagent doctor
39
40
  ```
40
41
 
41
42
  ## 可用命令
@@ -43,17 +44,64 @@ fastagent --help
43
44
  ```bash
44
45
  fastagent
45
46
  fastagent --channel weixin
47
+ fastagent --channel weixin --config ./fastagent.config.json
46
48
  fastagent --channel weixin --output jsonl
47
49
  fastagent --channel weixin --sandbox local
48
50
  fastagent --channel weixin --sandbox remote --sandbox-url http://127.0.0.1:8788
49
51
  fastagent config
50
52
  fastagent doctor
53
+ fastagent doctor --config ./fastagent.config.json
51
54
  fastagent skills add <source>
52
55
  fastagent skills list
53
56
  ```
54
57
 
55
58
  当前 `fastagent` 裸命令默认显示帮助信息;如果你想直接启动一个可工作的服务入口,优先从 IM 通道开始。
56
59
 
60
+ ## Runtime Config File
61
+
62
+ runtime 命令和 `doctor` 支持显式 JSON 配置文件:
63
+
64
+ ```bash
65
+ fastagent --channel weixin --config ./fastagent.config.json
66
+ fastagent doctor --config ./fastagent.config.json
67
+ ```
68
+
69
+ - 只有显式传入 `--config <path>` 时才会读取配置文件。
70
+ - 优先级固定为 `命令行参数 > 配置文件 > 环境变量`。
71
+ - `fastagent --config ...` 裸命令会报固定错误;`--config` 当前必须和 runtime 命令或 `doctor` 一起使用。
72
+ - `fastagent --channel weixin --config ...` 会读取 `gateway`、`sandbox`、`imGateway`;`fastagent doctor --config ...` 只诊断 `sandbox.launcher`
73
+ - `sandbox` 整段都是可选的;只有 remote sandbox 需要从配置文件注入地址/API key,或 local sandbox 需要自定义 launcher 时才需要填写
74
+ - `imGateway.channels.weixin.apiBaseUrl` 是可选项;不填时默认使用 `https://ilinkai.weixin.qq.com`
75
+ - npm 发布包会附带整个 `examples/` 目录;当前配置示例文件是 `examples/fastagent.config.example.json`
76
+
77
+ 示例配置:
78
+
79
+ ```json
80
+ {
81
+ "gateway": {
82
+ "provider": "openai",
83
+ "model": "gpt-5.4",
84
+ "apiType": "openai-responses",
85
+ "baseUrl": "https://api.openai.com/v1",
86
+ "userAgent": "fastagent-cli-example",
87
+ "apiKey": "<your-api-key>"
88
+ },
89
+ "sandbox": {
90
+ "remoteUrl": "http://127.0.0.1:8788",
91
+ "apiKey": "<sandbox-api-key>",
92
+ "launcher": {
93
+ "bin": "fastagent-sandbox"
94
+ }
95
+ },
96
+ "imGateway": {
97
+ "workspaceDir": "/abs/workspace",
98
+ "agentId": "agent-weixin-dev",
99
+ "dataDir": "/abs/fastagent",
100
+ "allowAllPermissions": true
101
+ }
102
+ }
103
+ ```
104
+
57
105
  ## IM Channel
58
106
 
59
107
  当前公开提供的内置 IM 通道是微信 `weixin`。
@@ -140,6 +188,19 @@ fastagent --channel weixin --sandbox remote --sandbox-url http://127.0.0.1:8788
140
188
  - 单独安装 `@fastagent/sandbox-runtime`,让包提供 `fastagent-sandbox`
141
189
  - 让 `fastagent-sandbox` 已经存在于 PATH 中
142
190
 
191
+ 你也可以先运行:
192
+
193
+ ```bash
194
+ fastagent doctor
195
+ fastagent doctor --config ./fastagent.config.json
196
+ ```
197
+
198
+ 当前 `doctor` 会按下面的顺序检查 local sandbox launcher discoverability:
199
+
200
+ - 不带 `--config` 时:`FASTAGENT_SANDBOX_RUNTIME_BIN` -> PATH `fastagent-sandbox`
201
+ - 带 `--config <path>` 时:`config.sandbox.launcher` -> env -> PATH
202
+ - 若两者都没有,会直接提示 companion package / env 的修复方式
203
+
143
204
  ## 常见用例
144
205
 
145
206
  ```bash