private-ai-proxy 0.2.0-beta.1-linux-arm64 → 0.2.0-beta.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 +45 -2
- package/bin/aci.cjs +6 -0
- package/bin/private-ai-proxy.cjs +136 -0
- package/package.json +22 -14
- package/vendor/private-ai-proxy +0 -0
- package/vendor/private-ai-proxy-helper +0 -0
- package/vendor/private-ai-proxy-service +0 -4
package/README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Private AI Proxy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Private AI Proxy runs AI coding agents through a local, user-owned gateway that verifies confidential-computing evidence before forwarding requests.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --global private-ai-proxy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package installs `pap` as the preferred command. `private-ai-proxy` is the
|
|
12
|
+
full-name alias and `aci` is a legacy alias kept for existing scripts; all three
|
|
13
|
+
run the same CLI. The native executables for each supported platform ship as a
|
|
14
|
+
version of this package, such as `private-ai-proxy@<version>-linux-x64`, that
|
|
15
|
+
the package installs as an optional dependency. Your package manager installs
|
|
16
|
+
only the one for the current operating system and CPU architecture. Do not
|
|
17
|
+
install with `--omit=optional` or `--no-optional`.
|
|
18
|
+
|
|
19
|
+
Install `private-ai-proxy` (the stable release), `private-ai-proxy@beta`, or an
|
|
20
|
+
exact version such as `private-ai-proxy@0.2.0`. Do not use a prerelease range
|
|
21
|
+
such as `private-ai-proxy@^0.2.0-beta.1`: it can resolve to a platform version
|
|
22
|
+
(for example `0.2.0-beta.2-linux-x64`) instead of the installable package.
|
|
23
|
+
|
|
24
|
+
Supported platforms are macOS, Linux with glibc 2.35 or newer, and Windows, each
|
|
25
|
+
on arm64 and x64. musl-based Linux distributions such as Alpine are not
|
|
26
|
+
supported.
|
|
27
|
+
|
|
28
|
+
## Use
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pap --help
|
|
32
|
+
pap service start
|
|
33
|
+
pap service status
|
|
34
|
+
pap app open --web
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The CLI, service, and credential helper are distributed together so the local
|
|
38
|
+
service can start the matching binaries from the same installation. The
|
|
39
|
+
service can also host the management UI on `127.0.0.1` (off by default): set a
|
|
40
|
+
password with `pap settings set web-ui.password`, enable it with
|
|
41
|
+
`pap settings set web-ui.enabled true`, then open the address from `pap app open --web`
|
|
42
|
+
and sign in. For another machine, prefer an SSH tunnel or Tailscale;
|
|
43
|
+
read [Remote Access](https://github.com/Dstack-TEE/private-ai-gateway/blob/main/apps/desktop/docs/cli.md#remote-access)
|
|
44
|
+
before listening on a LAN address over plain HTTP.
|
|
45
|
+
|
|
46
|
+
Source and release notes: https://github.com/Dstack-TEE/private-ai-gateway
|
package/bin/aci.cjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
const { accessSync, constants, realpathSync } = require("node:fs");
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
|
|
8
|
+
// Each target's native binaries are a version of this package, such as
|
|
9
|
+
// private-ai-proxy@1.2.3-linux-x64, installed through an optional dependency
|
|
10
|
+
// alias such as private-ai-proxy-linux-x64. The package manager installs only
|
|
11
|
+
// the one whose os/cpu/libc match, as for @openai/codex's bin/codex.js.
|
|
12
|
+
const supportedTargets = [
|
|
13
|
+
"darwin-arm64",
|
|
14
|
+
"darwin-x64",
|
|
15
|
+
"linux-arm64",
|
|
16
|
+
"linux-x64",
|
|
17
|
+
"win32-arm64",
|
|
18
|
+
"win32-x64",
|
|
19
|
+
];
|
|
20
|
+
const muslMessage =
|
|
21
|
+
"Linux builds require glibc 2.35 or newer; musl-based distributions such as Alpine are not supported";
|
|
22
|
+
|
|
23
|
+
function platformPackage(platform, arch) {
|
|
24
|
+
const target = `${platform}-${arch}`;
|
|
25
|
+
if (!supportedTargets.includes(target)) return undefined;
|
|
26
|
+
return {
|
|
27
|
+
alias: `private-ai-proxy-${target}`,
|
|
28
|
+
target,
|
|
29
|
+
executable: `vendor/private-ai-proxy${platform === "win32" ? ".exe" : ""}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// The global reinstall command for the package manager that owns this copy,
|
|
34
|
+
// detected from its install path as bin/codex.js does.
|
|
35
|
+
function reinstallCommand(version) {
|
|
36
|
+
const spec = `private-ai-proxy@${version}`;
|
|
37
|
+
let location = __dirname;
|
|
38
|
+
try {
|
|
39
|
+
location = realpathSync(__dirname);
|
|
40
|
+
} catch {
|
|
41
|
+
// Fall back to the lexical path.
|
|
42
|
+
}
|
|
43
|
+
if (/[\\/]\.bun[\\/]install[\\/]global[\\/]/.test(location)) return `bun add --global ${spec}`;
|
|
44
|
+
if (/[\\/]\.pnpm[\\/]/.test(location)) return `pnpm add --global ${spec}`;
|
|
45
|
+
return `npm install --global ${spec} --include=optional`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Only consulted after a failure: npm skips the glibc package on musl, and
|
|
49
|
+
// package managers that ignore `libc` install a binary musl cannot load.
|
|
50
|
+
function isLinuxWithoutGlibc() {
|
|
51
|
+
if (process.platform !== "linux") return false;
|
|
52
|
+
try {
|
|
53
|
+
process.report.excludeNetwork = true;
|
|
54
|
+
return !process.report.getReport().header.glibcVersionRuntime;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function fail(message) {
|
|
61
|
+
console.error(`private-ai-proxy: ${message}`);
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// `command` becomes the binary's argv[0], as a symlink named after it would.
|
|
66
|
+
function main(command) {
|
|
67
|
+
const target = `${process.platform}-${process.arch}`;
|
|
68
|
+
const platform = platformPackage(process.platform, process.arch);
|
|
69
|
+
if (!platform) {
|
|
70
|
+
fail(`unsupported platform ${target}; supported platforms are ${supportedTargets.join(", ")}`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const version = require("../package.json").version;
|
|
75
|
+
const expectedVersion = `${version}-${platform.target}`;
|
|
76
|
+
let manifestPath;
|
|
77
|
+
try {
|
|
78
|
+
manifestPath = require.resolve(`${platform.alias}/package.json`);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error?.code !== "MODULE_NOT_FOUND") throw error;
|
|
81
|
+
fail(isLinuxWithoutGlibc()
|
|
82
|
+
? muslMessage
|
|
83
|
+
: `the native binaries for ${target} (private-ai-proxy@${expectedVersion}) are not installed. `
|
|
84
|
+
+ "Optional dependencies were omitted (--omit=optional or --no-optional) or their download failed. "
|
|
85
|
+
+ `Reinstall with: ${reinstallCommand(version)}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// An update that could not replace the native package, for example because
|
|
90
|
+
// a running process locked its files on Windows, leaves an older version.
|
|
91
|
+
const installedVersion = require(manifestPath).version;
|
|
92
|
+
if (installedVersion !== expectedVersion) {
|
|
93
|
+
fail(`the installed native binaries are private-ai-proxy@${installedVersion}, expected ${expectedVersion}. `
|
|
94
|
+
+ `Stop any running private-ai-proxy processes, then reinstall with: ${reinstallCommand(version)}`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const executable = path.join(path.dirname(manifestPath), platform.executable);
|
|
99
|
+
try {
|
|
100
|
+
accessSync(executable, process.platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
101
|
+
} catch {
|
|
102
|
+
fail(`the native executable is missing or not executable in ${path.dirname(manifestPath)}. `
|
|
103
|
+
+ `Reinstall with: ${reinstallCommand(version)}`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const result = spawnSync(executable, process.argv.slice(2), {
|
|
108
|
+
argv0: command,
|
|
109
|
+
stdio: "inherit",
|
|
110
|
+
windowsHide: false,
|
|
111
|
+
});
|
|
112
|
+
if (result.error) {
|
|
113
|
+
if (result.error.code === "ENOENT" && isLinuxWithoutGlibc()) {
|
|
114
|
+
fail(muslMessage);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
throw result.error;
|
|
118
|
+
}
|
|
119
|
+
if (result.signal) {
|
|
120
|
+
process.kill(process.pid, result.signal);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
process.exitCode = result.status ?? 1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function run(command) {
|
|
127
|
+
try {
|
|
128
|
+
main(command);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (require.main === module) run("private-ai-proxy");
|
|
135
|
+
|
|
136
|
+
module.exports = { platformPackage, run, supportedTargets };
|
package/package.json
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "private-ai-proxy",
|
|
3
|
-
"version": "0.2.0-beta.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
4
|
+
"description": "Local verifying gateway for confidential AI inference",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Dstack-TEE/private-ai-gateway.git"
|
|
8
|
+
"url": "git+https://github.com/Dstack-TEE/private-ai-gateway.git",
|
|
9
|
+
"directory": "apps/desktop/npm/private-ai-proxy"
|
|
9
10
|
},
|
|
10
11
|
"homepage": "https://github.com/Dstack-TEE/private-ai-gateway#readme",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"libc": [
|
|
18
|
-
"glibc"
|
|
19
|
-
],
|
|
20
|
-
"preferUnplugged": true,
|
|
12
|
+
"bugs": "https://github.com/Dstack-TEE/private-ai-gateway/issues",
|
|
13
|
+
"bin": {
|
|
14
|
+
"private-ai-proxy": "bin/private-ai-proxy.cjs",
|
|
15
|
+
"pap": "bin/private-ai-proxy.cjs",
|
|
16
|
+
"aci": "bin/aci.cjs"
|
|
17
|
+
},
|
|
21
18
|
"files": [
|
|
22
|
-
"
|
|
19
|
+
"bin"
|
|
23
20
|
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"optionalDependencies": {
|
|
25
|
+
"private-ai-proxy-darwin-arm64": "npm:private-ai-proxy@0.2.0-beta.1-darwin-arm64",
|
|
26
|
+
"private-ai-proxy-darwin-x64": "npm:private-ai-proxy@0.2.0-beta.1-darwin-x64",
|
|
27
|
+
"private-ai-proxy-linux-arm64": "npm:private-ai-proxy@0.2.0-beta.1-linux-arm64",
|
|
28
|
+
"private-ai-proxy-linux-x64": "npm:private-ai-proxy@0.2.0-beta.1-linux-x64",
|
|
29
|
+
"private-ai-proxy-win32-arm64": "npm:private-ai-proxy@0.2.0-beta.1-win32-arm64",
|
|
30
|
+
"private-ai-proxy-win32-x64": "npm:private-ai-proxy@0.2.0-beta.1-win32-x64"
|
|
31
|
+
},
|
|
24
32
|
"publishConfig": {
|
|
25
33
|
"access": "public"
|
|
26
34
|
}
|
package/vendor/private-ai-proxy
DELETED
|
Binary file
|
|
Binary file
|