@gt-fe/eap-cli 0.2.11 → 0.2.13
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 +304 -304
- package/dist/static/playground/index.html +131 -131
- package/dist/static/playground/playground.css +209 -209
- package/dist/static/playground/playground.js +151 -151
- package/dist/static/playground-app/index.html +11 -11
- package/dist/templates/README.md +51 -51
- package/dist/templates/agent-api-orchestration/.env +16 -16
- package/dist/templates/agent-api-orchestration/README.md +326 -326
- package/dist/templates/agent-api-orchestration/agent.manifest.json +19 -19
- package/dist/templates/agent-api-orchestration/eap.config.json +1 -1
- package/dist/templates/agent-api-orchestration/eap.lock.yaml +5 -5
- package/dist/templates/agent-api-orchestration/gitignore +3 -3
- package/dist/templates/agent-api-orchestration/graph.json +35 -35
- package/dist/templates/agent-api-orchestration/package.json +2 -2
- package/dist/templates/agent-api-orchestration/scripts/api-test.mjs +443 -443
- package/dist/templates/agent-api-orchestration/scripts/build-runtime.mjs +26 -26
- package/dist/templates/agent-api-orchestration/scripts/validate.mjs +12 -12
- package/dist/templates/agent-api-orchestration/src/embedded-agent.ts +91 -91
- package/dist/templates/agent-api-orchestration/src/http/app.ts +58 -58
- package/dist/templates/agent-api-orchestration/src/http/config.ts +34 -34
- package/dist/templates/agent-api-orchestration/src/http/errors.ts +63 -63
- package/dist/templates/agent-api-orchestration/src/http/index.ts +4 -4
- package/dist/templates/agent-api-orchestration/src/http/middleware/cors.ts +17 -17
- package/dist/templates/agent-api-orchestration/src/http/routes/agent.ts +33 -33
- package/dist/templates/agent-api-orchestration/src/http/routes/health.ts +15 -15
- package/dist/templates/agent-api-orchestration/src/http/routes/invocations.ts +29 -29
- package/dist/templates/agent-api-orchestration/src/http/routes/sessions.ts +70 -70
- package/dist/templates/agent-api-orchestration/src/http/services/agent-service.ts +60 -60
- package/dist/templates/agent-api-orchestration/src/http/services/resource-service.ts +95 -95
- package/dist/templates/agent-api-orchestration/src/http/shared/request.ts +82 -82
- package/dist/templates/agent-api-orchestration/src/http/shared/sse.ts +32 -32
- package/dist/templates/agent-api-orchestration/src/http/types.ts +39 -39
- package/dist/templates/agent-api-orchestration/src/index.ts +91 -91
- package/dist/templates/agent-api-orchestration/src/platform-user.ts +36 -36
- package/dist/templates/agent-api-orchestration/src/project-config.ts +45 -45
- package/dist/templates/agent-api-orchestration/tsconfig.json +15 -15
- package/dist/templates/dag-workflow/README.md +102 -102
- package/dist/templates/dag-workflow/agent.manifest.json +19 -19
- package/dist/templates/dag-workflow/eap.config.json +1 -1
- package/dist/templates/dag-workflow/eap.lock.yaml +5 -5
- package/dist/templates/dag-workflow/gitignore +51 -51
- package/dist/templates/dag-workflow/graph.json +51 -51
- package/dist/templates/dag-workflow/package.json +10 -10
- package/dist/templates/dag-workflow/skills/README.md +116 -116
- package/dist/templates/plan-and-execute/README.md +109 -109
- package/dist/templates/plan-and-execute/agent.manifest.json +19 -19
- package/dist/templates/plan-and-execute/eap.config.json +1 -1
- package/dist/templates/plan-and-execute/eap.lock.yaml +5 -5
- package/dist/templates/plan-and-execute/gitignore +51 -51
- package/dist/templates/plan-and-execute/graph.json +49 -49
- package/dist/templates/plan-and-execute/package.json +10 -10
- package/dist/templates/plan-and-execute/skills/README.md +120 -120
- package/dist/templates/plan-and-execute/tools/echo-tool/src/index.js +17 -17
- package/dist/templates/plan-and-execute/tools/echo-tool/toolset.manifest.json +55 -55
- package/dist/templates/simple-flow/README.md +87 -87
- package/dist/templates/simple-flow/agent.manifest.json +19 -19
- package/dist/templates/simple-flow/eap.config.json +1 -1
- package/dist/templates/simple-flow/eap.lock.yaml +5 -5
- package/dist/templates/simple-flow/gitignore +51 -51
- package/dist/templates/simple-flow/graph.json +32 -32
- package/dist/templates/simple-flow/package.json +10 -10
- package/dist/templates/simple-flow/skills/README.md +113 -113
- package/dist/templates/single-agent-with-tools/README.md +138 -138
- package/dist/templates/single-agent-with-tools/agent.manifest.json +19 -19
- package/dist/templates/single-agent-with-tools/eap.config.json +1 -1
- package/dist/templates/single-agent-with-tools/eap.lock.yaml +5 -5
- package/dist/templates/single-agent-with-tools/gitignore +51 -51
- package/dist/templates/single-agent-with-tools/graph.json +41 -41
- package/dist/templates/single-agent-with-tools/package.json +10 -10
- package/dist/templates/single-agent-with-tools/skills/README.md +119 -119
- package/dist/templates/single-agent-with-tools/tools/echo-tool/src/index.js +17 -17
- package/dist/templates/single-agent-with-tools/tools/echo-tool/toolset.manifest.json +55 -55
- package/dist/templates/single-agent-with-tools/tools/http-weather/toolset.manifest.json +73 -73
- package/dist/templates/single-agent-with-tools/tools/web-search/toolset.manifest.json +41 -41
- package/package.json +3 -3
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "规划后逐步执行:planner 写出计划,executor 按计划逐步调用工具直至完成。",
|
|
3
|
-
"nodes": [
|
|
4
|
-
{
|
|
5
|
-
"id": "planner",
|
|
6
|
-
"type": "llm",
|
|
7
|
-
"config": {
|
|
8
|
-
"disableTools": true,
|
|
9
|
-
"systemPrompt": "为用户请求写一份简短有序计划,每行一步。不要调用工具。不要把未调用的工具写成 XML、命令块或伪 execute_command。"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"id": "executor",
|
|
14
|
-
"type": "llm",
|
|
15
|
-
"config": {
|
|
16
|
-
"systemPrompt": "按上一份计划逐步执行。每一步只做一件事:调用 echo-tool,把该步原文放入 text。只通过平台提供的工具调用执行,不要在回复里写未调用的 XML、命令块或伪 execute_command。全部完成后直接用中文回复,不要再调用工具。"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"id": "tools",
|
|
21
|
-
"type": "tool",
|
|
22
|
-
"config": {
|
|
23
|
-
"tool": "echo-tool"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"edges": [
|
|
28
|
-
{ "from": "__start__", "to": "planner" },
|
|
29
|
-
{ "from": "planner", "to": "executor" },
|
|
30
|
-
{ "from": "tools", "to": "executor" }
|
|
31
|
-
],
|
|
32
|
-
"conditionalEdges": [
|
|
33
|
-
{
|
|
34
|
-
"from": "executor",
|
|
35
|
-
"conditionFn": "shouldContinue",
|
|
36
|
-
"branches": [
|
|
37
|
-
{ "value": "call_tools", "to": "tools" },
|
|
38
|
-
{ "value": "finish", "to": "__end__" }
|
|
39
|
-
],
|
|
40
|
-
"fallback": "__end__"
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"entryPoint": "planner",
|
|
44
|
-
"finishPoints": ["__end__"],
|
|
45
|
-
"config": {
|
|
46
|
-
"maxRetries": 3,
|
|
47
|
-
"checkpointStore": "memory"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"description": "规划后逐步执行:planner 写出计划,executor 按计划逐步调用工具直至完成。",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"id": "planner",
|
|
6
|
+
"type": "llm",
|
|
7
|
+
"config": {
|
|
8
|
+
"disableTools": true,
|
|
9
|
+
"systemPrompt": "为用户请求写一份简短有序计划,每行一步。不要调用工具。不要把未调用的工具写成 XML、命令块或伪 execute_command。"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "executor",
|
|
14
|
+
"type": "llm",
|
|
15
|
+
"config": {
|
|
16
|
+
"systemPrompt": "按上一份计划逐步执行。每一步只做一件事:调用 echo-tool,把该步原文放入 text。只通过平台提供的工具调用执行,不要在回复里写未调用的 XML、命令块或伪 execute_command。全部完成后直接用中文回复,不要再调用工具。"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "tools",
|
|
21
|
+
"type": "tool",
|
|
22
|
+
"config": {
|
|
23
|
+
"tool": "echo-tool"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"edges": [
|
|
28
|
+
{ "from": "__start__", "to": "planner" },
|
|
29
|
+
{ "from": "planner", "to": "executor" },
|
|
30
|
+
{ "from": "tools", "to": "executor" }
|
|
31
|
+
],
|
|
32
|
+
"conditionalEdges": [
|
|
33
|
+
{
|
|
34
|
+
"from": "executor",
|
|
35
|
+
"conditionFn": "shouldContinue",
|
|
36
|
+
"branches": [
|
|
37
|
+
{ "value": "call_tools", "to": "tools" },
|
|
38
|
+
{ "value": "finish", "to": "__end__" }
|
|
39
|
+
],
|
|
40
|
+
"fallback": "__end__"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"entryPoint": "planner",
|
|
44
|
+
"finishPoints": ["__end__"],
|
|
45
|
+
"config": {
|
|
46
|
+
"maxRetries": 3,
|
|
47
|
+
"checkpointStore": "memory"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "plan-and-execute-agent",
|
|
3
|
-
"description": "Agent template that plans, executes, and summarizes each request",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"validate": "eap validate --strict",
|
|
8
|
-
"package": "eap package"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "plan-and-execute-agent",
|
|
3
|
+
"description": "Agent template that plans, executes, and summarizes each request",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"validate": "eap validate --strict",
|
|
8
|
+
"package": "eap package"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
# 装配与执行 Skill
|
|
2
|
-
|
|
3
|
-
四种执行模式都可以装配 Skill,但装配与执行是两个步骤。
|
|
4
|
-
|
|
5
|
-
## 普通 SKILL.md 目录
|
|
6
|
-
|
|
7
|
-
1. 把含 `SKILL.md` 的目录放到 `skills/<name>/`,可同时包含 `scripts/`、`references/`。文件夹名与 frontmatter 的 `name` 保持一致;不要嵌套版本目录。
|
|
8
|
-
2. 在根级 `agent.manifest.json` 的 `skillRefs` 中追加 `{ "code": "<name>", "version": "1.0.0" }`,保留已有引用。本地版本来自 `SKILL.md` frontmatter,省略时为 `1.0.0`。
|
|
9
|
-
3. 确认 `eap.config.json` 的 `localSkillDirectories` 包含 `"./skills"`,重启本地运行以重新物化资源。
|
|
10
|
-
|
|
11
|
-
这种装配只需要 `SKILL.md`,无需额外 JSON 清单。可调用工具的 LLM 会获得 Skill 目录信息,通过 `read_file` 阅读正文、通过 `execute_command` 执行脚本。`disableTools: true` 的节点不能这样读取或执行 Skill。模型按文档使用脚本,不等于 Runtime 执行结构化 workflow。
|
|
12
|
-
|
|
13
|
-
## 作为子图执行的完整最小样例
|
|
14
|
-
|
|
15
|
-
本例创建 `request-summary`,由一个 code 节点整理用户请求,输出以“需求记录:”开头的助手消息。须设 `emitReply: true`,否则 `reply` 只出现在 tool 结果 JSON 里。不调用外部工具。
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
skills/
|
|
19
|
-
request-summary/
|
|
20
|
-
SKILL.md
|
|
21
|
-
skill.manifest.json
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
创建 `skills/request-summary/SKILL.md`:
|
|
25
|
-
|
|
26
|
-
```markdown
|
|
27
|
-
---
|
|
28
|
-
name: request-summary
|
|
29
|
-
description: 整理用户原始请求,生成需求记录。
|
|
30
|
-
version: 1.0.0
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
把用户请求中的连续空白整理成一个空格,输出需求记录。
|
|
34
|
-
结构化执行入口在同目录 skill.manifest.json 的 workflow 字段中。
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
创建 `skills/request-summary/skill.manifest.json`:
|
|
38
|
-
|
|
39
|
-
```json
|
|
40
|
-
{
|
|
41
|
-
"code": "request-summary",
|
|
42
|
-
"name": "request-summary",
|
|
43
|
-
"version": "1.0.0",
|
|
44
|
-
"workflow": {
|
|
45
|
-
"nodes": [
|
|
46
|
-
{
|
|
47
|
-
"id": "record-request",
|
|
48
|
-
"type": "code",
|
|
49
|
-
"config": {
|
|
50
|
-
"timeoutMs": 1000,
|
|
51
|
-
"emitReply": true,
|
|
52
|
-
"code": "const messages = Array.isArray(state.messages) ? state.messages : []; let input = ''; for (let i = messages.length - 1; i >= 0; i--) { if (messages[i].role === 'user') { input = String(messages[i].content || ''); break; } } return { reply: '需求记录:' + input.replace(/\\s+/g, ' ').trim() };"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"edges": [
|
|
57
|
-
{
|
|
58
|
-
"from": "__start__",
|
|
59
|
-
"to": "record-request"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"from": "record-request",
|
|
63
|
-
"to": "__end__"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"entryPoint": "record-request",
|
|
67
|
-
"finishPoints": [
|
|
68
|
-
"__end__"
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
在 Agent 的 `skillRefs` 中追加:
|
|
75
|
-
|
|
76
|
-
```json
|
|
77
|
-
{ "code": "request-summary", "version": "1.0.0" }
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
这里的 `skill.manifest.json` 为子图提供结构化定义。当前 Runtime 从该清单的 `workflow`(也支持 `graph` / `definitionSnapshot`)读取图对象,**不会自动读取 Skill 目录中的独立 `graph.json`,也不会把 SKILL.md 的自然语言步骤编译成图**。
|
|
81
|
-
|
|
82
|
-
父图的节点必须绑定该 Skill:
|
|
83
|
-
|
|
84
|
-
```json
|
|
85
|
-
{
|
|
86
|
-
"id": "run-skill",
|
|
87
|
-
"type": "subgraph",
|
|
88
|
-
"config": { "skillCode": "request-summary" }
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
`skillCode` 必须与 `skillRefs[].code` 一致;不能只填写 `type: subgraph`。节点还需接入实际控制流,见下面的模板接法。
|
|
93
|
-
|
|
94
|
-
## 接到 Plan → Execute
|
|
95
|
-
|
|
96
|
-
默认 `executor` 的提示词只要求调用 `echo-tool`,它不会把任意计划步骤自动转换成 subgraph 调用。下面给出一个**固定两步计划**的接线示例,用于验证 Skill 执行:第一步执行 `request-summary`,第二步回显这份需求记录。
|
|
97
|
-
|
|
98
|
-
1. 在 `nodes` 中加入上面的 `run-skill`。
|
|
99
|
-
2. 将 `planner.config.systemPrompt` 改为:`为本示例输出固定的两步计划:第一步执行 request-summary 整理用户请求;第二步用 echo-tool 回显需求记录。不要调用工具。` 保持 `disableTools: true`。
|
|
100
|
-
3. 将 `executor.config.systemPrompt` 改为:`计划第一步 request-summary 已由上游子图完成。读取其需求记录,调用一次 echo-tool 回显该记录。收到结果后用中文报告完成,不要重复调用工具。`
|
|
101
|
-
4. 将 `planner → executor` 替换为下面的两条边,其他边、条件边、入口和结束配置保持原样:
|
|
102
|
-
|
|
103
|
-
```json
|
|
104
|
-
[
|
|
105
|
-
{ "from": "planner", "to": "run-skill" },
|
|
106
|
-
{ "from": "run-skill", "to": "executor" }
|
|
107
|
-
]
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
顺序为 `planner → run-skill → executor ⇄ tools`。Skill 每次请求只执行一次;不要把它接在 `tools → executor` 的循环上,否则每轮工具调用都会重复执行 Skill。
|
|
111
|
-
|
|
112
|
-
这个示例由图明确固定第一步。若要让任意动态计划中的某一步选择不同 Skill,需要另行实现计划步骤状态与 Skill 路由;默认模板没有这套调度。未接入子图的普通 Skill 仍可由支持工具的模型读取,但默认 executor 的 echo 专用提示词也需要按业务调整。
|
|
113
|
-
|
|
114
|
-
## 检查结果
|
|
115
|
-
|
|
116
|
-
改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
|
|
117
|
-
|
|
118
|
-
`eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
|
|
119
|
-
|
|
120
|
-
示例是本地开发资源。上线前按平台要求登记、锁定和发布 Skill 及其依赖。
|
|
1
|
+
# 装配与执行 Skill
|
|
2
|
+
|
|
3
|
+
四种执行模式都可以装配 Skill,但装配与执行是两个步骤。
|
|
4
|
+
|
|
5
|
+
## 普通 SKILL.md 目录
|
|
6
|
+
|
|
7
|
+
1. 把含 `SKILL.md` 的目录放到 `skills/<name>/`,可同时包含 `scripts/`、`references/`。文件夹名与 frontmatter 的 `name` 保持一致;不要嵌套版本目录。
|
|
8
|
+
2. 在根级 `agent.manifest.json` 的 `skillRefs` 中追加 `{ "code": "<name>", "version": "1.0.0" }`,保留已有引用。本地版本来自 `SKILL.md` frontmatter,省略时为 `1.0.0`。
|
|
9
|
+
3. 确认 `eap.config.json` 的 `localSkillDirectories` 包含 `"./skills"`,重启本地运行以重新物化资源。
|
|
10
|
+
|
|
11
|
+
这种装配只需要 `SKILL.md`,无需额外 JSON 清单。可调用工具的 LLM 会获得 Skill 目录信息,通过 `read_file` 阅读正文、通过 `execute_command` 执行脚本。`disableTools: true` 的节点不能这样读取或执行 Skill。模型按文档使用脚本,不等于 Runtime 执行结构化 workflow。
|
|
12
|
+
|
|
13
|
+
## 作为子图执行的完整最小样例
|
|
14
|
+
|
|
15
|
+
本例创建 `request-summary`,由一个 code 节点整理用户请求,输出以“需求记录:”开头的助手消息。须设 `emitReply: true`,否则 `reply` 只出现在 tool 结果 JSON 里。不调用外部工具。
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
skills/
|
|
19
|
+
request-summary/
|
|
20
|
+
SKILL.md
|
|
21
|
+
skill.manifest.json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
创建 `skills/request-summary/SKILL.md`:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
---
|
|
28
|
+
name: request-summary
|
|
29
|
+
description: 整理用户原始请求,生成需求记录。
|
|
30
|
+
version: 1.0.0
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
把用户请求中的连续空白整理成一个空格,输出需求记录。
|
|
34
|
+
结构化执行入口在同目录 skill.manifest.json 的 workflow 字段中。
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
创建 `skills/request-summary/skill.manifest.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"code": "request-summary",
|
|
42
|
+
"name": "request-summary",
|
|
43
|
+
"version": "1.0.0",
|
|
44
|
+
"workflow": {
|
|
45
|
+
"nodes": [
|
|
46
|
+
{
|
|
47
|
+
"id": "record-request",
|
|
48
|
+
"type": "code",
|
|
49
|
+
"config": {
|
|
50
|
+
"timeoutMs": 1000,
|
|
51
|
+
"emitReply": true,
|
|
52
|
+
"code": "const messages = Array.isArray(state.messages) ? state.messages : []; let input = ''; for (let i = messages.length - 1; i >= 0; i--) { if (messages[i].role === 'user') { input = String(messages[i].content || ''); break; } } return { reply: '需求记录:' + input.replace(/\\s+/g, ' ').trim() };"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"edges": [
|
|
57
|
+
{
|
|
58
|
+
"from": "__start__",
|
|
59
|
+
"to": "record-request"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"from": "record-request",
|
|
63
|
+
"to": "__end__"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"entryPoint": "record-request",
|
|
67
|
+
"finishPoints": [
|
|
68
|
+
"__end__"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
在 Agent 的 `skillRefs` 中追加:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{ "code": "request-summary", "version": "1.0.0" }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
这里的 `skill.manifest.json` 为子图提供结构化定义。当前 Runtime 从该清单的 `workflow`(也支持 `graph` / `definitionSnapshot`)读取图对象,**不会自动读取 Skill 目录中的独立 `graph.json`,也不会把 SKILL.md 的自然语言步骤编译成图**。
|
|
81
|
+
|
|
82
|
+
父图的节点必须绑定该 Skill:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"id": "run-skill",
|
|
87
|
+
"type": "subgraph",
|
|
88
|
+
"config": { "skillCode": "request-summary" }
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`skillCode` 必须与 `skillRefs[].code` 一致;不能只填写 `type: subgraph`。节点还需接入实际控制流,见下面的模板接法。
|
|
93
|
+
|
|
94
|
+
## 接到 Plan → Execute
|
|
95
|
+
|
|
96
|
+
默认 `executor` 的提示词只要求调用 `echo-tool`,它不会把任意计划步骤自动转换成 subgraph 调用。下面给出一个**固定两步计划**的接线示例,用于验证 Skill 执行:第一步执行 `request-summary`,第二步回显这份需求记录。
|
|
97
|
+
|
|
98
|
+
1. 在 `nodes` 中加入上面的 `run-skill`。
|
|
99
|
+
2. 将 `planner.config.systemPrompt` 改为:`为本示例输出固定的两步计划:第一步执行 request-summary 整理用户请求;第二步用 echo-tool 回显需求记录。不要调用工具。` 保持 `disableTools: true`。
|
|
100
|
+
3. 将 `executor.config.systemPrompt` 改为:`计划第一步 request-summary 已由上游子图完成。读取其需求记录,调用一次 echo-tool 回显该记录。收到结果后用中文报告完成,不要重复调用工具。`
|
|
101
|
+
4. 将 `planner → executor` 替换为下面的两条边,其他边、条件边、入口和结束配置保持原样:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
[
|
|
105
|
+
{ "from": "planner", "to": "run-skill" },
|
|
106
|
+
{ "from": "run-skill", "to": "executor" }
|
|
107
|
+
]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
顺序为 `planner → run-skill → executor ⇄ tools`。Skill 每次请求只执行一次;不要把它接在 `tools → executor` 的循环上,否则每轮工具调用都会重复执行 Skill。
|
|
111
|
+
|
|
112
|
+
这个示例由图明确固定第一步。若要让任意动态计划中的某一步选择不同 Skill,需要另行实现计划步骤状态与 Skill 路由;默认模板没有这套调度。未接入子图的普通 Skill 仍可由支持工具的模型读取,但默认 executor 的 echo 专用提示词也需要按业务调整。
|
|
113
|
+
|
|
114
|
+
## 检查结果
|
|
115
|
+
|
|
116
|
+
改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
|
|
117
|
+
|
|
118
|
+
`eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
|
|
119
|
+
|
|
120
|
+
示例是本地开发资源。上线前按平台要求登记、锁定和发布 Skill 及其依赖。
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
let input = '';
|
|
4
|
-
|
|
5
|
-
process.stdin.setEncoding('utf8');
|
|
6
|
-
process.stdin.on('data', (chunk) => {
|
|
7
|
-
input += chunk;
|
|
8
|
-
});
|
|
9
|
-
process.stdin.on('end', () => {
|
|
10
|
-
try {
|
|
11
|
-
const request = input.trim() ? JSON.parse(input) : {};
|
|
12
|
-
process.stdout.write(`${JSON.stringify({ text: String(request?.text ?? '') })}\n`);
|
|
13
|
-
} catch (error) {
|
|
14
|
-
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
15
|
-
process.exitCode = 1;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
let input = '';
|
|
4
|
+
|
|
5
|
+
process.stdin.setEncoding('utf8');
|
|
6
|
+
process.stdin.on('data', (chunk) => {
|
|
7
|
+
input += chunk;
|
|
8
|
+
});
|
|
9
|
+
process.stdin.on('end', () => {
|
|
10
|
+
try {
|
|
11
|
+
const request = input.trim() ? JSON.parse(input) : {};
|
|
12
|
+
process.stdout.write(`${JSON.stringify({ text: String(request?.text ?? '') })}\n`);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"code": "echo-tool",
|
|
3
|
-
"name": "回声工具",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"type": "code",
|
|
6
|
-
"description": "把传入的文本原样返回(回显)。用于连通性验证,或把一段文本再交回给调用方。",
|
|
7
|
-
"toolRuntime": "local",
|
|
8
|
-
"category": "general",
|
|
9
|
-
"tags": [
|
|
10
|
-
"template",
|
|
11
|
-
"local",
|
|
12
|
-
"echo"
|
|
13
|
-
],
|
|
14
|
-
"riskLevel": "low",
|
|
15
|
-
"package": {
|
|
16
|
-
"format": "zip",
|
|
17
|
-
"sandbox": true
|
|
18
|
-
},
|
|
19
|
-
"tools": [
|
|
20
|
-
{
|
|
21
|
-
"name": "echo-tool",
|
|
22
|
-
"description": "把传入的文本原样返回(回显)。",
|
|
23
|
-
"handler": "src/index.js",
|
|
24
|
-
"runtime": "node",
|
|
25
|
-
"timeout": 5,
|
|
26
|
-
"input": {
|
|
27
|
-
"type": "object",
|
|
28
|
-
"properties": {
|
|
29
|
-
"text": {
|
|
30
|
-
"type": "string",
|
|
31
|
-
"description": "Text to return."
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"required": [
|
|
35
|
-
"text"
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
"output": {
|
|
39
|
-
"type": "object",
|
|
40
|
-
"properties": {
|
|
41
|
-
"text": {
|
|
42
|
-
"type": "string"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"required": [
|
|
46
|
-
"text"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
"dataScope": "user-bound"
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
"metadata": {
|
|
53
|
-
"owner": "agent-template"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"code": "echo-tool",
|
|
3
|
+
"name": "回声工具",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "code",
|
|
6
|
+
"description": "把传入的文本原样返回(回显)。用于连通性验证,或把一段文本再交回给调用方。",
|
|
7
|
+
"toolRuntime": "local",
|
|
8
|
+
"category": "general",
|
|
9
|
+
"tags": [
|
|
10
|
+
"template",
|
|
11
|
+
"local",
|
|
12
|
+
"echo"
|
|
13
|
+
],
|
|
14
|
+
"riskLevel": "low",
|
|
15
|
+
"package": {
|
|
16
|
+
"format": "zip",
|
|
17
|
+
"sandbox": true
|
|
18
|
+
},
|
|
19
|
+
"tools": [
|
|
20
|
+
{
|
|
21
|
+
"name": "echo-tool",
|
|
22
|
+
"description": "把传入的文本原样返回(回显)。",
|
|
23
|
+
"handler": "src/index.js",
|
|
24
|
+
"runtime": "node",
|
|
25
|
+
"timeout": 5,
|
|
26
|
+
"input": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"text": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Text to return."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"text"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"output": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"properties": {
|
|
41
|
+
"text": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"text"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"dataScope": "user-bound"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"metadata": {
|
|
53
|
+
"owner": "agent-template"
|
|
54
|
+
}
|
|
55
|
+
}
|