@agent-proxy/gateway 0.0.0-stage → 0.11.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.
- package/LICENSE +21 -0
- package/README.md +309 -2
- package/dist/index.js +10388 -0
- package/dist/ui/index.html +26 -0
- package/package.json +49 -4
- package/schemas/gateway-config.schema.json +174 -0
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-proxy/gateway",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.11.1",
|
|
4
|
+
"description": "Agent Proxy 的 Bun 网关与 CLI 业务应用。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agent-proxy": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"schemas",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "bun src/index.ts",
|
|
19
|
+
"build": "bun ../../scripts/build-gateway.ts",
|
|
20
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
21
|
+
"prepack": "bun ../../scripts/verify-package.ts ."
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@agent-proxy/agy": "0.11.1",
|
|
25
|
+
"@agent-proxy/codebuddy": "0.11.1",
|
|
26
|
+
"@agent-proxy/opencode-zen": "0.11.1",
|
|
27
|
+
"@agent-proxy/plugin-api": "0.11.1",
|
|
28
|
+
"@agent-proxy/qoder": "0.11.1",
|
|
29
|
+
"@agent-proxy/zcode": "0.11.1",
|
|
30
|
+
"bytes": "^3.1.2",
|
|
31
|
+
"i18next": "^26.4.2",
|
|
32
|
+
"react": "^19.2.0",
|
|
33
|
+
"react-dom": "^19.2.0",
|
|
34
|
+
"react-i18next": "^17.0.16"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@agent-proxy/models": "0.11.1"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"bun": ">=1.2.0"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/aceHubert/codex-cliproxy-gateway.git"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "affd71836c6cb82ec474edc5efa46146eb92398f"
|
|
51
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/aceHubert/codex-cliproxy-gateway/main/apps/gateway/schemas/gateway-config.schema.json",
|
|
4
|
+
"title": "codex-cliproxy gateway config",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"host",
|
|
8
|
+
"port",
|
|
9
|
+
"upstreamBaseUrl",
|
|
10
|
+
"configVersion"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"$schema": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"format": "uri"
|
|
16
|
+
},
|
|
17
|
+
"configVersion": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"minLength": 1
|
|
20
|
+
},
|
|
21
|
+
"host": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"minLength": 1
|
|
24
|
+
},
|
|
25
|
+
"port": {
|
|
26
|
+
"type": "integer",
|
|
27
|
+
"minimum": 1,
|
|
28
|
+
"maximum": 65535
|
|
29
|
+
},
|
|
30
|
+
"mountPath": {
|
|
31
|
+
"description": "已过时,挂载路径固定为 /v1;读取时忽略残留值,命令前置同步会移除该键。",
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^/",
|
|
34
|
+
"deprecated": true
|
|
35
|
+
},
|
|
36
|
+
"prefix": {
|
|
37
|
+
"description": "已过时,第三方模型前缀按上游类型派生(cliproxy/ 或 newapi/);读取时忽略残留值,命令前置同步会移除该键。",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"deprecated": true
|
|
40
|
+
},
|
|
41
|
+
"officialBaseUrl": {
|
|
42
|
+
"description": "已过时,官方上游固定为 https://chatgpt.com/backend-api/codex;读取时忽略残留值,命令前置同步会移除该键。",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "uri",
|
|
45
|
+
"deprecated": true
|
|
46
|
+
},
|
|
47
|
+
"upstreamBaseUrl": {
|
|
48
|
+
"description": "第三方上游 URL(CLIProxyAPI 或 OpenAI 兼容的 new-api)。",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"format": "uri"
|
|
51
|
+
},
|
|
52
|
+
"cliproxyBaseUrl": {
|
|
53
|
+
"description": "已过时,由 upstreamBaseUrl 取代;命令前置同步会自动把旧值迁移为 upstreamBaseUrl 并移除该键。",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"format": "uri",
|
|
56
|
+
"deprecated": true
|
|
57
|
+
},
|
|
58
|
+
"upstreamType": {
|
|
59
|
+
"description": "第三方上游类型:cliproxy 直接消费其 Codex 目录;newapi 从 OpenAI /models 列表本地合成目录。缺省视为 cliproxy。",
|
|
60
|
+
"type": "string",
|
|
61
|
+
"enum": [
|
|
62
|
+
"cliproxy",
|
|
63
|
+
"newapi"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"upstream_type": {
|
|
67
|
+
"description": "已过时,由 upstreamType 取代;命令前置同步会自动迁移并移除该键。",
|
|
68
|
+
"type": "string",
|
|
69
|
+
"deprecated": true
|
|
70
|
+
},
|
|
71
|
+
"catalogPath": {
|
|
72
|
+
"description": "已过时,上游已选目录固定按上游类型落在运行主目录({cliproxy|newapi}-catalog.json);读取时忽略残留值,命令前置同步会移除该键。",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"minLength": 1,
|
|
75
|
+
"deprecated": true
|
|
76
|
+
},
|
|
77
|
+
"model_merge_json": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"format": "uri"
|
|
80
|
+
},
|
|
81
|
+
"selectedModels": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"minLength": 1
|
|
86
|
+
},
|
|
87
|
+
"uniqueItems": true
|
|
88
|
+
},
|
|
89
|
+
"excludedModels": {
|
|
90
|
+
"description": "排除模型规则:仅对本地兼容端生效——网关在所有适配器与上游目录合并后统一过滤 /models,命中模型的推理请求返回 404;上游 cliproxy/new-api 模型的可选性由 selectedModels(models --sync)管理,官方原生模型不参与排除。每条规则必须以确定的适配器前缀开始(zcode/、zcode-<plan>/、codebuddy-intl|cn/、workbuddy-intl|cn/、qoder-intl|cn/、agy/、opencode-zen/,含 codebuddy/、workbuddy/、qoder/ 旧前缀),另接受产品级家族通配 zcode*/、codebuddy-*/、workbuddy-*/、qoder-*/ 加模型名(各覆盖该产品的全部套餐/地域/旧前缀,Web 分组即保存此形态);通配只允许出现在前缀之后,大小写不敏感。整族形态(prefix/ 或 prefix/*)、裸 *、无/不完整前缀与作用域外规则会被写入路径拒绝(运行期对存量值宽松:整族仍被识别,作用域外规则被忽略,Web 分组保存会移除归不进分组的存量规则);Web UI 按兼容端分组编辑,前缀由网关保存时补全;默认空数组。",
|
|
91
|
+
"type": "array",
|
|
92
|
+
"items": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"minLength": 1
|
|
95
|
+
},
|
|
96
|
+
"uniqueItems": true,
|
|
97
|
+
"default": []
|
|
98
|
+
},
|
|
99
|
+
"requestLogging": {
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
"logDir": {
|
|
103
|
+
"description": "请求日志与调试转储目录;缺省时回退运行主目录(~/.agent-proxy-gateway,或环境变量 CODEX_CLIPROXY_HOME 指定的目录)下的 logs/。",
|
|
104
|
+
"type": "string",
|
|
105
|
+
"minLength": 1,
|
|
106
|
+
"deprecated": true
|
|
107
|
+
},
|
|
108
|
+
"maxRequestLogs": {
|
|
109
|
+
"description": "整个请求日志目录按修改时间保留的最新文件数,不按路由分组;正在写入的日志(如未结束的 WebSocket 会话文件)不参与裁剪;0 表示不限制。",
|
|
110
|
+
"type": "integer",
|
|
111
|
+
"minimum": 0
|
|
112
|
+
},
|
|
113
|
+
"maxGatewayLogBytes": {
|
|
114
|
+
"description": "网关进程日志 gateway.log 与 gateway.error.log 的最大字节数;超限时当前内容复制为时间戳备份(每个文件保留最新 5 个)并原地清空活跃文件,进程持有的句柄继续有效;设置上限同时约束 gateway.log 中配置审计的可追溯深度;0 表示不限制。",
|
|
115
|
+
"type": "integer",
|
|
116
|
+
"minimum": 0
|
|
117
|
+
},
|
|
118
|
+
"debug": {
|
|
119
|
+
"description": "是否开启调试转储:上游错误时把完整请求体落盘到日志目录(当前覆盖 agy 上游 400 的 agy-debug-400.json,含提示词,仅限本机排查)。与 requestLogging 互相独立;默认关闭。",
|
|
120
|
+
"type": "boolean",
|
|
121
|
+
"default": false
|
|
122
|
+
},
|
|
123
|
+
"upstreamOnly": {
|
|
124
|
+
"description": "未登录 ChatGPT、只将请求转发到上游,不使用本地授权账号配置模型。",
|
|
125
|
+
"type": "boolean"
|
|
126
|
+
},
|
|
127
|
+
"zcode": {
|
|
128
|
+
"description": "是否启用 ZCode;默认开启, 开启后自动发现 ZCode Desktop 登录。",
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"default": true
|
|
131
|
+
},
|
|
132
|
+
"codebuddy": {
|
|
133
|
+
"description": "是否启用 CodeBuddy/WorkBuddy;默认开启, 开启后自动发现 CodeBuddy/WorkBuddy CLI 登录。",
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"default": true
|
|
136
|
+
},
|
|
137
|
+
"codebuddyAccount": {
|
|
138
|
+
"description": "CodeBuddy/WorkBuddy 凭据选择:值为认证目录内的 .info 文件名时锁定该账号登录(文件缺失时运行期回退 auto,不改写配置);\"auto\" 或缺省按最近刷新的登录自动选取,并随客户端切换账号自动跟随。切换入口:codebuddy --switch。历史哨兵 \"default\" 读取时自动改写为 \"auto\"。",
|
|
139
|
+
"type": "string",
|
|
140
|
+
"pattern": "^(auto|[^/\\\\]+\\.info)$"
|
|
141
|
+
},
|
|
142
|
+
"codebuddyRegion": {
|
|
143
|
+
"description": "(deprecated) 已由 codebuddyAccount 取代;读取时旧值自动迁移为 codebuddyAccount=\"auto\",命令前置同步会移除该键。",
|
|
144
|
+
"type": "string",
|
|
145
|
+
"enum": [
|
|
146
|
+
"auto",
|
|
147
|
+
"cn",
|
|
148
|
+
"intl"
|
|
149
|
+
],
|
|
150
|
+
"deprecated": true
|
|
151
|
+
},
|
|
152
|
+
"qoder": {
|
|
153
|
+
"description": "是否启用 Qoder;默认开启,开启后自动发现 Qoder CLI/Desktop 登录。",
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"default": true
|
|
156
|
+
},
|
|
157
|
+
"agy": {
|
|
158
|
+
"description": "是否启用 Antigravity(agy);默认开启,开启后自动发现agy CLI(令牌由 agy 进程负责刷新,网关过期即失败不刷新)。",
|
|
159
|
+
"type": "boolean",
|
|
160
|
+
"default": true
|
|
161
|
+
},
|
|
162
|
+
"opencodeZen": {
|
|
163
|
+
"description": "是否启用 OpenCode Zen(opencode-zen/ 前缀)Chat Completions 入口;默认开启。经客户端指纹转发消费 Zen 免费模型(公共鉴权 Bearer public,可用环境变量 OPENCODE_API_KEY 覆盖)。",
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"default": true
|
|
166
|
+
},
|
|
167
|
+
"cpaOnly": {
|
|
168
|
+
"description": "已过时,由 upstreamOnly 取代;命令前置同步会自动迁移并移除该键。",
|
|
169
|
+
"type": "boolean",
|
|
170
|
+
"deprecated": true
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"additionalProperties": true
|
|
174
|
+
}
|