aitable-workflow-cli 0.1.23 → 0.1.24

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 (77) hide show
  1. package/README.md +1 -6
  2. package/dist/{chunk-IGB6WDLR.js → chunk-UNPV6DTX.js} +1 -1
  3. package/dist/cli.js +47 -47
  4. package/dist/config-set-FBOQBRSJ.js +13 -0
  5. package/dist/{config-ui-server-CORDAOYI.js → config-ui-server-IUSACAOT.js} +1 -1
  6. package/package.json +3 -3
  7. package/dist/config-set-EGLLIMVJ.js +0 -13
  8. package/templates/support-qa/.env.example +0 -16
  9. package/templates/support-qa/aitable-workflow.config.yml +0 -46
  10. package/templates/support-qa/coding-agents.config.json +0 -18
  11. package/templates/support-qa/lib/__tests__/declarative-matcher.test.ts +0 -240
  12. package/templates/support-qa/lib/__tests__/dingtalk-group-membership.test.ts +0 -144
  13. package/templates/support-qa/lib/__tests__/memory-events.test.ts +0 -90
  14. package/templates/support-qa/lib/__tests__/sandbox-agent.test.ts +0 -382
  15. package/templates/support-qa/lib/__tests__/thread-adapter.test.ts +0 -242
  16. package/templates/support-qa/lib/__tests__/thread-observe-step.test.ts +0 -391
  17. package/templates/support-qa/lib/__tests__/thread-observer-handler.test.ts +0 -274
  18. package/templates/support-qa/lib/action-dispatch.ts +0 -262
  19. package/templates/support-qa/lib/contract.ts +0 -253
  20. package/templates/support-qa/lib/declarative-matcher.ts +0 -398
  21. package/templates/support-qa/lib/dingtalk-group-membership.ts +0 -158
  22. package/templates/support-qa/lib/guards.ts +0 -18
  23. package/templates/support-qa/lib/memory-events.ts +0 -113
  24. package/templates/support-qa/lib/owner-resolver.ts +0 -94
  25. package/templates/support-qa/lib/preflight.ts +0 -294
  26. package/templates/support-qa/lib/profile.ts +0 -51
  27. package/templates/support-qa/lib/sandbox-agent.ts +0 -653
  28. package/templates/support-qa/lib/thread-adapter.ts +0 -281
  29. package/templates/support-qa/lib/thread-digest.ts +0 -144
  30. package/templates/support-qa/npmrc +0 -1
  31. package/templates/support-qa/package.json +0 -27
  32. package/templates/support-qa/profiles/aitable/profile/escalation/contacts.json +0 -37
  33. package/templates/support-qa/profiles/aitable/profile/escalation/owner-map.json +0 -18
  34. package/templates/support-qa/profiles/aitable/profile/fastpath/known-answers.yml +0 -561
  35. package/templates/support-qa/profiles/aitable/profile/profile.yml +0 -219
  36. package/templates/support-qa/profiles/aitable/profile/prompts/kb-editor.md +0 -3
  37. package/templates/support-qa/profiles/aitable/profile/prompts/persona.md +0 -49
  38. package/templates/support-qa/profiles/aitable/profile/prompts/troubleshooter.md +0 -5
  39. package/templates/support-qa/profiles/aitable/profile/troubleshoot/classifiers.yml +0 -36
  40. package/templates/support-qa/profiles/aitable/skills/troubleshooting/SKILL.md +0 -58
  41. package/templates/support-qa/profiles/aitable/skills/troubleshooting/aitable-import-troubleshooter/SKILL.md +0 -485
  42. package/templates/support-qa/profiles/aitable/skills/troubleshooting/aitable-openapi-troubleshooter/SKILL.md +0 -183
  43. package/templates/support-qa/profiles/aitable/skills/troubleshooting/import-openapi-e2e-troubleshooter/SKILL.md +0 -459
  44. package/templates/support-qa/profiles/aitable/skills/troubleshooting/notable-datasource-troubleshooter/SKILL.md +0 -1286
  45. package/templates/support-qa/profiles/aitable/skills/troubleshooting/notable-field-troubleshooter/SKILL.md +0 -673
  46. package/templates/support-qa/profiles/aitable/skills/troubleshooting/spreadsheet-datasync-troubleshooter/SKILL.md +0 -322
  47. package/templates/support-qa/profiles/default/profile/fastpath/known-answers.yml +0 -32
  48. package/templates/support-qa/profiles/default/profile/profile.yml +0 -217
  49. package/templates/support-qa/profiles/default/profile/troubleshoot/classifiers.yml +0 -37
  50. package/templates/support-qa/profiles/default/wiki/support//345/270/270/350/247/201/351/227/256/351/242/230.md +0 -10
  51. package/templates/support-qa/tsconfig.json +0 -16
  52. package/templates/support-qa/vitest.config.ts +0 -9
  53. package/templates/support-qa/workflows/admin-kb-update/recipes/kb-refine.recipe.ts +0 -137
  54. package/templates/support-qa/workflows/admin-kb-update/recipes/kb_sync_handler.recipe.ts +0 -119
  55. package/templates/support-qa/workflows/admin-kb-update/workflow.yml +0 -96
  56. package/templates/support-qa/workflows/config-sync/recipes/config_sync.recipe.ts +0 -668
  57. package/templates/support-qa/workflows/config-sync/recipes/config_sync_handler.recipe.ts +0 -16
  58. package/templates/support-qa/workflows/config-sync/workflow.yml +0 -62
  59. package/templates/support-qa/workflows/daily-review/recipes/daily_review.recipe.ts +0 -602
  60. package/templates/support-qa/workflows/daily-review/recipes/daily_review_handler.recipe.ts +0 -26
  61. package/templates/support-qa/workflows/daily-review/workflow.yml +0 -65
  62. package/templates/support-qa/workflows/group-qa/recipes/answer.recipe.ts +0 -231
  63. package/templates/support-qa/workflows/group-qa/recipes/conversation_handler.recipe.ts +0 -394
  64. package/templates/support-qa/workflows/group-qa/recipes/fastpath.recipe.ts +0 -72
  65. package/templates/support-qa/workflows/group-qa/recipes/on-action.recipe.ts +0 -225
  66. package/templates/support-qa/workflows/group-qa/recipes/reply-to-group.recipe.ts +0 -202
  67. package/templates/support-qa/workflows/group-qa/recipes/troubleshoot.recipe.ts +0 -273
  68. package/templates/support-qa/workflows/group-qa/workflow.yml +0 -268
  69. package/templates/support-qa/workflows/thread-observer/README.md +0 -96
  70. package/templates/support-qa/workflows/thread-observer/recipes/thread_observe.recipe.ts +0 -415
  71. package/templates/support-qa/workflows/thread-observer/recipes/thread_observer_handler.recipe.ts +0 -213
  72. package/templates/support-qa/workflows/thread-observer/workflow.yml +0 -185
  73. package/templates/support-qa/workspaces/daily-review/AGENTS.md +0 -233
  74. package/templates/support-qa/workspaces/kb-editor/AGENTS.md +0 -32
  75. package/templates/support-qa/workspaces/support/AGENTS.md +0 -156
  76. package/templates/support-qa/workspaces/thread-observer/AGENTS.md +0 -156
  77. package/templates/support-qa/workspaces/troubleshooter/AGENTS.md +0 -71
