@harapter/adapter-openclaw 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 +106 -0
- package/README.md +28 -1
- package/README.zh-CN.md +102 -0
- package/package.json +9 -7
package/README.ja.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
2
|
+
|
|
3
|
+
<h1 align="center"><code>@harapter/adapter-openclaw</code></h1>
|
|
4
|
+
|
|
5
|
+
<p align="center"><strong>stable ACP v1 で isolated OpenClaw Gateway Session を駆動します。</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-openclaw"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-openclaw/next?style=flat-square&label=npm%20next" alt="npm next バージョン"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@harapter/adapter-openclaw"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-openclaw?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&style=flat-square&label=ci" alt="CI ステータス"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&logo=nodedotjs&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-openclaw` は公式 `openclaw acp` stdio Bridge を起動し、stable
|
|
23
|
+
ACP
|
|
24
|
+
v1 の Session、Prompt、Event、Permission、Resume、cancellation を Harapter に mapping します。OpenClaw
|
|
25
|
+
Gateway の導入、設定、認証、運用はホストが行います。
|
|
26
|
+
|
|
27
|
+
## インストール
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @harapter/core@next @harapter/adapter-openclaw@next
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## クイックスタート
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { HarnessRegistry, profileId } from '@harapter/core';
|
|
37
|
+
import {
|
|
38
|
+
OPENCLAW_PROVIDER_ID,
|
|
39
|
+
createOpenClawProviderFactory,
|
|
40
|
+
} from '@harapter/adapter-openclaw';
|
|
41
|
+
|
|
42
|
+
const registry = new HarnessRegistry();
|
|
43
|
+
registry.register(createOpenClawProviderFactory());
|
|
44
|
+
|
|
45
|
+
const client = await registry.connect({
|
|
46
|
+
profileId: profileId('openclaw-local'),
|
|
47
|
+
providerId: OPENCLAW_PROVIDER_ID,
|
|
48
|
+
displayName: 'OpenClaw',
|
|
49
|
+
connection: {
|
|
50
|
+
kind: 'process',
|
|
51
|
+
command: 'openclaw',
|
|
52
|
+
args: ['acp'],
|
|
53
|
+
ownership: 'adapter',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const session = await client.createSession();
|
|
58
|
+
try {
|
|
59
|
+
const run = await session.start({
|
|
60
|
+
parts: [{ type: 'text', text: 'Describe the current project.' }],
|
|
61
|
+
});
|
|
62
|
+
for await (const event of run.events()) console.log(event.type);
|
|
63
|
+
console.log((await run.result()).status);
|
|
64
|
+
} finally {
|
|
65
|
+
try {
|
|
66
|
+
await session.close();
|
|
67
|
+
} finally {
|
|
68
|
+
await client.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Session と Run
|
|
74
|
+
|
|
75
|
+
- initialize は stable ACP v1 と implementation name `openclaw-acp`
|
|
76
|
+
を検証します;
|
|
77
|
+
- 新 Session は isolated Gateway Session Key を持ち、native
|
|
78
|
+
ID と route は Profile に束縛されます;
|
|
79
|
+
- Resume には同じ Provider、Profile、Compatibility、isolated route が必要です;
|
|
80
|
+
- ACP Connection 全体で active Run は一つです;
|
|
81
|
+
- text と handshake が許す Image Reference を扱い、Generic File/Native
|
|
82
|
+
Input は対象外です;
|
|
83
|
+
- validated ACP Prompt Response だけが terminal authority です;
|
|
84
|
+
- `run.cancel()` は authoritative `cancelled` Response で native
|
|
85
|
+
cancellation になります;
|
|
86
|
+
- valid Permission Request を観測すると Approval Capability が `unknown` から
|
|
87
|
+
`native` になります;
|
|
88
|
+
- 未知 ACP message は bounded redacted observation になり、Prompt、path、Tool
|
|
89
|
+
content を保持しません。
|
|
90
|
+
|
|
91
|
+
local timeout/abort で remote
|
|
92
|
+
mutation を確認できない場合、Connection を abort し、cancellation や success にはしません。`end_turn`
|
|
93
|
+
は完了、`refusal`、`max_tokens`、 `max_turn_requests` は失敗、EOF、Process
|
|
94
|
+
Loss、Queue Overflow は `connection_aborted` です。
|
|
95
|
+
|
|
96
|
+
## Compatibility と制限
|
|
97
|
+
|
|
98
|
+
stable ACP v1 は negotiated protocol version を持つため、connection 時に Runtime
|
|
99
|
+
identity と必須 structure を検証できます。Fixture、Provider Negative、shared
|
|
100
|
+
conformance、real completion、cross-Client Resume、Native
|
|
101
|
+
Cancellation の evidence があります。
|
|
102
|
+
|
|
103
|
+
shared Gateway routing、History Replay、Session MCP、Audio、Generic
|
|
104
|
+
File、Filesystem/ Terminal Client Service、自動 Process Restart、直接 Gateway
|
|
105
|
+
WebSocket は対象外です。Workspace は ACP に渡しますが Tool の実行 Directory は
|
|
106
|
+
`unknown` です。詳細は [英語のドキュメント](./README.md)を参照してください。
|
package/README.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
2
|
+
|
|
3
|
+
<h1 align="center"><code>@harapter/adapter-openclaw</code></h1>
|
|
4
|
+
|
|
5
|
+
<p align="center"><strong>Drive an isolated OpenClaw Gateway Session through stable ACP v1.</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-openclaw"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-openclaw/next?style=flat-square&label=npm%20next" alt="npm next version"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@harapter/adapter-openclaw"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-openclaw?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&style=flat-square&label=ci" alt="CI status"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&logo=nodedotjs&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-openclaw` maps the official `openclaw acp` stdio bridge to
|
|
4
23
|
the portable Harapter lifecycle.
|
|
@@ -8,6 +27,14 @@ Gateway. Harapter starts only the exact adapter-owned command selected by the
|
|
|
8
27
|
Profile. It does not install an OpenClaw Runtime or SDK, configure models or
|
|
9
28
|
tools, manage Gateway credentials, or change host security policy.
|
|
10
29
|
|
|
30
|
+
## Use this Adapter when
|
|
31
|
+
|
|
32
|
+
- your host already operates an authenticated OpenClaw Gateway;
|
|
33
|
+
- you need one isolated Gateway Session exposed as a portable Session over the
|
|
34
|
+
stable ACP v1 bridge; or
|
|
35
|
+
- you need resume, native cancellation, approvals, and unknown ACP observations
|
|
36
|
+
without direct Gateway WebSocket coupling.
|
|
37
|
+
|
|
11
38
|
## Installation
|
|
12
39
|
|
|
13
40
|
```bash
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
2
|
+
|
|
3
|
+
<h1 align="center"><code>@harapter/adapter-openclaw</code></h1>
|
|
4
|
+
|
|
5
|
+
<p align="center"><strong>通过稳定 ACP v1 驱动隔离的 OpenClaw Gateway Session。</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-openclaw"><img src="https://img.shields.io/npm/v/%40harapter%2Fadapter-openclaw/next?style=flat-square&label=npm%20next" alt="npm next 版本"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@harapter/adapter-openclaw"><img src="https://img.shields.io/npm/dm/%40harapter%2Fadapter-openclaw?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&style=flat-square&label=ci" alt="CI 状态"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&logo=nodedotjs&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-openclaw` 启动官方 `openclaw acp` stdio Bridge,将稳定 ACP v1
|
|
23
|
+
Session、Prompt、Event、Permission、Resume 与取消映射为 Harapter。宿主负责安装、配置、认证和运行 OpenClaw
|
|
24
|
+
Gateway。
|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @harapter/core@next @harapter/adapter-openclaw@next
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 快速开始
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { HarnessRegistry, profileId } from '@harapter/core';
|
|
36
|
+
import {
|
|
37
|
+
OPENCLAW_PROVIDER_ID,
|
|
38
|
+
createOpenClawProviderFactory,
|
|
39
|
+
} from '@harapter/adapter-openclaw';
|
|
40
|
+
|
|
41
|
+
const registry = new HarnessRegistry();
|
|
42
|
+
registry.register(createOpenClawProviderFactory());
|
|
43
|
+
|
|
44
|
+
const client = await registry.connect({
|
|
45
|
+
profileId: profileId('openclaw-local'),
|
|
46
|
+
providerId: OPENCLAW_PROVIDER_ID,
|
|
47
|
+
displayName: 'OpenClaw',
|
|
48
|
+
connection: {
|
|
49
|
+
kind: 'process',
|
|
50
|
+
command: 'openclaw',
|
|
51
|
+
args: ['acp'],
|
|
52
|
+
ownership: 'adapter',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const session = await client.createSession();
|
|
57
|
+
try {
|
|
58
|
+
const run = await session.start({
|
|
59
|
+
parts: [{ type: 'text', text: 'Describe the current project.' }],
|
|
60
|
+
});
|
|
61
|
+
for await (const event of run.events()) console.log(event.type);
|
|
62
|
+
console.log((await run.result()).status);
|
|
63
|
+
} finally {
|
|
64
|
+
try {
|
|
65
|
+
await session.close();
|
|
66
|
+
} finally {
|
|
67
|
+
await client.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Session 与 Run
|
|
73
|
+
|
|
74
|
+
- 初始化必须协商稳定 ACP v1,并验证 Implementation Name 为 `openclaw-acp`;
|
|
75
|
+
- 新 Session 使用显式隔离的 Gateway Session Key,Native
|
|
76
|
+
ID 和路由状态绑定到 Profile;
|
|
77
|
+
- Resume 要求相同 Provider、Profile、Compatibility 与隔离 Route;
|
|
78
|
+
- 整条 ACP Connection 同时只运行一个 Run,避免未知 Event 被错误分配;
|
|
79
|
+
- 支持非空文本和握手声明的 Image Reference,Generic File 与 Native
|
|
80
|
+
Input 不受支持;
|
|
81
|
+
- 验证通过的 ACP Prompt Response 是唯一终态 Authority;
|
|
82
|
+
- `run.cancel()` 必须得到 Authoritative `cancelled` Response 才是 Native
|
|
83
|
+
Cancel;
|
|
84
|
+
- Permission Request 动态把 Approval Capability 从 `unknown` 提升为 `native`;
|
|
85
|
+
- 未知 ACP 消息通过有界、脱敏 Observation 保持可见,不保存 Prompt、路径或 Tool 内容。
|
|
86
|
+
|
|
87
|
+
本地 timeout/abort 无法确认远端 Mutation 时,Adapter 会中止 Connection,绝不把它当成取消或成功。`end_turn`
|
|
88
|
+
是完成;`refusal`、`max_tokens` 和 `max_turn_requests` 是失败;EOF、Process
|
|
89
|
+
Loss 与 Queue Overflow 是 `connection_aborted`。
|
|
90
|
+
|
|
91
|
+
## 兼容性与限制
|
|
92
|
+
|
|
93
|
+
稳定 ACP
|
|
94
|
+
v1 提供可协商协议版本,因此 Runtime 身份和必需结构可在连接阶段验证。当前 Adapter 有 Fixture、Provider
|
|
95
|
+
Negative、共享 Conformance,以及真实完成、跨 Client Resume 和 Native
|
|
96
|
+
Cancellation Evidence。
|
|
97
|
+
|
|
98
|
+
当前不覆盖共享 Gateway Session 路由、History Replay、Session MCP、Audio、Generic
|
|
99
|
+
File、Filesystem/Terminal Client Service、自动 Process Restart 或直接 Gateway
|
|
100
|
+
WebSocket。Workspace 会传给 ACP,但 Tool 实际执行目录仍为
|
|
101
|
+
`unknown`。完整 Evidence、Live Test、安全隔离与 Native
|
|
102
|
+
Extension 见[英文详细文档](./README.md)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harapter/adapter-openclaw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "OpenClaw ACP 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/openclaw#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,12 +43,12 @@
|
|
|
41
43
|
"tag": "next"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@harapter/core": "0.1.
|
|
45
|
-
"@harapter/transport-acp": "0.1.
|
|
46
|
-
"@harapter/transport-jsonrpc-stdio": "0.1.
|
|
46
|
+
"@harapter/core": "0.1.2",
|
|
47
|
+
"@harapter/transport-acp": "0.1.2",
|
|
48
|
+
"@harapter/transport-jsonrpc-stdio": "0.1.2"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"@harapter/conformance": "0.1.
|
|
51
|
+
"@harapter/conformance": "0.1.2"
|
|
50
52
|
},
|
|
51
53
|
"scripts": {
|
|
52
54
|
"build": "tsc --project tsconfig.build.json"
|