@ariacompute/engine-ts 1.20.1 → 1.22.0
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 +1 -1
- package/dist/index.d.ts +2 -6
- package/dist/index.js +4 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Aria model name (e.g. `gemma-4-e2b-it_q4`). A value containing `/` or already on
|
|
|
20
20
|
disk is loaded directly; otherwise the SDK downloads it from the regional public
|
|
21
21
|
hub (same as `aria-engine download`: `.com` → Hugging Face, `.cn` → ModelScope;
|
|
22
22
|
`site` defaults to `https://ariacompute.com`) into `~/.ariacompute/models/{model}`
|
|
23
|
-
and then loads it. Dashboard is not used. A Dashboard `sk-` / `
|
|
23
|
+
and then loads it. Dashboard is not used. A Dashboard `sk-` / `sk-bf-` token is
|
|
24
24
|
ignored for hub auth. Token is optional for public models. A valid cached bundle
|
|
25
25
|
is reused without re-downloading.
|
|
26
26
|
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface CompleteResult {
|
|
|
27
27
|
generation?: Generation;
|
|
28
28
|
}
|
|
29
29
|
export interface OpenOptions {
|
|
30
|
-
/** Legacy generic hub token. Dashboard sk-/
|
|
30
|
+
/** Legacy generic hub token. Dashboard sk-/sk-bf- keys are ignored. */
|
|
31
31
|
token?: string;
|
|
32
32
|
/** Hugging Face hub token (`.com`). Same field as `aria-engine setup` `hf_token`. */
|
|
33
33
|
hfToken?: string;
|
|
@@ -43,13 +43,9 @@ 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) */
|
|
47
46
|
router: string;
|
|
47
|
+
/** sk-aria_ or sk-bf-; router associates by prefix */
|
|
48
48
|
router_api_key: string;
|
|
49
|
-
/** OAuth (Aria Compute) */
|
|
50
|
-
serve_site: string;
|
|
51
|
-
serve_api_key: string;
|
|
52
|
-
/** Hub / compute */
|
|
53
49
|
site_url: string;
|
|
54
50
|
upgrade_url: string;
|
|
55
51
|
compute: string;
|
package/dist/index.js
CHANGED
|
@@ -67,8 +67,6 @@ function defaultSetupConfig() {
|
|
|
67
67
|
return {
|
|
68
68
|
router: "",
|
|
69
69
|
router_api_key: "",
|
|
70
|
-
serve_site: "",
|
|
71
|
-
serve_api_key: "",
|
|
72
70
|
site_url: "",
|
|
73
71
|
upgrade_url: "",
|
|
74
72
|
compute: "auto",
|
|
@@ -103,20 +101,9 @@ function validateRouterApiKey(key) {
|
|
|
103
101
|
const t = (key || "").trim();
|
|
104
102
|
if (!t)
|
|
105
103
|
return;
|
|
106
|
-
if (t.startsWith("
|
|
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)
|
|
104
|
+
if (t.startsWith("sk-aria_") || t.startsWith("sk-bf-"))
|
|
113
105
|
return;
|
|
114
|
-
|
|
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
|
-
}
|
|
106
|
+
throw new Error("router_api_key must start with sk-aria_ or sk-bf-");
|
|
120
107
|
}
|
|
121
108
|
function applySetup(existing, updates) {
|
|
122
109
|
const out = { ...existing };
|
|
@@ -129,7 +116,6 @@ function applySetup(existing, updates) {
|
|
|
129
116
|
throw new Error(`invalid compute: ${out.compute}`);
|
|
130
117
|
}
|
|
131
118
|
validateRouterApiKey(out.router_api_key);
|
|
132
|
-
validateServeApiKey(out.serve_api_key);
|
|
133
119
|
return fillSetupUrls(out);
|
|
134
120
|
}
|
|
135
121
|
const DEFAULT_SDK = "v1.0";
|
|
@@ -196,7 +182,7 @@ function hubBearer(token) {
|
|
|
196
182
|
if (!t)
|
|
197
183
|
return undefined;
|
|
198
184
|
const low = t.toLowerCase();
|
|
199
|
-
if (low.startsWith("sk-")
|
|
185
|
+
if (low.startsWith("sk-"))
|
|
200
186
|
return undefined;
|
|
201
187
|
return t;
|
|
202
188
|
}
|
|
@@ -316,7 +302,7 @@ async function fetchHubFile(source, model, file, dest, token, required) {
|
|
|
316
302
|
last = e;
|
|
317
303
|
if (e instanceof HubHttpError && (e.status === 401 || e.status === 403)) {
|
|
318
304
|
const field = source === "modelscope" ? "modelscope_api_token" : "hf_token";
|
|
319
|
-
throw new Error(`auth failed HTTP ${e.status}; set ${field} via aria-engine setup (do not pass a Dashboard sk-/
|
|
305
|
+
throw new Error(`auth failed HTTP ${e.status}; set ${field} via aria-engine setup (do not pass a Dashboard sk-/sk-bf- key as the hub token)`);
|
|
320
306
|
}
|
|
321
307
|
}
|
|
322
308
|
}
|