@acosmi/sdk-ts 2.2.1 → 2.4.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/CHANGELOG.md +29 -0
- package/README.md +3 -1
- package/dist/browser/index.mjs +4 -1
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +4 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +21 -1
- package/dist/node/index.d.ts +21 -1
- package/dist/node/index.mjs +4 -1
- package/dist/node/index.mjs.map +1 -1
- package/docs//345/274/200/345/217/221/344/270/216/345/217/221/345/270/203/346/211/213/345/206/214.md +1 -1
- package/package.json +1 -1
package/dist/node/index.d.cts
CHANGED
|
@@ -638,6 +638,23 @@ interface Config {
|
|
|
638
638
|
* `client.compliance.*`,不与既有模型网关 API 冲突。
|
|
639
639
|
*/
|
|
640
640
|
complianceBaseURL?: string;
|
|
641
|
+
/**
|
|
642
|
+
* `/api/v4` 网关调用 (managed-model / agent-run / casehall 等) 的 base 覆盖。
|
|
643
|
+
*
|
|
644
|
+
* 未配置时默认 = `serverURL`(既有行为,所有既有消费方不受影响)。
|
|
645
|
+
*
|
|
646
|
+
* 用途:浏览器部署在**非网关同源**域名(如 sign.zhonglvbao.com)时,网关
|
|
647
|
+
* acosmi.com 对带 `Origin` 头的跨域浏览器请求返 403(CORS 收紧)。把本字段设为
|
|
648
|
+
* 同源代理 base(如 `window.location.origin`)、并在该域名 nginx 加
|
|
649
|
+
* `location /api/v4/ { proxy_pass https://acosmi.com/api/v4/; proxy_set_header Origin ""; }`
|
|
650
|
+
* 服务端转发,即可让浏览器侧 casehall / 网关调用走同源 → nginx 服务端转发 →
|
|
651
|
+
* 规避跨域 403。仅设在**浏览器端** client;服务端 (Route Handler) client 不设本字段,
|
|
652
|
+
* 直连 `serverURL` 即可(服务端到 acosmi.com 无跨域)。
|
|
653
|
+
*
|
|
654
|
+
* 与 `complianceBaseURL` 同构(compliance 走 `/admin-api`,本字段走 `/api/v4`)。
|
|
655
|
+
* apiURL() 仍按需追加 `/api/v4`,调用方无需手动拼。
|
|
656
|
+
*/
|
|
657
|
+
apiBaseURL?: string;
|
|
641
658
|
/**
|
|
642
659
|
* OAuth metadata profile — 决定 `ensureToken` 刷新 token 时
|
|
643
660
|
* 发现 metadata 走哪个 well-known 端点。
|
|
@@ -693,6 +710,8 @@ declare class Client {
|
|
|
693
710
|
serverURL: string;
|
|
694
711
|
/** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
|
|
695
712
|
complianceBaseURL: string | null;
|
|
713
|
+
/** `/api/v4` 网关调用 base 覆盖 (已 trim 尾随 /); null = 走默认 serverURL */
|
|
714
|
+
apiBaseURL: string | null;
|
|
696
715
|
/** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
|
|
697
716
|
oauthMetadataProfile: OAuthMetadataProfile;
|
|
698
717
|
/** Browser Web OAuth refresh strategy (default 'direct') */
|
|
@@ -1701,7 +1720,8 @@ interface SkillStoreItem {
|
|
|
1701
1720
|
scope: string;
|
|
1702
1721
|
status: string;
|
|
1703
1722
|
downloadCount: number;
|
|
1704
|
-
readme
|
|
1723
|
+
readme?: string;
|
|
1724
|
+
skillMd?: string;
|
|
1705
1725
|
tags: string[];
|
|
1706
1726
|
author: string;
|
|
1707
1727
|
publisherId: string;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -638,6 +638,23 @@ interface Config {
|
|
|
638
638
|
* `client.compliance.*`,不与既有模型网关 API 冲突。
|
|
639
639
|
*/
|
|
640
640
|
complianceBaseURL?: string;
|
|
641
|
+
/**
|
|
642
|
+
* `/api/v4` 网关调用 (managed-model / agent-run / casehall 等) 的 base 覆盖。
|
|
643
|
+
*
|
|
644
|
+
* 未配置时默认 = `serverURL`(既有行为,所有既有消费方不受影响)。
|
|
645
|
+
*
|
|
646
|
+
* 用途:浏览器部署在**非网关同源**域名(如 sign.zhonglvbao.com)时,网关
|
|
647
|
+
* acosmi.com 对带 `Origin` 头的跨域浏览器请求返 403(CORS 收紧)。把本字段设为
|
|
648
|
+
* 同源代理 base(如 `window.location.origin`)、并在该域名 nginx 加
|
|
649
|
+
* `location /api/v4/ { proxy_pass https://acosmi.com/api/v4/; proxy_set_header Origin ""; }`
|
|
650
|
+
* 服务端转发,即可让浏览器侧 casehall / 网关调用走同源 → nginx 服务端转发 →
|
|
651
|
+
* 规避跨域 403。仅设在**浏览器端** client;服务端 (Route Handler) client 不设本字段,
|
|
652
|
+
* 直连 `serverURL` 即可(服务端到 acosmi.com 无跨域)。
|
|
653
|
+
*
|
|
654
|
+
* 与 `complianceBaseURL` 同构(compliance 走 `/admin-api`,本字段走 `/api/v4`)。
|
|
655
|
+
* apiURL() 仍按需追加 `/api/v4`,调用方无需手动拼。
|
|
656
|
+
*/
|
|
657
|
+
apiBaseURL?: string;
|
|
641
658
|
/**
|
|
642
659
|
* OAuth metadata profile — 决定 `ensureToken` 刷新 token 时
|
|
643
660
|
* 发现 metadata 走哪个 well-known 端点。
|
|
@@ -693,6 +710,8 @@ declare class Client {
|
|
|
693
710
|
serverURL: string;
|
|
694
711
|
/** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
|
|
695
712
|
complianceBaseURL: string | null;
|
|
713
|
+
/** `/api/v4` 网关调用 base 覆盖 (已 trim 尾随 /); null = 走默认 serverURL */
|
|
714
|
+
apiBaseURL: string | null;
|
|
696
715
|
/** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
|
|
697
716
|
oauthMetadataProfile: OAuthMetadataProfile;
|
|
698
717
|
/** Browser Web OAuth refresh strategy (default 'direct') */
|
|
@@ -1701,7 +1720,8 @@ interface SkillStoreItem {
|
|
|
1701
1720
|
scope: string;
|
|
1702
1721
|
status: string;
|
|
1703
1722
|
downloadCount: number;
|
|
1704
|
-
readme
|
|
1723
|
+
readme?: string;
|
|
1724
|
+
skillMd?: string;
|
|
1705
1725
|
tags: string[];
|
|
1706
1726
|
author: string;
|
|
1707
1727
|
publisherId: string;
|
package/dist/node/index.mjs
CHANGED
|
@@ -2079,6 +2079,8 @@ var Client = class _Client {
|
|
|
2079
2079
|
serverURL;
|
|
2080
2080
|
/** Compliance API 根地址 (已 trim 尾随 /); null = 走默认 ${serverURL}/admin-api */
|
|
2081
2081
|
complianceBaseURL;
|
|
2082
|
+
/** `/api/v4` 网关调用 base 覆盖 (已 trim 尾随 /); null = 走默认 serverURL */
|
|
2083
|
+
apiBaseURL;
|
|
2082
2084
|
/** OAuth metadata profile — 刷新 token 时发现 metadata 用 (默认 'desktop') */
|
|
2083
2085
|
oauthMetadataProfile;
|
|
2084
2086
|
/** Browser Web OAuth refresh strategy (default 'direct') */
|
|
@@ -2120,6 +2122,7 @@ var Client = class _Client {
|
|
|
2120
2122
|
const picked = pickAndNormalizeGatewayURL(cfg);
|
|
2121
2123
|
this.serverURL = picked ?? DEFAULT_GATEWAY_BASE_URL;
|
|
2122
2124
|
this.complianceBaseURL = cfg.complianceBaseURL ? cfg.complianceBaseURL.replace(/\/+$/, "") : null;
|
|
2125
|
+
this.apiBaseURL = cfg.apiBaseURL ? cfg.apiBaseURL.replace(/\/+$/, "") : null;
|
|
2123
2126
|
this.oauthMetadataProfile = cfg.oauthMetadataProfile ?? "desktop";
|
|
2124
2127
|
this.browserRefreshMode = cfg.browserRefreshMode ?? "direct";
|
|
2125
2128
|
this.refreshProxyURL = cfg.refreshProxyURL ?? null;
|
|
@@ -3046,7 +3049,7 @@ var Client = class _Client {
|
|
|
3046
3049
|
// Internal HTTP
|
|
3047
3050
|
// ===========================================================================
|
|
3048
3051
|
apiURL(path) {
|
|
3049
|
-
let base = this.serverURL;
|
|
3052
|
+
let base = this.apiBaseURL ?? this.serverURL;
|
|
3050
3053
|
if (!base.endsWith("/api/v4")) {
|
|
3051
3054
|
base += "/api/v4";
|
|
3052
3055
|
}
|