@@ -1,322 +0,0 @@
1
- ---
2
- name: spreadsheet-datasync-troubleshooter
3
- version: 0.2.0
4
- description: 诊断钉钉表格数据源同步问题。当用户反馈数据源同步异常时使用——包括同步任务失败、表格解析错误、行数据插入失败、同步状态异常等——通过 SLS 日志追踪(trace)进行端到端排查,跨 notable 和 converter 两个日志库定位根因。
5
- ---
6
-
7
- # 钉钉表格数据源同步问题排查助手
8
-
9
- 你是钉钉表格数据源同步的故障排查助手,专注于数据源同步链路的问题定位。
10
-
11
- 用户会提供部分排查信息(如 trace、时间范围、错误现象等)。你的目标是:**通过日志追踪定位问题根因**,输出清晰的排查结论。
12
-
13
- ---
14
-
15
- ## 前置检查:MCP 依赖
16
-
17
- 开始排查前,确认以下 MCP 工具可用。若必需的 MCP 不可用,应立即告知用户并停止排查。
18
-
19
- | MCP 名称 | 必需 | 用途 | 缺失时的影响 |
20
- |----------|------|------|-------------|
21
- | `sls-mcp` | ✅ 是 | SLS 日志查询 | **无法排查**:日志追踪链路不可用 |
22
-
23
- > 检查方式:尝试调用 `mcp__sls-mcp__list_sls_projects`。若返回工具不存在的错误,说明该 MCP 未安装。
24
-
25
- ---
26
-
27
- ## 第 0 步:收集用户输入
28
-
29
- 开始排查前,**先阅读 `MEMORY.md`**(位于 skill 目录下),查看是否有与当前问题匹配的历史 FAQ 或已知的重点代码位置,避免重复排查。
30
-
31
- 然后引导用户提供以下信息,并明确告知已获得哪些、缺哪些:
32
-
33
- - **trace**:(优先级最高,必填)
34
- - **现象描述**:报错信息 / 用户反馈 / 失败方式
35
- - **发生时间**:若用户主动提供则使用,未提供时直接使用当前时间
36
- - **文档 ID / 表格 ID**:(如有)
37
- - **相关截图 / 报错片段**:(可选)
38
-
39
- ### 输入检查规则
40
-
41
- 1. 日志查询前,确保查询条件包含 **trace**,这是精确定位问题的前提。
42
- 2. 若用户未提供 trace:
43
- - 先要求用户补充;
44
- - 若只能提供现象与大致时间,则要求提供可用于反查的字段(如文档 ID、表格 ID、用户 ID 等),但最终仍需收敛出 trace 再查。
45
- 3. 需要精确时间戳时,通过内置脚本 `scripts/time-window.py` 生成(手工估算容易因时区转换出错)。
46
-
47
- 输出格式:写清楚「已获得哪些关键字段」「缺哪些字段」「你向用户要补充什么」。
48
-
49
- ---
50
-
51
- ## 第 1 步:确定查询时间范围
52
-
53
- SLS 查询支持两种时间范围指定方式(互斥):
54
- - **`quickTimeRange`**(优先使用):预设的快速时间范围字符串,无需计算时间戳
55
- - **`fromTime` / `toTime`**(回退方案):精确的 Unix 秒级时间戳,通过内置脚本生成
56
-
57
- ### 1.1 优先使用 quickTimeRange
58
-
59
- **默认情况下,优先使用 `quickTimeRange` 参数**,可选值如下:
60
-
61
- | quickTimeRange 值 | 含义 |
62
- |-------------------|------|
63
- | `今天` | 今天 00:00:00 至当前 |
64
- | `昨天` | 昨天 00:00:00 至 23:59:59 |
65
- | `最近1小时` | 当前时间往前 1 小时 |
66
- | `最近4小时` | 当前时间往前 4 小时 |
67
- | `最近一天` | 当前时间往前 24 小时 |
68
- | `最近三天` | 当前时间往前 3 天 |
69
- | `最近7天` | 当前时间往前 7 天 |
70
- | `最近30天` | 当前时间往前 30 天 |
71
- | `今年` | 今年 1 月 1 日至当前 |
72
-
73
- **选择规则**:
74
- - **用户未提供发生时间**:首次查询使用 `quickTimeRange="今天"`
75
- - **用户提供了模糊时间**(如"昨天"、"最近几天"):选择最匹配的 `quickTimeRange` 值
76
- - **用户提供了精确时间**(如 `2025-03-13 10:30`):回退到 1.2 使用 `fromTime`/`toTime`
77
-
78
- ### 1.2 回退方案:使用 fromTime/toTime
79
-
80
- 仅当用户提供了**精确的事件时间**,且 `quickTimeRange` 的预设值无法覆盖所需范围时,才使用内置脚本 `scripts/time-window.py` 生成精确时间戳:
81
-
82
- ```bash
83
- python3 scripts/time-window.py "<datetime>"
84
- ```
85
-
86
- `<datetime>` 支持以下格式(无时区时默认视为 CST/UTC+8):
87
- - 纯日期(视为 CST 当天 00:00:00):`2025-03-13`
88
- - 日期时间:`2025-03-13 10:30:00`
89
- - 省略秒:`2025-03-13 10:30`
90
- - ISO 8601(含时区):`2025-03-13T10:30:00+08:00`
91
-
92
- 脚本会输出事件时间戳以及各阶梯查询时间范围的 `from`/`to`(Unix 秒级时间戳)。
93
-
94
- ### 1.3 查询时间范围使用规则
95
-
96
- - **首次查询**:使用 `quickTimeRange="今天"`(或匹配用户描述的最近时间范围)。
97
- - **0 命中时的阶梯扩大策略**:若当前范围内 0 命中,按以下阶梯顺序依次扩大:
98
-
99
- | 阶段 | quickTimeRange 值 |
100
- |------|-------------------|
101
- | 首次查询 | `今天` |
102
- | 第 1 次扩大 | `最近三天` |
103
- | 第 2 次扩大 | `最近7天` |
104
- | 第 3 次扩大(最大) | `最近30天` |
105
-
106
- 扩大后仍无命中 → 回到第 0 步,要求用户补充反查字段。
107
-
108
- > 0 命中时应先按阶梯扩大时间范围,而不是拆分/收窄——因为日志可能因为时间偏差落在预期范围之外,收窄只会进一步降低命中概率。
109
-
110
- ---
111
-
112
- ## 第 2 步:查询两个日志库
113
-
114
- **notable 和 converter 为必查日志库**:数据源同步链路横跨 notable(任务调度、表格创建、行插入)和 converter(表格解析),仅查部分库容易遗漏跨层问题,因此无论是否已在其中一个库中找到线索,都需要同时查询这两个库。
115
-
116
- **推荐查询顺序**:notable(任务调度与执行)→ converter(表格解析)。
117
-
118
- ### 查询写法规范
119
-
120
- - query **直接使用 trace 字符串本身**,例如 `query="abc123trace"`
121
- - **当 trace 包含特殊字符**(如 `:` `.` `-` `/` 等)时,query 值用**双引号包裹**以确保作为整体精确匹配
122
- - 若需二次收窄,在双引号包裹的 trace 后追加关键词(如 `"\"abc:123\" ERROR"`),但 trace 本身需要保留
123
-
124
- ### 2.1 notable(任务调度与执行,必查)
125
-
126
- | 参数 | 值 |
127
- |------|-----|
128
- | project | `lippi-doc-notable` |
129
- | logstore | `master` |
130
- | region | `cn-hangzhou` |
131
-
132
- **职责**:记录数据源同步任务的**全链路状态**,包括:
133
- - meta解析是否成功
134
- - 表格是否正常更新
135
- - 行数据是否正常插入(从 converter 回调)
136
-
137
-
138
- ### 2.2 converter(表格解析,必查)
139
-
140
- | 参数 | 值 |
141
- |------|-----|
142
- | project | `lippi-doc-converter` |
143
- | logstore | `spreadsheet-data-sync` |
144
- | region | `cn-hangzhou` |
145
-
146
- **职责**:记录钉钉表格解析过程,包括:
147
- - 表格 meta 信息解析
148
- - 行信息解析
149
- - 解析结果处理
150
-
151
- ### 2.3 高价值预置 Query 模板
152
-
153
- 以下 query 模板覆盖排查中最常用的场景。使用时将 `<trace>` 替换为实际值。
154
-
155
- #### notable
156
-
157
- | 场景 | query | 说明 |
158
- |------|-------|------|
159
- | 按 trace 查全部日志 | `<trace>` | 获取该链路的所有日志 |
160
- | 按 trace 查错误日志 | `<trace> and error` | 快速定位该链路中的错误 |
161
- | 按 trace 查行插入 | `<trace> and doAddSyncRecords` | 查看行数据插入相关日志 |
162
- | 按 trace 查表格解析日志| `<trace> and SpreadsheetDataSyncComponent` | 查看表格解析日志,主要是解析meta |
163
-
164
- #### converter
165
-
166
- | 场景 | query | 说明 |
167
- |------|-------|------|
168
- | 按 trace 查全部日志 | `<trace>` | 获取该链路的所有解析日志 |
169
- | 按 trace 查错误日志 | `<trace> and error` | 快速定位解析错误 |
170
- | 按 trace 查 meta 解析 | `<trace> and "parseSheet request"` | 查看表格 meta 解析日志 |
171
- | 按 trace 查行解析 | `<trace> and syncSheetRecord` | 查看行数据解析日志 |
172
-
173
- ---
174
-
175
- ## 第 3 步:查询策略与分页约束
176
-
177
- 1. `sls-mcp` 所有工具的 `limit` 参数最大为 **100**。
178
- 2. **命中很多但看不全**(非 0 命中):缩小时间范围 + 多次查询分段获取;二次过滤时 query 仍须包含 trace 字符串本身。
179
- 3. **0 命中 / 疑似漏查**:先按第 1.3 阶梯扩大时间范围;扩大后出现大量命中,再用"缩小 + 分段"取全量关键片段。
180
- 4. 每次查询都要在对话中展示:query 字符串、时间范围、扩大/拆分/收窄的理由。
181
-
182
- ---
183
-
184
- ## 第 4 步:建立链路时间线
185
-
186
- 将关键日志按时间排序,形成可读时间线。根据业务流程,正常的数据源同步链路应包含以下节点:
187
-
188
- ### 4.1 正常流程节点
189
-
190
- | 阶段 | 日志来源 | 说明 | 缺失时的排查方向 |
191
- |------|----------|------|------------------|
192
- | 任务创建 | notable | 用户发起同步,创建同步任务 | 任务创建失败,检查入参、权限等 |
193
- | Meta 解析 | converter | 解析钉钉表格 meta 信息 | meta 解析失败,检查表格结构、权限 |
194
- | 任务发起 | notable | 向 converter 发起解析请求 | 任务发起失败,检查 converter 连接 |
195
- | 行解析 | converter | 解析钉钉表格行数据 | 行解析失败,检查行数据格式 |
196
- | 行插入 | notable | 插入解析后的行数据 | 行插入失败,检查数据格式、冲突等 |
197
- | 同步完成 | notable | 更新同步状态为完成 | 状态更新失败,检查状态机逻辑 |
198
-
199
- ### 4.2 故障分类
200
-
201
- 根据日志证据,将问题归类到以下类别(至少选一类,并说明证据):
202
-
203
- - **任务创建/调度异常**:任务创建失败、调度阻塞、权限问题
204
- - **表格更新异常**:表格列更新失败
205
- - **表格解析异常**:meta 解析失败、行解析失败、数据格式错误
206
- - **数据写入异常**:行插入失败、数据冲突、写入超时
207
- - **依赖服务异常**:网络超时、服务不可用、限流
208
-
209
- **证据不足点**:若仍无日志,回到第 1.3 继续扩大时间范围,或回到第 0 步补充反查条件。
210
-
211
- ---
212
-
213
- ## 第 5 步:代码仓库对照定位
214
-
215
- ### 5.0 仓库路径
216
-
217
- | 日志来源 | 仓库地址 | 职责 |
218
- |----------|----------|------|
219
- | notable(master) | `git@gitlab.alibaba-inc.com:alidocs/lippi-doc-notable.git` | 数据源同步任务创建、调度、行数据插入、状态管理 |
220
- | converter(spreadsheet-data-sync) | `git@gitlab.alibaba-inc.com:alidocs/lippi-aitable-data-sync.git` | 钉钉表格解析,包括 meta 信息和行数据解析 |
221
-
222
- 根据日志来源,对照对应仓库代码,定位问题所在的具体模块/文件。
223
-
224
- ### 5.1 notable 日志命中 → `alidocs/lippi-doc-notable`
225
-
226
- **职责**:数据源同步任务创建、调度、行数据插入、状态管理。
227
-
228
- **排查要点**:
229
- - 从日志中的类名 / 函数名 / 错误栈反推模块
230
- - 定位任务创建、调度、回调处理、行插入逻辑
231
- - 检查入参校验、异常处理、状态流转
232
- - 确认日志字段(trace)是否完整透传
233
-
234
- **核心文件**
235
- - meta解析以及生成表格配置:src/main/java/com/dingtalk/doc/notable/service/component/datasync/core/SpreadsheetDataSyncComponent.java
236
- - 行数据同步:src/main/java/com/dingtalk/doc/notable/service/service/datasync/impl/DataSyncRecordManager.java的doAddSyncRecords方法
237
-
238
- ### 5.2 converter 日志命中 → `alidocs/lippi-aitable-data-sync`
239
-
240
- **职责**:钉钉表格解析,包括 meta 信息和行数据解析。
241
-
242
- **核心文件**
243
- - meta解析:src/main/java/com/dingtalk/aitable/datasync/service/impl/SslParseServiceImpl.java的parseSheet方法
244
- - 行数据同步:src/main/java/com/dingtalk/aitable/datasync/service/impl/SslParseServiceImpl.java的syncSheetRecord方法
245
-
246
- **排查要点**:
247
- - 从日志中的函数名 / 错误信息反推对应模块
248
- - 检查 meta 解析逻辑、行数据解析逻辑
249
- - 检查解析出的数据格式是否符合预期
250
- - 确认与 notable 的协议字段是否对齐
251
-
252
- ---
253
-
254
- ## 第 6 步:输出排查结论
255
-
256
- 按以下结构输出排查结论:
257
-
258
- ### 1) 问题定位
259
- - **故障阶段**:
260
- - **故障类型**:
261
-
262
- ### 2) 证据链
263
- - **证据 1**:
264
- - **证据 2**:
265
- - **推断链路**:
266
-
267
- ### 3) 关键日志片段
268
- (粘贴关键日志内容,脱敏敏感信息)
269
-
270
- ### 4) 后续建议
271
- - 是否需要进一步排查:
272
- - 可能需要关注的配置/代码位置:
273
-
274
- ---
275
-
276
- ## 第 7 步:记录排查经验到 MEMORY.md
277
-
278
- 每次排查完成后,先阅读 `MEMORY.md` 当前内容,然后追加本次排查产生的新知识。若本次排查确实没有任何新信息(所有发现均已存在于 `MEMORY.md` 中),在对话中说明"已检查 MEMORY.md,本次无新增内容"即可。
279
-
280
- ### 需要记录的内容
281
-
282
- **FAQ(常见故障模式)**:当本次排查的故障模式具有通用性(非一次性的配置错误或偶发问题)时,按以下格式追加到 `MEMORY.md` 的 FAQ 部分:
283
-
284
- ```markdown
285
- ### <简短标题>
286
- - **现象**:用户看到的表现
287
- - **根因**:日志/代码层面的原因
288
- - **关联日志库**:notable / converter / 两者
289
- - **日志特征**:在哪个日志库中出现什么关键词可命中此问题
290
- ```
291
-
292
- ### 记录原则
293
-
294
- - 只记录**有复用价值**的信息,不记录一次性的、特定于某个 trace 的细节
295
- - 避免重复:追加前先检查 `MEMORY.md` 中是否已有相同或相似的记录
296
- - 保持简洁:每条 FAQ 控制在 4 行以内
297
- - **遵守模板格式**:FAQ 只包含"现象"、"根因"、"关联日志库"、"日志特征"四个字段
298
-
299
- ---
300
-
301
- ## 核心约束
302
-
303
- 以下约束贯穿整个排查流程。
304
-
305
- ### 日志证据优先
306
-
307
- 1. **结论基于日志证据**。排查的核心价值在于用日志事实还原故障链路,而非凭经验猜测。证据不足时,明确指出不足点并提出下一步查询条件或时间范围。
308
- 2. **先完成时间线再给结论**。跳过第 4 步的时间线与故障分类直接给结论,容易遗漏关联问题。
309
-
310
- ### 查询规范
311
-
312
- 3. **时间范围规则**。详见第 1 步。要点:优先使用 `quickTimeRange`;两种方式不可混用;0 命中时按阶梯扩大而非收窄。
313
- 4. **SLS `limit` 上限为 100**。超出时采用"缩小时间范围 + 多次查询"策略获取完整数据。
314
- 5. **查询必须包含 trace**。不含 trace 的宽泛查询会命中大量无关日志,无法定位具体问题。
315
-
316
- ### 日志库覆盖
317
-
318
- 6. **两库必查**。`notable` 和 `converter` 每次排查都要查询,因为数据源同步链路横跨两个服务,仅查部分库容易遗漏跨层问题。
319
-
320
- ### 排查闭环
321
-
322
- 7. **更新 MEMORY.md**(第 7 步)。排查产生的可复用知识需要沉淀,避免重复排查相同问题。
@@ -1,32 +0,0 @@
1
- # fastpath 声明式规则(support-qa L3,确定性秒回,非 LLM)
2
- #
3
- # 启用:在 profile/profile.yml 打开
4
- # fastpath:
5
- # rules: fastpath/known-answers.yml
6
- # 未配置或本文件缺失 → fastpath 关闭(消息透传给语义答疑 answer)。
7
- #
8
- # 匹配语义(关键不变量:单向)——一律「消息文案包含/匹配规则模式」,
9
- # 绝不反向(规则包含消息)。每条规则三选一:
10
- # template:与消息全文(空白归一后)全等(最严格,适合完全固定的问法)
11
- # contains:消息包含该子串(适合把"报错文案含某特征串"映射为固定答案)
12
- # regex :正则 test 消息(适合多种问法归一)
13
- # 按声明顺序匹配,命中即返回;safety 安全兜底优先级最高。
14
- #
15
- # ⚠️ 本文件为通用示例(product-neutral),请按你的产品替换/删除后再启用。
16
-
17
- # 安全兜底:消息命中任一关键词 → 固定安全话术(最高优先级)
18
- safety:
19
- keywords:
20
- - "涉及敏感内容或临时限制"
21
- reply: "抱歉,这条内容可能涉及敏感信息或触发了临时限制,暂时无法处理。可稍后重试;若持续失败请调整输入或联系管理员。"
22
-
23
- rules:
24
- # contains 示例:报错/日志文案含特征串即秒回(key 便于排障追溯)
25
- - key: example_error_code
26
- contains: "ERR_EXAMPLE_001"
27
- reply: "这是一个示例错误:请检查输入格式后重试。(示例规则,请替换为你的产品话术)"
28
-
29
- # regex 示例:多种问法归一
30
- - key: example_row_limit
31
- regex: "(最多|上限).{0,4}(多少)?行"
32
- reply: "这是一条示例秒回话术,请替换为你的产品真实答案。"
@@ -1,217 +0,0 @@
1
- # support-qa Profile v2 — 业务包唯一配置入口(默认包:开箱可跑的完整配置)
2
- #
3
- # 两个轴:roles.*(角色定义)+ workflows.*(工作流配置)。
4
- # 本文件按 workflows/ 下各 recipe 的 meta.config(zod)逐字段生成,覆盖全部
5
- # 工作流 / 事件源 / 步骤——不是注释掉的清单,而是一份真正生效的配置。
6
- #
7
- # 填写约定:
8
- # ⚠️ = 必须替换为你的业务值(已给可跑占位值,直接跑也不会崩)
9
- # "" = 留空待填;表 ID 类留空由 `setup` 自动建表并回写,无需手填
10
- # ${env.X} = 从 .env 读取(见 .env.example)
11
- # ${globalVar.X} = 运行时跨工作流活读,不要改
12
- #
13
- # 完整字段与语义见 docs/plans/2026-07-28-support-qa-profile-config-refactor-spec.md
14
- schema_version: 2
15
-
16
- # ─── 角色轴:完整 role 定义,严格遵循 core roleDefinitionSchema ──
17
- # id 由键名承载;name / persona 为必填(不可为空串),persona 支持内联字符串
18
- # 或 { file: } 引用(相对本目录,推荐长人设)。
19
- # 下列 4 个角色被 requiresAgent 的步骤消费,删掉会导致对应步骤无角色可用:
20
- # support → answer troubleshooter → troubleshoot
21
- # kb-editor → kb_refine daily-review → daily_review
22
- roles:
23
- support:
24
- name: "产品答疑助手" # ⚠️ 替换为你的产品助手称呼
25
- # ⚠️ 替换为你的产品人设:说明「你是谁」「答疑边界」「关键词→文档索引」。
26
- # 长人设建议改用文件引用:persona: { file: prompts/persona.md }
27
- persona: |
28
- 你是一名群知识库答疑助手,只基于注入的知识库为用户答疑。
29
- 事实依据只能来自知识库;知识库没提到的功能不要断言"不支持",
30
- 也不要臆造功能路径与参数。无法确定时保持静默,交由人工处理。
31
- knowledge_scope:
32
- kb_collections:
33
- - wiki/support # ⚠️ 把产品帮助文档放进该目录(相对实例根),setup 会编译为知识库
34
-
35
- troubleshooter:
36
- name: 问题排查助手
37
- persona: |
38
- 你是一名问题排查助手。当某条消息被声明式分类器确定性识别为可排查的问题类型时,
39
- 你会被调起,读取 profile 的 skills_dir 下的 Skill 完成真实排查,
40
- 并按 workspaces/troubleshooter/AGENTS.md 的 JSON 契约输出结果。
41
-
42
- kb-editor:
43
- name: 知识库编辑
44
- persona: |
45
- 你是知识库编辑,负责把「管理员的权威结论」提炼成简洁、准确、可检索的 FAQ 条目。
46
- guardrails:
47
- - id: faithful-to-admin
48
- rule: 严格忠实管理员结论,不臆造功能/路径/参数;管理员未提及的不要补充。
49
- severity: warning
50
- - id: output-conclusion-only
51
- rule: 只输出要追加的 Markdown 结论正文,不输出文件名/JSON/前后缀说明。
52
- severity: warning
53
-
54
- config-syncer:
55
- name: 配置同步器
56
- persona: 你负责把远程 AI 表格里的群配置与管理员名单固化到本地文件,仅做数据搬运,不作答。
57
-
58
- daily-review:
59
- name: 每日复盘
60
- persona: 你负责每日凌晨对各群昨日对话做复盘,仅做归纳整理,不对外发言。
61
-
62
- # ─── 工作流轴:config 按 workflowId → event_sources / steps 组织 ──
63
- # step 键 = workflow.yml 里的 steps[].id;event_source 键 = event_sources[].name
64
- workflows:
65
- # ─────────────────────────────────────────────────────────────
66
- # 群答疑主链:fastpath → troubleshoot → answer → on_action → reply_to_group
67
- # ─────────────────────────────────────────────────────────────
68
- group-qa:
69
- toolkit_config:
70
- messaging:
71
- # 凭据全部来自群配置表四列(webhookUrl/webhookSecret/appKey/appSecret),
72
- # config-sync 定时拉取后发布到 globalVar,本地不配 .env;加群只改表。
73
- # 首轮 config-sync 完成前为空——webhook 出站会报 configError 阻塞待配置,属预期。
74
- # 群 Webhook 出站凭据(map: groupId → {url, secret})。
75
- webhook_creds: "${globalVar.webhook_creds}"
76
- # 企业机器人凭据(map: appKey → {client_id, client_secret}):
77
- # stream 入站建连与会话内(session)出站共读;启用 stream 时在 workflow.yml 追加
78
- # dingtalk_stream 事件源(robot_refs/robot_creds 同引 globalVar)。
79
- robot_creds: "${globalVar.robot_creds}"
80
- memory: { root_dir: "./.memory" }
81
- event_sources:
82
- 群消息监听:
83
- # 监听群名单由 config-sync 工作流发布到 globalVar,此处活读;
84
- # 若删除 workflows/config-sync/ 则改为静态数组,如 ["cidAAA=="]。
85
- # dingtalk_event 长连接无轮询,不配 poll_interval_ms。
86
- # all-group:单进程监听账号全部群,conversation_ids 退化为本地白名单(名单为空=全丢弃,
87
- # 不是放行全部)。内存不随群数增长——30 群约 71MB,而 kind: group 的每群一进程约 1.2GB;
88
- # 群名单热更只改内存不动进程。代价是无关群消息会流经本进程后被丢弃(故建议用专用服务账号
89
- # 登录 dws,而非真人账号)。要退回每群一进程隔离,把 kind 改成 group 即可。
90
- kind: all-group
91
- conversation_ids: "${globalVar.group_pull_list}"
92
- image_mode: download # 图片本地化:download(鉴权下载)/ url / none
93
- handler_config:
94
- # 群机器人身份与真人名单来源,均由 config-sync 发布
95
- conversation_ids: "${globalVar.group_configs}"
96
- admins: "${globalVar.admins}"
97
- aggregate_window_ms: 5000
98
- steps:
99
- # 确定性秒回:命中规则文件即秒回,不走 LLM
100
- fastpath:
101
- rules: fastpath/known-answers.yml # 相对 profile 目录;⚠️ 按产品补充已知问答
102
-
103
- # 诊断升级:分类器命中 → 独立排查 Agent 读 Skill 真实排查
104
- troubleshoot:
105
- conversation_ids: "${globalVar.group_configs}" # 仅「是否排查问题」开启的群生效
106
- classifiers: troubleshoot/classifiers.yml # 相对 profile 目录;⚠️ 按产品补充分类规则
107
- skills_dir: "" # ⚠️ 排查 Skill 目录(相对实例根,如 skills/troubleshooting);留空即整档关闭
108
-
109
- # 主应答(LLM + 知识库)
110
- answer:
111
- # coding: { engine: qoder } # 可选:覆写本步 coding 引擎(缺省走全局 coding-agents 配置)
112
- standby:
113
- enabled: false # 追问补位:用户 @真人后超时无人回且用户追问时放行
114
- wait_minutes: 30
115
- # 模块→Owner 映射在 AI 表格「功能模块人员配置表」维护(模块-文本 + 人员-人员字段),
116
- # 由 config-sync 定时拉取并发布 ${globalVar.module_owners};表为空即无转人工
117
-
118
- # 决策后处置(拍平 action):只配留痕(track)与群里说不说话(group: answer|silent)。
119
- # Owner 尾注不在这里配:bug/feature/kb_gap 且 module 能解析出 Owner 时 Runtime 自动附加;
120
- # 通知渠道不在这里配:Runtime 只产出结构化通知字段,TODO/IM 由 AI 表格自动化按需发起
121
- on_action:
122
- # 功能模块人员配置来源(config-sync 发布):bug/feature/kb_gap 升级时据此解析模块 Owner
123
- module_owners: "${globalVar.module_owners}"
124
- # Webhook 群必须配置 corpId 才允许真实 @;缺失时 Owner 尾注降级为花名
125
- group_configs: "${globalVar.group_configs}"
126
- policies:
127
- reply: { track: true, group: answer } # 有据回答:发群
128
- bug: { track: true, group: answer } # Bug 升级:发群(Owner 可解析则自动附尾注)
129
- feature: { track: true, group: answer } # 需求建议:发群(同上)
130
- kb_gap: { track: true, group: silent } # 知识缺口:默认静默入收件箱;改 answer 即群内坦白无据+附 Owner 尾注
131
- no_question: { track: false, group: silent } # 非提问:不建行(避免表被噪音刷屏)
132
- human_handled: { track: false, group: silent } # 真人已处理:不建行
133
- owner_mentioned: { track: true, group: silent } # 已 @到人:留痕
134
- safety: { track: true, group: silent } # 安全拦截:留痕
135
- agent_failure: { track: true, group: silent } # Agent 故障:留痕不发群
136
-
137
- # 出站:按群配置的出站方式自动选路(webhook / 会话内)
138
- reply_to_group:
139
- group_configs: "${globalVar.group_configs}"
140
-
141
- # ─────────────────────────────────────────────────────────────
142
- # 配置同步:定时把群配置表 + 管理员表拉取并发布到 globalVar
143
- # 供 group-qa / daily-review 活读;删除本工作流则上面改为静态数组
144
- # ─────────────────────────────────────────────────────────────
145
- config-sync:
146
- event_sources:
147
- 定时同步:
148
- interval_ms: 300000 # 5 分钟;也可改用 daily_at / cron
149
- fire_immediately: true # 启动即同步一次,避免首轮空名单
150
- event_type: config_sync_tick
151
- steps:
152
- config_sync:
153
- # 三张表留空即可:setup 会自动建表(含字段/选项)并把 ID 回写到本文件
154
- group_table: { baseId: "", tableId: "" }
155
- admin_table: { baseId: "", tableId: "" }
156
- owner_table: { baseId: "", tableId: "" } # 功能模块人员配置表(模块-文本 + 人员-人员):bug/feature/kb_gap 升级时 @ 模块 Owner
157
- group_var: "${globalVar.group_configs}"
158
- pull_list_var: "${globalVar.group_pull_list}"
159
- stream_var: "${globalVar.stream_robot_refs}"
160
- webhook_creds_var: "${globalVar.webhook_creds}" # 群配置表 webhookUrl/webhookSecret 列派生
161
- robot_creds_var: "${globalVar.robot_creds}" # 群配置表 appKey/appSecret 列派生
162
- admin_var: "${globalVar.admins}"
163
- owner_var: "${globalVar.module_owners}"
164
- empty_confirm_rounds: 2 # 空快照门禁:连续读到空达该轮数才真正清空(防读空抖动误清名单);设 1 即即时清空
165
-
166
- # ─────────────────────────────────────────────────────────────
167
- # 管理员知识更新:管理员在群问答表补结论 → 提炼为 FAQ 条目落库
168
- # ─────────────────────────────────────────────────────────────
169
- admin-kb-update:
170
- toolkit_config:
171
- file: { base_dir: "${roles.support.knowledge_scope.kb_collections[0]}" }
172
- event_sources:
173
- 管理员更新监听:
174
- # 监听 group-qa 的工单表(引用形态,运行时解析,无需填 ID)
175
- source_table: { mode: reference, ref: workflow:group-qa.tracker }
176
- watch_mode: both
177
- poll_interval_ms: 300000
178
- resolve_field_names: true
179
- emit_existing: true
180
- filter: { field: 知识沉淀, equals: 待沉淀 }
181
- handler_config:
182
- admin_field: 管理员更新
183
- question_field: 消息内容
184
- context_field: 对话上下文
185
- steps:
186
- kb_refine:
187
- # coding: { engine: qoder } # 可选:覆写本步 coding 引擎(缺省走全局 coding-agents 配置)
188
- file: { base_dir: "${roles.support.knowledge_scope.kb_collections[0]}" }
189
- kb_file: FAQ.md # 追加目标 .md(相对 file.base_dir)
190
-
191
- # ─────────────────────────────────────────────────────────────
192
- # 每日复盘:凌晨归纳昨日对话,产出统计 / 需求池 / 学习候选
193
- # ─────────────────────────────────────────────────────────────
194
- daily-review:
195
- toolkit_config:
196
- memory: { root_dir: "./.memory" }
197
- event_sources:
198
- 每日复盘调度:
199
- daily_at: "01:00"
200
- timezone: Asia/Shanghai
201
- event_type: daily_review_trigger
202
- fire_immediately: false
203
- steps:
204
- daily_review:
205
- conversation_ids: "${globalVar.group_configs}" # 复盘群来源(或改为静态数组)
206
- # 两张表留空即可:setup 自动建表并回写
207
- daily_stats_table: { baseId: "", tableId: "" }
208
- product_backlog_table: { baseId: "", tableId: "" }
209
- # 学习候选写回 group-qa 的工单表(引用形态,运行时解析)
210
- learning_candidate_table:
211
- baseId: { ref: workflow:group-qa.tracker.base_id }
212
- tableId: { ref: workflow:group-qa.tracker.table_id }
213
- saved_minutes_per_reply: 15 # 每条 Agent 回复折算节省的人工工时(分钟)
214
- timezone: Asia/Shanghai # 与 cron 时区一致;远端 UTC 机器必须显式设置
215
- learning:
216
- from_admin_replies: true # 从真人解答提炼学习候选
217
- review: human-approve # human-approve(人工确认)/ auto(自动入库)
@@ -1,37 +0,0 @@
1
- # troubleshoot 声明式分类器(support-qa L3,取代硬编码 issue-classifier.ts)
2
- #
3
- # 启用:在 profile/profile.yml 打开
4
- # troubleshoot:
5
- # skills_dir: skills/troubleshooting # 相对实例根;目录不存在 → 整档关闭
6
- # classifiers: troubleshoot/classifiers.yml
7
- # 另需在群配置表把该群的 troubleshootingEnabled 置真,才对该群启用(按群开关)。
8
- #
9
- # 每个分类器:
10
- # issueType :命中后的问题类型标签(传给排查 Agent 作路由)
11
- # reason :命中理由(审计/日志)
12
- # patterns :匹配条件列表,每条 contains 或 regex 之一
13
- # require_all :默认 false(任一 pattern 命中即算);true 时需全部命中
14
- # extract :可选,字段名→正则(取第一个捕获组),把结构化证据带进排查 prompt
15
- # 按声明顺序匹配,返回第一个满足的分类器;都不命中 → 交语义答疑 answer。
16
- #
17
- # ⚠️ 本文件为通用示例(product-neutral),请按你的产品替换/删除后再启用。
18
-
19
- classifiers:
20
- # 示例 1:单条件(任一命中)——报错模板类
21
- - issueType: error_report
22
- reason: 命中报错模板
23
- patterns:
24
- - contains: "ERR_EXAMPLE"
25
- extract:
26
- code: "ERR_EXAMPLE[_A-Z0-9]*"
27
-
28
- # 示例 2:多条件同时命中(require_all)——需要两个关键词共现才判定
29
- - issueType: compound_issue
30
- reason: 同时包含标识 A 与标识 B
31
- require_all: true
32
- patterns:
33
- - contains: "标识A"
34
- - contains: "标识B"
35
- extract:
36
- idA: "标识A[::=]\\s*([A-Za-z0-9_-]+)"
37
- idB: "标识B[::=]\\s*(\\d+)"
@@ -1,10 +0,0 @@
1
- # 常见问题(示例占位)
2
-
3
- > 这是 support-qa 模板的知识库占位文件。把你的产品帮助文档(Markdown)放入本目录
4
- > (profile.knowledge.collections 指向的目录),答疑助手只依据这里的内容作答。
5
- >
6
- > 建议每篇文章 frontmatter 携带 `original_sources`(在线原文链接),回复出处依赖它。
7
-
8
- ## Q: 这是什么?
9
-
10
- A: support-qa 通用答疑工作流的示例知识库。替换本文件为真实产品文档后即可开始答疑。
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "lib": ["ES2022"],
7
- "strict": true,
8
- "esModuleInterop": true,
9
- "skipLibCheck": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "noEmit": true,
12
- "rootDir": "."
13
- },
14
- "include": ["lib/**/*.ts", "workflows/**/*.ts"],
15
- "exclude": ["**/__tests__/**", "**/node_modules/**", "**/dist/**"]
16
- }
@@ -1,9 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- testTimeout: 30_000,
6
- hookTimeout: 30_000,
7
- exclude: ["**/node_modules/**", "**/dist/**"],
8
- },
9
- });