@gt-fe/eap-cli 0.2.19 → 0.2.21

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.
Files changed (39) hide show
  1. package/README.md +304 -304
  2. package/dist/static/playground-app/assets/{index-Bg09N-Dc.css → index-B3p2mvcC.css} +1 -1
  3. package/dist/static/playground-app/assets/{index-CjAzCUkk.js → index-EGQ_46bX.js} +65 -65
  4. package/dist/static/playground-app/index.html +2 -2
  5. package/dist/templates/README.md +51 -51
  6. package/dist/templates/agent-api-orchestration/README.md +326 -326
  7. package/dist/templates/agent-api-orchestration/eap.config.json +1 -1
  8. package/dist/templates/agent-api-orchestration/graph.json +35 -35
  9. package/dist/templates/agent-api-orchestration/package.json +1 -1
  10. package/dist/templates/dag-workflow/README.md +102 -102
  11. package/dist/templates/dag-workflow/agent.manifest.json +19 -19
  12. package/dist/templates/dag-workflow/eap.config.json +1 -1
  13. package/dist/templates/dag-workflow/gitignore +51 -51
  14. package/dist/templates/dag-workflow/graph.json +51 -51
  15. package/dist/templates/dag-workflow/skills/README.md +116 -116
  16. package/dist/templates/plan-and-execute/README.md +109 -109
  17. package/dist/templates/plan-and-execute/agent.manifest.json +19 -19
  18. package/dist/templates/plan-and-execute/eap.config.json +1 -1
  19. package/dist/templates/plan-and-execute/eap.lock.yaml +5 -5
  20. package/dist/templates/plan-and-execute/gitignore +51 -51
  21. package/dist/templates/plan-and-execute/graph.json +49 -49
  22. package/dist/templates/plan-and-execute/skills/README.md +120 -120
  23. package/dist/templates/simple-flow/README.md +87 -87
  24. package/dist/templates/simple-flow/agent.manifest.json +19 -19
  25. package/dist/templates/simple-flow/eap.config.json +1 -1
  26. package/dist/templates/simple-flow/gitignore +51 -51
  27. package/dist/templates/simple-flow/graph.json +32 -32
  28. package/dist/templates/simple-flow/package.json +10 -10
  29. package/dist/templates/simple-flow/skills/README.md +113 -113
  30. package/dist/templates/single-agent-with-tools/README.md +138 -138
  31. package/dist/templates/single-agent-with-tools/agent.manifest.json +19 -19
  32. package/dist/templates/single-agent-with-tools/eap.config.json +1 -1
  33. package/dist/templates/single-agent-with-tools/eap.lock.yaml +5 -5
  34. package/dist/templates/single-agent-with-tools/gitignore +51 -51
  35. package/dist/templates/single-agent-with-tools/graph.json +41 -41
  36. package/dist/templates/single-agent-with-tools/skills/README.md +119 -119
  37. package/dist/templates/single-agent-with-tools/tools/http-weather/toolset.manifest.json +73 -73
  38. package/dist/templates/single-agent-with-tools/tools/web-search/toolset.manifest.json +41 -41
  39. package/package.json +2 -2
