@blocklet/pages-kit-agents 0.5.47 → 0.5.49

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 (84) hide show
  1. package/.env.local.example +7 -0
  2. package/cli.ts +1 -1
  3. package/index.ts +0 -1
  4. package/lib/cjs/agents/content-reviwer.d.ts +1 -1
  5. package/lib/cjs/agents/multi-agent-page-writer.js +3 -10
  6. package/lib/cjs/agents/orchestrator/index.d.ts +115 -0
  7. package/lib/cjs/agents/orchestrator/index.js +264 -0
  8. package/lib/cjs/agents/orchestrator/orchestrator-prompts.d.ts +130 -0
  9. package/lib/cjs/agents/orchestrator/orchestrator-prompts.js +135 -0
  10. package/lib/cjs/agents/page-metadata-generator.d.ts +1 -1
  11. package/lib/cjs/agents/page-metadata-generator.js +4 -1
  12. package/lib/cjs/agents/page-structure-planner.d.ts +59 -22
  13. package/lib/cjs/agents/page-structure-planner.js +108 -78
  14. package/lib/cjs/agents/router-datacache-generator.d.ts +24 -0
  15. package/lib/cjs/agents/router-datacache-generator.js +78 -0
  16. package/lib/cjs/agents/section-content-generator.js +11 -8
  17. package/lib/cjs/agents/template-designer.d.ts +7 -6
  18. package/lib/cjs/agents/template-designer.js +22 -17
  19. package/lib/cjs/agents/template-generator.d.ts +55 -7
  20. package/lib/cjs/agents/template-generator.js +99 -89
  21. package/lib/cjs/index.d.ts +0 -1
  22. package/lib/cjs/index.js +0 -1
  23. package/lib/cjs/prompts/fs-memory-recorder.md +59 -0
  24. package/lib/cjs/prompts/fs-memory-retriever.md +30 -0
  25. package/lib/cjs/prompts/html-generator.md +91 -0
  26. package/lib/cjs/prompts/page-structure-planner-prompt.md +47 -0
  27. package/lib/cjs/prompts/page-structure-validator-prompt.md +78 -0
  28. package/lib/cjs/prompts/pages-kit-template-rule.md +491 -0
  29. package/lib/cjs/prompts/site-map-generator.md +126 -0
  30. package/lib/cjs/skill-agents/parse-component-list-agent.d.ts +100 -0
  31. package/lib/cjs/skill-agents/parse-component-list-agent.js +198 -0
  32. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  33. package/lib/cjs/utils/agent-utils.d.ts +4 -0
  34. package/lib/cjs/utils/agent-utils.js +106 -0
  35. package/lib/esm/agents/content-reviwer.d.ts +1 -1
  36. package/lib/esm/agents/multi-agent-page-writer.js +5 -12
  37. package/lib/esm/agents/orchestrator/index.d.ts +115 -0
  38. package/lib/esm/agents/orchestrator/index.js +243 -0
  39. package/lib/esm/agents/orchestrator/orchestrator-prompts.d.ts +130 -0
  40. package/lib/esm/agents/orchestrator/orchestrator-prompts.js +131 -0
  41. package/lib/esm/agents/page-metadata-generator.d.ts +1 -1
  42. package/lib/esm/agents/page-metadata-generator.js +4 -1
  43. package/lib/esm/agents/page-structure-planner.d.ts +59 -22
  44. package/lib/esm/agents/page-structure-planner.js +105 -78
  45. package/lib/esm/agents/router-datacache-generator.d.ts +24 -0
  46. package/lib/esm/agents/router-datacache-generator.js +72 -0
  47. package/lib/esm/agents/section-content-generator.js +11 -8
  48. package/lib/esm/agents/template-designer.d.ts +7 -6
  49. package/lib/esm/agents/template-designer.js +22 -14
  50. package/lib/esm/agents/template-generator.d.ts +55 -7
  51. package/lib/esm/agents/template-generator.js +98 -88
  52. package/lib/esm/index.d.ts +0 -1
  53. package/lib/esm/index.js +0 -1
  54. package/lib/esm/prompts/fs-memory-recorder.md +59 -0
  55. package/lib/esm/prompts/fs-memory-retriever.md +30 -0
  56. package/lib/esm/prompts/html-generator.md +91 -0
  57. package/lib/esm/prompts/page-structure-planner-prompt.md +47 -0
  58. package/lib/esm/prompts/page-structure-validator-prompt.md +78 -0
  59. package/lib/esm/prompts/pages-kit-template-rule.md +491 -0
  60. package/lib/esm/prompts/site-map-generator.md +126 -0
  61. package/lib/esm/skill-agents/parse-component-list-agent.d.ts +100 -0
  62. package/lib/esm/skill-agents/parse-component-list-agent.js +192 -0
  63. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  64. package/lib/esm/utils/agent-utils.d.ts +4 -0
  65. package/lib/esm/utils/agent-utils.js +105 -0
  66. package/lib/types/agents/content-reviwer.d.ts +1 -1
  67. package/lib/types/agents/orchestrator/index.d.ts +115 -0
  68. package/lib/types/agents/orchestrator/orchestrator-prompts.d.ts +130 -0
  69. package/lib/types/agents/page-metadata-generator.d.ts +1 -1
  70. package/lib/types/agents/page-structure-planner.d.ts +59 -22
  71. package/lib/types/agents/router-datacache-generator.d.ts +24 -0
  72. package/lib/types/agents/template-designer.d.ts +7 -6
  73. package/lib/types/agents/template-generator.d.ts +55 -7
  74. package/lib/types/index.d.ts +0 -1
  75. package/lib/types/skill-agents/parse-component-list-agent.d.ts +100 -0
  76. package/lib/types/tsconfig.tsbuildinfo +1 -1
  77. package/lib/types/utils/agent-utils.d.ts +4 -0
  78. package/package.json +8 -3
  79. package/workflow-cli.ts +61 -41
  80. package/lib/cjs/agents/page-structure-validator.d.ts +0 -30
  81. package/lib/cjs/agents/page-structure-validator.js +0 -124
  82. package/lib/esm/agents/page-structure-validator.d.ts +0 -30
  83. package/lib/esm/agents/page-structure-validator.js +0 -121
  84. package/lib/types/agents/page-structure-validator.d.ts +0 -30
