private-ai-proxy 0.4.0 → 0.5.0-beta.1-darwin-arm64

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
@@ -1,45 +1,3 @@
1
- # Private AI Proxy
1
+ # private-ai-proxy 0.5.0-beta.1-darwin-arm64
2
2
 
3
- Private AI Proxy runs AI coding agents through a local, user-owned gateway that
4
- verifies confidential-computing evidence before forwarding requests. This
5
- package installs its `pap` CLI together with the per-user backend service and
6
- the agent credential helper.
7
-
8
- ## Install
9
-
10
- ```sh
11
- npm install --global private-ai-proxy
12
- ```
13
-
14
- It runs on macOS, Windows, and Linux with glibc 2.35 or newer (not musl), each
15
- on arm64 and x64. Do not install with `--omit=optional`, and install a tag or
16
- an exact version rather than a prerelease range. The
17
- [install guide](https://github.com/Dstack-TEE/private-ai-gateway/blob/main/docs/private-ai-proxy-install.md#npm)
18
- explains both and lists other ways to install, including the desktop app.
19
-
20
- ## Use
21
-
22
- ```sh
23
- pap --help
24
- pap service start
25
- pap service status
26
- ```
27
-
28
- `pap` is the preferred command. `private-ai-proxy` and the legacy `aci` run the
29
- same CLI.
30
-
31
- The service can also serve its management UI to a browser on `127.0.0.1`. It is
32
- off by default:
33
-
34
- ```sh
35
- pap settings set web-ui.enabled true
36
- pap web-ui password show # the generated sign-in password
37
- pap app open --web
38
- ```
39
-
40
- [Web UI](https://github.com/Dstack-TEE/private-ai-gateway/blob/main/apps/desktop/docs/cli.md#web-ui)
41
- covers the password, access from another machine, and the security model.
42
- [The CLI reference](https://github.com/Dstack-TEE/private-ai-gateway/blob/main/apps/desktop/docs/cli.md)
43
- documents every command.
44
-
45
- Source and release notes: https://github.com/Dstack-TEE/private-ai-gateway
3
+ The native darwin-arm64 binaries of [private-ai-proxy](https://www.npmjs.com/package/private-ai-proxy). Install `private-ai-proxy` instead of this version.
package/package.json CHANGED
@@ -1,34 +1,23 @@
1
1
  {
2
2
  "name": "private-ai-proxy",
3
- "version": "0.4.0",
4
- "description": "Local verifying gateway for confidential AI inference",
3
+ "version": "0.5.0-beta.1-darwin-arm64",
4
+ "description": "Native Private AI Proxy binaries for darwin-arm64",
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",
9
- "directory": "apps/desktop/npm/private-ai-proxy"
8
+ "url": "git+https://github.com/Dstack-TEE/private-ai-gateway.git"
10
9
  },
11
10
  "homepage": "https://github.com/Dstack-TEE/private-ai-gateway#readme",
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
- },
11
+ "os": [
12
+ "darwin"
13
+ ],
14
+ "cpu": [
15
+ "arm64"
16
+ ],
17
+ "preferUnplugged": true,
18
18
  "files": [
19
- "bin"
19
+ "vendor"
20
20
  ],
21
- "engines": {
22
- "node": ">=18"
23
- },
24
- "optionalDependencies": {
25
- "private-ai-proxy-darwin-arm64": "npm:private-ai-proxy@0.4.0-darwin-arm64",
26
- "private-ai-proxy-darwin-x64": "npm:private-ai-proxy@0.4.0-darwin-x64",
27
- "private-ai-proxy-linux-arm64": "npm:private-ai-proxy@0.4.0-linux-arm64",
28
- "private-ai-proxy-linux-x64": "npm:private-ai-proxy@0.4.0-linux-x64",
29
- "private-ai-proxy-win32-arm64": "npm:private-ai-proxy@0.4.0-win32-arm64",
30
- "private-ai-proxy-win32-x64": "npm:private-ai-proxy@0.4.0-win32-x64"
31
- },
32
21
  "publishConfig": {
33
22
  "access": "public"
34
23
  }
Binary file
Binary file
Binary file
package/bin/aci.cjs DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- // npm's Windows shims run a bin script without the name it was invoked by, so
5
- // the legacy `aci` command has its own entry that passes that name on.
6
- require("./private-ai-proxy.cjs").run("aci");
@@ -1,136 +0,0 @@
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 };