@meowo/aproxy 0.1.0-alpha.10t1

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 ADDED
@@ -0,0 +1,42 @@
1
+ # @meowo/aproxy
2
+
3
+ Local API proxy with **infinite retries** for agent workloads.
4
+
5
+ Upstream rate limits, broken streams, timeouts — aProxy catches the request
6
+ locally: on failure it retries without limit (exponential backoff, capped and
7
+ configurable), keeps streaming responses alive with injected SSE heartbeats,
8
+ and replays the successful response byte-for-byte. Your client never notices
9
+ the storm upstream; it only notices that the request took a little longer.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install -g @meowo/aproxy
15
+ ```
16
+
17
+ The right platform binary (windows x64/x86/arm64, linux x64/arm64 with glibc
18
+ or musl, macOS arm64/x64) is installed automatically via
19
+ `optionalDependencies` — no postinstall downloads, everything comes from the
20
+ npm registry.
21
+
22
+ ## Quick start
23
+
24
+ ```sh
25
+ # 1. Configure the upstream (writes ~/.aproxy/config.toml)
26
+ aproxy config --baseurl https://api.anthropic.com --api-key sk-ant-...
27
+
28
+ # 2. Start (background daemon)
29
+ aproxy
30
+
31
+ # 3. Point your agent's API base URL at the local proxy
32
+ # https://api.anthropic.com → http://127.0.0.1:12345
33
+ ```
34
+
35
+ ## Links
36
+
37
+ - Full documentation: <https://github.com/MoYeRanqianzhi/aProxy>
38
+ - Releases: <https://github.com/MoYeRanqianzhi/aProxy/releases>
39
+
40
+ ## License
41
+
42
+ MIT
package/bin/aproxy.js ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // aProxy npm 入口转发器(esbuild/rollup 同款多平台包模式)。
5
+ //
6
+ // 原理:npm 主包 @meowo/aproxy 只含这个 JS 脚本;真正的二进制在
7
+ // 各平台子包里(optionalDependencies),npm install 时按 os/cpu/libc 字段
8
+ // 自动只装当前平台的那一个——全程 registry 内分发,无二次网络下载。
9
+ // 本脚本运行时解析出平台子包内的二进制路径,spawn 并透传参数/stdio/退出码。
10
+
11
+ const { spawnSync } = require('child_process');
12
+ const path = require('path');
13
+
14
+ const PKG_PREFIX = '@meowo/aproxy-';
15
+
16
+ // 平台 → 子包后缀。linux 需区分 glibc/musl(两套静态链接产物)。
17
+ function platformPackage() {
18
+ const { platform, arch } = process;
19
+ if (platform === 'win32') {
20
+ if (arch === 'x64') return PKG_PREFIX + 'windows-x64';
21
+ if (arch === 'ia32') return PKG_PREFIX + 'windows-ia32';
22
+ if (arch === 'arm64') return PKG_PREFIX + 'windows-arm64';
23
+ }
24
+ if (platform === 'darwin') {
25
+ if (arch === 'arm64') return PKG_PREFIX + 'darwin-arm64';
26
+ if (arch === 'x64') return PKG_PREFIX + 'darwin-x64';
27
+ }
28
+ if (platform === 'linux' && arch === 'x64') {
29
+ return PKG_PREFIX + 'linux-x64' + (isMusl() ? '-musl' : '');
30
+ }
31
+ if (platform === 'linux' && arch === 'arm64') {
32
+ return PKG_PREFIX + 'linux-arm64' + (isMusl() ? '-musl' : '');
33
+ }
34
+ return null;
35
+ }
36
+
37
+ // process.report 的 glibcVersionRuntime 只在 glibc 构建的 Node 上有值;
38
+ // musl 环境(Alpine 等)拿不到它。report 不可用时保守回退 gnu(更常见)。
39
+ function isMusl() {
40
+ try {
41
+ if (!process.report || !process.report.getReport) return false;
42
+ return !process.report.getReport().header.glibcVersionRuntime;
43
+ } catch {
44
+ return false;
45
+ }
46
+ }
47
+
48
+ const pkg = platformPackage();
49
+ if (!pkg) {
50
+ console.error(
51
+ `aproxy: 不支持的平台 ${process.platform}-${process.arch}。` +
52
+ '请从 https://github.com/MoYeRanqianzhi/aProxy/releases 直接下载二进制。'
53
+ );
54
+ process.exit(1);
55
+ }
56
+
57
+ let bin;
58
+ try {
59
+ const pkgDir = path.dirname(require.resolve(pkg + '/package.json'));
60
+ bin = path.join(pkgDir, 'bin', process.platform === 'win32' ? 'aproxy.exe' : 'aproxy');
61
+ } catch {
62
+ // optionalDependencies 被 --omit=optional 跳过、或 npm 平台过滤未装上时走到这里
63
+ console.error(
64
+ `aproxy: 平台包 ${pkg} 未安装。请重新安装:npm install -g @meowo/aproxy`
65
+ );
66
+ process.exit(1);
67
+ }
68
+
69
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
70
+ if (result.error) {
71
+ console.error('aproxy: 无法启动二进制:' + result.error.message);
72
+ process.exit(1);
73
+ }
74
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@meowo/aproxy",
3
+ "version": "0.1.0-alpha.10t1",
4
+ "description": "Local API proxy with infinite retries for agent workloads",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/MoYeRanqianzhi/aProxy.git"
9
+ },
10
+ "keywords": ["proxy", "retry", "api", "agent", "llm", "claude"],
11
+ "bin": {
12
+ "aproxy": "bin/aproxy.js"
13
+ },
14
+ "files": ["bin/", "README.md", "skills/"],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "optionalDependencies": {
19
+ "@meowo/aproxy-windows-x64": "0.1.0-alpha.10t1",
20
+ "@meowo/aproxy-windows-ia32": "0.1.0-alpha.10t1",
21
+ "@meowo/aproxy-windows-arm64": "0.1.0-alpha.10t1",
22
+ "@meowo/aproxy-linux-x64": "0.1.0-alpha.10t1",
23
+ "@meowo/aproxy-linux-x64-musl": "0.1.0-alpha.10t1",
24
+ "@meowo/aproxy-linux-arm64": "0.1.0-alpha.10t1",
25
+ "@meowo/aproxy-linux-arm64-musl": "0.1.0-alpha.10t1",
26
+ "@meowo/aproxy-darwin-arm64": "0.1.0-alpha.10t1",
27
+ "@meowo/aproxy-darwin-x64": "0.1.0-alpha.10t1"
28
+ }
29
+ }
Binary file