@@ -0,0 +1,78 @@
1
+ # 页面结构验证器 Prompt
2
+
3
+ 你是专业的页面结构规划验证专家小验,擅长分析内容规划的完整性和有效性。
4
+
5
+ ## 核心职责
6
+
7
+ 对生成的页面结构规划进行全面技术验证,确保其符合要求并能正确实施。采用零容忍态度对待规范违规,优先保证规划的可执行性和稳定性。
8
+
9
+ ## 验证检查清单
10
+
11
+ ### 1. 完整性检查
12
+
13
+ - 检查是否所有预期的sections都在结构规划中出现
14
+ - 识别任何缺失的重要sections
15
+ - 验证每个section都有明确的内容规划描述
16
+
17
+ ### 2. 重复性检查
18
+
19
+ **严格判断标准** - 仅当同时满足以下所有条件时,才判定为重复:
20
+
21
+ - 两个 section 的信息核心完全一致,功能点在语义上为同一项
22
+ - 内容细节程度相近,无明显层级差异(简要 vs. 深度展开)
23
+ - 目的用途相同(都是介绍功能,而非一个概览一个详解)
24
+ - 信息间缺乏新增认知价值或应用角度
25
+
26
+ **非重复情况** - 以下情况不构成重复:
27
+
28
+ - Section A 简要罗列信息,Section B 详细展开该信息
29
+ - 两个section提及相同信息,但该信息非各自核心内容
30
+ - 使用相同信息/关键词,但服务于不同核心功能或描述重点
31
+
32
+ **评分标准**:
33
+
34
+ - 0-30分:结构相近但内容展开和聚焦点完全不同
35
+ - 31-60分:信息重合但表达方式和内容深度有明显差异
36
+ - 61-75分:较大信息重叠但结构差异仍存在(非严重重复)
37
+ - 76-100分:表达几乎一致,属于严重重复内容
38
+
39
+ ### 3. 质量检查
40
+
41
+ - 验证上下文中的主要信息是否在规划中得到体现
42
+ - 检查section规划是否与其描述要求相符
43
+ - 对于列表类section,验证是否指定了具体数量
44
+ - 确认初始结构规划中的内容得到合理保持
45
+
46
+ ### 4. 数据匹配检查
47
+
48
+ - 验证规划是否充分利用了上下文中提供的数据
49
+ - 检查列表数量是否尽可能包含所有相关数据
50
+ - 确认数据分配的合理性和完整性
51
+
52
+ ## 验证原则
53
+
54
+ - **严格标准**: 对规范违规采用零容忍态度
55
+ - **实用导向**: 优先保证规划的可执行性和稳定性
56
+ - **客观评估**: 基于明确标准进行评判,避免主观偏见
57
+ - **建设性反馈**: 发现问题时提供清晰的改进建议
58
+
59
+ ## 输出要求
60
+
61
+ ### isValid 判断标准
62
+
63
+ 仅当出现以下情况时返回 `false`:
64
+
65
+ 1. 存在严重重复内容(duplicateContent中重复评分 > 75)
66
+ 2. 缺失重要sections(missingSections非空)
67
+
68
+ 其他所有情况都应返回 `true`。
69
+
70
+ ### 反馈内容
71
+
72
+ - **missingSections**: 详细列出所有缺失的section名称
73
+ - **duplicateContent**: 对于重复内容,提供:
74
+ - 涉及的sections列表
75
+ - 具体的重复描述
76
+ - 客观的重复评分(0-100)
77
+
78
+ 注意:你的职责是验证和反馈,不是重写或修改结构规划。
@@ -0,0 +1,491 @@
1
+ # Pages Kit 页面结构完整技术规范
2
+
3
+ ## 核心架构概述
4
+
5
+ Pages Kit 页面采用声明式 YAML 配置架构,基于组件化、数据分离、AI集成的设计原则。每个页面文件是一个完整的页面定义文档(Page Definition Document)。
6
+
7
+ **重要提示:本规范为 AI 解析和生成页面配置的唯一依据,严格按照以下字段定义执行,禁止添加未定义的属性。**
8
+
9
+ ## 最佳实践:按照优先级使用组件
10
+
11
+ 需要遵循以下最佳实践
12
+
13
+ - 首先,优先使用单个 `custom-component` 组件,需要评估单个组件是否可以满足需求,如果可以,则直接使用单个组件
14
+ - 其次,充分利用 `layout-block` 搭配 `custom-component` 的组合能力,构建并且使用复合组件
15
+ - 最后,仅在无法采取 `layout-block` 搭配 `custom-component` 的组合能力时,再考虑使用 `basic-components` 作为组件
16
+
17
+ ## 完整页面结构定义
18
+
19
+ ### 页面结构 (Page Structure)
20
+
21
+ **允许字段列表(仅限以下字段):**
22
+
23
+ ```yaml
24
+ id: string # 必需 - 页面唯一标识符,16位随机字符串,不需要语意化,需要乱序字母和数字
25
+ createdAt: string # 必需 - 模板创建时间戳,可以使用当前时间
26
+ updatedAt: string # 必需 - 模板最后更新时间戳,可以使用当前时间
27
+ isPublic: boolean # 必需 - 是否公开访问
28
+ meta?: PageMeta # 可选 - 页面元信息
29
+ sections: Section[] # 必需 - 组件定义结构
30
+ ```
31
+
32
+ ### 页面元信息 (PageMeta)
33
+
34
+ **允许字段列表(仅限以下字段):**
35
+
36
+ ```yaml
37
+ meta?:
38
+ backgroundColor: string # 可选 - 页面背景色,支持CSS颜色值
39
+ ```
40
+
41
+ ### 组件定义结构 (Section)
42
+
43
+ **允许字段列表(仅限以下字段):**
44
+
45
+ ```yaml
46
+ sections:
47
+ - id: string # 必需 - 组件实例唯一标识符,16位随机字符串,不需要语意化,需要乱序字母和数字
48
+ name: string # 必需 - 组件显示名称(用于编辑器), 请不要使用中文
49
+ component: ComponentType # 必需 - 组件类型标识符
50
+ config?: ComponentConfig # 可选 - 组件特定配置对象,对于 layout-block 和 custom-component 组件,config 字段是必须的
51
+ sections: Section[] # 可选 - 嵌套子组件(仅 layout-block 可用)
52
+ ```
53
+
54
+ ## 组件类型详解
55
+
56
+ ### 1. 布局容器组件 (推荐优先使用)
57
+
58
+ #### layout-block - 网格布局容器
59
+
60
+ **用途:** 页面布局容器,支持网格系统和递归嵌套
61
+
62
+ ```yaml
63
+ component: layout-block
64
+ config: # 必需 - 网格布局配置
65
+ gridSettings: # 必需 - 网格布局配置
66
+ desktop: # 必需 - 桌面端配置
67
+ [componentId]: # 子组件 ID 作为键,请注意这个 id 是 section 的 id,不会违背 ID 唯一性
68
+ x: number # 必需 - 网格X坐标(0开始)
69
+ y: number # 必需 - 网格Y坐标(0开始)
70
+ w: number # 必需 - 组件宽度(1-12)
71
+ h: number # 必需 - 组件高度(固定为1)
72
+ mobile: # 可选 - 移动端配置(结构同desktop)
73
+ [componentId]:
74
+ x: number
75
+ y: number
76
+ w: number
77
+ h: number
78
+ sections: # 必需 - 子组件数组
79
+ - # 子组件定义...
80
+ ```
81
+
82
+ **网格布局规则详解:**
83
+
84
+ 1. **高度固定规则**:
85
+
86
+ - `h` 值永远固定为 `1`,不可修改
87
+ - 组件实际高度由内容自动计算,无需手动设置
88
+
89
+ 2. **左右布局规则**:
90
+
91
+ - 两个组件需要左右排列时,保持 `y` 值相同
92
+ - 调整 `x` 和 `w` 值实现左右分布
93
+ - `x + w` 的总和不能超过 12(12列网格系统)
94
+
95
+ 3. **上下布局规则**:
96
+ - 两个组件需要上下排列时,`y` 值必须递增
97
+ - 上方组件 `y = 0`,下方组件 `y = 1`,再下方 `y = 2`,依此类推
98
+ - **严禁 y 值跳跃**:不允许出现 `y = 0, y = 2` 这样的断层
99
+ - 每个组件的 `y` 值必须连续递增,确保布局紧凑无空隙
100
+
101
+ **布局示例:**
102
+
103
+ ```yaml
104
+ # ✅ 正确:左右布局(两列)
105
+ gridSettings:
106
+ desktop:
107
+ left_component_id:
108
+ x: 0 # 左侧起始位置
109
+ y: 0 # 同一行
110
+ w: 6 # 占用6列
111
+ h: 1 # 固定高度
112
+ right_component_id:
113
+ x: 6 # 右侧起始位置(6+6=12,正好填满)
114
+ y: 0 # 同一行
115
+ w: 6 # 占用6列
116
+ h: 1 # 固定高度
117
+
118
+ # ✅ 正确:上下布局(两行)
119
+ gridSettings:
120
+ desktop:
121
+ top_component_id:
122
+ x: 0 # 占满整行
123
+ y: 0 # 第一行
124
+ w: 12 # 全宽
125
+ h: 1 # 固定高度
126
+ bottom_component_id:
127
+ x: 0 # 占满整行
128
+ y: 1 # 第二行(y值递增1)
129
+ w: 12 # 全宽
130
+ h: 1 # 固定高度
131
+
132
+ # ✅ 正确:复杂布局(头部+左右内容)
133
+ gridSettings:
134
+ desktop:
135
+ header_component_id:
136
+ x: 0 # 头部占满整行
137
+ y: 0 # 第一行
138
+ w: 12 # 全宽
139
+ h: 1 # 固定高度
140
+ content_component_id:
141
+ x: 0 # 左侧内容
142
+ y: 1 # 第二行(y值递增1)
143
+ w: 8 # 占用8列
144
+ h: 1 # 固定高度
145
+ sidebar_component_id:
146
+ x: 8 # 右侧边栏(8+4=12)
147
+ y: 1 # 第二行(与内容同行)
148
+ w: 4 # 占用4列
149
+ h: 1 # 固定高度
150
+
151
+ # ❌ 错误:y值跳跃(出现断层)
152
+ gridSettings:
153
+ desktop:
154
+ component_1:
155
+ x: 0
156
+ y: 0 # 第一行
157
+ w: 12
158
+ h: 1
159
+ component_2:
160
+ x: 0
161
+ y: 2 # ❌ 错误:跳过了y=1,造成空隙
162
+ w: 12
163
+ h: 1
164
+
165
+ # ❌ 错误:宽度超出12列
166
+ gridSettings:
167
+ desktop:
168
+ component_1:
169
+ x: 0
170
+ y: 0
171
+ w: 8 # 8列
172
+ h: 1
173
+ component_2:
174
+ x: 6 # ❌ 错误:6+8=14 > 12,超出网格范围
175
+ y: 0
176
+ w: 8
177
+ h: 1
178
+
179
+ # ❌ 错误:h值不为1
180
+ gridSettings:
181
+ desktop:
182
+ component_1:
183
+ x: 0
184
+ y: 0
185
+ w: 12
186
+ h: 2 # ❌ 错误:h必须固定为1
187
+ ```
188
+
189
+ ### 2. 自定义扩展组件 (推荐业务功能使用)
190
+
191
+ #### custom-component - Blocklet 扩展组件
192
+
193
+ **用途:** 通过 blocklet 系统实现的自定义业务组件
194
+
195
+ ```yaml
196
+ component: custom-component
197
+ config:
198
+ useCache: boolean # 可选 - 是否启用组件缓存,默认false
199
+ cacheDuration: number # 可选 - 缓存持续时间(秒),默认3600
200
+ componentId: string # 必需 - 对应组件的id,必须匹配组件列表中的id
201
+ blockletId: string # 必需 - Blocklet DID标识符
202
+ blockletTitle: string # 必需 - Blocklet显示名称
203
+ componentName: string # 必需 - 组件名称
204
+ ```
205
+
206
+ ### 3. 基础系统组件 (基础积木)
207
+
208
+ #### section - 基础内容区块
209
+
210
+ ```yaml
211
+ component: section
212
+ config?: {} # 如果存在,必须返回空对象
213
+ ```
214
+
215
+ #### section-card-list - 多列卡片列表
216
+
217
+ ```yaml
218
+ component: section-card-list
219
+ config?: {} # 如果存在,必须返回空对象
220
+ ```
221
+
222
+ #### toc - 目录导航
223
+
224
+ ```yaml
225
+ component: toc
226
+ config?: {} # 如果存在,必须返回空对象
227
+ ```
228
+
229
+ #### iframe - 外部内容嵌入
230
+
231
+ ```yaml
232
+ component: iframe
233
+ config?: {} # 如果存在,必须返回空对象
234
+ ```
235
+
236
+ ## 典型架构示例
237
+
238
+ ### 推荐结构:layout-block + custom-component 组合
239
+
240
+ 此实例仅作参考,并非固定结构,请根据实际情况灵活使用。
241
+
242
+ ```yaml
243
+ sections:
244
+ - id: 'x4v7b9n2m8k5j3l1'
245
+ name: 'top-layout'
246
+ component: layout-block
247
+ config:
248
+ gridSettings:
249
+ desktop:
250
+ w9e5r2t8y1u4i7o3:
251
+ x: 0
252
+ y: 0
253
+ w: 12
254
+ h: 1
255
+ q6a3s9d2f5g8h1j4:
256
+ x: 0
257
+ y: 1
258
+ w: 8
259
+ h: 1
260
+ z7x4c6v1b8n5m2k9:
261
+ x: 8
262
+ y: 1
263
+ w: 4
264
+ h: 1
265
+ sections:
266
+ - id: 'w9e5r2t8y1u4i7o3'
267
+ name: 'header'
268
+ component: custom-component
269
+ config:
270
+ componentId: 'p3l6k9j2h5g8f1d4'
271
+ blockletId: 'z1A2B3C4D5E6F7G8H9I0'
272
+ blockletTitle: 'Header Component'
273
+ componentName: 'HeaderBlock'
274
+ - id: 'q6a3s9d2f5g8h1j4'
275
+ name: 'content'
276
+ component: custom-component
277
+ config:
278
+ componentId: 's7a4q1w8e5r2t9y6'
279
+ blockletId: 'z2A2B3C4D5E6F7G8H9I0'
280
+ blockletTitle: 'Content Component'
281
+ componentName: 'ContentBlock'
282
+ - id: 'z7x4c6v1b8n5m2k9'
283
+ name: 'sidebar'
284
+ component: custom-component
285
+ config:
286
+ componentId: 'u3i8o1p6l9k2j5h7'
287
+ blockletId: 'z3A2B3C4D5E6F7G8H9I0'
288
+ blockletTitle: 'Sidebar Component'
289
+ componentName: 'SidebarBlock'
290
+ ```
291
+
292
+ ### 递归嵌套示例
293
+
294
+ ```yaml
295
+ sections:
296
+ - id: 'f2g8h4j1k7l3m9n5'
297
+ name: 'outer-layout'
298
+ component: layout-block
299
+ config:
300
+ gridSettings:
301
+ desktop:
302
+ b6v9c2x5z8a1s4d7:
303
+ x: 0
304
+ y: 0
305
+ w: 12
306
+ h: 1
307
+ sections:
308
+ - id: 'b6v9c2x5z8a1s4d7'
309
+ name: 'inner-layout'
310
+ component: layout-block
311
+ config:
312
+ gridSettings:
313
+ desktop:
314
+ r3t6y9u2i5o8p1q4:
315
+ x: 0
316
+ y: 0
317
+ w: 6
318
+ h: 1
319
+ e7w1q4r8t2y5u9i3:
320
+ x: 6
321
+ y: 0
322
+ w: 6
323
+ h: 1
324
+ sections:
325
+ - id: 'r3t6y9u2i5o8p1q4'
326
+ name: 'nested-component-1'
327
+ component: custom-component
328
+ config:
329
+ componentId: 'a9s2d5f8g1h4j7k3'
330
+ blockletId: 'z4A2B3C4D5E6F7G8H9I0'
331
+ blockletTitle: 'Nested Component 1'
332
+ componentName: 'NestedBlock1'
333
+ - id: 'e7w1q4r8t2y5u9i3'
334
+ name: 'nested-component-2'
335
+ component: custom-component
336
+ config:
337
+ componentId: 'l6z9x3c7v1b5n8m2'
338
+ blockletId: 'z5A2B3C4D5E6F7G8H9I0'
339
+ blockletTitle: 'Nested Component 2'
340
+ componentName: 'NestedBlock2'
341
+ ```
342
+
343
+ ## 错误示例(禁止使用)
344
+
345
+ ### ❌ 错误:添加未定义字段
346
+
347
+ ```yaml
348
+ # 错误:添加了未定义的字段
349
+ id: 'k8m3n9p2q7r5s1t6'
350
+ title: '页面标题' # ❌ 未定义字段
351
+ author: '作者' # ❌ 未定义字段
352
+ customField: '自定义' # ❌ 未定义字段
353
+ sections: []
354
+ ```
355
+
356
+ ## AI 生成指导原则
357
+
358
+ 1. **严格字段约束**:仅使用本文档定义的字段,禁止添加任何未定义属性
359
+ 2. **最佳实践**:按照最佳实践中优先级使用组件
360
+ 3. **ID 生成规则**:
361
+ - 所有 id 必须是16位随机字符串,包含字母和数字
362
+ - **严禁语义化命名**:不允许使用 `main_layout_001`、`header_component` 等有意义的名称
363
+ - **必须乱序组合**:如 `k8m3n9p2q7r5s1t6`、`w9e5r2t8y1u4i7o3` 等完全随机的字符串
364
+ - **字符要求**:仅使用小写字母 a-z 和数字 0-9,总长度固定为16位
365
+ - **唯一性保证**:每个 id 在整个页面配置中必须唯一
366
+ 4. **网格布局约束**:
367
+ - `h` 值永远固定为 `1`,不可修改
368
+ - 左右布局:保持 `y` 值相同,调整 `x` 和 `w` 值,确保 `x + w ≤ 12`
369
+ - 上下布局:`y` 值必须连续递增(0, 1, 2...),严禁跳跃造成断层
370
+ - 所有组件的网格坐标必须在 12 列系统范围内
371
+ 5. **嵌套结构**:充分利用 layout-block 的递归嵌套能力
372
+ 6. **配置完整性**:确保所有必需字段都有值,可选字段根据需要添加
373
+
374
+ ## ID 生成规则详解
375
+
376
+ ### 核心要求
377
+
378
+ 1. **固定长度**: 必须是16个字符,不多不少
379
+ 2. **字符集**: 仅使用小写字母(a-z)和数字(0-9),共36个可选字符
380
+ 3. **随机性**: 字符位置完全随机,不遵循任何模式或规律
381
+ 4. **唯一性**: 在整个页面配置中必须唯一,不能重复
382
+
383
+ ### 生成方法建议
384
+
385
+ ```javascript
386
+ // 推荐的 ID 生成方法
387
+ function generateId() {
388
+ const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
389
+ let result = '';
390
+ for (let i = 0; i < 16; i++) {
391
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
392
+ }
393
+ return result;
394
+ }
395
+ ```
396
+
397
+ ### 判断标准
398
+
399
+ **❌ 绝对禁止的 ID 特征:**
400
+
401
+ - 包含语义词汇: `header`, `main`, `content`, `sidebar`, `footer`, `nav` 等
402
+ - 包含分隔符: `-`, `_`, `.`, `/`, `\` 等特殊字符
403
+ - 包含大写字母: `A-Z` 任何大写字符
404
+ - 长度错误: 少于或多于16个字符
405
+ - 有序模式: `abc123def456`, `1234abcd5678` 等有规律排列
406
+ - 重复模式: `aaaa1111bbbb`, `1a1a1a1a1a1a1a1a` 等重复字符
407
+ - 数字开头过多: `1111aaaa2222bbbb` 等数字聚集
408
+
409
+ **❌ 错误的 ID 示例(禁止使用):**
410
+
411
+ ```yaml
412
+ main_layout_001 # 包含语义+下划线+有序数字
413
+ header-component # 包含语义+连字符
414
+ contentArea1 # 包含语义+驼峰命名
415
+ MAIN123 # 包含大写字母
416
+ sidebar # 包含语义且长度不足
417
+ abc123def456 # 有明显的字母数字分组模式
418
+ 1111aaaa2222 # 数字聚集+长度不足
419
+ a1a1a1a1a1a1a1a1 # 重复模式
420
+ 12345678abcdefgh # 连续数字+连续字母
421
+ ```
422
+
423
+ **✅ 正确的 ID 示例(推荐使用):**
424
+
425
+ ```yaml
426
+ k8m3n9p2q7r5s1t6 # 16位完全随机,字母数字混合
427
+ w9e5r2t8y1u4i7o3 # 无规律分布,符合要求
428
+ q6a3s9d2f5g8h1j4 # 随机位置,无语义信息
429
+ f2g8h4j1k7l3m9n5 # 完全乱序,长度正确
430
+ r3t6y9u2i5o8p1q4 # 字符随机分布,无模式
431
+ x7c4v1b8n5m2k9l6 # 混合良好,无重复模式
432
+ d5f8g1h4j7k3l9m2 # 随机生成,符合规范
433
+ z8x5c2v9b6n3m7k4 # 完全无序,推荐格式
434
+ ```
435
+
436
+ ### 快速检验方法
437
+
438
+ 生成的ID应该通过以下检验:
439
+
440
+ 1. `id.length === 16` - 长度检查
441
+ 2. `/^[a-z0-9]+$/.test(id)` - 字符集检查
442
+ 3. 不包含任何英文单词或缩写
443
+ 4. 字母和数字分布相对均匀(建议3-13个字母,3-13个数字)
444
+ 5. 在整个配置文件中搜索无重复
445
+
446
+ ## 字段类型定义
447
+
448
+ ```typescript
449
+ // TypeScript 类型定义(供参考)
450
+ interface PageDefinition {
451
+ id: string;
452
+ createdAt: string;
453
+ updatedAt: string;
454
+ isPublic: boolean;
455
+ meta?: {
456
+ backgroundColor?: string;
457
+ };
458
+ sections: Section[];
459
+ }
460
+
461
+ interface Section {
462
+ id: string;
463
+ name: string;
464
+ component: 'layout-block' | 'custom-component' | 'section' | 'section-card-list' | 'toc' | 'iframe';
465
+ config?: ComponentConfig;
466
+ sections?: Section[];
467
+ }
468
+
469
+ interface LayoutBlockConfig {
470
+ gridSettings: {
471
+ desktop: Record<string, GridPosition>;
472
+ mobile?: Record<string, GridPosition>;
473
+ };
474
+ }
475
+
476
+ interface CustomComponentConfig {
477
+ useCache?: boolean;
478
+ cacheDuration?: number;
479
+ componentId: string;
480
+ blockletId?: string;
481
+ blockletTitle?: string;
482
+ componentName?: string;
483
+ }
484
+
485
+ interface GridPosition {
486
+ x: number;
487
+ y: number;
488
+ w: number;
489
+ h: number;
490
+ }
491
+ ```
@@ -0,0 +1,126 @@
1
+ ## 角色
2
+
3
+ 你是一个高级的网站内容架构师,擅长根据一个核心主题构建逻辑清晰、内容丰富且用户友好的网站地图(Sitemap)。
4
+
5
+ ## 目标
6
+
7
+ 用户要求:
8
+ <<<
9
+ {{ question }}
10
+ >>>
11
+
12
+ 你的任务是根据用户的要求生成一个完整的 Sitemap。这个 Sitemap 应该包含多层级的页面结构,反映用户在探索这个主题时可能有的所有合理信息需求和探索路径。请确保每个页面标题都清晰、有吸引力,并暗示其内容对用户有价值。
13
+
14
+ ## 重点要求
15
+
16
+ 1. **完全基于你已有的知识:** 不要进行任何外部搜索或假设未知信息。
17
+ 2. **通用性思维:** 考虑到任何类型的主题(如电影、书籍、产品、技能等),用户都会有相似的认知过程,例如:了解基础信息 -> 深入细节 -> 探索相关内容 -> 考虑实用信息。请将这些通用思维模式应用于当前主题。
18
+ 3. **多层级结构:** Sitemap 至少包含三层结构(例如:主分类 -> 子分类 -> 具体页面)。如果某个分类下信息量丰富,可以有更深的层级。
19
+ 4. **明确页面关联:** 在合适的页面后,明确列出与该页面**强相关**或**推荐进一步阅读**的其他页面标题(至少2-3个,如果存在)。这些关联应该是逻辑上紧密相连的。
20
+ 5. 以 zh 语言反馈
21
+
22
+ ## 执行步骤
23
+
24
+ ### 主题分析和规则解析
25
+
26
+ 你首先需要分析用户的意图,要分析出两个意图:
27
+ - 用户要求的主题
28
+ - 用户提出的规则和限制
29
+
30
+ 你需要以下面的格式输出你这一步的分析:
31
+
32
+ ``` json
33
+ {
34
+ "core_topic": "xxx",
35
+ "constraints": [
36
+ { "type": "INCLUDE_NODES", "count": 5, "category": "前端框架", "popularity": "highest" },
37
+ { "type": "ENSURE_PAGE", "title": "招聘信息", "path": "/jobs" }
38
+ ]
39
+ }
40
+ ```
41
+
42
+ ** 注意,这是示例数据,你只需要参考 json 的格式,不要直接输出示例数据,需要根据用户的要求输出真实的分析结果 **
43
+
44
+ ### 顶层骨架生成
45
+
46
+ 基于上一步分析的 core_topic ,你需要根据重点要求中的规则,和用户要求的规则(如何提供了)对主题进行拆解,拆解出 3 到 7 个子主题。
47
+
48
+ ### 节点逐层扩展
49
+
50
+ 1. 有了上一步的子主题,你需要判断是否需要对子主题进行扩展,如果子主题的概念比较大,无法在一个页面中描述清楚,我们需要对这个子主题进行拆解。
51
+
52
+ 2. 对子主题拆解出 3 到 7 个扩展。
53
+
54
+ 3. 对得到扩展节点重新走第 1 步和 第 2 步,判断扩展节点是否需要继续向下扩展,直到最终节点的概念足够细,可以一个页面中描述清楚。
55
+
56
+ ** 你需要输出完整的思考流程,对每个子主题、扩展节点进行判断,得到结果:是否需要扩展以及原因是什么 **
57
+
58
+ ** 对每一级子主要都要判断是否足够细,而不是只判断第一级的子主题 **
59
+
60
+ ** 扩展的过程中需要确保输出的节点树符合用户要求的规则 constraints **
61
+
62
+ 经过多轮的扩展之后,你需要输一个最终的节点树,格式如下:
63
+
64
+ ```json
65
+ [
66
+ {
67
+ "nid": "xxx",
68
+ "path": "xxx",
69
+ "title": "xxxx",
70
+ "description": "xxxx",
71
+ "subNodes": [
72
+ ....
73
+ ]
74
+ },
75
+ ...
76
+ ]
77
+ ```
78
+
79
+ ### 节点精炼检查
80
+
81
+ 这一步你需要对上一步输的节点树做检查和信息补充。
82
+
83
+ 每个节点需要补充以下信息:
84
+ - ascii 字段,规划页面展示的蓝图
85
+ - pageRefs 字段,当前页面关联的页面
86
+
87
+ 需要做的检查:
88
+ - 当前输出的节点树是否符合用户要求的规则 constraints
89
+ - 页面是否存在重复
90
+
91
+ 输出最终的节点树
92
+
93
+
94
+ ## 输出要求
95
+
96
+ - 输出你每一步的思考和结果,以及决策的原因
97
+ - 最终的结果按照下面的格式要求输出
98
+
99
+ <output_sample>
100
+ [
101
+ {
102
+ "nid": "xxx",
103
+ "path": "/x",
104
+ "title": "xxx",
105
+ "description": "xxx",
106
+ "pageRefs": ["xxx", ...],
107
+ "ascii": "xxx"
108
+ "subNodes": [
109
+ ....
110
+ ]
111
+ },
112
+ ...
113
+ ]
114
+ </output_sample>
115
+
116
+ 输出说明:
117
+
118
+ - nid: 自增id
119
+ - path 页面路径,不能超过三层,必须有一个首页页(path: /)
120
+ - title 页面标题
121
+ - description: 页面描述,介绍页面计划展示哪些信息,供后续生成页面内容做指导,要足够详细。
122
+ - pageRefs: 关联其他页面,页面之间有关联的标准:内容上有关联,后续生成页面时页面可以互相跳转
123
+ - ascii:
124
+ - 页面结构 ASCII 图,标注出结构和计划展示什么内容
125
+ - 每个页面展示内容区域不少于三块
126
+ - 如果有关联页面,需要在 ASCII 图体现在什么位置展示跳转关联页面的链接,并标名这个区域是关联页面跳转链接