@nodeskai/genehub-sdk 2026.3.2-9 → 2026.3.3
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/LICENSE +21 -0
- package/README.md +83 -0
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NoDeskAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @nodeskai/genehub-sdk
|
|
2
|
+
|
|
3
|
+
GeneHub TypeScript SDK -- API 客户端、产品适配器和学习引擎。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nodeskai/genehub-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
### API 客户端
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { GeneHubClient } from '@nodeskai/genehub-sdk';
|
|
17
|
+
|
|
18
|
+
const client = new GeneHubClient({
|
|
19
|
+
registryUrl: 'https://genehub.nodeskai.com',
|
|
20
|
+
token: 'ghb_...',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const genes = await client.searchGenes({ q: 'code-review' });
|
|
24
|
+
const gene = await client.getGene('code-review');
|
|
25
|
+
const manifest = await client.getManifest('code-review');
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 产品适配器
|
|
29
|
+
|
|
30
|
+
为不同 AI 产品提供统一的基因安装/卸载接口:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { OpenClawAdapter } from '@nodeskai/genehub-sdk';
|
|
34
|
+
|
|
35
|
+
const adapter = new OpenClawAdapter({ workspaceDir: '/path/to/workspace' });
|
|
36
|
+
await adapter.install(manifest);
|
|
37
|
+
await adapter.uninstall('code-review');
|
|
38
|
+
const installed = await adapter.list();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
支持的适配器:
|
|
42
|
+
|
|
43
|
+
| 适配器 | 产品 | 说明 |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `OpenClawAdapter` | OpenClaw | AGENTS.md + memory + MCP 配置 |
|
|
46
|
+
| `NanobotAdapter` | nanobot | memory 记录、版本解析 |
|
|
47
|
+
| `GenericAdapter` | 通用 | 基础文件写入 |
|
|
48
|
+
|
|
49
|
+
### 学习引擎
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { LearningEngine } from '@nodeskai/genehub-sdk';
|
|
53
|
+
|
|
54
|
+
const engine = new LearningEngine(client, adapter);
|
|
55
|
+
const task = await engine.createTask('code-review');
|
|
56
|
+
const result = await engine.checkResult('code-review');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 目录结构
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
packages/sdk/typescript/
|
|
63
|
+
├── src/
|
|
64
|
+
│ ├── index.ts # 导出入口
|
|
65
|
+
│ ├── client.ts # GeneHubClient API 客户端
|
|
66
|
+
│ ├── adapters/ # 产品适配器
|
|
67
|
+
│ │ ├── base.ts
|
|
68
|
+
│ │ ├── openclaw.ts
|
|
69
|
+
│ │ ├── nanobot.ts
|
|
70
|
+
│ │ └── generic.ts
|
|
71
|
+
│ └── learning/
|
|
72
|
+
│ └── engine.ts # L2 深度学习引擎
|
|
73
|
+
├── dist/ # 构建产物
|
|
74
|
+
└── package.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 开发
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm build # 构建
|
|
81
|
+
pnpm dev # 开发模式(watch)
|
|
82
|
+
pnpm test # 运行测试
|
|
83
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeskai/genehub-sdk",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.3",
|
|
4
4
|
"description": "GeneHub TypeScript SDK - API 客户端与产品适配器",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,16 +14,9 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup",
|
|
19
|
-
"dev": "tsup --watch",
|
|
20
|
-
"prepublishOnly": "pnpm build",
|
|
21
|
-
"test": "vitest run",
|
|
22
|
-
"test:watch": "vitest"
|
|
23
|
-
},
|
|
24
17
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
18
|
+
"yaml": "^2.7",
|
|
19
|
+
"@nodeskai/genehub-types": "2026.3.3"
|
|
27
20
|
},
|
|
28
21
|
"devDependencies": {
|
|
29
22
|
"tsup": "^8.3",
|
|
@@ -44,5 +37,11 @@
|
|
|
44
37
|
"gene",
|
|
45
38
|
"sdk"
|
|
46
39
|
],
|
|
47
|
-
"license": "MIT"
|
|
48
|
-
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup",
|
|
43
|
+
"dev": "tsup --watch",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:watch": "vitest"
|
|
46
|
+
}
|
|
47
|
+
}
|