@acosmi/sdk-ts 1.4.0 → 1.4.2
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 +40 -0
- package/README.md +8 -3
- package/dist/browser/index.mjs +1983 -1878
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +1983 -1878
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs +6 -4
- 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 +6 -4
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs +4 -2
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +2 -64
- package/dist/node/adapters/openai.d.ts +2 -64
- package/dist/node/adapters/openai.mjs +4 -2
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/index-DEA6LXw6.d.cts +409 -0
- package/dist/node/index-DEA6LXw6.d.ts +409 -0
- package/dist/node/index.cjs +1985 -1877
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1463 -867
- package/dist/node/index.d.ts +1463 -867
- package/dist/node/index.mjs +1983 -1878
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/openai-BDodfhsG.d.cts +125 -0
- package/dist/node/openai-vfUUgdvL.d.ts +125 -0
- package/examples/agent-runs-stream.ts +118 -0
- package/examples/auth-oauth-flow.ts +97 -0
- package/examples/core-chat.ts +85 -0
- package/package.json +13 -3
- package/dist/node/index-CbG9NqE-.d.cts +0 -1027
- package/dist/node/index-CbG9NqE-.d.ts +0 -1027
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
+
## [1.4.2] — 2026-05-22
|
|
13
|
+
|
|
14
|
+
> `src/` 目录按业务域重组(实施计划 `docs/audit/sdk-ts-directory-restructure-plan-2026-05-22`)。
|
|
15
|
+
> **纯内部重组 + 开发工具 + 文档**——公共导出符号集合(295 个标识符)、`package.json`
|
|
16
|
+
> `exports`、`dist/` 产物路径全部一字未变;`typecheck` / `lint` / `vitest`(140) / `build` /
|
|
17
|
+
> `test:pack`(消费者视角 packed 产物)全绿。下游 `crabcode` / `crabclaw` / `csign` 零感知。
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- `src/` 从扁平 36 文件重组为按业务域分文件夹结构(`core/`、`shared/`、`auth/`、
|
|
22
|
+
`models/`、`billing/`、`skills/`、`notifications/`、`agent-runs/`、`compliance/`、
|
|
23
|
+
`support/`);每域一个 barrel `index.ts`,根 `index.ts` 改为只从各域 barrel re-export。
|
|
24
|
+
`types.ts`(1341 行)、`scopes.ts`、`compliance-*.ts` 按域拆分。为后续平台控制面能力
|
|
25
|
+
预留 `apiClients/`、`tenant/`、`iam/`、`audit/`、`operations/`、`mcp/`、`gateway/`、
|
|
26
|
+
`certification/` 占位目录。
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- TypeDoc API 参考文档:`npm run docs` 生成 `docs/api/`(Markdown);接入 `release.yml`。
|
|
31
|
+
- `examples/` 补 core / auth / agent-runs 三个示例(此前仅 compliance 三例)。
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
|
|
35
|
+
- 死入口 `src/node.ts`——它既非 `tsup` 构建 entry 也不在 `package.json` `exports`,
|
|
36
|
+
从未被打包发布,删除对所有外部消费者零可观测影响。
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## [1.4.1] — 2026-05-22
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **`Config.browserRefreshMode?: 'direct' | 'server-proxy' | 'none'`** 与
|
|
45
|
+
`refreshProxyURL` — 浏览器 Web OAuth token 刷新策略。默认 `direct` 保持既有行为;
|
|
46
|
+
`server-proxy` 可把刷新收口到同源 Route Handler,规避 OAuth issuer CORS 403;
|
|
47
|
+
`none` 用于产品自行处理过期登录态。新增错误码常量
|
|
48
|
+
`ErrOAuthCORSBlocked`、`ErrRefreshProxyFailed`、`ErrTokenExpired`。
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
12
52
|
## [1.4.0] — 2026-05-21
|
|
13
53
|
|
|
14
54
|
> csign `/login` Web OAuth 接入复核审计(`docs/audit/csign-login-oauth-audit-result-2026-05-21`)
|
package/README.md
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
|
|
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
10
|
- 当前版本:**1.3.2**(`verifyEvidencePublic` 匿名公开验真收口、新增 `compliance:reports:write` scope、compliance 方法状态四档分级;`1.3.0` 新增 `client.compliance`、`complianceBaseURL`、合规域 types/errors/status/scopes、示例与文档;详见 [CHANGELOG](./CHANGELOG.md))
|
|
11
11
|
- 测试:发布前需通过 typecheck/lint/vitest/build/packed-tarball smoke (`npm run test:pack`)
|
|
12
|
+
- API 参考文档:`npm run docs` 经 TypeDoc 生成到 `docs/api/`
|
|
12
13
|
- 包链接:[npm](https://www.npmjs.com/package/@acosmi/sdk-ts) · [GitHub Releases](https://github.com/acosmi/sdk-ts/releases)
|
|
13
14
|
|
|
14
15
|
## 安装
|
|
@@ -76,7 +77,7 @@ for await (const ev of stream) {
|
|
|
76
77
|
}
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
`chatStreamWithUsage()` 返回带 usage/error/sources 标签的 AsyncIterable,便于聚合统计(详见 `src/client.ts`)。
|
|
80
|
+
`chatStreamWithUsage()` 返回带 usage/error/sources 标签的 AsyncIterable,便于聚合统计(详见 `src/core/client.ts`)。
|
|
80
81
|
|
|
81
82
|
## Agent Runs
|
|
82
83
|
|
|
@@ -449,8 +450,11 @@ client.compliance.waitForProviderRequestTerminal(id, opts?)
|
|
|
449
450
|
|
|
450
451
|
### 示例
|
|
451
452
|
|
|
452
|
-
`examples/`
|
|
453
|
+
`examples/` 下提供可直接运行的端到端示例,并随 npm 包一起发布:
|
|
453
454
|
|
|
455
|
+
- `examples/core-chat.ts` — Client 构造 / 配置 / 模型列举 / 同步与流式 chat
|
|
456
|
+
- `examples/auth-oauth-flow.ts` — 手动 OAuth 2.1 PKCE 流程(discover / register / authorize / exchangeCode / refreshToken / token store)
|
|
457
|
+
- `examples/agent-runs-stream.ts` — Agent Run Gateway 创建 / 流式消费 / 本地工具桥 / 产物下载
|
|
454
458
|
- `examples/compliance-read.ts` — 只读 / public verify 流程
|
|
455
459
|
- `examples/compliance-evidence-timestamp.ts` — hash-only evidence + timestamp + package 链路
|
|
456
460
|
- `examples/compliance-envelope.ts` — envelope 创建 / 错误正确处理(step-up / gate closed)
|
|
@@ -481,6 +485,7 @@ npm run typecheck
|
|
|
481
485
|
npm run lint
|
|
482
486
|
npm test
|
|
483
487
|
npm run build
|
|
488
|
+
npm run docs # 经 TypeDoc 生成 API 参考到 docs/api/
|
|
484
489
|
```
|
|
485
490
|
|
|
486
491
|
## 更新历史
|