@ariacompute/engine-ts 1.19.2 → 1.20.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/dist/index.d.ts CHANGED
@@ -43,8 +43,13 @@ export declare const INTL_UPGRADE = "https://github.com/ariacompute";
43
43
  export declare const CN_SITE = "https://ariacompute.cn";
44
44
  export declare const CN_UPGRADE = "https://gitee.com/ariacompute";
45
45
  export interface SetupConfig {
46
+ /** Local (router registration) */
46
47
  router: string;
47
48
  router_api_key: string;
49
+ /** OAuth (Aria Compute) */
50
+ serve_site: string;
51
+ serve_api_key: string;
52
+ /** Hub / compute */
48
53
  site_url: string;
49
54
  upgrade_url: string;
50
55
  compute: string;
package/dist/index.js CHANGED
@@ -67,6 +67,8 @@ function defaultSetupConfig() {
67
67
  return {
68
68
  router: "",
69
69
  router_api_key: "",
70
+ serve_site: "",
71
+ serve_api_key: "",
70
72
  site_url: "",
71
73
  upgrade_url: "",
72
74
  compute: "auto",
@@ -97,6 +99,25 @@ function fillSetupUrls(cfg) {
97
99
  out.upgrade_url = upgrade;
98
100
  return out;
99
101
  }
102
+ function validateRouterApiKey(key) {
103
+ const t = (key || "").trim();
104
+ if (!t)
105
+ return;
106
+ if (t.startsWith("bfvk-")) {
107
+ throw new Error("OAuth key detected (bfvk-); use serve_api_key / [2/2] OAuth (Aria Compute)");
108
+ }
109
+ }
110
+ function validateServeApiKey(key) {
111
+ const t = (key || "").trim();
112
+ if (!t)
113
+ return;
114
+ if (t.startsWith("sk-aria_")) {
115
+ throw new Error("Local router key detected (sk-aria_); use router_api_key / [1/2] Local");
116
+ }
117
+ if (!t.startsWith("bfvk-")) {
118
+ throw new Error("serve_api_key must start with bfvk-");
119
+ }
120
+ }
100
121
  function applySetup(existing, updates) {
101
122
  const out = { ...existing };
102
123
  for (const [k, v] of Object.entries(updates)) {
@@ -107,6 +128,8 @@ function applySetup(existing, updates) {
107
128
  if (!["auto", "cpu", "cuda"].includes(out.compute)) {
108
129
  throw new Error(`invalid compute: ${out.compute}`);
109
130
  }
131
+ validateRouterApiKey(out.router_api_key);
132
+ validateServeApiKey(out.serve_api_key);
110
133
  return fillSetupUrls(out);
111
134
  }
112
135
  const DEFAULT_SDK = "v1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariacompute/engine-ts",
3
- "version": "1.19.2",
3
+ "version": "1.20.1",
4
4
  "description": "TypeScript/Node SDK for Aria Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",