@@ -1,119 +1,119 @@
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
- ## 接到 ReAct
95
-
96
- 默认图通过 `read_file` / `execute_command` 使用普通 Skill,可看到 `📦 skill:…` 和工具执行记录。默认 `shouldContinue` 只返回 `call_tools` 或 `finish`,其中 `call_tools` 必须进入 `type: tool`;不能把该目标直接改为 subgraph。
97
-
98
- 若先验证结构化 Skill 的执行,可把它作为 ReAct 前的**固定预处理步骤**:
99
-
100
- 1. 在 `nodes` 中加入上面的 `run-skill`。
101
- 2. 将 `__start__ → agent` 替换为下面两条边。
102
- 3. 把 `entryPoint` 从 `agent` 改为 `run-skill`;工具循环、条件边和结束配置保持原样。
103
-
104
- ```json
105
- [
106
- { "from": "__start__", "to": "run-skill" },
107
- { "from": "run-skill", "to": "agent" }
108
- ]
109
- ```
110
-
111
- 顺序为 `__start__ → run-skill → agent ⇄ tools`,Skill 的需求记录进入 Agent 上下文。这个例子每次请求都执行 Skill,不代表模型自主选择 Skill。要达到“Agent 决定进入某个 Skill,完成后返回推理”的产品形态,需要额外的选择与条件路由;不能仅靠 `skillRefs` 或修改 `call_tools` 分支实现。
112
-
113
- ## 检查结果
114
-
115
- 改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
116
-
117
- `eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
118
-
119
- 示例是本地开发资源。上线前按平台要求登记、锁定和发布 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
+ ## 接到 ReAct
95
+
96
+ 默认图通过 `read_file` / `execute_command` 使用普通 Skill,可看到 `📦 skill:…` 和工具执行记录。默认 `shouldContinue` 只返回 `call_tools` 或 `finish`,其中 `call_tools` 必须进入 `type: tool`;不能把该目标直接改为 subgraph。
97
+
98
+ 若先验证结构化 Skill 的执行,可把它作为 ReAct 前的**固定预处理步骤**:
99
+
100
+ 1. 在 `nodes` 中加入上面的 `run-skill`。
101
+ 2. 将 `__start__ → agent` 替换为下面两条边。
102
+ 3. 把 `entryPoint` 从 `agent` 改为 `run-skill`;工具循环、条件边和结束配置保持原样。
103
+
104
+ ```json
105
+ [
106
+ { "from": "__start__", "to": "run-skill" },
107
+ { "from": "run-skill", "to": "agent" }
108
+ ]
109
+ ```
110
+
111
+ 顺序为 `__start__ → run-skill → agent ⇄ tools`,Skill 的需求记录进入 Agent 上下文。这个例子每次请求都执行 Skill,不代表模型自主选择 Skill。要达到“Agent 决定进入某个 Skill,完成后返回推理”的产品形态,需要额外的选择与条件路由;不能仅靠 `skillRefs` 或修改 `call_tools` 分支实现。
112
+
113
+ ## 检查结果
114
+
115
+ 改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
116
+
117
+ `eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
118
+
119
+ 示例是本地开发资源。上线前按平台要求登记、锁定和发布 Skill 及其依赖。
@@ -1,73 +1,73 @@
1
- {
2
- "code": "http-weather",
3
- "version": "1.0.0",
4
- "name": "天气预报",
5
- "type": "http",
6
- "description": "官方脚手架默认装配。Open-Meteo 公开天气 HTTP,无需 API Key。本地 eap chat(mode=mcp)由 DevHttpExecutor 按 pathTemplate 直连;生产由 Gateway 受控出站。",
7
- "toolRuntime": "server",
8
- "category": "general",
9
- "riskLevel": "low",
10
- "gateway": {
11
- "baseUrl": "https://api.open-meteo.com",
12
- "allowedHosts": [
13
- "api.open-meteo.com",
14
- "geocoding-api.open-meteo.com"
15
- ],
16
- "timeout": 15
17
- },
18
- "tools": [
19
- {
20
- "name": "geocode_place",
21
- "description": "按地名解析经纬度。查预报前先调用。返回 results[].name / latitude / longitude / country。",
22
- "method": "GET",
23
- "pathTemplate": "https://geocoding-api.open-meteo.com/v1/search?name={name}&count=5&language=zh&format=json",
24
- "timeout": 15,
25
- "input": {
26
- "type": "object",
27
- "required": [
28
- "name"
29
- ],
30
- "properties": {
31
- "name": {
32
- "type": "string",
33
- "description": "城市或地名,例如 上海、Beijing"
34
- }
35
- }
36
- }
37
- },
38
- {
39
- "name": "get_forecast",
40
- "description": "按经纬度查询当前天气与逐日预报。latitude / longitude 须来自 geocode_place。weather_code 为 WMO 天气代码。",
41
- "method": "GET",
42
- "pathTemplate": "/v1/forecast?latitude={latitude}&longitude={longitude}&current=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_sum&timezone=auto&forecast_days={forecast_days}",
43
- "timeout": 15,
44
- "input": {
45
- "type": "object",
46
- "required": [
47
- "latitude",
48
- "longitude"
49
- ],
50
- "properties": {
51
- "latitude": {
52
- "type": "number",
53
- "description": "纬度"
54
- },
55
- "longitude": {
56
- "type": "number",
57
- "description": "经度"
58
- },
59
- "forecast_days": {
60
- "type": "integer",
61
- "minimum": 1,
62
- "maximum": 16,
63
- "description": "预报天数。省略时由 Open-Meteo 默认 7 天"
64
- }
65
- }
66
- }
67
- }
68
- ],
69
- "metadata": {
70
- "owner": "agent-template",
71
- "source": "open-meteo http"
72
- }
73
- }
1
+ {
2
+ "code": "http-weather",
3
+ "version": "1.0.0",
4
+ "name": "天气预报",
5
+ "type": "http",
6
+ "description": "官方脚手架默认装配。Open-Meteo 公开天气 HTTP,无需 API Key。本地 eap chat(mode=mcp)由 DevHttpExecutor 按 pathTemplate 直连;生产由 Gateway 受控出站。",
7
+ "toolRuntime": "server",
8
+ "category": "general",
9
+ "riskLevel": "low",
10
+ "gateway": {
11
+ "baseUrl": "https://api.open-meteo.com",
12
+ "allowedHosts": [
13
+ "api.open-meteo.com",
14
+ "geocoding-api.open-meteo.com"
15
+ ],
16
+ "timeout": 15
17
+ },
18
+ "tools": [
19
+ {
20
+ "name": "geocode_place",
21
+ "description": "按地名解析经纬度。查预报前先调用。返回 results[].name / latitude / longitude / country。",
22
+ "method": "GET",
23
+ "pathTemplate": "https://geocoding-api.open-meteo.com/v1/search?name={name}&count=5&language=zh&format=json",
24
+ "timeout": 15,
25
+ "input": {
26
+ "type": "object",
27
+ "required": [
28
+ "name"
29
+ ],
30
+ "properties": {
31
+ "name": {
32
+ "type": "string",
33
+ "description": "城市或地名,例如 上海、Beijing"
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "name": "get_forecast",
40
+ "description": "按经纬度查询当前天气与逐日预报。latitude / longitude 须来自 geocode_place。weather_code 为 WMO 天气代码。",
41
+ "method": "GET",
42
+ "pathTemplate": "/v1/forecast?latitude={latitude}&longitude={longitude}&current=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_sum&timezone=auto&forecast_days={forecast_days}",
43
+ "timeout": 15,
44
+ "input": {
45
+ "type": "object",
46
+ "required": [
47
+ "latitude",
48
+ "longitude"
49
+ ],
50
+ "properties": {
51
+ "latitude": {
52
+ "type": "number",
53
+ "description": "纬度"
54
+ },
55
+ "longitude": {
56
+ "type": "number",
57
+ "description": "经度"
58
+ },
59
+ "forecast_days": {
60
+ "type": "integer",
61
+ "minimum": 1,
62
+ "maximum": 16,
63
+ "description": "预报天数。省略时由 Open-Meteo 默认 7 天"
64
+ }
65
+ }
66
+ }
67
+ }
68
+ ],
69
+ "metadata": {
70
+ "owner": "agent-template",
71
+ "source": "open-meteo http"
72
+ }
73
+ }
@@ -1,41 +1,41 @@
1
- {
2
- "code": "web-search",
3
- "version": "1.0.0",
4
- "name": "网络搜索",
5
- "type": "mcp",
6
- "description": "官方脚手架示例,默认未装配,上线前删除。Exa 公开网页检索。url 里的 ${EXA_API_KEY} 由本地 Runtime 展开。生产由 Gateway 注入凭据。",
7
- "toolRuntime": "server",
8
- "category": "general",
9
- "riskLevel": "low",
10
- "server": {
11
- "transport": "streamable_http",
12
- "url": "https://mcp.exa.ai/mcp?exaApiKey=${EXA_API_KEY}&tools=web_search_exa",
13
- "timeout": 30
14
- },
15
- "tools": [
16
- {
17
- "name": "web_search_exa",
18
- "description": "搜索公开网页。天气、新闻、外部事实用本工具。",
19
- "input": {
20
- "type": "object",
21
- "required": [
22
- "query"
23
- ],
24
- "properties": {
25
- "query": {
26
- "type": "string",
27
- "minLength": 1
28
- },
29
- "numResults": {
30
- "type": "number"
31
- }
32
- },
33
- "additionalProperties": false
34
- }
35
- }
36
- ],
37
- "metadata": {
38
- "owner": "agent-template",
39
- "source": "exa mcp"
40
- }
41
- }
1
+ {
2
+ "code": "web-search",
3
+ "version": "1.0.0",
4
+ "name": "网络搜索",
5
+ "type": "mcp",
6
+ "description": "官方脚手架示例,默认未装配,上线前删除。Exa 公开网页检索。url 里的 ${EXA_API_KEY} 由本地 Runtime 展开。生产由 Gateway 注入凭据。",
7
+ "toolRuntime": "server",
8
+ "category": "general",
9
+ "riskLevel": "low",
10
+ "server": {
11
+ "transport": "streamable_http",
12
+ "url": "https://mcp.exa.ai/mcp?exaApiKey=${EXA_API_KEY}&tools=web_search_exa",
13
+ "timeout": 30
14
+ },
15
+ "tools": [
16
+ {
17
+ "name": "web_search_exa",
18
+ "description": "搜索公开网页。天气、新闻、外部事实用本工具。",
19
+ "input": {
20
+ "type": "object",
21
+ "required": [
22
+ "query"
23
+ ],
24
+ "properties": {
25
+ "query": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ },
29
+ "numResults": {
30
+ "type": "number"
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ }
35
+ }
36
+ ],
37
+ "metadata": {
38
+ "owner": "agent-template",
39
+ "source": "exa mcp"
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gt-fe/eap-cli",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "EAP CLI 工具 — Agent 项目创建、开发、测试、发布",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,7 +23,7 @@
23
23
  "react": "^18.3.1",
24
24
  "react-markdown": "^9.0.1",
25
25
  "remark-gfm": "^4.0.0",
26
- "@gt-fe/eap-sdk": "0.2.19"
26
+ "@gt-fe/eap-sdk": "0.2.21"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.0.0",