@acosmi/sdk-ts 2.5.1 → 2.7.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.
@@ -1,4 +1,4 @@
1
- import { P as ProviderAdapter, k as ProviderFormat, j as ModelCapabilities, e as ChatRequest, f as ChatResponse, n as StreamEvent } from './index-BdzF9tmA.cjs';
1
+ import { P as ProviderAdapter, k as ProviderFormat, j as ModelCapabilities, e as ChatRequest, f as ChatResponse, n as StreamEvent } from './index-BrbgHn0E.cjs';
2
2
 
3
3
  /**
4
4
  * Anthropic 内容块
@@ -1,4 +1,4 @@
1
- import { P as ProviderAdapter, k as ProviderFormat, j as ModelCapabilities, e as ChatRequest, f as ChatResponse, n as StreamEvent } from './index-BdzF9tmA.js';
1
+ import { P as ProviderAdapter, k as ProviderFormat, j as ModelCapabilities, e as ChatRequest, f as ChatResponse, n as StreamEvent } from './index-BrbgHn0E.js';
2
2
 
3
3
  /**
4
4
  * Anthropic 内容块
@@ -10,7 +10,7 @@
10
10
  | 项目 | 值 |
11
11
  | -------- | -- |
12
12
  | 实现地位 | **主实现 / 事实标准**;Go SDK 暂停维护,后续从 TS 反向翻译 |
13
- | 当前版本 | **2.5.1**(模型 adapter 格式一致性护栏,patch,2026-05-31;上游 2.1.0 远控 / 2.2.0 图片视频 / 2.3.0 `apiBaseURL` / 2.4.0 `skillMd?` / 2.5.0 健康度审计根因修复,详见 §14 与 CHANGELOG) |
13
+ | 当前版本 | **2.7.0**(远控管理面补齐 + BYOK 密钥客户端 + Chat Bridge CRUD Phase 7Bminor,2026-06-11;上游 2.1.0 远控 / 2.2.0 图片视频 / 2.3.0 `apiBaseURL` / 2.4.0 `skillMd?` / 2.5.0 健康度审计根因修复 / 2.5.1 adapter 格式护栏 / 2.6.0 会员订阅查询 + WS ticket,详见 §14 与 CHANGELOG) |
14
14
  | 版本策略 | TS 独立演进;wire-format / API 不兼容变更升 major(v2.0.0 已发,见 §10 / §18) |
15
15
  | 主消费者 | `crabcode` (Anthropic 格式)、`crabdesign` / `crabclaw` 等下游产品 |
16
16
  | 长期保留 | `OpenAIAdapter` (P0 红线,`crabclaw` 暂不用 TS 但保留双格式等地位) |
@@ -79,7 +79,7 @@ acosmi-sdk-ts/
79
79
  │ ├── notifications/ # 通知 / 推送 / WebSocket
80
80
  │ ├── agent-runs/ # SDK-facing Agent Run Gateway(client + 公开协议类型)
81
81
  │ │ └── remote-control.ts # v2.1 远控类型 + parseRemoteControlEvent / 11 事件 union
82
- │ ├── chatbridge/ # v2.1 第三方聊天平台桥接类型骨架(types-only,无 client
82
+ │ ├── chatbridge/ # v2.1 类型骨架; v2.7 Phase 7B 管理面 CRUD (client.chatBridge)
83
83
  │ ├── pricing/ # 公开业务参数(v1.7.0)+ csign 合规 SKU 报价(v1.7.0)
84
84
  │ ├── products/ # 商品中心(v1.7.0)— productFamily / audience / billingMode 索引
85
85
  │ ├── sanitize/ # 历史消息清理子包
@@ -241,10 +241,19 @@ git commit -m "fix: ..."
241
241
 
242
242
  **远程控制(v2.1,CrabCode remote-control)** — 同属 `agentRuns` 命名空间,但事件协议独立(契约 §4 的 11 事件,不复用 `stream` 旧 union):
243
243
 
244
- - `client.agentRuns.createRemoteRun(req, signal?)` — `req.runtime` 固定 `'crabcode_remote'`,`runner` + `adapter` 必填。
244
+ - `client.agentRuns.createRemoteRun(req, signal?)` — `req.runtime` 固定 `'crabcode_remote'`,`runner` + `adapter` 必填;v2.7.0 起支持 `byokCredentialRef`(仅 cloud runner)与 metadata 约定键 `title`/`workspace`(契约 §18.3 r4)。
245
245
  - `client.agentRuns.streamRemoteControl(runId, signal?)` — **无 options 参数**(`error` 恒非终结、`done`/`settle` 终结、从不抛异常)。
246
+ - **远控管理面(v2.7.0,契约 §18.1 附录 A)**:`list(opts?)`(runtime/status 过滤分页,信封 `{records,total,page,pageSize}`)、`submitPermissionResult(runId, {requestId, decision, reason?})`(仅 approved|rejected)、`submitUserMessage(runId, {content, requestId?})`(≤64KB,role 服务端硬编码)、`revealRemoteToken(runId)`(一次性 token,仅 desktop runner,永不落浏览器存储)。
247
+ - **BYOK(v2.7.0,契约 §18.2)**:`client.crabcodeByok.list/create/rotate/revoke` —— `/crabcode/byok-credentials`,`remote_control` scope;明文一次性提交,响应恒 masked。
246
248
  - helper:`parseRemoteControlEvent(raw)`(wire→强类型,未知 type 返回 null)、`isTerminalRemoteEvent(ev)`。
247
- - `chatbridge`(v2.1,Phase 7 types-only):仅导出类型 + 守卫(`isPlatform` / `isRegion` / `isChannelInboundEvent` / `asCredentialRef`),**无 `client.chatBridge.*` 方法**;平台 webhook/凭证/桥接 handler Phase 7B 后端工作,平台 SDK 依赖留在独立 adapter 包,禁进主包。
249
+ - `chatbridge`(v2.7.0 起 Phase 7B 管理面落地):`client.chatBridge.createIntegration/listIntegrations/getIntegration/updateIntegrationStatus + storeCredential/listCredentials/rotateCredential/revokeCredential`(请求 snake_case 由 SDK 转换、响应 camelCase;scope 三档 `chat_bridge:read`/`:write`/`:rotate`)。类型 + 守卫(`isPlatform` / `isRegion` / `isChannelInboundEvent` / `asCredentialRef`)沿用 v2.1 骨架。平台 webhook adapter(验签/收发)是 Phase 8 后端工作,平台 SDK 依赖留在独立 adapter 包,禁进主包。
250
+
251
+ **会员订阅查询(v2.6,C 端会员体系)** — `subscription` 命名空间新增:
252
+
253
+ - `client.subscription.getMembership(signal?)` — 当前会员视图(**取代** `listUserSubscriptions`,后者已废弃)。
254
+ - `client.subscription.getSubscriptionTier(signal?)` — 订阅档位。
255
+ - `client.subscription.subscriptionPrecheck(req, signal?)` — 升级前置校验。
256
+ - 同版本 `ManagedModel` 新增档位门控字段 `locked` / `freeTier` / `minPlanTier` / `chatRuntimeSupported` / `defaultToolIds`,供 C 端聊天模型选择器按会员档位加锁 / 分区。废弃 `ModelCoefficient` / `listCoefficients`(系数退役恒空)与 `ManagedModel.pricePerMTok` / `isDefault`(公开端点不返回)。
248
257
 
249
258
  红线:
250
259
  - 下游产品禁止直连 Nexus 内部 `/api/v4/chat/completions` 或 `/api/v4/managed-models/:id/...` 来实现智能体循环。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acosmi/sdk-ts",
3
- "version": "2.5.1",
3
+ "version": "2.7.0",
4
4
  "description": "Acosmi TypeScript SDK:模型网关、Agent Run Gateway 与 Compliance(电子证据、时间章、报告、签署 envelope)统一客户端,支持浏览器 / Node ≥18 / Deno / Bun。",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.cjs",