@acosmi/sdk-ts 1.2.0 → 1.3.1
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 +59 -0
- package/README.md +159 -20
- package/dist/browser/index.mjs +1039 -352
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +1039 -352
- package/dist/index.mjs.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/openai.d.cts +1 -1
- package/dist/node/adapters/openai.d.ts +1 -1
- package/dist/node/{index-B2Uuh21R.d.cts → index-28x02ITB.d.cts} +1 -1
- package/dist/node/{index-B2Uuh21R.d.ts → index-28x02ITB.d.ts} +1 -1
- package/dist/node/index.cjs +1072 -351
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +687 -193
- package/dist/node/index.d.ts +687 -193
- package/dist/node/index.mjs +1039 -352
- package/dist/node/index.mjs.map +1 -1
- package/docs/compliance.md +265 -0
- package/examples/compliance-envelope.ts +112 -0
- package/examples/compliance-evidence-timestamp.ts +130 -0
- package/examples/compliance-read.ts +72 -0
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,62 @@ 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
|
+
## [1.3.1] — 2026-05-20
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- 修订 npm 包短介绍和搜索关键词,明确 SDK 同时覆盖模型网关、
|
|
13
|
+
Agent Run Gateway 与 Compliance(电子证据、时间章、报告、签署 envelope)
|
|
14
|
+
统一客户端能力。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## [1.3.0] — 2026-05-20
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Compliance SDK client** — 新增 `client.compliance` 子客户端,覆盖电子证据、
|
|
23
|
+
时间章、证据包、报告、签署 envelope、用印审批和 provider request 脱敏状态轮询。
|
|
24
|
+
- **`Config.complianceBaseURL` / `Client.complianceURL(path)`** — compliance API 使用
|
|
25
|
+
独立 base URL,未配置时默认 `${serverURL}/admin-api`,不复用既有 `/api/v4`
|
|
26
|
+
模型网关路径。
|
|
27
|
+
- **Compliance public types** — 新增 `src/compliance-types.ts`,只暴露 Acosmi 公共领域
|
|
28
|
+
DTO;不包含 provider product/user/transaction/project/seal-provider 字段,不包含证书、
|
|
29
|
+
私钥、keystore、provider raw payload、storage key、subject snapshot 或 billing commit 内部字段。
|
|
30
|
+
- **Compliance error classification** — 新增 `src/compliance-errors.ts`,把 Java 数值业务错误码
|
|
31
|
+
映射到 SDK symbolic key,并提供 `classifyComplianceError` / `isComplianceBusinessError`。
|
|
32
|
+
- **Compliance status helpers** — 新增稳定状态与错误码辅助函数,供前端区分 step-up、
|
|
33
|
+
gate closed、provider not configured、local verify failed、billing not committable 等状态。
|
|
34
|
+
- **Compliance scopes** — 新增 12 个细粒度 compliance scope 常量和 `complianceScopes()`。
|
|
35
|
+
- **Examples and docs** — 新增 `docs/compliance.md` 以及 3 个示例:
|
|
36
|
+
`examples/compliance-read.ts`、`examples/compliance-evidence-timestamp.ts`、
|
|
37
|
+
`examples/compliance-envelope.ts`。
|
|
38
|
+
- **Tests** — 新增 compliance client 与 compliance scopes 单元测试,覆盖 URL 拼接、
|
|
39
|
+
`Authorization`、`Idempotency-Key`、GET 401 refresh retry、write no-retry/no-401-replay、
|
|
40
|
+
CommonResult 解包、数值错误码分类、隐私边界和 polling 终态。
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- `README.md` 增加 compliance 快速开始、scope 申请、base URL 配置、evidence +
|
|
45
|
+
timestamp/report 示例、provider request polling、step-up/gate closed 错误处理、
|
|
46
|
+
idempotency key 持久化和安全禁止项说明。
|
|
47
|
+
- Packed tarball smoke test 覆盖 `client.compliance`,确保 consumer 视角能解析新增
|
|
48
|
+
declaration merging 和导出的 compliance 类型。
|
|
49
|
+
- `package.json.files` 现在包含 `docs/compliance.md` 和 `examples/`,npm 包随附用户文档
|
|
50
|
+
与可运行示例;开发手册仍保留在仓库中,不随包发布。
|
|
51
|
+
|
|
52
|
+
### Safety
|
|
53
|
+
|
|
54
|
+
- Compliance write methods do not auto retry and do not refresh/replay on 401.
|
|
55
|
+
GET read methods still allow one safe 401 refresh retry.
|
|
56
|
+
- All compliance write methods accept `Idempotency-Key` through `ComplianceWriteOptions`;
|
|
57
|
+
callers should persist keys and reuse the same key when resuming the same business action.
|
|
58
|
+
- SDK code, docs, tests, examples, and package files do not include provider materials,
|
|
59
|
+
credentials, real provider endpoints, signing containers, archives, jars, passwords,
|
|
60
|
+
or raw provider payloads.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
8
64
|
## [1.2.0] — 2026-05-18
|
|
9
65
|
|
|
10
66
|
### Added
|
|
@@ -152,6 +208,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
152
208
|
- 36/36 vitest 全绿,源码 typecheck/lint/build 0 错误
|
|
153
209
|
- 翻车机制:`prepublishOnly` 仅跑源码 typecheck/vitest/build,不验证 packed product 在 consumer 视角能否解析
|
|
154
210
|
|
|
211
|
+
[1.3.1]: https://github.com/acosmi/sdk-ts/releases/tag/v1.3.1
|
|
212
|
+
[1.3.0]: https://github.com/acosmi/sdk-ts/releases/tag/v1.3.0
|
|
213
|
+
[1.2.0]: https://github.com/acosmi/sdk-ts/releases/tag/v1.2.0
|
|
155
214
|
[1.1.0]: https://github.com/acosmi/sdk-ts/releases/tag/v1.1.0
|
|
156
215
|
[1.0.2]: https://github.com/acosmi/sdk-ts/releases/tag/v1.0.2
|
|
157
216
|
[1.0.1]: https://github.com/acosmi/sdk-ts/releases/tag/v1.0.1
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
## 状态
|
|
8
8
|
|
|
9
9
|
- 端口源:[acosmi-sdk-go](https://github.com/acosmi/acosmi-sdk-go) v1.0.0(与 Go SDK 联动稳定测试版)
|
|
10
|
-
- 当前版本:**1.
|
|
11
|
-
-
|
|
12
|
-
- 包链接:[npm](https://www.npmjs.com/package/@acosmi/sdk-ts
|
|
10
|
+
- 当前版本:**1.3.1**(修订 npm 包介绍与搜索关键词;`1.3.0` 新增 `client.compliance`、`complianceBaseURL`、合规域 types/errors/status/scopes、示例与文档;详见 [CHANGELOG](./CHANGELOG.md))
|
|
11
|
+
- 测试:发布前需通过 typecheck/lint/vitest/build/packed-tarball smoke (`npm run test:pack`)
|
|
12
|
+
- 包链接:[npm](https://www.npmjs.com/package/@acosmi/sdk-ts) · [GitHub Releases](https://github.com/acosmi/sdk-ts/releases)
|
|
13
13
|
|
|
14
14
|
## 安装
|
|
15
15
|
|
|
@@ -22,7 +22,7 @@ npm install @acosmi/sdk-ts
|
|
|
22
22
|
```ts
|
|
23
23
|
import { Client, allScopes } from '@acosmi/sdk-ts';
|
|
24
24
|
|
|
25
|
-
const client = new Client({ serverURL:
|
|
25
|
+
const client = new Client({ serverURL: process.env.ACOSMI_SERVER_URL! });
|
|
26
26
|
await client.login('My App', allScopes());
|
|
27
27
|
|
|
28
28
|
const resp = await client.chat('claude-opus-4-7', {
|
|
@@ -87,7 +87,7 @@ for await (const ev of stream) {
|
|
|
87
87
|
```ts
|
|
88
88
|
import { Client, allScopes } from '@acosmi/sdk-ts';
|
|
89
89
|
|
|
90
|
-
const client = new Client({ serverURL:
|
|
90
|
+
const client = new Client({ serverURL: process.env.ACOSMI_SERVER_URL! });
|
|
91
91
|
await client.login('CrabDesign', allScopes());
|
|
92
92
|
|
|
93
93
|
const run = await client.agentRuns.create({
|
|
@@ -155,7 +155,7 @@ const token = await client.ensureToken(); // 拿到当前有效 access toke
|
|
|
155
155
|
```ts
|
|
156
156
|
import { discover, register, authorize, exchangeCode } from '@acosmi/sdk-ts';
|
|
157
157
|
|
|
158
|
-
const meta = await discover(
|
|
158
|
+
const meta = await discover(process.env.ACOSMI_SERVER_URL!);
|
|
159
159
|
const reg = await register(meta, 'My CLI', allScopes());
|
|
160
160
|
const result = await authorize(meta, reg, allScopes(), {
|
|
161
161
|
onEvent: (ev) => console.log(ev.type, ev.url),
|
|
@@ -169,7 +169,7 @@ const tokens = await exchangeCode(meta, reg, result.code, result.codeVerifier);
|
|
|
169
169
|
import { Client, FileTokenStore, LocalStorageTokenStore } from '@acosmi/sdk-ts';
|
|
170
170
|
|
|
171
171
|
// Node — 默认 ~/.acosmi/tokens.json,可自定义路径
|
|
172
|
-
const client = new Client({ serverURL:
|
|
172
|
+
const client = new Client({ serverURL: process.env.ACOSMI_SERVER_URL!, store: new FileTokenStore('./my-tokens.json') });
|
|
173
173
|
|
|
174
174
|
// 浏览器 — 自动用 LocalStorage(无 LocalStorage 时退化为内存)
|
|
175
175
|
```
|
|
@@ -190,6 +190,7 @@ const client = new Client({ serverURL: 'https://acosmi.com', tokenStore: new Fil
|
|
|
190
190
|
| **Notifications** | `listNotifications`, `getUnreadCount`, `markNotificationRead`, `registerDevice`, `listNotificationPreferences` |
|
|
191
191
|
| **Bug Report** | `submitBugReport`, `getBugReport` |
|
|
192
192
|
| **Web Search** | `newWebSearchTool` (factory) |
|
|
193
|
+
| **Compliance** | `compliance.createEvidenceAsset`, `compliance.issueTimestamp`, `compliance.waitForTimestampVerified`, `compliance.buildEvidencePackage`, `compliance.createReport`, `compliance.downloadReport`, `compliance.createSigningEnvelope`, `compliance.signEnvelope`, `compliance.getProviderRequest`, `compliance.waitForProviderRequestTerminal` |
|
|
193
194
|
|
|
194
195
|
完整签名见 `dist/node/index.d.ts`,IDE 自带补全。
|
|
195
196
|
|
|
@@ -198,7 +199,7 @@ const client = new Client({ serverURL: 'https://acosmi.com', tokenStore: new Fil
|
|
|
198
199
|
```ts
|
|
199
200
|
import { Client } from '@acosmi/sdk-ts';
|
|
200
201
|
|
|
201
|
-
const client = new Client({ serverURL:
|
|
202
|
+
const client = new Client({ serverURL: process.env.ACOSMI_SERVER_URL! });
|
|
202
203
|
|
|
203
204
|
// 公共端点 — 无需登录
|
|
204
205
|
const result = await client.browseSkills(
|
|
@@ -239,7 +240,7 @@ import {
|
|
|
239
240
|
modelSupportsImageInput,
|
|
240
241
|
} from '@acosmi/sdk-ts';
|
|
241
242
|
|
|
242
|
-
const client = new Client({ serverURL:
|
|
243
|
+
const client = new Client({ serverURL: process.env.ACOSMI_SERVER_URL! });
|
|
243
244
|
const models = await client.listModels();
|
|
244
245
|
|
|
245
246
|
// 1) 主模型是否能直接吃截图?
|
|
@@ -297,15 +298,16 @@ const view = await client.getBugReport(result.feedback_id);
|
|
|
297
298
|
|
|
298
299
|
所有方法 `throw` 类型化错误(不是 Go 风格多返回值):
|
|
299
300
|
|
|
300
|
-
| 错误类型 | 触发
|
|
301
|
-
| -------------------- |
|
|
302
|
-
| `HTTPError` | 4xx/5xx,含 `
|
|
303
|
-
| `NetworkError` | TCP/DNS/TLS 失败
|
|
304
|
-
| `StreamError` | SSE 流解析失败
|
|
301
|
+
| 错误类型 | 触发 |
|
|
302
|
+
| -------------------- | ---------------------------------------------------------------------- |
|
|
303
|
+
| `HTTPError` | 4xx/5xx,含 `statusCode` / `body` / `type` / `retryAfter` |
|
|
304
|
+
| `NetworkError` | TCP/DNS/TLS 失败 |
|
|
305
|
+
| `StreamError` | SSE 流解析失败 |
|
|
305
306
|
| `AgentRunStreamError` | Agent Runs 流返回 `error` 事件(默认抛出;可设 `throwOnError:false` 自行消费) |
|
|
306
|
-
| `BusinessError` | 网关返回 `code !== 0`,含 `code` / `
|
|
307
|
-
| `RateLimitError` | 429(含 `retryAfter`)
|
|
308
|
-
| `OrderTerminalError` | `waitForPayment` 终态失败
|
|
307
|
+
| `BusinessError` | 网关返回 `code !== 0`,含 `code` (number) / `message` (字符串) |
|
|
308
|
+
| `RateLimitError` | 429(含 `retryAfter`) |
|
|
309
|
+
| `OrderTerminalError` | `waitForPayment` 终态失败 |
|
|
310
|
+
| `CompliancePollError` | `waitForTimestampVerified` / `waitForProviderRequestTerminal` 终态失败或超时 |
|
|
309
311
|
|
|
310
312
|
```ts
|
|
311
313
|
import { HTTPError, BusinessError } from '@acosmi/sdk-ts';
|
|
@@ -313,12 +315,146 @@ import { HTTPError, BusinessError } from '@acosmi/sdk-ts';
|
|
|
313
315
|
try {
|
|
314
316
|
await client.chat(...);
|
|
315
317
|
} catch (e) {
|
|
316
|
-
if (e instanceof HTTPError && e.
|
|
317
|
-
if (e instanceof BusinessError) console.error(e.code, e.
|
|
318
|
+
if (e instanceof HTTPError && e.statusCode === 401) await client.login(...);
|
|
319
|
+
if (e instanceof BusinessError) console.error(e.code, e.message);
|
|
318
320
|
throw e;
|
|
319
321
|
}
|
|
320
322
|
```
|
|
321
323
|
|
|
324
|
+
### Compliance 错误分类
|
|
325
|
+
|
|
326
|
+
合规域使用 Java 数值错误码(1-031-xxx-xxx),SDK 通过 `classifyComplianceError` 把
|
|
327
|
+
`BusinessError` 映射到 symbolic key,便于分支判断:
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
import { BusinessError, classifyComplianceError, isComplianceBusinessError } from '@acosmi/sdk-ts';
|
|
331
|
+
|
|
332
|
+
try {
|
|
333
|
+
await client.compliance.publishReport(reportId, { idempotencyKey });
|
|
334
|
+
} catch (e) {
|
|
335
|
+
if (e instanceof BusinessError && isComplianceBusinessError(e)) {
|
|
336
|
+
const info = classifyComplianceError(e);
|
|
337
|
+
if (info.stepUpRequired) {
|
|
338
|
+
// 引导用户重新做 OAuth introspection / 重新登录后用同一 idempotency-key 再试
|
|
339
|
+
} else if (info.terminal) {
|
|
340
|
+
// 终态错误(gate closed / provider not configured 等),不要 retry,用新 key 重发
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
throw e;
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Compliance (时间章 / 电子证据 / 合同签署)
|
|
348
|
+
|
|
349
|
+
合规域走独立子客户端 `client.compliance.*`,使用独立 base URL。**SDK 永远不接触
|
|
350
|
+
provider endpoint、证书/密钥材料、provider raw payload / callback billing commit**;
|
|
351
|
+
所有 provider 选择由服务端按配置决定,调用方不传 `provider` 字段。
|
|
352
|
+
|
|
353
|
+
完整 API 指南见 [docs/compliance.md](./docs/compliance.md)。
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
import { Client, complianceScopes } from '@acosmi/sdk-ts';
|
|
357
|
+
|
|
358
|
+
// 1. 配置 — complianceBaseURL 默认 ${serverURL}/admin-api
|
|
359
|
+
const client = await Client.create({
|
|
360
|
+
serverURL: process.env.ACOSMI_SERVER_URL!,
|
|
361
|
+
// complianceBaseURL: process.env.ACOSMI_COMPLIANCE_BASE_URL, // 独立 ingress 时显式覆盖
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// 2. 登录 — OAuth scope 申请按业务最小集合
|
|
365
|
+
await client.login('My App', complianceScopes());
|
|
366
|
+
|
|
367
|
+
// 3. 申请时间章(写操作;strongly recommended 持久化 idempotency-key)
|
|
368
|
+
const idempotencyKey = `ts-${orderId}-${Date.now()}`;
|
|
369
|
+
await persistKey(idempotencyKey);
|
|
370
|
+
const token = await client.compliance.issueTimestamp(
|
|
371
|
+
{ name: 'release-artifact', hashAlgorithm: 'sha256', digest: sha256Hex },
|
|
372
|
+
{ idempotencyKey },
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
// 4. 轮询到本地 verify 通过
|
|
376
|
+
const verified = await client.compliance.waitForTimestampVerified(token.id, {
|
|
377
|
+
timeoutMs: 60_000,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// 5. 公开 verify — 不要求登录、不暴露 PII / 合同原文
|
|
381
|
+
const result = await client.compliance.verifyEvidencePublic({ evidenceNo: 'EV-001' });
|
|
382
|
+
console.log(result.manifestOfflineVerify);
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### 写操作幂等与 401 策略
|
|
386
|
+
|
|
387
|
+
合规域写操作有别于普通 API:
|
|
388
|
+
|
|
389
|
+
- **Idempotency-Key**:所有 POST 写操作支持 `Idempotency-Key` header;调用方必须**持久化**
|
|
390
|
+
key(重启后仍可用)。同一 key 重发等价于"对账查询同一业务结果",避免 provider 侧重复
|
|
391
|
+
请求 / 重复扣费。
|
|
392
|
+
- **401 不自动重放**:写操作 401 直接抛 `HTTPError`,**不会自动 refresh + replay**。
|
|
393
|
+
调用方需要重新登录后用**同一 idempotency-key** 调用同一方法。GET 读操作仍走单次 401
|
|
394
|
+
refresh 重试。
|
|
395
|
+
- **5xx / timeout 不自动重试**:合规域写操作完全禁用自动重试。
|
|
396
|
+
- **step-up 错误(`COMPLIANCE_STEP_UP_REQUIRED`,code=1031000013)**:通过
|
|
397
|
+
`classifyComplianceError` 识别后引导用户重新做 OAuth introspection / 升级 token 等级。
|
|
398
|
+
- **gate closed / provider not configured / unknown**:terminal 错误,禁止自动重发原请求。
|
|
399
|
+
|
|
400
|
+
### 隐私边界
|
|
401
|
+
|
|
402
|
+
`verifyEvidencePublic` 返回字段:`evidenceNo` / `assetType` / `hashAlgorithm` / `contentHash` /
|
|
403
|
+
`size` / `manifestHash` / `packageHash` / `manifestOfflineVerify` / `verifiedAt`。**不暴露**
|
|
404
|
+
PII / 合同原文 / storage bucket+key / subject snapshot / provider raw / TSA 证书内部字段。
|
|
405
|
+
|
|
406
|
+
### 完整 API 列表
|
|
407
|
+
|
|
408
|
+
```ts
|
|
409
|
+
client.compliance.createEvidenceAsset(req, options?)
|
|
410
|
+
client.compliance.getEvidenceAsset(id, signal?)
|
|
411
|
+
client.compliance.verifyEvidencePublic(req, signal?)
|
|
412
|
+
|
|
413
|
+
client.compliance.issueTimestamp(req, options?)
|
|
414
|
+
client.compliance.issueTimestampForAsset(assetId, options?)
|
|
415
|
+
client.compliance.getTimestamp(id, signal?)
|
|
416
|
+
client.compliance.verifyTimestamp(req, options?)
|
|
417
|
+
client.compliance.waitForTimestampVerified(id, opts?)
|
|
418
|
+
|
|
419
|
+
client.compliance.buildEvidencePackage(assetId, timestampTokenId?, options?)
|
|
420
|
+
|
|
421
|
+
client.compliance.createReport(req, options?)
|
|
422
|
+
client.compliance.getReport(id, signal?)
|
|
423
|
+
client.compliance.publishReport(id, options?) // step-up
|
|
424
|
+
client.compliance.downloadReport(id, signal?) // 离线复核 hash 视图
|
|
425
|
+
|
|
426
|
+
client.compliance.createSigningEnvelope(req, options?)
|
|
427
|
+
client.compliance.getSigningEnvelope(envelopeId, signal?)
|
|
428
|
+
client.compliance.signEnvelope(envelopeId, req, options?) // step-up + gate
|
|
429
|
+
client.compliance.createH5SigningUrl(envelopeId, req, options?) // step-up + gate
|
|
430
|
+
client.compliance.syncSigningEnvelopeStatus(envelopeId, options?)
|
|
431
|
+
|
|
432
|
+
client.compliance.submitSealApproval(req, options?)
|
|
433
|
+
client.compliance.approveSealApproval(id, query, options?) // step-up
|
|
434
|
+
client.compliance.rejectSealApproval(id, query, options?)
|
|
435
|
+
client.compliance.cancelSealApproval(id, query, options?)
|
|
436
|
+
client.compliance.listPendingSealApprovals(signal?)
|
|
437
|
+
client.compliance.getSealApproval(id, signal?)
|
|
438
|
+
|
|
439
|
+
client.compliance.getProviderRequest(id, signal?)
|
|
440
|
+
client.compliance.waitForProviderRequestTerminal(id, opts?)
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### 示例
|
|
444
|
+
|
|
445
|
+
`examples/` 下提供 3 份可直接运行的端到端示例,并随 npm 包一起发布:
|
|
446
|
+
|
|
447
|
+
- `examples/compliance-read.ts` — 只读 / public verify 流程
|
|
448
|
+
- `examples/compliance-evidence-timestamp.ts` — hash-only evidence + timestamp + package 链路
|
|
449
|
+
- `examples/compliance-envelope.ts` — envelope 创建 / 错误正确处理(step-up / gate closed)
|
|
450
|
+
|
|
451
|
+
### 后端边界
|
|
452
|
+
|
|
453
|
+
- Java compliance 后端负责 provider 集成、受控材料、provider raw payload、local verify、
|
|
454
|
+
billing 状态机和对外 public DTO 收敛。
|
|
455
|
+
- Go OAuth/JWKS 层负责 token 签发、scope 与 step-up/introspection 语义。
|
|
456
|
+
- TS SDK 只申请 scope、发送公共 DTO、传递 `Idempotency-Key`、分类公开错误码并轮询脱敏状态视图。
|
|
457
|
+
|
|
322
458
|
## AbortSignal
|
|
323
459
|
|
|
324
460
|
每个异步方法都接 `signal?: AbortSignal`,用于取消请求或流:
|
|
@@ -346,7 +482,10 @@ npm run build
|
|
|
346
482
|
|
|
347
483
|
| 版本 | 状态 | 概要 |
|
|
348
484
|
| --- | --- | --- |
|
|
349
|
-
| 1.1
|
|
485
|
+
| 1.3.1 | 当前稳定版 | 修订 npm 包短介绍与搜索关键词,明确模型网关、Agent Run Gateway 与 Compliance 统一客户端定位。 |
|
|
486
|
+
| 1.3.0 | 稳定版 | 新增 compliance SDK client、base URL、types/errors/status/scopes、docs/examples/tests,并明确 idempotency/no-retry/no-401-replay 与 provider material 安全边界。 |
|
|
487
|
+
| 1.2.0 | 稳定版 | 新增 `ManagedModel.inputModalities`、桌面视觉理解 sidecar capability 与 4 个 catalog helpers。 |
|
|
488
|
+
| 1.1.0 | 稳定版 | 新增 SDK-facing `agentRuns` 网关客户端,覆盖 create/stream/cancel/get/artifacts/local-tool-result,并提供本地只读工具桥协议。 |
|
|
350
489
|
| 1.0.2 | 稳定版 | 修复多进程共享 token refresh rotation 竞态。 |
|
|
351
490
|
| 1.0.1 | 历史稳定版 | 修复 1.0.0 双层 broken packaging:tsup 输出 `.mjs+.cjs` 与 exports 字段对齐;9 处 `declare module` 绑包名 `@acosmi/sdk-ts` 让 d.ts augmentation 在 consumer 视角合并;prepublishOnly 加 packed-tarball 烟测拦截"源码过 / 打包后 broken"。 |
|
|
352
491
|
| 1.0.0 | **deprecated** | 双层 broken:(1) `package.json.exports` 8 处 `.mjs` 引用与 tsup 默认 `.js+.cjs` 错位 → bun/Node ESM `Cannot find module`;(2) 9 处 `declare module` 用相对路径,consumer 视角断链 → 50+ 方法 TS2339。`npm install @acosmi/sdk-ts` 自动跳到 1.0.1。 |
|