@harapter/adapter-dsh 0.1.1 → 0.1.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/README.ja.md ADDED
@@ -0,0 +1,117 @@
1
+ <!-- markdownlint-disable MD033 MD041 -->
2
+
3
+ <h1 align="center"><code>@harapter/adapter-dsh</code></h1>
4
+
5
+ <p align="center"><strong>公式 DeepSeek Harness SDK Runtime protocol を Harapter に mapping します。</strong></p>
6
+
7
+ <p align="center">
8
+ <a href="./README.md">English</a> · <a href="./README.zh-CN.md">简体中文</a> · <a href="./README.ja.md">日本語</a> · <a href="../../README.ja.md">Harapter</a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-dsh/next?style=flat-square&amp;label=npm%20next" alt="npm next バージョン"></a>
13
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-dsh?style=flat-square" alt="npm ダウンロード数"></a>
14
+ <a href="https://github.com/yunfeizhu/harapter/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/yunfeizhu/harapter/ci.yml?branch=main&amp;style=flat-square&amp;label=ci" alt="CI ステータス"></a>
15
+ <img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 24 以上">
16
+ <a href="../../LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-0B7285?style=flat-square" alt="Apache-2.0 ライセンス"></a>
17
+ <img src="https://img.shields.io/badge/status-pre--alpha-EA580C?style=flat-square" alt="Pre-alpha ステータス">
18
+ </p>
19
+
20
+ <!-- markdownlint-enable MD033 -->
21
+
22
+ `@harapter/adapter-dsh` は DeepSeek Harness SDK Runtime の newline-delimited
23
+ JSON-RPC 2.0
24
+ Server に接続し、Session、Run、Event、Interaction、cancellation、Error を Harapter に mapping します。Agent
25
+ Loop 自体は埋め込みません。
26
+
27
+ ## 前提条件とインストール
28
+
29
+ DeepSeek
30
+ Harness の導入、composition、設定、認証はホストが行います。Harapter は DSH
31
+ CLI、SDK package、Cordis Application、Plugin、Model
32
+ Adapter、Credential を同梱しません。
33
+
34
+ ```bash
35
+ pnpm add @harapter/core@next @harapter/adapter-dsh@next
36
+ ```
37
+
38
+ ## クイックスタート
39
+
40
+ ```ts
41
+ import { HarnessRegistry, profileId } from '@harapter/core';
42
+ import {
43
+ DSH_PROVIDER_ID,
44
+ createDshProviderFactory,
45
+ } from '@harapter/adapter-dsh';
46
+
47
+ const registry = new HarnessRegistry();
48
+ registry.register(createDshProviderFactory());
49
+
50
+ const client = await registry.connect({
51
+ profileId: profileId('dsh-local'),
52
+ providerId: DSH_PROVIDER_ID,
53
+ displayName: 'Local DeepSeek Harness',
54
+ connection: {
55
+ kind: 'process',
56
+ command: 'dsh',
57
+ args: ['--profile', 'sdk'],
58
+ ownership: 'adapter',
59
+ },
60
+ providerOptions: {
61
+ provider: 'host-configured-provider',
62
+ model: 'host-configured-model',
63
+ },
64
+ });
65
+
66
+ const session = await client.createSession();
67
+ try {
68
+ const run = await session.start({
69
+ parts: [{ type: 'text', text: 'Describe the current project.' }],
70
+ });
71
+ for await (const event of run.events()) console.log(event.type);
72
+ console.log((await run.result()).status);
73
+ } finally {
74
+ try {
75
+ await session.close();
76
+ } finally {
77
+ await client.close();
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Profile とライフサイクル
83
+
84
+ - Adapter-owned `process` Connection のみで、Shell は使用しません;
85
+ - Profile に非空 `provider` と `model` が必要で、Reasoning、Token、bounded
86
+ transport 値も設定できます;
87
+ - Workspace は Runtime 初期化 Directory と一致する必要があります;
88
+ - 現 protocol に Resume と Native Session Close はなく、close は local
89
+ handle 解放です;
90
+ - Connection 全体で active Run は一つです;
91
+ - `session/prompt` が返すのは永続的な Inbox `messageId`
92
+ だけで、Result や終端の authority ではありません。所有する activity 区間内の唯一有効な
93
+ `turn/end.data.reason` が終端を決め、EOF と Process
94
+ Exit は success になりません;
95
+ - 現 protocol に Prompt Cancel はなく、`run.cancel`
96
+ は未対応です。Timeout は所有する Connection を閉じて `connection_aborted`
97
+ となります。upstream で観測した `aborted` は `run.cancelled`
98
+ に mapping できますが、Harapter が Native
99
+ Cancel を要求した証拠にはなりません;
100
+ - 未知 notification は bounded redacted
101
+ observation に残り、終端には変換されません。
102
+
103
+ ## Compatibility と Evidence
104
+
105
+ 接続は `deepseek-harness-sdk-runtime`
106
+ identity と、使用する Response、Event、Terminal の structure を検証します。Runtime は診断 Version を返しますが protocol
107
+ version
108
+ negotiation がないため allowlist は使いません。新 Runtime は既定で試し、互換でない構造を使用した時点で fail
109
+ closed します。
110
+
111
+ 公式 SDK Profile は Fixture、mapping test、shared conformance、real Runtime
112
+ lifecycle で検証済みです。`experimental`
113
+ は「未実装」ではなく、任意 Runtime を実行前に既存 evidence へ自動対応付けできないことを示します。production
114
+ host は記録済み Version を pin して再現性を得られます。
115
+
116
+ Native Client、Interaction、cancel、検証 Version、live test、全制限は
117
+ [英語の詳細ドキュメント](./README.md)を参照してください。
package/README.md CHANGED
@@ -1,4 +1,23 @@
1
- # `@harapter/adapter-dsh`
1
+ <!-- markdownlint-disable MD033 MD041 -->
2
+
3
+ <h1 align="center"><code>@harapter/adapter-dsh</code></h1>
4
+
5
+ <p align="center"><strong>Map the official DeepSeek Harness SDK Runtime protocol to Harapter.</strong></p>
6
+
7
+ <p align="center">
8
+ <a href="./README.md">English</a> · <a href="./README.zh-CN.md">简体中文</a> · <a href="./README.ja.md">日本語</a> · <a href="../../README.md">Harapter</a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-dsh/next?style=flat-square&amp;label=npm%20next" alt="npm next version"></a>
13
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-dsh?style=flat-square" alt="npm downloads"></a>
14
+ <a href="https://github.com/yunfeizhu/harapter/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/yunfeizhu/harapter/ci.yml?branch=main&amp;style=flat-square&amp;label=ci" alt="CI status"></a>
15
+ <img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 24 or newer">
16
+ <a href="../../LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-0B7285?style=flat-square" alt="Apache-2.0 license"></a>
17
+ <img src="https://img.shields.io/badge/status-pre--alpha-EA580C?style=flat-square" alt="Pre-alpha status">
18
+ </p>
19
+
20
+ <!-- markdownlint-enable MD033 -->
2
21
 
3
22
  `@harapter/adapter-dsh` maps the official
4
23
  [DeepSeek Harness SDK protocol](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sdk/protocol/README.md)
@@ -6,6 +25,14 @@ to the portable Harapter lifecycle. It connects to the newline-delimited
6
25
  JSON-RPC 2.0 server exposed by the SDK Runtime and does not embed or reproduce
7
26
  the DeepSeek Harness Agent Loop.
8
27
 
28
+ ## Use this Adapter when
29
+
30
+ - your host installs and starts the official DeepSeek Harness SDK Runtime;
31
+ - you need its Session, Run, Event, interaction, resume, and cancellation
32
+ behavior behind Harapter Core; or
33
+ - you want runtime validation and bounded raw observations without embedding the
34
+ DeepSeek Harness Agent Loop in your application.
35
+
9
36
  ## Installation
10
37
 
11
38
  ```bash
