@meowo/aproxy 0.1.0 → 0.2.0-alpha.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/README.md CHANGED
@@ -10,15 +10,32 @@ the storm upstream; it only notices that the request took a little longer.
10
10
 
11
11
  ## Install
12
12
 
13
+ Two packages carry the same proxy and command line; install one of them (both
14
+ provide the `aproxy` command):
15
+
13
16
  ```sh
14
- npm install -g @meowo/aproxy
17
+ npm install -g @meowo/aproxy # with the desktop window (aproxy desktop)
18
+ npm install -g @meowo/aproxy-headless # without it: servers, containers
15
19
  ```
16
20
 
21
+ Stable versions install with the commands above. Pre-releases (alpha, beta, rc)
22
+ are published under the `next` tag, so ask for them explicitly:
23
+ `npm install -g @meowo/aproxy@next` or `npm install -g @meowo/aproxy-headless@next`.
24
+
17
25
  The right platform binary (windows x64/x86/arm64, linux x64/arm64 with glibc
18
26
  or musl, macOS arm64/x64) is installed automatically via
19
27
  `optionalDependencies` — no postinstall downloads, everything comes from the
20
28
  npm registry.
21
29
 
30
+ On Linux the desktop build links WebKitGTK: it needs WebKitGTK 2.40 or later
31
+ (`libwebkit2gtk-4.1-0` on Debian/Ubuntu) and glibc 2.34 or later, and without
32
+ them it cannot start at all — use `@meowo/aproxy-headless` there. On musl
33
+ systems (Alpine) both packages carry the same headless binary.
34
+
35
+ In the 0.2.0 pre-releases `aproxy desktop` is a preview: the window shows demo
36
+ data, not your running instances. Use `aproxy status` and `aproxy logs` for the
37
+ real state.
38
+
22
39
  ## Quick start
23
40
 
