@acosmi/sdk-ts 2.16.0 → 2.18.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 +26 -0
- package/README.md +23 -2
- package/dist/browser/index.mjs +30 -4
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +30 -4
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs.map +1 -1
- package/dist/node/adapters/anthropic.d.cts +1 -1
- package/dist/node/adapters/anthropic.d.ts +1 -1
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +2 -2
- package/dist/node/adapters/openai.d.ts +2 -2
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/{index-yOZUFtNQ.d.cts → index-C2oh157O.d.cts} +7 -0
- package/dist/node/{index-yOZUFtNQ.d.ts → index-C2oh157O.d.ts} +7 -0
- package/dist/node/index.cjs +31 -3
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +21 -7
- package/dist/node/index.d.ts +21 -7
- package/dist/node/index.mjs +30 -4
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{openai-DuQHy2AA.d.ts → openai-Cyvi8g6B.d.ts} +1 -1
- package/dist/node/{openai-B6mz3cyj.d.cts → openai-DR_KhEdM.d.cts} +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 +6 -4
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ All notable changes to `@acosmi/sdk-ts` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.18.0] - 2026-08-29 — `ManagedModel.thinking_levels` 类型面对齐
|
|
9
|
+
|
|
10
|
+
网关 `ManagedModelPublicResponse` 新增 `thinking_levels: []string`(升序档位 id,按「admin 声明 ∩ wire 层真投递」读时派生)。`listModels` / `listModelsWithStatus` 对 `ManagedModel` 本就原样透传(唯一归一化是 `input_modalities` → `inputModalities`),所以本版**只补类型面与文档**,零运行时改动。
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`ManagedModel.thinking_levels?: string[]`** —— 该模型可选的思考深度档位 id,取值是 `ThinkingOff` / `ThinkingHigh` / `ThinkingMax`(`'off'` / `'high'` / `'max'`)的子集。字段名保持 wire snake_case,与同结构的 `supported_formats` / `preferred_format` 同风格(见 `src/models/types.ts` 文件头命名约定)。三态语义写进 JSDoc 与 README:`[]` = 该模型没有思考档(不渲染档位选择);`undefined` = 上游未播报(旧网关),调用方必须按"未知"处理,**严禁**回落到自己推档或按模型名 substring 猜。公开方法签名零移除、零改名,旧调用方逐字节兼容。
|
|
15
|
+
|
|
16
|
+
### 回归闸门
|
|
17
|
+
|
|
18
|
+
- `test/list-models-thinking-levels.test.ts` —— `listModels` / `listModelsWithStatus` 在 `thinking_levels: ['off','high','max']`、单档子集、`[]`、字段缺失四种 payload 下的原样可读性;含"`[]` 与 `undefined` 不可互换"的正向对照(防把空数组当缺失处理的读侧漂移),以及"不因新字段而误伤 `inputModalities` 归一化"的共存用例。
|
|
19
|
+
|
|
20
|
+
## [2.17.0] - 2026-08-15 — 桌面 loopback OAuth state 全路径闸 + 端口确定性关闭
|
|
21
|
+
|
|
22
|
+
**回环监听在整个登录期间对本机任意进程开放,state 是唯一的门。** 2.16.0 及更早版本的桌面 loopback `authorize` 不生成也不校验 OAuth `state`(`af2daa0b` 已在源码补上核心校验,但从未发版);且校验只覆盖"带 code"的回调 —— 携带 OAuth error 的回调**绕过 state 直接把登录结算成"用户已拒绝"**,本机恶意进程不猜任何秘密就能打断/塑形一次等待中的登录;重复 `state` 参数取首值即可蒙混(`?code=攻击者的码&state=<正确值>&state=x` 在旧实现下**成功登录到攻击者会话**)。本版把 state 校验提到 `/callback` 所有形态之前,并收紧为"恰好一个"。
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **`/callback` 全形态 state 先行校验** —— 成功回调、OAuth error 回调、畸形回调一律先验 state 再消费 code / 结算 denied。缺失、重复(含重复的正确值)、错值均以稳定错误码 `state_mismatch` 拒绝本次登录、返回安全失败页并关闭 listener;错误信息只描述形态,不回显 code / state / token / 完整 callback query。
|
|
27
|
+
- **"恰好一个 state"** —— `searchParams.getAll('state').length === 1` 且严格等值;重复参数不再因 `get()` 取首值而通过。
|
|
28
|
+
- **端口确定性关闭** —— `finally` 里在 `server.close()` 后补 `closeIdleConnections?.()`:Node 18 上 `close()` 不关浏览器残留的 idle keep-alive 连接,端口会滞留到对端松手;现在每条终止路径(成功 / 各类 state 失败 / 用户拒绝 / 超时 / 取消 / 浏览器打开失败)都以端口完全关闭收尾。
|
|
29
|
+
|
|
30
|
+
### 回归闸门
|
|
31
|
+
|
|
32
|
+
- `test/auth/desktop-loopback-state.test.ts` —— 十路终止矩阵:成功、缺失 state、错误 state、重复 state(异值与同值)、恶意先到回调后合法回调不能复活、用户拒绝(正确 state + OAuth error → `auth_denied`)、超时、取消(pre-aborted signal)、浏览器打开失败后手动回调仍可完成;每条路径断言**只结算一次**(事件流恰一条 error / 结果不可翻转)且**新连接最终被拒**(listener teardown)。对 2.16.0 实测:4 条缺口用例全红(其中"重复 state 首值正确"在旧实现下以攻击者 code 成功 resolve),6 条保行为用例双版本皆绿。
|
|
33
|
+
|
|
8
34
|
## [2.16.0] - 2026-08-06 — chat 超时预算真正下传 + 流式活性回调
|
|
9
35
|
|
|
10
36
|
**一个预算只有在被传下去时才存在。** `chat` / `chatMessagesAnthropic` / `chatMessagesOpenAI` 三条推理链路都用 `withRequestTimeout(CHAT_REQUEST_TIMEOUT_MS)` 建了 11 分钟的外层预算,却只把 `ctl.signal` 传给 `doJSONFullRaw` —— 后者的 `timeoutMs` 形参有 **30 秒**默认值,会**另建**一个计时器并恒先于外层触发。于是 v1.6.0 那次"调整为 11min 以容纳 DeepSeek 保活窗口"的改动,**一天都没生效过**,而它上方的注释还在声称它已生效。
|
package/README.md
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
## 状态
|
|
8
8
|
|
|
9
9
|
- **主实现 / 事实标准**:本 TS SDK 现为 Acosmi SDK 的主力实现。Go SDK [acosmi-sdk-go](https://github.com/acosmi/acosmi-sdk-go) 已暂停维护,待 TS 稳定后再从 TS 反向翻译补齐。
|
|
10
|
-
- **当前版本:`2.
|
|
10
|
+
- **当前版本:`2.18.0`**(`ManagedModel.thinking_levels` 类型面对齐,2026-08-29)。
|
|
11
|
+
- **`v2.18.0`(加性类型发布)**:`ManagedModel` 新增可选字段 `thinking_levels?: string[]` —— 网关下发的**升序思考档位 id 列表**(`ThinkingOff`/`ThinkingHigh`/`ThinkingMax` 的子集)。`listModels` 对它原样透传,公开签名向后兼容、零行为变化;`[]` = 该模型无思考档,`undefined` = 旧网关未播报(按"未知"处理,严禁自行推档)。详见〈思考档位 `thinking_levels`〉。
|
|
12
|
+
- **`v2.17.0`(安全修复发布)**:桌面 loopback `authorize()` 对 `/callback` 的**一切形态**(成功 / OAuth error / 畸形)先行校验 CSRF `state`,且必须"恰好一个"并严格等值 —— 缺失、重复(含重复的正确值)、错值一律以稳定错误码 `state_mismatch` 拒绝本次登录;此前携带 OAuth error 的回调绕过 state 直接结算 `auth_denied`,本机任意进程零知识即可打断/塑形等待中的登录,且 `?code=…&state=<正确值>&state=x` 这类重复参数可蒙混通过。`finally` 补 `closeIdleConnections()`,每条终止路径以端口完全关闭收尾。公开 API 签名零变化;回归闸门 `test/auth/desktop-loopback-state.test.ts` 十路终止矩阵。
|
|
11
13
|
- **`v2.15.0`(加性兼容发布)**:新增 `classifySourcesEvent()`、`SourcesEventParseResult` 与稳定 issue code,把 `not_sources`、合法 `empty_sources`、非空 `sources`、`malformed_sources` 明确分开。既有 `parseSourcesEvent()` 的代码路径、宽松判定、`null` 条件和返回对象形状保持原样;现有 consumer 无需改动,新 consumer 才选择严格 API。
|
|
12
14
|
- **`v2.6.0`(会员订阅查询 + 类型修正,2026-06-04)**:新增 `subscription.getMembership()` / `getSubscriptionTier()` / `subscriptionPrecheck()`;`ManagedModel` 补档位门控字段(`locked`/`freeTier`/`minPlanTier`/`chatRuntimeSupported`/`defaultToolIds`);auth 新增 `ScopeChatBridge`(+read/write/rotate) 与 `chatBridgeScopes()`。**破坏性类型修正**:`BalanceDetail` 形状对齐网关 `InternalBalanceResponse`、`Order` 拆为 `BuyResponse`/`OrderListItem`、`getOrderStatus`/`waitForPayment` 改用 `BuyResponse.paymentStatus`(修死循环)、`PayPayload.payMethod`→`paymentMethod`、`TokenPackage` 对齐 `toProductView`、`WalletStats`/`Transaction` `amount` 由 string 改 number、consume-records 分页修正、notifications WebSocket 用一次性 `stream-ticket` 取代 URL `?token=` JWT。废弃 `listUserSubscriptions`(改用 `getMembership`)、`ModelCoefficient`/`listCoefficients`(系数退役恒空)、`ManagedModel.pricePerMTok`/`isDefault`(公开端点不返回);notifications 设备/偏好方法标 `@experimental`。详见 CHANGELOG。
|
|
13
15
|
- **`v2.5.1`(格式一致性护栏,2026-05-31)**:`getAdapterForModel` 路由加固 —— `preferred_format` 现仅在**确被 `supported_formats` 收录**时才采信(或 `supported_formats` 未声明时维持原样)。防止上游元数据漂移(如 `preferred_format=anthropic` 但 `supported_formats=[openai]`)把 SDK 路由到模型并不支持的格式端点,撞 `/anthropic`「未绑定 Anthropic」4xx。`supported_formats` 为空/未知(旧上游)时**行为逐字节不变**。新增 3 条 routing 用例钉死矛盾场景。
|
|
@@ -176,6 +178,21 @@ console.log(res.videoUrl); // VideoTaskResponse: taskId / status / videoUrl / er
|
|
|
176
178
|
|
|
177
179
|
> 字段是网关**通用契约**;某厂商支持哪些取值由上游模型决定(如万相尺寸 `宽*高` 星号格式由网关代转)。网关适配范围:OpenAI 兼容图片 + 火山引擎(即梦/豆包)视频 + DashScope 通义万相(wanx)原生异步任务(图片+视频)。
|
|
178
180
|
|
|
181
|
+
## 思考档位 `thinking_levels`(v2.18+)
|
|
182
|
+
|
|
183
|
+
`ManagedModel.thinking_levels?: string[]` —— 该模型**可选的思考深度档位 id**,升序下发,取值是 `ThinkingOff` / `ThinkingHigh` / `ThinkingMax`(`'off'` / `'high'` / `'max'`)的子集。网关按「admin 声明 ∩ wire 层真投递」读时派生;`listModels` 对它**原样透传**(与 `supported_formats` / `preferred_format` 同为 wire snake_case,不做 camelCase 重映射)。
|
|
184
|
+
|
|
185
|
+
**三态必须分开处理 —— `[]` 与 `undefined` 不是同一件事**:
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
const m = (await client.listModels()).find((x) => x.id === modelId)!;
|
|
189
|
+
if (m.thinking_levels === undefined) renderThinkingUnknown(); // 旧网关未播报 → 按"未知"处理
|
|
190
|
+
else if (m.thinking_levels.length === 0) hideThinkingPicker(); // 该模型没有思考档 → 不渲染档位选择
|
|
191
|
+
else renderThinkingPicker(m.thinking_levels); // 升序档位, 原样渲染
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
缺失时**严禁**自己推档或按模型名 substring 猜 —— 档位值域归网关模型目录所有,靠运营动作扩张,不靠发 SDK 新版(同 `inputModalities` 开放值域的教训,见 v2.14.0)。该字段与 `capabilities.supports_thinking` / `supports_max_effort` 是**正交**两件事:后者描述模型有无该能力,前者描述**这条链路上此刻真能选哪几档**。
|
|
195
|
+
|
|
179
196
|
## 向量 / 重排序(托管模型网关,v2.9+)
|
|
180
197
|
|
|
181
198
|
向量(embedding)与重排序(rerank)走与 chat 同一套**会员计费**(Hold→Settle→Release,按 `total_tokens` 套 input 费率),上游接阿里云百炼 DashScope。仅 `capabilities.supports_embedding` / `supports_rerank` 的托管模型可用;具体上游模型名由管理员在后台自填。
|
|
@@ -602,6 +619,8 @@ const tokens = newTokenSet(tokenResp, reg.client_id, process.env.ACOSMI_SERVER_U
|
|
|
602
619
|
await new FileTokenStore('./tokens.json').save(tokens);
|
|
603
620
|
```
|
|
604
621
|
|
|
622
|
+
> **state 语义(v2.17.0 起)**:桌面 loopback 流程自动生成 32 字节随机 `state` 并对 `/callback` 的一切形态先行校验 —— 恰好一个且严格等值,缺失 / 重复 / 错值一律以错误码 `state_mismatch` 拒绝本次登录并关闭 listener(含携带 OAuth error 的回调;用户真拒绝须回传正确 state 才结算为 `auth_denied`)。调用方零改动:`state` 由 SDK 内部管理,不出现在 `authorize()` 的公开签名里。授权服务器按 RFC 6749 §4.1.2.1 在**错误响应**上也必须原样回传 `state`(Acosmi 官方 consent 页已适配)。
|
|
623
|
+
>
|
|
605
624
|
> 浏览器侧(无法启 loopback HTTP server)请改用 v1.4.0+ Web OAuth 原语 `discoverWebOAuthMetadata` + `registerWebOAuthClient` + `createWebAuthorizationRequest` + `completeWebAuthorizationRequest`,由调用方实现 popup / 同窗口 redirect handler,SDK 负责 PKCE / state 校验 / token 兑换。
|
|
606
625
|
|
|
607
626
|
### Token 持久化
|
|
@@ -1124,7 +1143,9 @@ npm run docs # 经 TypeDoc 生成 API 参考到 docs/api/
|
|
|
1124
1143
|
|
|
1125
1144
|
| 版本 | 状态 | 概要 |
|
|
1126
1145
|
| --- | --- | --- |
|
|
1127
|
-
| 2.
|
|
1146
|
+
| 2.18.0 | **当前版本** | **`ManagedModel.thinking_levels` 类型面对齐(2026-08-29)**。加性新增可选字段 `thinking_levels?: string[]`:网关下发的升序思考档位 id 列表(`'off'`/`'high'`/`'max'` 的子集,按「admin 声明 ∩ wire 层真投递」派生)。`listModels` 原样透传,无归一化、无新方法、公开签名零变化。`[]` = 该模型无思考档;`undefined` = 旧网关未播报,调用方按"未知"处理,严禁按模型名推档。 |
|
|
1147
|
+
| 2.17.0 | 稳定版 | **桌面 loopback OAuth state 全路径闸 + 端口确定性关闭(2026-08-15)**。`/callback` 一切形态(成功 / OAuth error / 畸形)先验 `state` 且必须恰好一个并严格等值;缺失 / 重复(含重复的正确值)/ 错值一律 `state_mismatch` 拒绝且不再被误结算为 `auth_denied`;错误信息只描述形态,不回显 code / state / token / 完整 callback query。`finally` 补 `closeIdleConnections()`(Node 18 上 `close()` 不关残留 idle keep-alive)。用户真拒绝(OAuth error + 正确 state)语义保留为 `auth_denied`。公开 API 签名零变化。 |
|
|
1148
|
+
| 2.16.0 | 稳定版 | **chat 超时预算真正下传 + 流式活性回调(2026-08-06)**。`chat` / `chatMessagesAnthropic` / `chatMessagesOpenAI` / `generateVideo` 此前漏传 `doJSONFullRaw` 的第 5 实参,内层 **30 秒**默认值恒先于外层 11 分钟预算触发 —— v1.6.0 那次"调整为 11min"一天都没生效过(生产实证:单日 29 条 latency≈30 000 ms 的 499,横跨 4 厂商 5 模型,受害最重的是默认主循环模型)。加性导出 `CHAT_REQUEST_TIMEOUT_MS`;`chatStream` / `chatMessagesStream` 新增第 4 个可选实参 `onUpstreamActivity`,让被 `isSSECommentLine` 吞掉的保活注释行(以及 OpenAI 格式下零事件的 data 行)能抵达消费方的空闲看门狗。不传回调时行为逐字节不变。 |
|
|
1128
1149
|
| 2.15.0 | 稳定版 | **sources 四态分类与零结果契约(2026-08-02)**。加性新增 `classifySourcesEvent`、`SourcesEventParseResult` 与稳定 issue code,区分非 sources、合法空结果、有效结果和结构损坏;未知额外字段继续兼容。既有 `parseSourcesEvent` 的返回形状、宽松解析和 `null` 条件保持不变。 |
|
|
1129
1150
|
| 2.14.0 | 稳定版 | **托管模型 input modalities 开放值域(2026-08-02)**。snake_case/camelCase 归一规则对称,数据字段允许未来新增标签;查询 API 仍保留已知标签自动补全。现网 camelCase 路径行为不变。 |
|
|
1130
1151
|
| 2.13.0 | 稳定版 | **邀请奖励窗口重置券(2026-08-01)**。加性新增窗口重置券总览与幂等核销 API,不改变既有 token、额度和会员调用。 |
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
|
|
3
|
+
var __esm = (fn, res, err) => function __init() {
|
|
4
|
+
if (err) throw err[0];
|
|
5
|
+
try {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
} catch (e) {
|
|
8
|
+
throw err = [e], e;
|
|
9
|
+
}
|
|
5
10
|
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
@@ -1322,6 +1327,7 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1322
1327
|
};
|
|
1323
1328
|
const verifier = await generateCodeVerifier();
|
|
1324
1329
|
const challenge = await codeChallenge(verifier);
|
|
1330
|
+
const state = await generateState();
|
|
1325
1331
|
const http = await import('http');
|
|
1326
1332
|
const server = http.createServer();
|
|
1327
1333
|
await new Promise((resolve, reject) => {
|
|
@@ -1337,6 +1343,8 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1337
1343
|
codeResolver = resolve;
|
|
1338
1344
|
codeRejecter = reject;
|
|
1339
1345
|
});
|
|
1346
|
+
codePromise.catch(() => {
|
|
1347
|
+
});
|
|
1340
1348
|
server.on("request", (req, res) => {
|
|
1341
1349
|
const url = new URL(req.url ?? "/", `http://127.0.0.1:${port}`);
|
|
1342
1350
|
if (url.pathname !== "/callback") {
|
|
@@ -1344,6 +1352,16 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1344
1352
|
res.end();
|
|
1345
1353
|
return;
|
|
1346
1354
|
}
|
|
1355
|
+
const states = url.searchParams.getAll("state");
|
|
1356
|
+
const stateFailure = states.length === 0 ? "callback missing state" : states.length > 1 ? "callback carried multiple state values" : states[0] !== state ? "callback state does not match pending state" : null;
|
|
1357
|
+
if (stateFailure !== null) {
|
|
1358
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
1359
|
+
res.end(
|
|
1360
|
+
`<!DOCTYPE html><html><head><meta charset="utf-8"><title>\u6388\u6743\u5931\u8D25</title></head><body style="font-family:system-ui,sans-serif;text-align:center;padding:60px 20px"><h2>\u6388\u6743\u5931\u8D25</h2><p>\u56DE\u8C03\u6821\u9A8C\u672A\u901A\u8FC7, \u5DF2\u4E2D\u6B62\u767B\u5F55\u3002</p><p style="color:#888;font-size:14px">\u53EF\u4EE5\u5173\u95ED\u6B64\u7A97\u53E3\u3002</p></body></html>`
|
|
1361
|
+
);
|
|
1362
|
+
codeRejecter(new Error(`authorize: ${ErrStateMismatch}: ${stateFailure} (possible CSRF)`));
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1347
1365
|
const code = url.searchParams.get("code");
|
|
1348
1366
|
if (!code) {
|
|
1349
1367
|
const errMsg = url.searchParams.get("error_description") || url.searchParams.get("error") || "";
|
|
@@ -1374,6 +1392,7 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1374
1392
|
authURL.searchParams.set("response_type", "code");
|
|
1375
1393
|
authURL.searchParams.set("code_challenge", challenge);
|
|
1376
1394
|
authURL.searchParams.set("code_challenge_method", "S256");
|
|
1395
|
+
authURL.searchParams.set("state", state);
|
|
1377
1396
|
if (scopes.length > 0) {
|
|
1378
1397
|
authURL.searchParams.set("scope", scopes.join(" "));
|
|
1379
1398
|
}
|
|
@@ -1411,7 +1430,9 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1411
1430
|
return { result: { code, redirectURI }, verifier };
|
|
1412
1431
|
} catch (e) {
|
|
1413
1432
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1414
|
-
if (msg.includes(
|
|
1433
|
+
if (msg.includes(ErrStateMismatch)) {
|
|
1434
|
+
emit({ type: EventError, err_code: ErrStateMismatch, error: msg });
|
|
1435
|
+
} else if (msg.includes("denied")) {
|
|
1415
1436
|
emit({ type: EventError, err_code: ErrAuthDenied, error: msg });
|
|
1416
1437
|
} else if (msg.includes("timed out")) {
|
|
1417
1438
|
emit({ type: EventError, err_code: ErrTimeout, error: msg });
|
|
@@ -1422,6 +1443,7 @@ async function authorize(meta, clientID, scopes, opts = {}) {
|
|
|
1422
1443
|
} finally {
|
|
1423
1444
|
if (abortHandler && signal) signal.removeEventListener("abort", abortHandler);
|
|
1424
1445
|
server.close();
|
|
1446
|
+
server.closeIdleConnections?.();
|
|
1425
1447
|
}
|
|
1426
1448
|
}
|
|
1427
1449
|
function htmlEscape(s) {
|
|
@@ -4169,6 +4191,7 @@ var ScopeChatBridge = "chat_bridge";
|
|
|
4169
4191
|
var ScopeChatBridgeRead = "chat_bridge:read";
|
|
4170
4192
|
var ScopeChatBridgeWrite = "chat_bridge:write";
|
|
4171
4193
|
var ScopeChatBridgeRotate = "chat_bridge:rotate";
|
|
4194
|
+
var ScopeAgentAccessManage = "agent_access:manage";
|
|
4172
4195
|
var ScopeModels = "models";
|
|
4173
4196
|
var ScopeModelsChat = "models:chat";
|
|
4174
4197
|
var ScopeEntitlements = "entitlements";
|
|
@@ -4197,6 +4220,9 @@ function remoteControlScopes() {
|
|
|
4197
4220
|
function chatBridgeScopes() {
|
|
4198
4221
|
return [ScopeChatBridge];
|
|
4199
4222
|
}
|
|
4223
|
+
function agentAccessScopes() {
|
|
4224
|
+
return [ScopeAgentAccessManage];
|
|
4225
|
+
}
|
|
4200
4226
|
|
|
4201
4227
|
// src/models/index.ts
|
|
4202
4228
|
init_types();
|
|
@@ -7786,6 +7812,6 @@ function brandCredential(c) {
|
|
|
7786
7812
|
return c;
|
|
7787
7813
|
}
|
|
7788
7814
|
|
|
7789
|
-
export { AGENT_RUN_META_TITLE, AGENT_RUN_META_WORKSPACE, ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, AgentRunStreamError, AgentRunsClient, AnthropicAdapter, AudienceEnum, BillingModeEnum, BucketClassCommercial, BucketClassGeneric, BusinessError, CHAT_REQUEST_TIMEOUT_MS, ChatBridgeClient, Client, ComplianceClient, CompliancePollError, CrabCodeByokClient, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, IdempotencyKeyHeader, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OAuthTokenEndpointError, OpenAIAdapter, OrderTerminalError, ProductFamilyEnum, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, RegionScopeEnum, ScopeAI, ScopeAccount, ScopeChatBridge, ScopeChatBridgeRead, ScopeChatBridgeRotate, ScopeChatBridgeWrite, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeRemoteControl, ScopeRemoteControlAgentRun, ScopeRemoteControlPermissionResponse, ScopeRemoteControlSessionControl, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, chatBridgeScopes, classifyComplianceError, classifySourcesEvent, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
|
|
7815
|
+
export { AGENT_RUN_META_TITLE, AGENT_RUN_META_WORKSPACE, ALL_INTEGRATION_STATUS, ALL_PLATFORMS, ALL_REGIONS, AgentRunStreamError, AgentRunsClient, AnthropicAdapter, AudienceEnum, BillingModeEnum, BucketClassCommercial, BucketClassGeneric, BusinessError, CHAT_REQUEST_TIMEOUT_MS, ChatBridgeClient, Client, ComplianceClient, CompliancePollError, CrabCodeByokClient, DEFAULT_API_TIMEOUT_MS, DEFAULT_GATEWAY_BASE_URL, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, IdempotencyKeyHeader, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OAuthTokenEndpointError, OpenAIAdapter, OrderTerminalError, ProductFamilyEnum, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, RegionScopeEnum, ScopeAI, ScopeAccount, ScopeAgentAccessManage, ScopeChatBridge, ScopeChatBridgeRead, ScopeChatBridgeRotate, ScopeChatBridgeWrite, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeRemoteControl, ScopeRemoteControlAgentRun, ScopeRemoteControlPermissionResponse, ScopeRemoteControlSessionControl, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, agentAccessScopes, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, asCredentialRef, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, chatBridgeScopes, classifyComplianceError, classifySourcesEvent, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, getWindowLimitStreamDetails, isBillingConfirmable, isChannelInboundEvent, isComplianceBusinessError, isComplianceTerminalError, isContinuableWindowLimitError, isIntegrationStatus, isInvalidGrantError, isPlatform, isRegion, isSSECommentLine, isSSLError, isTerminalRemoteEvent, isValidTokenSet, isWindowLimitError, isWindowLimitStreamError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, normalizeGatewayBaseURL, normalizeOverrideBaseURL, parseNotificationEvent, parseRemoteControlEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, remoteControlScopes, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
|
|
7790
7816
|
//# sourceMappingURL=index.mjs.map
|
|
7791
7817
|
//# sourceMappingURL=index.mjs.map
|