@lingxiao-office/sdk 1.0.0 → 1.0.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.
- package/README.md +77 -0
- package/package.json +4 -2
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @lingxiao-office/sdk
|
|
2
|
+
|
|
3
|
+
凌霄剑域可复用 Agent 引擎 SDK:编排内核、Agent 运行时、LLM 客户端、工具系统、记忆系统。不依赖 Web API,可直接嵌入任意产品线。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lingxiao-office/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import {
|
|
15
|
+
contentToPlainText,
|
|
16
|
+
createAgentLoop,
|
|
17
|
+
createLLMClient,
|
|
18
|
+
createToolRegistry,
|
|
19
|
+
} from '@lingxiao-office/sdk';
|
|
20
|
+
|
|
21
|
+
const llm = createLLMClient(runtimeSnapshot);
|
|
22
|
+
const registry = createToolRegistry();
|
|
23
|
+
|
|
24
|
+
const loop = createAgentLoop({
|
|
25
|
+
llm,
|
|
26
|
+
registry,
|
|
27
|
+
model: 'claude-opus-4-8',
|
|
28
|
+
messages: [
|
|
29
|
+
{ role: 'system', content: 'You are a helpful agent.' },
|
|
30
|
+
{ role: 'user', content: 'Inspect the workspace.' },
|
|
31
|
+
],
|
|
32
|
+
toolContext: {
|
|
33
|
+
workspace: process.cwd(),
|
|
34
|
+
permissionContext: { mode: 'yolo' },
|
|
35
|
+
},
|
|
36
|
+
done: ({ text }) => text.includes('DONE'),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const result = await loop.run();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 核心能力
|
|
43
|
+
|
|
44
|
+
| 能力 | 入口 | 说明 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| LLM 客户端 | `createLLMClient()` | 接 Anthropic/OpenAI 兼容端点,内置 thinking、重试、token 计数 |
|
|
47
|
+
| 工具系统 | `createToolRegistry()` | 50+ 内置工具(shell/http/file/code_search/memory/...) |
|
|
48
|
+
| Agent 循环 | `createAgentLoop()` | 封装 LLM 调用 + tool_calls 执行 + 结果回灌 + done 判断 |
|
|
49
|
+
| 文本提取 | `contentToPlainText()` | 把 LLM 返回统一转成纯文本 |
|
|
50
|
+
| 会话管理 | `SessionManager` | 会话级编排:多 agent、共享上下文 |
|
|
51
|
+
| 任务图 | `TaskBoard` | 任务 DAG:建任务、设依赖、追踪状态 |
|
|
52
|
+
| 消息总线 | `MessageBus` | 进程内异步通信 |
|
|
53
|
+
| Team 协作 | `team_manage` / `team_message` / `team_inbox` | 多 agent 组团、P2P/广播消息 |
|
|
54
|
+
| Blackboard | `blackboard` 工具 | 共享知识图:多 agent 往同一黑板写事实 |
|
|
55
|
+
| 记忆系统 | `memory` / `memory_read` / `memory_write` | 持久化记忆 |
|
|
56
|
+
| MCP | `mcp` 工具 | 接入任意 MCP server 的 tools/resources/prompts |
|
|
57
|
+
|
|
58
|
+
## 子路径导入
|
|
59
|
+
|
|
60
|
+
部分高级 runtime 能力通过子路径访问:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { createContentGenerator } from '@lingxiao-office/sdk/llm/ContentGenerator.js';
|
|
64
|
+
import { AgentRoundExecutor } from '@lingxiao-office/sdk/agents/AgentRoundExecutor.js';
|
|
65
|
+
import { AgentCore } from '@lingxiao-office/sdk/agents/runtime/AgentCore.js';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 文档
|
|
69
|
+
|
|
70
|
+
- [完整文档](https://github.com/lingxiao-office/lingxiao-backend/tree/main/docs)
|
|
71
|
+
- [API Reference](https://github.com/lingxiao-office/lingxiao-backend/blob/main/docs/api-reference.md)
|
|
72
|
+
- [Team / Blackboard / DAG](https://github.com/lingxiao-office/lingxiao-backend/blob/main/docs/team-blackboard-dag.md)
|
|
73
|
+
- [Pentest Agent 教学项目](https://github.com/lingxiao-office/lingxiao-backend/tree/main/examples/pentest-agent)
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiao-office/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "凌霄剑域可复用后端引擎 SDK:编排内核、Agent 运行时、LLM 客户端、工具系统、记忆系统。不依赖 Web API,可直接嵌入任意产品线。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": ["agent", "llm", "ai", "sdk", "orchestration", "multi-agent", "tool-calling", "framework", "lingxiao"],
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"node": ">=24.0.0"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
|
-
"dist"
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
34
36
|
],
|
|
35
37
|
"publishConfig": {
|
|
36
38
|
"access": "public",
|