@fastagent/cli 0.2.0 → 0.2.2

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 (3) hide show
  1. package/README.md +42 -0
  2. package/cli.js +299 -260
  3. package/package.json +1 -1
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,32 @@ 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
+
57
73
  ## IM Channel
58
74
 
59
75
  当前公开提供的内置 IM 通道是微信 `weixin`。
@@ -103,6 +119,19 @@ export FASTAGENT_BASE_URL=https://api.openai.com/v1
103
119
  export FASTAGENT_USER_AGENT=your-app-name
104
120
  ```
105
121
 
122
+ `FASTAGENT_API_TYPE` 当前支持这些值:
123
+
124
+ - `anthropic-messages`
125
+ - `openai-completions`
126
+ - `openai-responses`
127
+ - `google-generative-ai`
128
+
129
+ 如果不显式设置,会按 `FASTAGENT_PROVIDER` 推断:
130
+
131
+ - `anthropic` -> `anthropic-messages`
132
+ - `google` / `gemini` / `google-ai-studio` -> `google-generative-ai`
133
+ - 其他 provider 默认回落到 `openai-completions`
134
+
106
135
  ### 启动微信服务
107
136
 
108
137
  ```bash
@@ -127,6 +156,19 @@ fastagent --channel weixin --sandbox remote --sandbox-url http://127.0.0.1:8788
127
156
  - 单独安装 `@fastagent/sandbox-runtime`,让包提供 `fastagent-sandbox`
128
157
  - 让 `fastagent-sandbox` 已经存在于 PATH 中
129
158
 
159
+ 你也可以先运行:
160
+
161
+ ```bash
162
+ fastagent doctor
163
+ fastagent doctor --config ./fastagent.config.json
164
+ ```
165
+
166
+ 当前 `doctor` 会按下面的顺序检查 local sandbox launcher discoverability:
167
+
168
+ - 不带 `--config` 时:`FASTAGENT_SANDBOX_RUNTIME_BIN` -> PATH `fastagent-sandbox`
169
+ - 带 `--config <path>` 时:`config.sandbox.launcher` -> env -> PATH
170
+ - 若两者都没有,会直接提示 companion package / env 的修复方式
171
+
130
172
  ## 常见用例
131
173
 
132
174
  ```bash