@axiom-lattice/examples-deep_research 1.0.16 → 1.0.17
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +10 -0
- package/dist/index.js +322 -815
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/agents/data_agent/index.ts +41 -16
- package/src/agents/data_agent/skills/analysis-methodology/SKILL.md +73 -0
- package/src/agents/data_agent/skills/analyst/SKILL.md +105 -0
- package/src/agents/data_agent/skills/data-visualization/SKILL.md +77 -0
- package/src/agents/data_agent/skills/infographic-creator/SKILL.md +337 -0
- package/src/agents/data_agent/skills/inventory-doctor/SKILL.md +61 -0
- package/src/agents/data_agent/skills/inventory-doctor.ts +47 -0
- package/src/agents/data_agent/skills/notebook-report/SKILL.md +81 -0
- package/src/agents/data_agent/skills/sql-query/SKILL.md +58 -0
- package/src/agents/data_agent/skills/test/SKILL.md +9 -0
- package/src/agents/index.ts +1 -0
- package/src/agents/inventory_doctor/index.ts +53 -0
- package/src/agents/inventory_doctor/tools.ts +244 -0
- package/src/index.ts +81 -0
- package/src/agents/data_agent/tools/load_skills.ts +0 -88
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: data-visualization
|
|
3
|
+
description: 为数据分析结果选择合适的图表类型并生成 ECharts 配置。适用于需要将查询结果可视化为柱状图、折线图、饼图、散点图等图表的场景。
|
|
4
|
+
metadata:
|
|
5
|
+
category: analysis
|
|
6
|
+
---
|
|
7
|
+
## 图表类型选择指南
|
|
8
|
+
|
|
9
|
+
根据数据特征和业务问题选择最合适的图表类型:
|
|
10
|
+
|
|
11
|
+
- **柱状图** (bar): 比较类别或时间周期
|
|
12
|
+
- 使用 category xAxis,value yAxis
|
|
13
|
+
- 多系列用于分组/堆叠柱状图
|
|
14
|
+
|
|
15
|
+
- **折线图** (line): 展示时间趋势
|
|
16
|
+
- 使用 category/time xAxis,value yAxis
|
|
17
|
+
- 多系列展示多个指标
|
|
18
|
+
|
|
19
|
+
- **饼图** (pie): 展示构成/百分比
|
|
20
|
+
- 无需 xAxis/yAxis
|
|
21
|
+
- 数据格式: [{value: number, name: string}, ...]
|
|
22
|
+
- 使用 radius: ["40%", "70%"] 创建环形图
|
|
23
|
+
|
|
24
|
+
- **散点图** (scatter): 相关性分析
|
|
25
|
+
- 使用 value xAxis 和 value yAxis
|
|
26
|
+
- 数据格式: [[x, y], [x, y], ...]
|
|
27
|
+
|
|
28
|
+
- **热力图** (heatmap): 多维数据
|
|
29
|
+
- 需要 category xAxis 和 yAxis
|
|
30
|
+
- 数据格式: [[xIndex, yIndex, value], ...]
|
|
31
|
+
|
|
32
|
+
## ECharts 配置要求
|
|
33
|
+
|
|
34
|
+
生成完整的 ECharts 配置,必须包含:
|
|
35
|
+
|
|
36
|
+
\`\`\`json
|
|
37
|
+
{
|
|
38
|
+
"table": [...], // 原始数据表格
|
|
39
|
+
"echarts": {
|
|
40
|
+
"title": {"text": "清晰的图表标题"},
|
|
41
|
+
"tooltip": {
|
|
42
|
+
"trigger": "axis", // bar/line 用 "axis", pie/scatter 用 "item"
|
|
43
|
+
"formatter": "..." // 可选:自定义格式化
|
|
44
|
+
},
|
|
45
|
+
"legend": {...}, // 多系列时必需
|
|
46
|
+
"xAxis": {
|
|
47
|
+
"type": "category", // 或 "time", "value"
|
|
48
|
+
"name": "X轴名称",
|
|
49
|
+
"data": [...] // category 类型时必需
|
|
50
|
+
},
|
|
51
|
+
"yAxis": {
|
|
52
|
+
"type": "value",
|
|
53
|
+
"name": "Y轴名称"
|
|
54
|
+
},
|
|
55
|
+
"series": [{
|
|
56
|
+
"type": "bar|line|pie|scatter|heatmap",
|
|
57
|
+
"name": "系列名称",
|
|
58
|
+
"data": [...],
|
|
59
|
+
"label": {...} // 可选:显示数值
|
|
60
|
+
}],
|
|
61
|
+
"grid": {...} // 可选:控制边距
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## 最佳实践
|
|
67
|
+
|
|
68
|
+
- 图表标题清晰描述业务问题
|
|
69
|
+
- 轴标签使用业务术语,而非技术字段名
|
|
70
|
+
- 数值格式化:百分比、货币、千分位
|
|
71
|
+
- 时间序列使用 "xAxis.type: 'time'" 并正确格式化日期
|
|
72
|
+
- 多系列时使用 legend 区分
|
|
73
|
+
- 重要数值在图表上直接标注(series.label)
|
|
74
|
+
|
|
75
|
+
## 输出格式
|
|
76
|
+
|
|
77
|
+
提供完整的 chart JSON 配置,可直接用于渲染。
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: infographic-creator
|
|
3
|
+
description: 创建信息图表,将数据可视化为易于理解的图表。适用于需要将数据可视化为易于理解的图表的场景。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
信息图(Infographic)将数据、信息与知识转化为可感知的视觉语言。它结合视觉设计与数据可视化,用直观符号压缩复杂信息,帮助受众快速理解并记住要点。
|
|
7
|
+
|
|
8
|
+
Infographic = Information Structure + Visual Expression
|
|
9
|
+
|
|
10
|
+
本任务使用 AntV Infographic 创建可视化信息图。
|
|
11
|
+
|
|
12
|
+
在开始任务前,需要理解 AntV Infographic 语法规范,包括模板列表、数据结构、主题等。
|
|
13
|
+
|
|
14
|
+
规范
|
|
15
|
+
AntV Infographic 语法
|
|
16
|
+
AntV Infographic 语法是一种自定义的 DSL,用于描述信息图渲染配置。它使用缩进描述信息,具有较强鲁棒性,便于 AI 流式输出并渲染信息图。主要包含以下信息:
|
|
17
|
+
|
|
18
|
+
template:用模板表达文字信息结构。
|
|
19
|
+
data:信息图数据,包含 title、desc、数据项等。数据项通常包含 label、desc、icon 等字段。
|
|
20
|
+
theme:主题包含 palette、font 等样式配置。
|
|
21
|
+
例如:
|
|
22
|
+
|
|
23
|
+
\`\`\`infographic
|
|
24
|
+
infographic list-row-horizontal-icon-arrow
|
|
25
|
+
data
|
|
26
|
+
title Title
|
|
27
|
+
desc Description
|
|
28
|
+
lists
|
|
29
|
+
- label Label
|
|
30
|
+
value 12.5
|
|
31
|
+
desc Explanation
|
|
32
|
+
icon document text
|
|
33
|
+
theme
|
|
34
|
+
palette #3b82f6 #8b5cf6 #f97316
|
|
35
|
+
\`\`\`
|
|
36
|
+
语法规范
|
|
37
|
+
第一行必须是 infographic <template-name>,模板从下方列表中选择(见"可用模板"部分)。
|
|
38
|
+
|
|
39
|
+
使用 data / theme 块,块内用两个空格缩进。
|
|
40
|
+
|
|
41
|
+
键值对使用「键 空格 值」;数组使用 - 作为条目前缀。
|
|
42
|
+
|
|
43
|
+
icon 使用图标关键词(如 star fill)。
|
|
44
|
+
|
|
45
|
+
data 应包含 title/desc + 模板对应的主数据字段(不一定是 items)。
|
|
46
|
+
|
|
47
|
+
主数据字段选择(只用一个,避免混用):
|
|
48
|
+
|
|
49
|
+
list-* → lists
|
|
50
|
+
sequence-* → sequences(可选 order asc|desc)
|
|
51
|
+
compare-* → compares(支持 children 分组对比),可包含多个对比项
|
|
52
|
+
hierarchy-structure → items(每一项对应一个独立层级,每一层级可以包含子项,最多可嵌套 3 层)
|
|
53
|
+
hierarchy-* → 单一 root(树结构,通过 children 嵌套);
|
|
54
|
+
relation-* → nodes + relations;简单关系图可省略 nodes,在 relations 中用箭头语法
|
|
55
|
+
chart-* → values(数值统计,可选 category)
|
|
56
|
+
不确定时再用 items 兜底
|
|
57
|
+
compare-binary-* / compare-hierarchy-left-right-* 二元模板:必须两个根节点,所有对比项挂在这两个根节点的 children
|
|
58
|
+
|
|
59
|
+
hierarchy-*:使用单一 root,通过 children 嵌套(不要重复 root)
|
|
60
|
+
|
|
61
|
+
theme 用于自定义主题(palette、font 等) 例如:暗色主题 + 自定义配色
|
|
62
|
+
|
|
63
|
+
\`\`\`infographic
|
|
64
|
+
infographic list-row-simple-horizontal-arrow
|
|
65
|
+
theme dark
|
|
66
|
+
palette
|
|
67
|
+
- #61DDAA
|
|
68
|
+
- #F6BD16
|
|
69
|
+
- #F08BB4
|
|
70
|
+
\`\`\`
|
|
71
|
+
使用 theme.base.text.font-family 指定字体,如手写风格 851tegakizatsu
|
|
72
|
+
|
|
73
|
+
使用 theme.stylize 选择内置风格并传参 常见风格:
|
|
74
|
+
|
|
75
|
+
rough:手绘效果
|
|
76
|
+
pattern:图案填充
|
|
77
|
+
linear-gradient / radial-gradient:线性/径向渐变
|
|
78
|
+
例如:手绘风格(rough)
|
|
79
|
+
|
|
80
|
+
\`\`\`infographic
|
|
81
|
+
infographic list-row-simple-horizontal-arrow
|
|
82
|
+
theme
|
|
83
|
+
stylize rough
|
|
84
|
+
base
|
|
85
|
+
text
|
|
86
|
+
font-family 851tegakizatsu
|
|
87
|
+
\`\`\`
|
|
88
|
+
输出格式要求:
|
|
89
|
+
必须使用 Markdown 代码块格式输出,语言标识为 infographic。格式如下:
|
|
90
|
+
|
|
91
|
+
\`\`\`infographic
|
|
92
|
+
infographic <template-name>
|
|
93
|
+
data
|
|
94
|
+
...
|
|
95
|
+
theme
|
|
96
|
+
...
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
禁止输出纯文本、JSON、HTML、JS 代码或其他格式。只能输出上述格式的 Markdown 代码块。
|
|
100
|
+
|
|
101
|
+
数据语法示例
|
|
102
|
+
按模板类别的数据语法示例(使用对应字段,避免同时添加 items):
|
|
103
|
+
|
|
104
|
+
list-* 模版
|
|
105
|
+
\`\`\`infographic
|
|
106
|
+
infographic list-grid-badge-card
|
|
107
|
+
data
|
|
108
|
+
title Feature List
|
|
109
|
+
lists
|
|
110
|
+
- label Fast
|
|
111
|
+
icon flash fast
|
|
112
|
+
- label Secure
|
|
113
|
+
icon secure shield check
|
|
114
|
+
\`\`\`
|
|
115
|
+
sequence-* 模版
|
|
116
|
+
\`\`\`infographic
|
|
117
|
+
infographic sequence-steps-simple
|
|
118
|
+
data
|
|
119
|
+
sequences
|
|
120
|
+
- label Step 1
|
|
121
|
+
- label Step 2
|
|
122
|
+
- label Step 3
|
|
123
|
+
order asc
|
|
124
|
+
\`\`\`
|
|
125
|
+
hierarchy-* 模版
|
|
126
|
+
\`\`\`infographic
|
|
127
|
+
infographic hierarchy-structure
|
|
128
|
+
data
|
|
129
|
+
root
|
|
130
|
+
label Company
|
|
131
|
+
children
|
|
132
|
+
- label Dept A
|
|
133
|
+
- label Dept B
|
|
134
|
+
\`\`\`
|
|
135
|
+
compare-* 模版
|
|
136
|
+
\`\`\`infographic
|
|
137
|
+
infographic compare-swot
|
|
138
|
+
data
|
|
139
|
+
compares
|
|
140
|
+
- label Strengths
|
|
141
|
+
children
|
|
142
|
+
- label Strong brand
|
|
143
|
+
- label Loyal users
|
|
144
|
+
- label Weaknesses
|
|
145
|
+
children
|
|
146
|
+
- label High cost
|
|
147
|
+
- label Slow release
|
|
148
|
+
\`\`\`
|
|
149
|
+
四象限图
|
|
150
|
+
|
|
151
|
+
\`\`\`infographic
|
|
152
|
+
infographic compare-quadrant-quarter-simple-card
|
|
153
|
+
data
|
|
154
|
+
compares
|
|
155
|
+
- label High Impact & Low Effort
|
|
156
|
+
- label High Impact & High Effort
|
|
157
|
+
- label Low Impact & Low Effort
|
|
158
|
+
- label Low Impact & High Effort
|
|
159
|
+
\`\`\`
|
|
160
|
+
chart-* 模版
|
|
161
|
+
\`\`\`infographic
|
|
162
|
+
infographic chart-column-simple
|
|
163
|
+
data
|
|
164
|
+
values
|
|
165
|
+
- label Visits
|
|
166
|
+
value 1280
|
|
167
|
+
- label Conversion
|
|
168
|
+
value 12.4
|
|
169
|
+
\`\`\`
|
|
170
|
+
relation-* 模版
|
|
171
|
+
边标签写法:A -label-> B 或 A -->|label| B
|
|
172
|
+
|
|
173
|
+
\`\`\`infographic
|
|
174
|
+
infographic relation-dagre-flow-tb-simple-circle-node
|
|
175
|
+
data
|
|
176
|
+
nodes
|
|
177
|
+
- id A
|
|
178
|
+
label Node A
|
|
179
|
+
- id B
|
|
180
|
+
label Node B
|
|
181
|
+
relations
|
|
182
|
+
A - approves -> B
|
|
183
|
+
A -->|blocks| B
|
|
184
|
+
\`\`\`
|
|
185
|
+
兜底 items 示例
|
|
186
|
+
\`\`\`infographic
|
|
187
|
+
infographic list-row-horizontal-icon-arrow
|
|
188
|
+
data
|
|
189
|
+
items
|
|
190
|
+
- label Item A
|
|
191
|
+
desc Description
|
|
192
|
+
icon sun
|
|
193
|
+
- label Item B
|
|
194
|
+
desc Description
|
|
195
|
+
icon moon
|
|
196
|
+
\`\`\`
|
|
197
|
+
可用模板
|
|
198
|
+
chart-bar-plain-text
|
|
199
|
+
chart-column-simple
|
|
200
|
+
chart-line-plain-text
|
|
201
|
+
chart-pie-compact-card
|
|
202
|
+
chart-pie-donut-pill-badge
|
|
203
|
+
chart-pie-donut-plain-text
|
|
204
|
+
chart-pie-plain-text
|
|
205
|
+
chart-wordcloud
|
|
206
|
+
compare-binary-horizontal-badge-card-arrow
|
|
207
|
+
compare-binary-horizontal-simple-fold
|
|
208
|
+
compare-binary-horizontal-underline-text-vs
|
|
209
|
+
compare-hierarchy-left-right-circle-node-pill-badge
|
|
210
|
+
compare-quadrant-quarter-circular
|
|
211
|
+
compare-quadrant-quarter-simple-card
|
|
212
|
+
compare-swot
|
|
213
|
+
hierarchy-mindmap-branch-gradient-capsule-item
|
|
214
|
+
hierarchy-mindmap-level-gradient-compact-card
|
|
215
|
+
hierarchy-structure
|
|
216
|
+
hierarchy-tree-curved-line-rounded-rect-node
|
|
217
|
+
hierarchy-tree-tech-style-badge-card
|
|
218
|
+
hierarchy-tree-tech-style-capsule-item
|
|
219
|
+
list-column-done-list
|
|
220
|
+
list-column-simple-vertical-arrow
|
|
221
|
+
list-column-vertical-icon-arrow
|
|
222
|
+
list-grid-badge-card
|
|
223
|
+
list-grid-candy-card-lite
|
|
224
|
+
list-grid-ribbon-card
|
|
225
|
+
list-row-horizontal-icon-arrow
|
|
226
|
+
list-sector-plain-text
|
|
227
|
+
list-zigzag-down-compact-card
|
|
228
|
+
list-zigzag-down-simple
|
|
229
|
+
list-zigzag-up-compact-card
|
|
230
|
+
list-zigzag-up-simple
|
|
231
|
+
relation-dagre-flow-tb-animated-badge-card
|
|
232
|
+
relation-dagre-flow-tb-animated-simple-circle-node
|
|
233
|
+
relation-dagre-flow-tb-badge-card
|
|
234
|
+
relation-dagre-flow-tb-simple-circle-node
|
|
235
|
+
sequence-ascending-stairs-3d-underline-text
|
|
236
|
+
sequence-ascending-steps
|
|
237
|
+
sequence-circular-simple
|
|
238
|
+
sequence-color-snake-steps-horizontal-icon-line
|
|
239
|
+
sequence-cylinders-3d-simple
|
|
240
|
+
sequence-filter-mesh-simple
|
|
241
|
+
sequence-funnel-simple
|
|
242
|
+
sequence-horizontal-zigzag-underline-text
|
|
243
|
+
sequence-mountain-underline-text
|
|
244
|
+
sequence-pyramid-simple
|
|
245
|
+
sequence-roadmap-vertical-plain-text
|
|
246
|
+
sequence-roadmap-vertical-simple
|
|
247
|
+
sequence-snake-steps-compact-card
|
|
248
|
+
sequence-snake-steps-simple
|
|
249
|
+
sequence-snake-steps-underline-text
|
|
250
|
+
sequence-stairs-front-compact-card
|
|
251
|
+
sequence-stairs-front-pill-badge
|
|
252
|
+
sequence-timeline-rounded-rect-node
|
|
253
|
+
sequence-timeline-simple
|
|
254
|
+
sequence-zigzag-pucks-3d-simple
|
|
255
|
+
sequence-zigzag-steps-underline-text
|
|
256
|
+
模板选择建议:
|
|
257
|
+
|
|
258
|
+
严格顺序(流程/步骤/发展趋势)→ sequence-*
|
|
259
|
+
时间线 → sequence-timeline-*
|
|
260
|
+
阶梯图 → sequence-stairs-*
|
|
261
|
+
路线图 → sequence-roadmap-vertical-*
|
|
262
|
+
折线路径 → sequence-zigzag-*
|
|
263
|
+
环形进度 → sequence-circular-simple
|
|
264
|
+
彩色蛇形步骤 → sequence-color-snake-steps-*
|
|
265
|
+
金字塔 → sequence-pyramid-simple
|
|
266
|
+
观点列举 → list-row-* 或 list-column-*
|
|
267
|
+
二元对比(利弊)→ compare-binary-*
|
|
268
|
+
SWOT → compare-swot
|
|
269
|
+
层级结构(树图)→ hierarchy-tree-*
|
|
270
|
+
数据图表 → chart-*
|
|
271
|
+
象限分析 → quadrant-*
|
|
272
|
+
网格列表(要点)→ list-grid-*
|
|
273
|
+
关系展示 → relation-*
|
|
274
|
+
词云 → chart-wordcloud
|
|
275
|
+
思维导图 → hierarchy-mindmap-*
|
|
276
|
+
示例
|
|
277
|
+
绘制互联网技术演进信息图
|
|
278
|
+
|
|
279
|
+
\`\`\`infographic
|
|
280
|
+
infographic list-row-horizontal-icon-arrow
|
|
281
|
+
data
|
|
282
|
+
title Internet Technology Evolution
|
|
283
|
+
desc From Web 1.0 to AI era, key milestones
|
|
284
|
+
lists
|
|
285
|
+
- time 1991
|
|
286
|
+
label Web 1.0
|
|
287
|
+
desc Tim Berners-Lee published the first website, opening the Internet era
|
|
288
|
+
icon web
|
|
289
|
+
- time 2004
|
|
290
|
+
label Web 2.0
|
|
291
|
+
desc Social media and user-generated content become mainstream
|
|
292
|
+
icon account multiple
|
|
293
|
+
- time 2007
|
|
294
|
+
label Mobile
|
|
295
|
+
desc iPhone released, smartphone changes the world
|
|
296
|
+
icon cellphone
|
|
297
|
+
- time 2015
|
|
298
|
+
label Cloud Native
|
|
299
|
+
desc Containerization and microservices architecture are widely used
|
|
300
|
+
icon cloud
|
|
301
|
+
- time 2020
|
|
302
|
+
label Low Code
|
|
303
|
+
desc Visual development lowers the technology threshold
|
|
304
|
+
icon application brackets
|
|
305
|
+
- time 2023
|
|
306
|
+
label AI Large Model
|
|
307
|
+
desc ChatGPT ignites the generative AI revolution
|
|
308
|
+
icon brain
|
|
309
|
+
\`\`\`
|
|
310
|
+
生成流程
|
|
311
|
+
第一步:理解用户需求
|
|
312
|
+
在创建信息图之前,先理解用户需求与想表达的信息,以便确定模板和数据结构。
|
|
313
|
+
|
|
314
|
+
若用户提供清晰的内容描述,应将其拆解为清晰、简洁的结构。
|
|
315
|
+
|
|
316
|
+
否则需要向用户澄清(如:"请提供清晰简洁的内容描述。"、"你希望使用哪个模板?")
|
|
317
|
+
|
|
318
|
+
提取关键信息结构(title、desc、items 等)。
|
|
319
|
+
明确所需数据字段(title、desc、items、label、value、icon 等)。
|
|
320
|
+
选择合适模板。
|
|
321
|
+
使用 AntV Infographic 语法描述信息图内容,并以 Markdown 代码块格式输出,语言标识为 infographic。
|
|
322
|
+
|
|
323
|
+
输出格式示例:
|
|
324
|
+
\`\`\`infographic
|
|
325
|
+
infographic <template-name>
|
|
326
|
+
data
|
|
327
|
+
title ...
|
|
328
|
+
desc ...
|
|
329
|
+
...
|
|
330
|
+
theme
|
|
331
|
+
...
|
|
332
|
+
\`\`\`
|
|
333
|
+
|
|
334
|
+
关键注意:
|
|
335
|
+
1. 必须尊重用户输入的语言。例如用户输入中文,则语法中的文本也必须是中文。
|
|
336
|
+
2. 必须使用 Markdown 代码块格式,语言标识为 infographic,而不是 HTML、JS 或其他代码格式。
|
|
337
|
+
3. 代码块内只包含 AntV Infographic DSL 语法,不要包含任何解释性文字。
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: inventory-doctor
|
|
3
|
+
description: 针对 WMS 拣货缺货场景的库存异常诊断 SOP,涵盖触发、信息收集、决策分支(自动修复/物理复核)与终态汇报。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 场景
|
|
7
|
+
|
|
8
|
+
- 商品 A 系统显示 5 件,拣货员现场为 0(缺货)。
|
|
9
|
+
- 智能体以 Think-Act-Observe 循环完成诊断与处置。
|
|
10
|
+
|
|
11
|
+
## 核心流程(TAO)
|
|
12
|
+
|
|
13
|
+
### 1) Trigger(感知与锁定)
|
|
14
|
+
- 事件:拣货员上报 Pick Shortage。
|
|
15
|
+
- 动作:锁定相关 SKU + 库位,冻结并发变更。
|
|
16
|
+
|
|
17
|
+
### 2) Data Retrieval & Triage(信息收集与分诊)
|
|
18
|
+
- 查路向:拉取未完结的上架/移库/波次任务,判断是否在途或延迟。
|
|
19
|
+
- 查历史:检索近 24 小时库位操作日志,关注未确认的移库、撤销、盘点。
|
|
20
|
+
- 形成初步假设:数据延迟 / 中间态卡死 / 实物错位。
|
|
21
|
+
|
|
22
|
+
### 3) Reasoning & Execution(决策执行)
|
|
23
|
+
- 分支 A 自动修复:接口中间态→触发 retry_sync 或状态刷新。
|
|
24
|
+
- 分支 B 需物理验证:生成盘点任务,派发就近理货员检查可能错放库位。
|
|
25
|
+
- 所有动作记录审计日志,保持可追溯。
|
|
26
|
+
|
|
27
|
+
### 4) Reporting(终态汇报)
|
|
28
|
+
- 输出诊断结论、采取的动作、残留风险与建议(培训/流程改进)。
|
|
29
|
+
|
|
30
|
+
## 推荐工具契约(可 Mock)
|
|
31
|
+
|
|
32
|
+
> 工具可返回随机/固定示例数据即可,无需真实后端。
|
|
33
|
+
|
|
34
|
+
- `get_wms_movement_tasks(skuId, locationId)` → { tasks: [...], pending: boolean }
|
|
35
|
+
- `get_location_logs(locationId, lookbackHours)` → [{ ts, action, operator, status }]
|
|
36
|
+
- `retry_sync(taskId)` → { fixed: boolean, message }
|
|
37
|
+
- `dispatch_cycle_count({ skuId, locations, priority })` → { taskId, assignee, eta }
|
|
38
|
+
- `notify_picker(message)` → { delivered: boolean }
|
|
39
|
+
- `write_case_report(markdown)` → { saved: true, path }
|
|
40
|
+
|
|
41
|
+
## 交付物模板
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
### 诊断概览
|
|
45
|
+
- 异常:Pick Shortage / SKU: xxx / 库位: xxx
|
|
46
|
+
- 初步结论:数据中间态 / 物理错放 / 待验证
|
|
47
|
+
|
|
48
|
+
### 关键发现
|
|
49
|
+
- 路向检查:...
|
|
50
|
+
- 日志发现:...
|
|
51
|
+
- 其他迹象:...
|
|
52
|
+
|
|
53
|
+
### 处置动作
|
|
54
|
+
- 自动修复:已调用 retry_sync(taskId=...) / 结果 ...
|
|
55
|
+
- 物理验证:已派发盘点任务 {taskId, 库位 B/C, ETA}
|
|
56
|
+
- 通知:已告知拣货员重试/等待/改捡
|
|
57
|
+
|
|
58
|
+
### 后续建议
|
|
59
|
+
- 培训/流程:...
|
|
60
|
+
- 监控/预警:...
|
|
61
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const inventoryDoctor = {
|
|
2
|
+
name: "inventory-doctor",
|
|
3
|
+
description:
|
|
4
|
+
"针对 WMS 拣货缺货场景的库存异常诊断 SOP,涵盖触发、信息收集、分支决策(自动修复或物理复核)与终态汇报。",
|
|
5
|
+
prompt: `你是库存异常诊断智能体(Inventory Doctor)。面对“系统库存为 5,现场为 0”的缺货事件,按 Think-Act-Observe 循环完成诊断。
|
|
6
|
+
|
|
7
|
+
## 核心流程
|
|
8
|
+
1) Trigger:收到 Pick Shortage,锁定 SKU + 库位,冻结并发变更。
|
|
9
|
+
2) Data Retrieval & Triage:
|
|
10
|
+
- 查路向:拉取未完结的上架/移库/波次任务,判断是否在途或延迟。
|
|
11
|
+
- 查历史:检索近 24h 库位操作日志,找未确认移库/撤销/盘点。
|
|
12
|
+
- 初步假设:数据延迟/中间态卡死/实物错放。
|
|
13
|
+
3) Reasoning & Execution:
|
|
14
|
+
- 分支 A 自动修复:若接口中间态,调用 retry_sync 或刷新状态。
|
|
15
|
+
- 分支 B 需物理验证:生成盘点任务,派发就近理货员检查备选库位。
|
|
16
|
+
- 全程记录审计日志。
|
|
17
|
+
4) Reporting:输出诊断结论、已执行动作、残留风险与建议。
|
|
18
|
+
|
|
19
|
+
## 可用工具(可返回 Mock 数据)
|
|
20
|
+
- get_wms_movement_tasks(skuId, locationId) -> { tasks: [...], pending: boolean }
|
|
21
|
+
- get_location_logs(locationId, lookbackHours) -> [{ ts, action, operator, status }]
|
|
22
|
+
- retry_sync(taskId) -> { fixed: boolean, message }
|
|
23
|
+
- dispatch_cycle_count({ skuId, locations, priority }) -> { taskId, assignee, eta }
|
|
24
|
+
- notify_picker(message) -> { delivered: boolean }
|
|
25
|
+
- write_case_report(markdown) -> { saved: true, path }
|
|
26
|
+
|
|
27
|
+
## 输出模板
|
|
28
|
+
请用 Markdown 返回:
|
|
29
|
+
### 诊断概览
|
|
30
|
+
- 异常:Pick Shortage / SKU: xxx / 库位: xxx
|
|
31
|
+
- 初步结论:数据中间态 / 物理错放 / 待验证
|
|
32
|
+
|
|
33
|
+
### 关键发现
|
|
34
|
+
- 路向检查:...
|
|
35
|
+
- 日志发现:...
|
|
36
|
+
- 其他迹象:...
|
|
37
|
+
|
|
38
|
+
### 处置动作
|
|
39
|
+
- 自动修复:retry_sync(taskId=...) 结果 ...
|
|
40
|
+
- 物理验证:盘点任务 {taskId, 库位 B/C, ETA}
|
|
41
|
+
- 通知:拣货员已获知重试/等待/改捡
|
|
42
|
+
|
|
43
|
+
### 后续建议
|
|
44
|
+
- 培训/流程:...
|
|
45
|
+
- 监控/预警:...
|
|
46
|
+
`,
|
|
47
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: notebook-report
|
|
3
|
+
description: 生成笔记本风格的数据分析报告,包含执行摘要、分析步骤(SQL、可视化、洞察)和结论。适用于需要将多步骤分析整合为完整、可复现的分析报告的场景。
|
|
4
|
+
metadata:
|
|
5
|
+
category: analysis
|
|
6
|
+
---
|
|
7
|
+
如何可视化数据,请通过data-visualization技能了解。
|
|
8
|
+
|
|
9
|
+
## 报告结构
|
|
10
|
+
|
|
11
|
+
### 报告标题部分
|
|
12
|
+
|
|
13
|
+
- **标题**:清晰、描述性的分析标题
|
|
14
|
+
- **上下文**:简要介绍分析内容和原因
|
|
15
|
+
- **数据源**:数据库信息和时间周期
|
|
16
|
+
- **执行摘要**:所有关键发现的高级摘要(2-3 段)
|
|
17
|
+
|
|
18
|
+
### 分析步骤(笔记本单元格)
|
|
19
|
+
|
|
20
|
+
每个分析步骤是一个完整的单元格,包含:
|
|
21
|
+
|
|
22
|
+
\`\`\`markdown
|
|
23
|
+
## 步骤 [N]:[步骤标题]
|
|
24
|
+
|
|
25
|
+
### 问题 / 目标
|
|
26
|
+
[此步骤要回答的业务问题,来自 topic_[sub_topic_name].md]
|
|
27
|
+
|
|
28
|
+
### SQL 查询
|
|
29
|
+
\`\`\`sql
|
|
30
|
+
[完整 SQL 查询,带注释说明]
|
|
31
|
+
\`\`\`
|
|
32
|
+
|
|
33
|
+
### 数据可视化
|
|
34
|
+
\`\`\`chart
|
|
35
|
+
{
|
|
36
|
+
"table": [...],
|
|
37
|
+
"echarts": {
|
|
38
|
+
"title": {"text": "[图表标题]"},
|
|
39
|
+
"tooltip": {...},
|
|
40
|
+
"legend": {...},
|
|
41
|
+
"xAxis": {...},
|
|
42
|
+
"yAxis": {...},
|
|
43
|
+
"series": [...]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
### 关键发现
|
|
49
|
+
[来自 data-analysis-agent 的核心洞察,用业务语言表达]
|
|
50
|
+
|
|
51
|
+
### 业务解释
|
|
52
|
+
[这些发现对业务的意义和影响]
|
|
53
|
+
|
|
54
|
+
### 建议
|
|
55
|
+
[基于此分析的具体、可操作建议]
|
|
56
|
+
\`\`\`
|
|
57
|
+
|
|
58
|
+
### 报告结论
|
|
59
|
+
|
|
60
|
+
- **所有发现的摘要**:综合所有步骤的洞察
|
|
61
|
+
- **总体建议**:按优先级排序的可操作建议
|
|
62
|
+
- **后续分析**:建议的下一步分析方向(如适用)
|
|
63
|
+
|
|
64
|
+
## 报告编写原则
|
|
65
|
+
|
|
66
|
+
- **故事性**:将分析组织成连贯的故事,而非技术报告
|
|
67
|
+
- **业务聚焦**:使用业务术语,避免技术 jargon
|
|
68
|
+
- **数据驱动**:将具体数值自然融入叙述
|
|
69
|
+
- **可操作**:每个发现都应导向可执行的建议
|
|
70
|
+
- **逻辑递进**:步骤之间要有清晰的逻辑连接
|
|
71
|
+
|
|
72
|
+
## 数据来源
|
|
73
|
+
|
|
74
|
+
报告应基于:
|
|
75
|
+
- `/question.md`:原始业务问题
|
|
76
|
+
- `/topic_*.md`:各子主题的分析结果
|
|
77
|
+
- 步骤 3 的综合摘要
|
|
78
|
+
|
|
79
|
+
## 输出格式
|
|
80
|
+
|
|
81
|
+
生成完整的 Markdown 格式报告,包含所有分析步骤、图表配置和洞察。
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sql-query
|
|
3
|
+
description: 生成和执行 SQL 查询以检索业务数据。适用于需要从数据库获取数据、探索表结构、验证查询正确性的场景。委托给 sql-builder-agent 执行。
|
|
4
|
+
metadata:
|
|
5
|
+
category: sql
|
|
6
|
+
---
|
|
7
|
+
## 委托给 sql-builder-agent
|
|
8
|
+
|
|
9
|
+
所有 SQL 相关操作都委托给 sql-builder-agent 子代理执行。
|
|
10
|
+
|
|
11
|
+
## 数据库模式探索
|
|
12
|
+
|
|
13
|
+
**请求模式信息**:
|
|
14
|
+
- "请列出数据库中所有可用的表"
|
|
15
|
+
- "请显示表 [X] 的模式,包括列、数据类型和关系"
|
|
16
|
+
|
|
17
|
+
**检查现有文档**:
|
|
18
|
+
- 先读取 `/db_schema.md`(如存在)
|
|
19
|
+
- 仅在需要时请求新的模式探索
|
|
20
|
+
|
|
21
|
+
## 查询生成与执行
|
|
22
|
+
|
|
23
|
+
**提供清晰的业务需求**:
|
|
24
|
+
1. **业务问题**:明确要回答的问题
|
|
25
|
+
2. **指标**:需要计算的业务指标(收入、订单数、转化率等)
|
|
26
|
+
3. **维度**:分组维度(地区、渠道、产品类别等)
|
|
27
|
+
4. **筛选条件**:时间范围、状态、类别等
|
|
28
|
+
5. **比较需求**:同比、环比、目标对比等
|
|
29
|
+
|
|
30
|
+
**请求格式示例**:
|
|
31
|
+
"我需要按地区比较 2024 年第三季度与 2023 年第三季度的收入。请生成并执行 SQL 查询。"
|
|
32
|
+
|
|
33
|
+
"请查询过去 6 个月每个月的订单量和平均订单金额,按渠道分组。"
|
|
34
|
+
|
|
35
|
+
## 接收与验证结果
|
|
36
|
+
|
|
37
|
+
sql-builder-agent 会返回:
|
|
38
|
+
- **SQL 查询**:格式清晰的完整查询
|
|
39
|
+
- **查询结果**:返回的数据
|
|
40
|
+
- **模式信息**:使用的表结构信息
|
|
41
|
+
|
|
42
|
+
**验证要点**:
|
|
43
|
+
- 查询是否正确回答了业务问题
|
|
44
|
+
- 数据质量(NULL 值、异常值)
|
|
45
|
+
- 结果完整性(行数、时间范围)
|
|
46
|
+
- 列名是否业务友好
|
|
47
|
+
|
|
48
|
+
## 错误处理
|
|
49
|
+
|
|
50
|
+
如遇到查询错误:
|
|
51
|
+
- 分析错误信息
|
|
52
|
+
- 检查表名、列名是否正确
|
|
53
|
+
- 验证 JOIN 条件和数据类型
|
|
54
|
+
- 请求 sql-builder-agent 修正并重新执行
|
|
55
|
+
|
|
56
|
+
## 文档化
|
|
57
|
+
|
|
58
|
+
将使用的 SQL 查询和结果保存到分析文档中,便于后续参考和复现。
|
package/src/agents/index.ts
CHANGED