@@ -92,17 +119,24 @@ const client = await registry.connect({
92
119
  });
93
120
 
94
121
  const session = await client.createSession();
95
- const run = await session.start({
96
- parts: [{ type: 'text', text: 'Describe the current project.' }],
97
- });
98
-
99
- for await (const event of run.events()) {
100
- // Render or persist according to the host's data policy.
122
+ try {
123
+ const run = await session.start({
124
+ parts: [{ type: 'text', text: 'Describe the current project.' }],
125
+ });
126
+
127
+ for await (const event of run.events()) {
128
+ // Render or persist according to the host's data policy.
129
+ }
130
+
131
+ const result = await run.result();
132
+ console.log(result.status);
133
+ } finally {
134
+ try {
135
+ await session.close();
136
+ } finally {
137
+ await client.close();
138
+ }
101
139
  }
102
-
103
- const result = await run.result();
104
- await session.close();
105
- await client.close();
106
140
  ```
107
141
 
108
142
  ## Profile and process ownership
@@ -0,0 +1,110 @@
1
+ <!-- markdownlint-disable MD033 MD041 -->
2
+
3
+ <h1 align="center"><code>@harapter/adapter-dsh</code></h1>
4
+
5
+ <p align="center"><strong>把 DeepSeek Harness 官方 SDK Runtime 协议映射为 Harapter。</strong></p>
6
+
7
+ <p align="center">
8
+ <a href="./README.md">English</a> · <a href="./README.zh-CN.md">简体中文</a> · <a href="./README.ja.md">日本語</a> · <a href="../../README.zh-CN.md">Harapter</a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-dsh/next?style=flat-square&amp;label=npm%20next" alt="npm next 版本"></a>
13
+ <a href="https://www.npmjs.com/package/@harapter/adapter-dsh"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-dsh?style=flat-square" alt="npm 下载量"></a>
14
+ <a href="https://github.com/yunfeizhu/harapter/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/yunfeizhu/harapter/ci.yml?branch=main&amp;style=flat-square&amp;label=ci" alt="CI 状态"></a>
15
+ <img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 24 或更高版本">
16
+ <a href="../../LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-0B7285?style=flat-square" alt="Apache-2.0 许可证"></a>
17
+ <img src="https://img.shields.io/badge/status-pre--alpha-EA580C?style=flat-square" alt="Pre-alpha 状态">
18
+ </p>
19
+
20
+ <!-- markdownlint-enable MD033 -->
21
+
22
+ `@harapter/adapter-dsh` 连接 DeepSeek Harness SDK
23
+ Runtime 暴露的换行分隔 JSON-RPC 2.0
24
+ Server,并把 Session、Run、Event、Interaction、取消和错误映射到 Harapter。它不会嵌入或复制 DeepSeek
25
+ Harness Agent Loop。
26
+
27
+ ## 前置条件与安装
28
+
29
+ 宿主自行安装、组合、配置和认证 DeepSeek Harness。Harapter 不包含 DSH CLI、SDK
30
+ Package、Cordis Application、Plugin、Model Adapter 或 Credential。
31
+
32
+ ```bash
33
+ pnpm add @harapter/core@next @harapter/adapter-dsh@next
34
+ ```
35
+
36
+ ## 快速开始
37
+
38
+ ```ts
39
+ import { HarnessRegistry, profileId } from '@harapter/core';
40
+ import {
41
+ DSH_PROVIDER_ID,
42
+ createDshProviderFactory,
43
+ } from '@harapter/adapter-dsh';
44
+
45
+ const registry = new HarnessRegistry();
46
+ registry.register(createDshProviderFactory());
47
+
48
+ const client = await registry.connect({
49
+ profileId: profileId('dsh-local'),
50
+ providerId: DSH_PROVIDER_ID,
51
+ displayName: 'Local DeepSeek Harness',
52
+ connection: {
53
+ kind: 'process',
54
+ command: 'dsh',
55
+ args: ['--profile', 'sdk'],
56
+ ownership: 'adapter',
57
+ },
58
+ providerOptions: {
59
+ provider: 'host-configured-provider',
60
+ model: 'host-configured-model',
61
+ },
62
+ });
63
+
64
+ const session = await client.createSession();
65
+ try {
66
+ const run = await session.start({
67
+ parts: [{ type: 'text', text: 'Describe the current project.' }],
68
+ });
69
+ for await (const event of run.events()) console.log(event.type);
70
+ console.log((await run.result()).status);
71
+ } finally {
72
+ try {
73
+ await session.close();
74
+ } finally {
75
+ await client.close();
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Profile 与生命周期
81
+
82
+ - 只接受 Adapter 拥有的 `process` Connection,并且不会使用 Shell;
83
+ - Profile 必须提供非空 `provider` 和
84
+ `model`,还可设置 Reasoning、Token 与有界传输参数;
85
+ - Workspace 必须与 Runtime 初始化目录一致;Session 级 Model、System
86
+ Context 和 Metadata 不受支持;
87
+ - 当前协议没有 Resume 与 Native Session Close;`session.close()`
88
+ 只释放本地 Handle;
89
+ - 整条 Connection 同时只有一个 Run;普通文本按官方 SDK 消息发送;
90
+ - `session/prompt` 只返回持久的 Inbox
91
+ `messageId`,不是 Result 或终态 Authority;归属活动区间内唯一有效的
92
+ `turn/end.data.reason` 才决定终态,EOF 或 Process Exit 不会成为成功;
93
+ - 当前协议没有 Prompt Cancel,`run.cancel`
94
+ 因此不受支持;Timeout 会关闭所属 Connection 并得到
95
+ `connection_aborted`,上游观测到的 `aborted` 可映射为
96
+ `run.cancelled`,但不证明 Harapter 发起了 Native Cancel;
97
+ - 未知通知进入有界、脱敏 Observation,不会被猜测为终态。
98
+
99
+ ## 兼容性与 Evidence
100
+
101
+ 连接会验证 `deepseek-harness-sdk-runtime`
102
+ 身份以及实际使用的每个 Response、Event 和 Terminal 结构。Runtime 会报告诊断 Version,但协议没有协商版本,因此不使用版本白名单:新版本默认尝试,结构不兼容时在边界 fail
103
+ closed。
104
+
105
+ 官方 SDK Profile 已通过合成 Fixture、Mapping
106
+ Test、共享 Conformance 和真实 Runtime 生命周期验证。Adapter 仍显示
107
+ `experimental`,表示任意连接的 Runtime无法在执行前自动绑定到已验证证据,而不是“没有实现或没有跑过”。生产环境可以固定文档记录的验证版本以获得可复现部署。
108
+
109
+ Native Client、Interaction、取消细节、最后验证版本、Live Test 与全部限制见
110
+ [英文详细文档](./README.md)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harapter/adapter-dsh",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "DeepSeek Harness stdio JSON-RPC provider adapter for Harapter.",
5
5
  "keywords": [
6
6
  "agent",
@@ -17,11 +17,13 @@
17
17
  "bugs": {
18
18
  "url": "https://github.com/yunfeizhu/harapter/issues"
19
19
  },
20
- "homepage": "https://github.com/yunfeizhu/harapter#readme",
20
+ "homepage": "https://github.com/yunfeizhu/harapter/tree/main/providers/dsh#readme",
21
21
  "type": "module",
22
22
  "sideEffects": false,
23
23
  "files": [
24
- "dist"
24
+ "dist",
25
+ "README.zh-CN.md",
26
+ "README.ja.md"
25
27
  ],
26
28
  "main": "./dist/index.js",
27
29
  "types": "./dist/index.d.ts",
@@ -41,11 +43,11 @@
41
43
  "tag": "next"
42
44
  },
43
45
  "dependencies": {
44
- "@harapter/core": "0.1.1",
45
- "@harapter/transport-jsonrpc-stdio": "0.1.1"
46
+ "@harapter/core": "0.1.2",
47
+ "@harapter/transport-jsonrpc-stdio": "0.1.2"
46
48
  },
47
49
  "devDependencies": {
48
- "@harapter/conformance": "0.1.1"
50
+ "@harapter/conformance": "0.1.2"
49
51
  },
50
52
  "scripts": {
51
53
  "build": "tsc --project tsconfig.build.json"