@alienplatform/ai-gateway 3.3.39 → 3.3.41
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/dist/gateway.js +5 -10
- package/dist/index.js +1 -2
- package/dist/native.js +1 -2
- package/package.json +8 -8
package/dist/gateway.js
CHANGED
|
@@ -6,7 +6,7 @@ import { chmodSync, existsSync, mkdtempSync, statSync, writeFileSync } from "nod
|
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
|
|
9
|
+
// src/binding.ts
|
|
10
10
|
/**
|
|
11
11
|
* Parsing for the `ALIEN_<NAME>_BINDING` env var an `ai` resource projects. The client only
|
|
12
12
|
* routes on the binding: a BYO-key (`external-ai`) binding is validated strictly here because the
|
|
@@ -45,8 +45,7 @@ async function parseAiBinding(name) {
|
|
|
45
45
|
if (!result.success) throw (await AlienError.from(result.error)).withContext(InvalidBindingConfigError.create({ message: `AI binding '${name}' has an unexpected shape` }));
|
|
46
46
|
return result.data;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
//#region src/errors.ts
|
|
48
|
+
// src/errors.ts
|
|
50
49
|
/**
|
|
51
50
|
* Typed errors for the AI client surface (`ai()` / `getAiConnection`).
|
|
52
51
|
*
|
|
@@ -162,8 +161,7 @@ const GatewayStartFailedError = defineError({
|
|
|
162
161
|
internal: true,
|
|
163
162
|
httpStatusCode: 503
|
|
164
163
|
});
|
|
165
|
-
|
|
166
|
-
//#region src/client.ts
|
|
164
|
+
// src/client.ts
|
|
167
165
|
/**
|
|
168
166
|
* AI binding — a thin OpenAI-compatible client to the workload's AI gateway.
|
|
169
167
|
*
|
|
@@ -424,8 +422,7 @@ async function extractErrorMessage(response) {
|
|
|
424
422
|
return response.statusText || "Unknown upstream error";
|
|
425
423
|
}
|
|
426
424
|
}
|
|
427
|
-
|
|
428
|
-
//#region src/loader.ts
|
|
425
|
+
// src/loader.ts
|
|
429
426
|
/**
|
|
430
427
|
* Locate (and, for a compiled Worker, extract) the `alien-ai-gateway` executable
|
|
431
428
|
* that the gateway wrapper spawns.
|
|
@@ -577,8 +574,7 @@ async function resolvePrebuild(triple) {
|
|
|
577
574
|
const candidate = join(dirname(pkgJson), BINARY_NAME);
|
|
578
575
|
return existsSync(candidate) ? candidate : void 0;
|
|
579
576
|
}
|
|
580
|
-
|
|
581
|
-
//#region src/gateway.ts
|
|
577
|
+
// src/gateway.ts
|
|
582
578
|
/**
|
|
583
579
|
* The gateway surface: obtain the loopback URL of the Alien AI gateway.
|
|
584
580
|
*
|
|
@@ -745,5 +741,4 @@ function keepChildAlive(child, onGatewayLost) {
|
|
|
745
741
|
unrefStream(child.stderr);
|
|
746
742
|
child.unref();
|
|
747
743
|
}
|
|
748
|
-
//#endregion
|
|
749
744
|
export { createAiClient as a, BindingNotFoundError as c, isExternalAiBinding as d, parseAiBinding as f, Ai as i, InvalidBindingConfigError$1 as l, registerEmbeddedBinary as n, AiTransportError as o, resolveGatewayBinary as r, AiUpstreamError as s, createGateway as t, aiBindingEnvVarName as u };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as createAiClient, c as BindingNotFoundError, d as isExternalAiBinding, f as parseAiBinding, i as Ai, l as InvalidBindingConfigError, o as AiTransportError, r as resolveGatewayBinary, s as AiUpstreamError, t as createGateway, u as aiBindingEnvVarName } from "./gateway.js";
|
|
2
|
-
|
|
2
|
+
// src/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@alienplatform/ai-gateway`: the thin TypeScript wrapper that starts the Alien
|
|
5
5
|
* AI gateway as a local subprocess.
|
|
@@ -26,5 +26,4 @@ const startAiGateway = gateway.startAiGateway;
|
|
|
26
26
|
const ai = client.ai;
|
|
27
27
|
/** Resolve an AI binding to `{ baseURL, apiKey? }`, starting the gateway for ambient bindings. */
|
|
28
28
|
const getAiConnection = client.getAiConnection;
|
|
29
|
-
//#endregion
|
|
30
29
|
export { Ai, AiTransportError, AiUpstreamError, BindingNotFoundError, InvalidBindingConfigError, ai, aiBindingEnvVarName, getAiConnection, isExternalAiBinding, parseAiBinding, startAiGateway };
|
package/dist/native.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as createAiClient, c as BindingNotFoundError, d as isExternalAiBinding, f as parseAiBinding, i as Ai, l as InvalidBindingConfigError, n as registerEmbeddedBinary, o as AiTransportError, r as resolveGatewayBinary, s as AiUpstreamError, t as createGateway, u as aiBindingEnvVarName } from "./gateway.js";
|
|
2
2
|
import embeddedBinaryPath from "./alien-ai-gateway.bin" with { type: "file" };
|
|
3
|
-
|
|
3
|
+
// src/native.ts
|
|
4
4
|
/**
|
|
5
5
|
* `@alienplatform/ai-gateway/native` — static-embed entry for `bun build --compile`.
|
|
6
6
|
*
|
|
@@ -29,5 +29,4 @@ const client = createAiClient(gateway);
|
|
|
29
29
|
const startAiGateway = gateway.startAiGateway;
|
|
30
30
|
const ai = client.ai;
|
|
31
31
|
const getAiConnection = client.getAiConnection;
|
|
32
|
-
//#endregion
|
|
33
32
|
export { Ai, AiTransportError, AiUpstreamError, BindingNotFoundError, InvalidBindingConfigError, ai, aiBindingEnvVarName, getAiConnection, installEmbeddedGateway, isExternalAiBinding, parseAiBinding, startAiGateway };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alienplatform/ai-gateway",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"zod": "^4.5.2",
|
|
52
|
-
"@alienplatform/core": "^3.3.
|
|
52
|
+
"@alienplatform/core": "^3.3.41"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"openai": "^4 || ^7.0.0"
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@alienplatform/ai-gateway-darwin-arm64": "3.3.
|
|
64
|
-
"@alienplatform/ai-gateway-darwin-x64": "3.3.
|
|
65
|
-
"@alienplatform/ai-gateway-linux-x64-gnu": "3.3.
|
|
66
|
-
"@alienplatform/ai-gateway-linux-x64-musl": "3.3.
|
|
67
|
-
"@alienplatform/ai-gateway-linux-arm64-gnu": "3.3.
|
|
68
|
-
"@alienplatform/ai-gateway-linux-arm64-musl": "3.3.
|
|
63
|
+
"@alienplatform/ai-gateway-darwin-arm64": "3.3.41",
|
|
64
|
+
"@alienplatform/ai-gateway-darwin-x64": "3.3.41",
|
|
65
|
+
"@alienplatform/ai-gateway-linux-x64-gnu": "3.3.41",
|
|
66
|
+
"@alienplatform/ai-gateway-linux-x64-musl": "3.3.41",
|
|
67
|
+
"@alienplatform/ai-gateway-linux-arm64-gnu": "3.3.41",
|
|
68
|
+
"@alienplatform/ai-gateway-linux-arm64-musl": "3.3.41"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
|