24
41
  ```sh
package/bin/aproxy.js CHANGED
@@ -9,19 +9,33 @@
9
9
  // 网络下载。本脚本运行时解析出平台子包内的二进制路径,spawn 并透传参数/
10
10
  // stdio/退出码。
11
11
  //
12
- // 包名自检测:wrapper 由主包 package.json 的 name 推导子包前缀与二进制名
13
- // (@meowo/aproxy → 子包 @meowo/aproxy-*、二进制 aproxy;@meowo/aproxy-format
14
- // → 同理)——一份脚本两组通用,改包名时无需同步此处。
12
+ // 包名自检测:wrapper 由主包 package.json 推导子包前缀(name 加 -)与二进制名(bin 的命令名)
13
+ // ——@meowo/aproxy → 子包 @meowo/aproxy-*、二进制 aproxy;@meowo/aproxy-headless →
14
+ // 子包 @meowo/aproxy-headless-*、二进制同样是 aproxy;@meowo/aproxy-format 同理。一份脚本
15
+ // 三组通用,改包名时无需同步此处。
15
16
 
16
17
  const { spawnSync } = require('child_process');
17
18
  const path = require('path');
18
19
 
19
- const SELF_NAME = path.basename(require('../package.json').name); // aproxy | aproxy-format
20
- const PKG_PREFIX = require('../package.json').name + '-';
20
+ const PKG = require('../package.json');
21
+ const SELF_NAME = Object.keys(PKG.bin)[0]; // aproxy | aproxy-format
22
+ const PKG_PREFIX = PKG.name + '-';
23
+ // 带桌面界面的那一组:Linux 上它的 gnu 二进制动态链接 GTK 与 WebKitGTK
24
+ const DESKTOP_GROUP = PKG.name === '@meowo/aproxy';
21
25
 
22
- // gnu 产物能运行的 glibc 下限。必须与 .github/workflows/release.yml 里 gnu 构建的
23
- // glibc 下限、scripts/install.sh 的 MIN_GLIBC 保持一致;低于它的系统改用 musl 产物。
26
+ // gnu 产物能运行的 glibc 下限。必须与 .github/workflows/release.yml 的 GNU_GLIBC_FLOOR、
27
+ // scripts/install.sh 的 MIN_GLIBC 保持一致;低于它的系统改用 musl 产物。
24
28
  const MIN_GLIBC = '2.28';
29
+ // 带界面的 gnu 产物能运行的 glibc 下限,必须与 release.yml 的 DESKTOP_GLIBC_FLOOR、
30
+ // scripts/install.sh 的 DESKTOP_MIN_GLIBC 保持一致。它还要 WebKitGTK 2.40+,那一项这里查不了,
31
+ // 缺库时由动态加载器报错(见文件末尾)。
32
+ const DESKTOP_MIN_GLIBC = '2.34';
33
+ const HEADLESS_HINT = [
34
+ '改装无界面的 headless 版本(代理与命令行完全相同,只是没有 aproxy desktop 窗口):',
35
+ ' npm uninstall -g @meowo/aproxy && npm install -g @meowo/aproxy-headless',
36
+ '想留着带界面的版本,就装上 WebKitGTK 2.40+(Debian / Ubuntu:sudo apt install libwebkit2gtk-4.1-0),',
37
+ '它还需要 glibc ' + DESKTOP_MIN_GLIBC + ' 或更新。',
38
+ ].join('\n');
25
39
 
26
40
  // 平台 → 子包后缀。linux 需区分 glibc/musl(两套产物);forceMusl 用于 glibc 过老的系统。
27
41
  function platformPackage(forceMusl) {
@@ -66,6 +80,16 @@ function versionLt(a, b) {
66
80
  const glibc = process.platform === 'linux' ? glibcRuntime() : undefined;
67
81
  const glibcTooOld = typeof glibc === 'string' && versionLt(glibc, MIN_GLIBC);
68
82
 
83
+ // 带界面的 gnu 二进制在这里注定起不来(glibc 够 headless、不够带界面版):不 spawn 一个必然在
84
+ // 动态加载阶段失败的进程,直接说清原因与改装办法。glibc 低于 MIN_GLIBC 的走下面的 musl 分支。
85
+ if (DESKTOP_GROUP && typeof glibc === 'string' && !glibcTooOld && versionLt(glibc, DESKTOP_MIN_GLIBC)) {
86
+ console.error(
87
+ `${SELF_NAME}: 本机 glibc ${glibc} 低于带桌面界面的版本要求的 ${DESKTOP_MIN_GLIBC},它在这里起不来。\n` +
88
+ HEADLESS_HINT
89
+ );
90
+ process.exit(1);
91
+ }
92
+
69
93
  const pkg = platformPackage(glibc === null || glibcTooOld);
70
94
  if (!pkg) {
71
95
  console.error(
@@ -114,4 +138,17 @@ if (result.error) {
114
138
  console.error(`${SELF_NAME}: 无法启动二进制:` + result.error.message);
115
139
  process.exit(1);
116
140
  }
141
+ // 动态加载器在 main 之前失败(缺库、库太旧、glibc 太旧)时退出码是 127,它的报错已经打在终端上。
142
+ // aproxy 自己不用 127,但要确认是加载失败才提示:再跑一次 --version 把 stderr 收下来看(只在
143
+ // 这种失败时多花这一次)。带界面的版本在缺 WebKitGTK 的 Linux 上就是这样起不来的。
144
+ if (result.status === 127 && DESKTOP_GROUP && process.platform === 'linux') {
145
+ const probe = spawnSync(bin, ['--version'], { encoding: 'utf8', timeout: 10000 });
146
+ const loaderError =
147
+ /error while loading shared libraries|symbol lookup error|version `GLIBC_[^']*' not found/;
148
+ if (probe.status === 127 && loaderError.test(probe.stderr || '')) {
149
+ console.error(
150
+ `${SELF_NAME}: 带桌面界面的版本在本机缺系统库,起不来(见上面动态加载器的报错)。\n` + HEADLESS_HINT
151
+ );
152
+ }
153
+ }
117
154
  process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meowo/aproxy",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-alpha.1",
4
4
  "description": "Local API proxy with infinite retries for agent workloads",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,14 +16,14 @@
16
16
  "node": ">=18"
17
17
  },
18
18
  "optionalDependencies": {
19
- "@meowo/aproxy-windows-x64": "0.1.0",
20
- "@meowo/aproxy-windows-ia32": "0.1.0",
21
- "@meowo/aproxy-windows-arm64": "0.1.0",
22
- "@meowo/aproxy-linux-x64": "0.1.0",
23
- "@meowo/aproxy-linux-x64-musl": "0.1.0",
24
- "@meowo/aproxy-linux-arm64": "0.1.0",
25
- "@meowo/aproxy-linux-arm64-musl": "0.1.0",
26
- "@meowo/aproxy-darwin-arm64": "0.1.0",
27
- "@meowo/aproxy-darwin-x64": "0.1.0"
19
+ "@meowo/aproxy-windows-x64": "0.2.0-alpha.1",
20
+ "@meowo/aproxy-windows-ia32": "0.2.0-alpha.1",
21
+ "@meowo/aproxy-windows-arm64": "0.2.0-alpha.1",
22
+ "@meowo/aproxy-linux-x64": "0.2.0-alpha.1",
23
+ "@meowo/aproxy-linux-x64-musl": "0.2.0-alpha.1",
24
+ "@meowo/aproxy-linux-arm64": "0.2.0-alpha.1",
25
+ "@meowo/aproxy-linux-arm64-musl": "0.2.0-alpha.1",
26
+ "@meowo/aproxy-darwin-arm64": "0.2.0-alpha.1",
27
+ "@meowo/aproxy-darwin-x64": "0.2.0-alpha.1"
28
28
  }
29
29
  }
Binary file