agentsw 0.9.0 → 0.9.1

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 -30
  2. package/README.zh-CN.md +44 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,14 +18,14 @@ without touching the settings you hand-tuned.
18
18
  </div>
19
19
 
20
20
  ```console
21
- $ asw use vfing -m glm-5.3-flash
22
- switching to vfing (openai) · default model glm-5.3-flash
21
+ $ asw use myproxy -m glm-5.3-flash
22
+ switching to myproxy (openai) · default model glm-5.3-flash
23
23
 
24
24
  skip claude Claude Code does not support openai-protocol providers
25
25
  ok codex ~/.codex/config.toml, ~/.codex/auth.json
26
26
  backup: ~/.config/agentsw/backups/transaction-<unique>
27
27
  ok omp ~/.omp/agent/models.yml
28
- select in omp with: omp --model vfing/glm-5.3-flash
28
+ select in omp with: omp --model myproxy/glm-5.3-flash
29
29
  skip pi pi not detected (pass --apps pi to force)
30
30
  ok opencode ~/.config/opencode/opencode.json
31
31
  ok dsh ~/.dsh/settings.yaml, ~/.dsh/.credentials.yaml
@@ -73,35 +73,35 @@ when a portable home directory is desired.
73
73
  ## Quick start
74
74
 
75
75
  ```bash
