@acosmi/sdk-ts 1.5.0 → 1.5.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.
@@ -90,15 +90,15 @@ Report scopes are split by action:
90
90
  again) so the new scope is granted.
91
91
  - `ScopeComplianceReportsPublish` — `publishReport` (also requires step-up).
92
92
 
93
- Contract-template scopes (added in v1.10.0) are split by direction and do not
94
- require step-up:
93
+ Contract-template scopes (added in v1.5.0; originally planned as v1.10.0 see
94
+ CHANGELOG §"S5:合同模板") are split by direction and do not require step-up:
95
95
 
96
96
  - `ScopeComplianceContractTemplateRead` — `getContractTemplate`,
97
97
  `listContractTemplates`, `listContractTemplateVersions`.
98
98
  - `ScopeComplianceContractTemplateWrite` — `createContractTemplate`,
99
99
  `updateContractTemplate`, `deleteContractTemplate`,
100
100
  `uploadContractTemplatePdf`, `publishContractTemplate`,
101
- `archiveContractTemplate`. Tokens issued before v1.10.0 do **not** carry these
101
+ `archiveContractTemplate`. Tokens issued before v1.5.0 do **not** carry these
102
102
  scopes; existing users must re-authorize so the new scopes are granted.
103
103
 
104
104
  ## Base URL
@@ -244,7 +244,8 @@ if (view.status === 'SUCCESS') {
244
244
 
245
245
  ## Paginated Lists
246
246
 
247
- Since v1.6.0 the SDK exposes paginated list reads against the backend
247
+ Since v1.5.0 (originally planned as v1.6.0 see CHANGELOG §"S1:6 个分页列表")
248
+ the SDK exposes paginated list reads against the backend
248
249
  compliance gateway (`GET .../page`). Each returns a yudao `PageResult<T>`
249
250
  (`{ total, list }` — the single SDK-wide pagination result shape, an alias of
250
251
  `YudaoPageResult<T>`):
@@ -330,7 +331,8 @@ release.
330
331
 
331
332
  ## Capabilities And Operation Projection
332
333
 
333
- Since v1.7.0 the SDK exposes the compliance gateway S2 reads: a capability gate
334
+ Since v1.5.0 (originally planned as v1.7.0 see CHANGELOG §"S2:capabilities +
335
+ operations 投影") the SDK exposes the compliance gateway S2 reads: a capability gate
334
336
  query and an operation-projection view.
335
337
 
336
338
  ```ts
@@ -421,7 +423,8 @@ by the backend as `yyyy-MM-dd HH:mm:ss`; the SDK passes them through verbatim.
421
423
 
422
424
  ## TSA Readonly Views
423
425
 
424
- Since v1.8.0 the SDK exposes the compliance gateway S3 reads: two timestamp
426
+ Since v1.5.0 (originally planned as v1.8.0 see CHANGELOG §"S3:TSA readonly
427
+ 视图") the SDK exposes the compliance gateway S3 reads: two timestamp
425
428
  authority (TSA) readonly views.
426
429
 
427
430
  ```ts
@@ -463,7 +466,8 @@ when no timestamps exist.
463
466
 
464
467
  ## Envelope Completion
465
468
 
466
- Since v1.9.0 the SDK exposes the compliance gateway S4 envelope-completion
469
+ Since v1.5.0 (originally planned as v1.9.0 see CHANGELOG §"S4:envelope 收尾
470
+ + void") the SDK exposes the compliance gateway S4 envelope-completion
467
471
  surface: two readonly views and one write.
468
472
 
469
473
  ```ts
@@ -526,7 +530,8 @@ methods in this release.
526
530
 
527
531
  ## Contract Templates
528
532
 
529
- Since v1.10.0 the SDK exposes the compliance gateway S5 contract-template
533
+ Since v1.5.0 (originally planned as v1.10.0 see CHANGELOG §"S5:合同模板")
534
+ the SDK exposes the compliance gateway S5 contract-template
530
535
  surface: a `DRAFT` → `PUBLISHED` → `ARCHIVED` lifecycle with PDF upload, field
531
536
  overlay, and immutable version snapshots.
532
537
 
@@ -11,8 +11,12 @@
11
11
  // 说明:
12
12
  // - 大多数场景直接用 `client.login(appName, scopes)` 即可(内部封装了下面全部步骤)。
13
13
  // 本示例演示底层 helper,适用于需要自定义授权流程 / 自管 token 的 CLI。
14
- // - authorize 仅在 Node 环境可用(需要本地 HTTP 回调 server);浏览器侧应自行实现
15
- // popup window + redirect handler。
14
+ // - authorize 仅在 Node 环境可用(需要本地 HTTP 回调 server)。
15
+ // - 浏览器侧(无 loopback server)请改用 v1.4.0+ Web OAuth 原语:
16
+ // discoverWebOAuthMetadata + registerWebOAuthClient +
17
+ // createWebAuthorizationRequest + completeWebAuthorizationRequest,
18
+ // 由调用方实现 popup / 同窗口 redirect handler,SDK 负责 PKCE / state 校验 / token 兑换。
19
+ // 浏览器 token 刷新可配 Config.browserRefreshMode / refreshProxyURL (v1.4.1+) 规避 issuer CORS 403。
16
20
 
17
21
  import {
18
22
  discover,
@@ -22,6 +22,7 @@ import {
22
22
  ScopeComplianceTimestampIssue,
23
23
  ScopeComplianceTimestampVerify,
24
24
  ScopeComplianceReportsRead,
25
+ ScopeComplianceReportsWrite,
25
26
  } from '@acosmi/sdk-ts';
26
27
 
27
28
  // 模拟持久化的 Idempotency-Key 存储;生产环境应落 DB / 本地文件 / 业务订单表。
@@ -51,7 +52,8 @@ async function main() {
51
52
  ScopeComplianceEvidenceWrite,
52
53
  ScopeComplianceTimestampIssue,
53
54
  ScopeComplianceTimestampVerify,
54
- ScopeComplianceReportsRead,
55
+ ScopeComplianceReportsRead, // getReport / downloadReport
56
+ ScopeComplianceReportsWrite, // createReport(v1.3.2 起从 read 切到独立 write scope)
55
57
  ]);
56
58
 
57
59
  // 1) 本地 sha256 (用户业务内容)
@@ -8,9 +8,12 @@
8
8
  // 5. 流式 chatStreamWithUsage 并聚合 usage / 结算事件
9
9
  //
10
10
  // 说明:
11
- // - SDK 自动按 ManagedModel 的 preferredFormat / supportedFormats 选 Anthropic
12
- // 或 OpenAI adapter,调用方无需关心。
11
+ // - SDK 自动按 ManagedModel 的 preferred_format / supported_formats(snake_case
12
+ // wire 字段)选 Anthropic 或 OpenAI adapter,调用方无需关心。详见
13
+ // src/models/adapters/index.ts:getAdapterForModel。
13
14
  // - 金额 / 余额字段是 string(避免 JS number 精度损失),不要做浮点运算。
15
+ // - ChatRequest 走 snake_case wire 字段(max_tokens 等),与上游 Go json tag 对齐;
16
+ // ManagedModel 顶层多为 camelCase(modelId / isEnabled / inputModalities)。
14
17
 
15
18
  import { Client, allScopes, FileTokenStore } from '@acosmi/sdk-ts';
16
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acosmi/sdk-ts",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
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",