omnius 1.0.610 → 1.0.612
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.js +83 -16
- package/dist/library.js +13 -8
- package/docs/DISCOVERY.json +3 -3
- package/npm-shrinkwrap.json +25 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -612859,10 +612859,15 @@ function serviceBaseForKnown(rawUrl, provider) {
|
|
|
612859
612859
|
...Object.values(provider.paths).filter((value2) => typeof value2 === "string"),
|
|
612860
612860
|
provider.apiPrefix
|
|
612861
612861
|
].filter(Boolean).sort((left, right) => right.length - left.length);
|
|
612862
|
-
|
|
612863
|
-
|
|
612864
|
-
|
|
612865
|
-
|
|
612862
|
+
let stripped = true;
|
|
612863
|
+
while (stripped && path16) {
|
|
612864
|
+
stripped = false;
|
|
612865
|
+
for (const suffix of suffixes) {
|
|
612866
|
+
if (path16.toLowerCase().endsWith(suffix.toLowerCase())) {
|
|
612867
|
+
path16 = normalizePath(path16.slice(0, -suffix.length));
|
|
612868
|
+
stripped = true;
|
|
612869
|
+
break;
|
|
612870
|
+
}
|
|
612866
612871
|
}
|
|
612867
612872
|
}
|
|
612868
612873
|
return withoutTrailingSlash(`${url.origin}${path16}`);
|
|
@@ -613154,11 +613159,11 @@ var init_providerRegistry = __esm({
|
|
|
613154
613159
|
label: "OpenRouter",
|
|
613155
613160
|
protocol: "openai-chat",
|
|
613156
613161
|
local: false,
|
|
613157
|
-
apiPrefix: "/
|
|
613162
|
+
apiPrefix: "/v1",
|
|
613158
613163
|
paths: {
|
|
613159
|
-
chat: "/
|
|
613160
|
-
models: "/
|
|
613161
|
-
embeddings: "/
|
|
613164
|
+
chat: "/v1/chat/completions",
|
|
613165
|
+
models: "/v1/models",
|
|
613166
|
+
embeddings: "/v1/embeddings"
|
|
613162
613167
|
},
|
|
613163
613168
|
auth: bearerAuth(true, "sk-or-"),
|
|
613164
613169
|
capabilities: OPENAI_CAPABILITIES,
|
|
@@ -747864,6 +747869,30 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
747864
747869
|
const provider = transport.descriptor;
|
|
747865
747870
|
const backendType = transport.protocol === "ollama" ? "ollama" : "vllm";
|
|
747866
747871
|
const persistedProviderId = transport.providerId === "custom" ? "" : transport.providerId;
|
|
747872
|
+
const promptForApiKey = async () => {
|
|
747873
|
+
if (!ctx3.rl) {
|
|
747874
|
+
return void 0;
|
|
747875
|
+
}
|
|
747876
|
+
return new Promise((resolve89) => {
|
|
747877
|
+
ctx3.rl.question(`${provider.label} API key: `, (value2) => {
|
|
747878
|
+
resolve89(value2.trim() || void 0);
|
|
747879
|
+
});
|
|
747880
|
+
});
|
|
747881
|
+
};
|
|
747882
|
+
if (provider.auth.required && !apiKey) {
|
|
747883
|
+
const entered = await promptForApiKey();
|
|
747884
|
+
if (!entered?.trim()) {
|
|
747885
|
+
if (ctx3.rl) {
|
|
747886
|
+
renderError(`${provider.label} requires an API key.`);
|
|
747887
|
+
} else {
|
|
747888
|
+
renderError(
|
|
747889
|
+
`${provider.label} requires an API key. Re-run as: /endpoint ${url} --auth <key>`
|
|
747890
|
+
);
|
|
747891
|
+
}
|
|
747892
|
+
return;
|
|
747893
|
+
}
|
|
747894
|
+
apiKey = entered.trim();
|
|
747895
|
+
}
|
|
747867
747896
|
process.stdout.write(`
|
|
747868
747897
|
${c3.dim("Detected:")} ${c3.bold(provider.label)}
|
|
747869
747898
|
`);
|
|
@@ -802661,8 +802690,12 @@ async function switchEndpoint() {
|
|
|
802661
802690
|
window.__omniusSelectedConfigProvider || settingsProviderIdForUrl(url),
|
|
802662
802691
|
);
|
|
802663
802692
|
if (!url) return;
|
|
802693
|
+
if (provider && provider.requiresAuth && !auth && !window.__omniusAuthAlreadySet) {
|
|
802694
|
+
alert(provider.label + ' requires an auth key.');
|
|
802695
|
+
return;
|
|
802696
|
+
}
|
|
802664
802697
|
try {
|
|
802665
|
-
await fetch('/v1/config/endpoint', {
|
|
802698
|
+
const response = await fetch('/v1/config/endpoint', {
|
|
802666
802699
|
method: 'PUT', headers: headers(),
|
|
802667
802700
|
body: JSON.stringify({
|
|
802668
802701
|
url,
|
|
@@ -802672,6 +802705,12 @@ async function switchEndpoint() {
|
|
|
802672
802705
|
providerProtocol: settingsProviderProtocol(provider),
|
|
802673
802706
|
}),
|
|
802674
802707
|
});
|
|
802708
|
+
if (!response.ok) {
|
|
802709
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
802710
|
+
const message = errorBody.error || errorBody.message || 'Request failed';
|
|
802711
|
+
alert('Could not switch endpoint: ' + message);
|
|
802712
|
+
return;
|
|
802713
|
+
}
|
|
802675
802714
|
loadConfig();
|
|
802676
802715
|
loadModels(); // refresh model list from new endpoint
|
|
802677
802716
|
} catch {}
|
|
@@ -807346,6 +807385,11 @@ async function saveSettingsConnections() {
|
|
|
807346
807385
|
window.__omniusSelectedProviderModule ||
|
|
807347
807386
|
settingsProviderIdForUrl(body.url),
|
|
807348
807387
|
);
|
|
807388
|
+
if (provider?.requiresAuth && (!auth || !auth.value) && !window.__omniusAuthAlreadySet) {
|
|
807389
|
+
status.textContent = '✗ this endpoint requires an auth key';
|
|
807390
|
+
status.style.color = 'var(--color-warning)';
|
|
807391
|
+
return;
|
|
807392
|
+
}
|
|
807349
807393
|
if (bt && bt.value && bt.value !== 'unknown') body.backendType = bt.value;
|
|
807350
807394
|
if (provider && provider.id !== 'custom') body.providerId = provider.id;
|
|
807351
807395
|
body.providerProtocol = settingsProviderProtocol(provider);
|
|
@@ -814848,20 +814892,42 @@ async function handlePutConfigEndpoint(req3, res) {
|
|
|
814848
814892
|
});
|
|
814849
814893
|
return;
|
|
814850
814894
|
}
|
|
814895
|
+
const requestedAuth = typeof requestBody["auth"] === "string" ? requestBody["auth"].trim() : "";
|
|
814896
|
+
const previousConfig = loadConfig();
|
|
814897
|
+
let previousAuth = "";
|
|
814898
|
+
if (previousConfig.apiKey) {
|
|
814899
|
+
try {
|
|
814900
|
+
const previousEndpoint = canonicalEndpointInput(
|
|
814901
|
+
previousConfig.backendUrl,
|
|
814902
|
+
previousConfig.backendType
|
|
814903
|
+
);
|
|
814904
|
+
if (previousEndpoint.url === endpoint.url) previousAuth = previousConfig.apiKey;
|
|
814905
|
+
} catch {
|
|
814906
|
+
const previousBackendUrl = previousConfig.backendUrl ? normalizeLocalhostForDaemon(previousConfig.backendUrl) : "";
|
|
814907
|
+
if (previousBackendUrl === endpoint.url) {
|
|
814908
|
+
previousAuth = previousConfig.apiKey;
|
|
814909
|
+
}
|
|
814910
|
+
}
|
|
814911
|
+
}
|
|
814912
|
+
if (endpoint.provider.auth.required && !requestedAuth && !previousAuth?.trim()) {
|
|
814913
|
+
jsonResponse(res, 400, {
|
|
814914
|
+
error: "auth_required",
|
|
814915
|
+
message: `${endpoint.provider.label} requires an API key to connect.`
|
|
814916
|
+
});
|
|
814917
|
+
return;
|
|
814918
|
+
}
|
|
814851
814919
|
const settings = {
|
|
814852
814920
|
backendUrl: endpoint.url,
|
|
814853
814921
|
backendType: endpoint.backendType,
|
|
814854
814922
|
providerProtocol: endpoint.protocol,
|
|
814855
814923
|
providerId: endpoint.providerId
|
|
814856
814924
|
};
|
|
814857
|
-
if (
|
|
814858
|
-
settings.apiKey = requestBody["auth"];
|
|
814925
|
+
if (requestedAuth) settings.apiKey = requestedAuth;
|
|
814859
814926
|
setConfigValue("backendUrl", endpoint.url);
|
|
814860
814927
|
setConfigValue("backendType", endpoint.backendType);
|
|
814861
814928
|
setConfigValue("providerProtocol", endpoint.protocol);
|
|
814862
814929
|
setConfigValue("providerId", endpoint.providerId);
|
|
814863
|
-
if (
|
|
814864
|
-
setConfigValue("apiKey", requestBody["auth"]);
|
|
814930
|
+
if (requestedAuth) setConfigValue("apiKey", requestedAuth);
|
|
814865
814931
|
saveGlobalSettings(settings);
|
|
814866
814932
|
try {
|
|
814867
814933
|
const meta = {
|
|
@@ -814870,9 +814936,10 @@ async function handlePutConfigEndpoint(req3, res) {
|
|
|
814870
814936
|
providerProtocol: endpoint.protocol,
|
|
814871
814937
|
providerId: endpoint.providerId
|
|
814872
814938
|
};
|
|
814873
|
-
|
|
814874
|
-
|
|
814875
|
-
meta.
|
|
814939
|
+
const authForHistory = requestedAuth || previousAuth;
|
|
814940
|
+
if (authForHistory) {
|
|
814941
|
+
meta.authHint = authForHistory.slice(0, 4) + "…";
|
|
814942
|
+
meta.authKey = authForHistory;
|
|
814876
814943
|
}
|
|
814877
814944
|
recordUsage("endpoint", endpoint.url, { meta });
|
|
814878
814945
|
} catch {
|
package/dist/library.js
CHANGED
|
@@ -400,11 +400,11 @@ var registrations = [
|
|
|
400
400
|
label: "OpenRouter",
|
|
401
401
|
protocol: "openai-chat",
|
|
402
402
|
local: false,
|
|
403
|
-
apiPrefix: "/
|
|
403
|
+
apiPrefix: "/v1",
|
|
404
404
|
paths: {
|
|
405
|
-
chat: "/
|
|
406
|
-
models: "/
|
|
407
|
-
embeddings: "/
|
|
405
|
+
chat: "/v1/chat/completions",
|
|
406
|
+
models: "/v1/models",
|
|
407
|
+
embeddings: "/v1/embeddings"
|
|
408
408
|
},
|
|
409
409
|
auth: bearerAuth(true, "sk-or-"),
|
|
410
410
|
capabilities: OPENAI_CAPABILITIES,
|
|
@@ -750,10 +750,15 @@ function serviceBaseForKnown(rawUrl, provider) {
|
|
|
750
750
|
...Object.values(provider.paths).filter((value) => typeof value === "string"),
|
|
751
751
|
provider.apiPrefix
|
|
752
752
|
].filter(Boolean).sort((left, right) => right.length - left.length);
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
let stripped = true;
|
|
754
|
+
while (stripped && path) {
|
|
755
|
+
stripped = false;
|
|
756
|
+
for (const suffix of suffixes) {
|
|
757
|
+
if (path.toLowerCase().endsWith(suffix.toLowerCase())) {
|
|
758
|
+
path = normalizePath(path.slice(0, -suffix.length));
|
|
759
|
+
stripped = true;
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
757
762
|
}
|
|
758
763
|
}
|
|
759
764
|
return withoutTrailingSlash(`${url.origin}${path}`);
|
package/docs/DISCOVERY.json
CHANGED
|
@@ -31348,9 +31348,9 @@
|
|
|
31348
31348
|
],
|
|
31349
31349
|
"auth": "Bearer",
|
|
31350
31350
|
"paths": {
|
|
31351
|
-
"chat": "/
|
|
31352
|
-
"models": "/
|
|
31353
|
-
"embeddings": "/
|
|
31351
|
+
"chat": "/v1/chat/completions",
|
|
31352
|
+
"models": "/v1/models",
|
|
31353
|
+
"embeddings": "/v1/embeddings"
|
|
31354
31354
|
},
|
|
31355
31355
|
"maturity": "stable",
|
|
31356
31356
|
"protocol": "openai-chat",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.612",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.612",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
|
@@ -1757,12 +1757,12 @@
|
|
|
1757
1757
|
}
|
|
1758
1758
|
},
|
|
1759
1759
|
"node_modules/@noble/curves": {
|
|
1760
|
-
"version": "2.
|
|
1761
|
-
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.
|
|
1762
|
-
"integrity": "sha512-
|
|
1760
|
+
"version": "2.3.0",
|
|
1761
|
+
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.3.0.tgz",
|
|
1762
|
+
"integrity": "sha512-v7cY+4oWYPQszRj6ZFGzTVL7uP2TaLo1xMhWHzYC5wj0ZhOXQ5x+sBre8rF3hi8cAoi0bh1qXoovoOkdFtvqEg==",
|
|
1763
1763
|
"license": "MIT",
|
|
1764
1764
|
"dependencies": {
|
|
1765
|
-
"@noble/hashes": "2.
|
|
1765
|
+
"@noble/hashes": "2.3.0"
|
|
1766
1766
|
},
|
|
1767
1767
|
"engines": {
|
|
1768
1768
|
"node": ">= 20.19.0"
|
|
@@ -1772,9 +1772,9 @@
|
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
"node_modules/@noble/hashes": {
|
|
1775
|
-
"version": "2.
|
|
1776
|
-
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.
|
|
1777
|
-
"integrity": "sha512-
|
|
1775
|
+
"version": "2.3.0",
|
|
1776
|
+
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.3.0.tgz",
|
|
1777
|
+
"integrity": "sha512-oN+QwyX7VSHotibwubG3kpzbwKrfnyR6OOO+3Nk/53ADL7FmgHHz4TgrbaYKvvOw09u6QTx0oiH1cNCIOuN0CQ==",
|
|
1778
1778
|
"license": "MIT",
|
|
1779
1779
|
"engines": {
|
|
1780
1780
|
"node": ">= 20.19.0"
|
|
@@ -3107,22 +3107,28 @@
|
|
|
3107
3107
|
}
|
|
3108
3108
|
},
|
|
3109
3109
|
"node_modules/core-js": {
|
|
3110
|
-
"version": "3.
|
|
3111
|
-
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.
|
|
3112
|
-
"integrity": "sha512-
|
|
3110
|
+
"version": "3.50.0",
|
|
3111
|
+
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.50.0.tgz",
|
|
3112
|
+
"integrity": "sha512-BRWgOLKkFeCgRudR6zrs8p9XJZcE14grzKMMssoYrk6krtuEZ7MTKPIY5RzOnqsEKIR9kst7wNzphttraT+Yqw==",
|
|
3113
3113
|
"hasInstallScript": true,
|
|
3114
3114
|
"license": "MIT",
|
|
3115
|
+
"engines": {
|
|
3116
|
+
"node": "*"
|
|
3117
|
+
},
|
|
3115
3118
|
"funding": {
|
|
3116
3119
|
"type": "opencollective",
|
|
3117
3120
|
"url": "https://opencollective.com/core-js"
|
|
3118
3121
|
}
|
|
3119
3122
|
},
|
|
3120
3123
|
"node_modules/core-js-pure": {
|
|
3121
|
-
"version": "3.
|
|
3122
|
-
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.
|
|
3123
|
-
"integrity": "sha512-
|
|
3124
|
+
"version": "3.50.0",
|
|
3125
|
+
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.50.0.tgz",
|
|
3126
|
+
"integrity": "sha512-6GP3Pxz4IKyWjAfa747vIu/jilB5z29JWROLqH/b+pXVcpgh6tM06ZIBwSuglgVqzDYURhOK6oEzTrG0bCHitA==",
|
|
3124
3127
|
"hasInstallScript": true,
|
|
3125
3128
|
"license": "MIT",
|
|
3129
|
+
"engines": {
|
|
3130
|
+
"node": "*"
|
|
3131
|
+
},
|
|
3126
3132
|
"funding": {
|
|
3127
3133
|
"type": "opencollective",
|
|
3128
3134
|
"url": "https://opencollective.com/core-js"
|
|
@@ -3163,6 +3169,7 @@
|
|
|
3163
3169
|
"version": "4.2.0",
|
|
3164
3170
|
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
|
3165
3171
|
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
|
3172
|
+
"deprecated": "Active development of CryptoJS has been discontinued. This library is no longer maintained.",
|
|
3166
3173
|
"license": "MIT"
|
|
3167
3174
|
},
|
|
3168
3175
|
"node_modules/datastore-core": {
|
|
@@ -6165,9 +6172,9 @@
|
|
|
6165
6172
|
}
|
|
6166
6173
|
},
|
|
6167
6174
|
"node_modules/pvutils": {
|
|
6168
|
-
"version": "1.
|
|
6169
|
-
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.
|
|
6170
|
-
"integrity": "sha512-
|
|
6175
|
+
"version": "1.2.0",
|
|
6176
|
+
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.2.0.tgz",
|
|
6177
|
+
"integrity": "sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==",
|
|
6171
6178
|
"license": "MIT",
|
|
6172
6179
|
"engines": {
|
|
6173
6180
|
"node": ">=16.0.0"
|
package/package.json
CHANGED