76
- agentsw # no args: interactive menu (add, import, use, status, apps)
76
+ npx agentsw # no install needed — opens the interactive menu
77
+ agentsw # once installed globally; the short alias `asw` is identical
77
78
  ```
78
79
 
79
- The first run on an empty store offers to import the providers already configured in your
80
- agents, and asks for English or 简体中文. Prefer flags? The same flow, unattended:
80
+ **Run it with no arguments and you get a menu — that is the whole tool.** Every action lives
81
+ there: add a provider (auto-detect or manual setup), import the providers already configured in
82
+ your agents, switch provider and default model, re-sync, update a model list, configure model
83
+ metadata, rename or delete, install/upgrade an agent, change language. On the first run it asks
84
+ for English or 简体中文 and offers to adopt what your agents are already using.
81
85
 
82
- ```bash
83
- # add a provider and let it discover its own model list
84
- asw add -y --id vfing --protocol openai --openai-api responses \
85
- --base-url https://api.example.com/v1 --api-key sk-... --discover
86
+ Each menu action has a command equivalent for scripts, CI and headless machines — see
87
+ [Commands](#commands). Examples below are written as `asw`; without a global install, run them
88
+ as `npx agentsw <command>`.
86
89
 
87
- asw use vfing # point every detected agent at it
88
- asw use vfing --dry-run # ...or just show the diffs
89
- asw status # what each agent points at right now
90
- ```
90
+ One command that needs no menu — `asw status` prints what each agent currently points at:
91
91
 
92
92
  ```console
93
93
  $ asw status
94
94
  config: ~/.config/agentsw/config.json
95
- active provider: vfing
96
-
97
- APP FOUND PROTOCOLS CURRENT CONFIG
98
- --------- ----- ---------------- ------------------------------------ ---------------------------
99
- claude yes anthropic - ~/.claude/settings.json
100
- codex yes openai vfing · glm-5.3-flash ~/.codex/config.toml
101
- omp yes openai+anthropic providers: sub, sub-anthropic, vfing ~/.omp/agent/models.yml
102
- pi no openai+anthropic - ~/.pi/agent/models.json
103
- opencode yes openai+anthropic vfing/glm-5.3-flash ~/.config/opencode/opencode.json
104
- dsh yes openai+anthropic vfing · glm-5.3-flash ~/.dsh/settings.yaml
95
+ active provider: myproxy
96
+
97
+ APP FOUND PROTOCOLS CURRENT CONFIG
98
+ -------- ----- ---------------- -------------------------------------- --------------------------------
99
+ claude yes anthropic - ~/.claude/settings.json
100
+ codex yes openai myproxy · glm-5.3-flash ~/.codex/config.toml
101
+ omp yes openai+anthropic providers: sub, sub-anthropic, myproxy ~/.omp/agent/models.yml
102
+ pi no openai+anthropic - ~/.pi/agent/models.json
103
+ opencode yes openai+anthropic myproxy/glm-5.3-flash ~/.config/opencode/opencode.json
104
+ dsh yes openai+anthropic myproxy · glm-5.3-flash ~/.dsh/settings.yaml
105
105
  ```
106
106
 
107
107
  ## Supported apps
@@ -135,13 +135,14 @@ lists and source apps are unioned. Different protocols on the same host stay sep
135
135
 
136
136
  ```console
137
137
  $ asw import --all
138
+
138
139
  ID PROTOCOL BASE URL MODELS FROM KEY
139
140
  ------------- --------- -------------------------------------- ------ --------- ---
140
- any anthropic https://a-ocnfniawgw.cn-shanghai... 1 cc-switch yes
141
- sub openai https://new.vfing.de/v1 18 omp yes
142
- sub-anthropic anthropic https://new.vfing.de 18 omp yes
141
+ any anthropic https://a-long-reseller.example.com... 1 cc-switch yes
142
+ sub openai https://api.example.com/v1 18 omp yes
143
+ sub-anthropic anthropic https://api.example.com 18 omp yes
143
144
  zhipu-glm anthropic https://open.bigmodel.cn/api/anthropic 1 cc-switch yes
144
- imported sub · openai · https://new.vfing.de/v1 · 18 models [from omp]
145
+ imported sub · openai · https://api.example.com/v1 · 18 models [from omp]
145
146
  imported zhipu-glm · anthropic · https://open.bigmodel.cn/api/anthropic · 1 models [from cc-switch]
146
147
  ```
147
148
 
@@ -251,7 +252,7 @@ Import still skips already configured accounts.
251
252
  | `use <id>` | switch every detected agent; `-a codex,omp`, `-m <model>`, `--dry-run` |
252
253
  | `sync` | re-apply the active provider (after an agent update, say) |
253
254
  | `discover <id> [--sync]` | refresh the model list + metadata from `/v1/models` |
254
- | `models [query]` | search the models.dev catalog |
255
+ | `models [query]` | search the models.dev catalog (`-r` refresh the cache, `-l <n>` limit rows) |
255
256
  | `refresh [--provider <id>]` | refresh saved metadata and optionally configure Gateway; keep the model list |
256
257
  | `models --provider <id> --metadata` | inspect field sources, conflicts and reference pricing as JSON |
257
258
  | `prune <id>` / `remove <id> [--prune]` | remove from app configs / from the store |
@@ -259,7 +260,11 @@ Import still skips already configured accounts.
259
260
  | `apps` / `install <app>` / `upgrade` | agent version manager |
260
261
 
261
262
  ```bash
262
- asw use myproxy -a codex,omp -m glm-5.2
263
+ # unattended add: discover the provider's model list, then write it everywhere
264
+ asw add -y --id myproxy --protocol openai --openai-api responses \
265
+ --base-url https://api.example.com/v1 --api-key sk-... --discover
266
+ asw use myproxy # every detected agent
267
+ asw use myproxy -a codex,omp -m glm-5.2 # ...or only these, with another default model
263
268
  asw discover myproxy --sync
264
269
  asw remove myproxy --prune
265
270
  ```
@@ -268,6 +273,13 @@ New automatic IDs include the full hostname and protocol, e.g. `api-example-com-
268
273
  An explicit `--id` is retained, and syncing never renames an existing provider. Import
269
274
  deduplication compares endpoint, protocol, and credentials; different accounts remain separate.
270
275
 
276
+ A bare IP works the same way — every dot and colon becomes a dash, and the **port is not part
277
+ of the ID**, so `http://152.53.108.231:3456` becomes `152-53-108-231-openai`. Two ports on that
278
+ host therefore share a base ID and the second provider gets `-2` appended
279
+ (`152-53-108-231-openai-2`); pass `--id` to name them yourself. IPv6 hosts lose their brackets
280
+ and dashes (`https://[2001:db8::1]:8080` → `2001-db8-1-openai`), an IDN host uses its punycode
281
+ form, and a base URL that cannot be parsed falls back to `imported`.
282
+
271
283
  ```bash
272
284
  asw rename myproxy api-example-com-openai --dry-run
273
285
  asw rename myproxy api-example-com-openai
package/README.zh-CN.md CHANGED
@@ -18,14 +18,14 @@
18
18
  </div>
19
19
 
20
20
  ```console
21
- $ asw use vfing -m glm-5.3-flash
22
- switching to vfing (openai) · default model glm-5.3-flash
21
+ $ asw use myproxy -m glm-5.3-flash
22
+ switching to myproxy (openai) · default model glm-5.3-flash
23
23
 
24
24
  skip claude Claude Code does not support openai-protocol providers
25
25
  ok codex ~/.codex/config.toml, ~/.codex/auth.json
26
26
  backup: ~/.config/agentsw/backups/transaction-<unique>
27
27
  ok omp ~/.omp/agent/models.yml
28
- select in omp with: omp --model vfing/glm-5.3-flash
28
+ select in omp with: omp --model myproxy/glm-5.3-flash
29
29
  skip pi pi not detected (pass --apps pi to force)
30
30
  ok opencode ~/.config/opencode/opencode.json
31
31
  ok dsh ~/.dsh/settings.yaml, ~/.dsh/.credentials.yaml
@@ -71,35 +71,32 @@ npm install -g agentsw # 需要 Node >= 22.13,内置 SQLite 无需额外启
71
71
  ## 快速开始
72
72
 
73
73
  ```bash
74
- agentsw # 不带参数:交互菜单(添加、导入、切换、状态、应用管理)
74
+ npx agentsw # 免安装,直接打开交互菜单
75
+ agentsw # 全局安装后可用;短名 `asw` 完全等价
75
76
  ```
76
77
 
77
- 存储为空时,首次运行会询问是否导入各智能体里已配置的供应商,并让你选择
78
- English 或简体中文。想用参数跑?同样的流程,全自动:
78
+ **不带参数运行就是一个菜单——整个工具都在里面。** 添加供应商(自动识别或手动设置)、导入各智能体
79
+ 已有的供应商、切换供应商和默认模型、重新同步、更新模型列表、设置模型参数补充源、重命名或删除、
80
+ 安装/升级智能体、切换语言。首次运行会先问你要 English 还是简体中文,并提议接管你各智能体已经在用的配置。
79
81
 
80
- ```bash
81
- # 添加供应商,并让它自己发现模型列表
82
- asw add -y --id vfing --protocol openai --openai-api responses \
83
- --base-url https://api.example.com/v1 --api-key sk-... --discover
82
+ 菜单里的每项操作都有对应的命令,方便脚本、CI 和无头机器——见 [命令](#命令)。
83
+ 下文示例统一写作 `asw`;没有全局安装时,请改成 `npx agentsw <命令>`。
84
84
 
85
- asw use vfing # 把所有检测到的智能体指向它
86
- asw use vfing --dry-run # ……或者只看 diff
87
- asw status # 各智能体当前指向什么
88
- ```
85
+ 不用菜单也能看一眼——`asw status` 打印各智能体当前指向哪个供应商:
89
86
 
90
87
  ```console
91
88
  $ asw status
92
89
  config: ~/.config/agentsw/config.json
93
- active provider: vfing
94
-
95
- APP FOUND PROTOCOLS CURRENT CONFIG
96
- --------- ----- ---------------- ------------------------------------ ---------------------------
97
- claude yes anthropic - ~/.claude/settings.json
98
- codex yes openai vfing · glm-5.3-flash ~/.codex/config.toml
99
- omp yes openai+anthropic providers: sub, sub-anthropic, vfing ~/.omp/agent/models.yml
100
- pi no openai+anthropic - ~/.pi/agent/models.json
101
- opencode yes openai+anthropic vfing/glm-5.3-flash ~/.config/opencode/opencode.json
102
- dsh yes openai+anthropic vfing · glm-5.3-flash ~/.dsh/settings.yaml
90
+ active provider: myproxy
91
+
92
+ APP FOUND PROTOCOLS CURRENT CONFIG
93
+ -------- ----- ---------------- -------------------------------------- --------------------------------
94
+ claude yes anthropic - ~/.claude/settings.json
95
+ codex yes openai myproxy · glm-5.3-flash ~/.codex/config.toml
96
+ omp yes openai+anthropic providers: sub, sub-anthropic, myproxy ~/.omp/agent/models.yml
97
+ pi no openai+anthropic - ~/.pi/agent/models.json
98
+ opencode yes openai+anthropic myproxy/glm-5.3-flash ~/.config/opencode/opencode.json
99
+ dsh yes openai+anthropic myproxy · glm-5.3-flash ~/.dsh/settings.yaml
103
100
  ```
104
101
 
105
102
  ## 支持的应用
@@ -119,6 +116,11 @@ dsh yes openai+anthropic vfing · glm-5.3-flash ~/.ds
119
116
  未安装的应用会被跳过,而不是瞎猜。`--apps codex,omp` 只跑指定应用;
120
117
  对未检测到的应用显式传 `--apps` 可强制写入。
121
118
 
119
+ 交互菜单写配置前会问同一个问题:多选框第一行是**全部检测到的应用**,已检测到的排在前面,
120
+ 未检测到的会标注出来。上次的选择会被记住,所以菜单里的 `use`/`sync` 只会继续写你勾选的那几个。
121
+ 任何配置文件解析失败(JSON/YAML/TOML 非法)都会报出文件与位置,绝不回显出错那一行;
122
+ `--dry-run` 同样保留这些细节,而不是含糊带过。
123
+
122
124
  ## 导入你已有的配置
123
125
 
124
126
  `import` 读取每个智能体的配置**以及 cc-switch 的 SQLite 存储**(只读),解析内联或环境变量
@@ -127,13 +129,14 @@ dsh yes openai+anthropic vfing · glm-5.3-flash ~/.ds
127
129
 
128
130
  ```console
129
131
  $ asw import --all
132
+
130
133
  ID PROTOCOL BASE URL MODELS FROM KEY
131
134
  ------------- --------- -------------------------------------- ------ --------- ---
132
- any anthropic https://a-ocnfniawgw.cn-shanghai... 1 cc-switch yes
133
- sub openai https://new.vfing.de/v1 18 omp yes
134
- sub-anthropic anthropic https://new.vfing.de 18 omp yes
135
+ any anthropic https://a-long-reseller.example.com... 1 cc-switch yes
136
+ sub openai https://api.example.com/v1 18 omp yes
137
+ sub-anthropic anthropic https://api.example.com 18 omp yes
135
138
  zhipu-glm anthropic https://open.bigmodel.cn/api/anthropic 1 cc-switch yes
136
- imported sub · openai · https://new.vfing.de/v1 · 18 models [from omp]
139
+ imported sub · openai · https://api.example.com/v1 · 18 models [from omp]
137
140
  imported zhipu-glm · anthropic · https://open.bigmodel.cn/api/anthropic · 1 models [from cc-switch]
138
141
  ```
139
142
 
@@ -234,7 +237,7 @@ asw sync --provider myproxy
234
237
  | `use <id>` | 切换所有检测到的智能体;`-a codex,omp`、`-m <model>`、`--dry-run` |
235
238
  | `sync` | 重新应用当前供应商(比如某个智能体升级之后) |
236
239
  | `discover <id> [--sync]` | 从 `/v1/models` 刷新模型列表与元数据 |
237
- | `models [query]` | 搜索 models.dev 目录 |
240
+ | `models [query]` | 搜索 models.dev 目录(`-r` 强制刷新缓存,`-l <n>` 限制条数) |
238
241
  | `refresh [--provider <id>]` | 刷新已有模型参数,可设置 Gateway 补充源,不改变模型列表 |
239
242
  | `models --provider <id> --metadata` | 以 JSON 查看字段来源、冲突和参考价格 |
240
243
  | `prune <id>` / `remove <id> [--prune]` | 从各应用配置中清除 / 从存储中删除 |
@@ -242,7 +245,11 @@ asw sync --provider myproxy
242
245
  | `apps` / `install <app>` / `upgrade` | 智能体版本管理 |
243
246
 
244
247
  ```bash
245
- asw use myproxy -a codex,omp -m glm-5.2
248
+ # 无人值守:添加供应商并自动发现模型列表,然后写入所有智能体
249
+ asw add -y --id myproxy --protocol openai --openai-api responses \
250
+ --base-url https://api.example.com/v1 --api-key sk-... --discover
251
+ asw use myproxy # 所有检测到的智能体
252
+ asw use myproxy -a codex,omp -m glm-5.2 # ……或只写这几个,并换一个默认模型
246
253
  asw discover myproxy --sync
247
254
  asw remove myproxy --prune
248
255
  ```
@@ -251,6 +258,13 @@ asw remove myproxy --prune
251
258
  显式指定的 `--id` 会保留,同步不会自动重命名。导入去重会同时比较端点、协议和凭据,
252
259
  不同账号保持独立;同一账号的自定义名称优先于自动生成名称。
253
260
 
261
+ 纯 IP 的填写方式完全一样——域名里的每个点和冒号都变成短横线,**端口不属于 ID**:
262
+ `http://152.53.108.231:3456` 生成的 ID 是 `152-53-108-231-openai`。因此同一 IP 上的两个端口
263
+ 共用一个基础 ID,第二个供应商会自动带上 `-2`(`152-53-108-231-openai-2`);
264
+ 想区分请自己传 `--id`。IPv6 会去掉方括号并把冒号变短横线
265
+ (`https://[2001:db8::1]:8080` → `2001-db8-1-openai`),国际化域名使用 punycode,
266
+ 无法解析的 base URL 退回 `imported`。
267
+
254
268
  ```bash
255
269
  asw rename myproxy api-example-com-openai --dry-run
256
270
  asw rename myproxy api-example-com-openai
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentsw",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "CLI provider switcher for coding agents: manage OpenAI/Anthropic-protocol providers in one place and sync them, with models.dev metadata, into Claude Code, Codex, omp, pi, prime-agent, opencode, Hermes, WorkBuddy and DeepSeek Harness",
5
5
  "type": "module",
6
6
  "repository": {