@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
@@ -1,3 +1,7 @@
1
+ import { FSMemory, FSMemoryOptions } from '@aigne/agent-library/fs-memory/index.js';
1
2
  import { AnthropicChatModel } from '@aigne/anthropic';
2
3
  import { OpenAIChatModel } from '@aigne/openai';
3
4
  export declare function getModel(modelName?: string): OpenAIChatModel | AnthropicChatModel | undefined;
5
+ export declare function getMemory({ projectId, ...rest }: Pick<FSMemoryOptions, 'autoUpdate'> & {
6
+ projectId?: string;
7
+ }): FSMemory;
@@ -1,10 +1,104 @@
1
+ import { FSMemory } from '@aigne/agent-library/fs-memory/index.js';
1
2
  import { AnthropicChatModel } from '@aigne/anthropic';
2
3
  import { DeepSeekChatModel } from '@aigne/deepseek';
3
4
  import { GeminiChatModel } from '@aigne/gemini';
4
5
  import { OpenAIChatModel } from '@aigne/openai';
5
6
  import { XAIChatModel } from '@aigne/xai';
6
7
  import assert from 'node:assert';
8
+ import path from 'node:path';
7
9
  const { OPENAI_API_KEY, GEMINI_API_KEY, CLAUDE_API_KEY, XAI_API_KEY, DEEPSEEK_API_KEY } = process.env;
10
+ // === 内置 prompt 内容,避免运行时读取文件 ===
11
+ const recorderInstructions = `你是一个智能的站点生成记忆管理器,负责从多轮对话和用户反馈中提取对后续站点生成有用的知识和偏好,并以结构化方式存储。
12
+
13
+ ## 你的任务
14
+
15
+ - 只记录对后续站点生成、内容补全、页面设计、组件选择、风格偏好等有实际帮助的信息。
16
+ - 忽略无效、重复、无关、泛泛的内容。
17
+ - 将新的对话中,有用的信息补充到记忆中,重点记忆用户的反馈
18
+ - **不允许删除 existing-memory 中的记忆**
19
+
20
+ ## 需要记录的内容示例
21
+
22
+ - 用户对产品/服务/公司/行业的补充、修正、详细描述
23
+ - 用户对目标用户、USP、CTA、痛点、案例等内容补全问题的详细回答
24
+ - 用户对 SiteMap、页面结构、模板设计的反馈、偏好、否定/肯定意见
25
+ - 用户对文案风格、页面布局、组件选择、品牌色彩等的明确要求
26
+ - 用户对行业、竞品、特殊需求的补充说明
27
+ - 用户对生成结果的纠错、修正、特殊说明
28
+ - 任何跨页面/全局性的偏好、约束、风格、品牌要求
29
+
30
+ ## 不要记录的内容
31
+
32
+ - 一般性寒暄、确认、无实际内容的反馈
33
+ - 纯粹的系统提示、流程性对话
34
+ - 与站点生成无关的闲聊、无效输入
35
+ - 已经被记忆、无新意的重复内容
36
+ - 页面中使用了什么组件
37
+
38
+ ## 操作流程
39
+
40
+ 1. 读取所有历史记忆(existing-memory)
41
+ 2. 分析当前对话内容(conversation),提取有用信息
42
+ 3. 判断是否需要新增、更新
43
+ 4. 会有多个 Agent 共用当前记忆,现有记忆可能和当前对话无关,保留这些记忆不做修改
44
+ 5. 如果当前对话中信息对现有记忆有更新,可以更新现有记忆
45
+ 6. **不允许删除 existing-memory 的记忆,可以更新**
46
+ 7. 返回所有有用记忆
47
+
48
+ ## 记忆结构
49
+
50
+ - 每条记忆应简明扼要,内容聚焦于"对后续站点生成有帮助"的知识、偏好、约束
51
+ - 不要存储无关、冗余、重复内容
52
+
53
+ ## 记忆输出格式
54
+
55
+ - 返回所有有用记忆(existing + new),每条为独立对象
56
+ - existing-memory 中的记忆必须返回,条数不能减少,其中的记忆可以有更新
57
+ - 使用 zh 语言记录
58
+
59
+ ## 现有记忆
60
+
61
+ <existing-memory>
62
+ {{allMemory}}
63
+ </existing-memory>
64
+
65
+ ## 当前对话
66
+
67
+ <conversation>
68
+ {{content}}
69
+ </conversation>
70
+ `;
71
+ const retrieverInstructions = `你是一个智能的站点生成记忆检索器,负责从所有历史记忆中筛选出与当前任务最相关、最有帮助的内容,供后续 Agent 使用。
72
+
73
+ ## 检索原则
74
+
75
+ - 只返回与当前任务、页面、实体、主题、设计决策等密切相关的记忆
76
+ - 优先返回能直接影响当前内容补全、页面设计、组件选择、风格设定等的记忆
77
+ - 忽略与当前任务无关的记忆
78
+ - 如果记忆描述出现冲突,返回后出现的记忆内容
79
+
80
+ ## 检索流程
81
+
82
+ 1. 读取所有历史记忆(allMemory)
83
+ 2. 分析当前检索请求(search/query),提取关键主题
84
+ 3. 匹配并返回最相关的记忆内容(可多条)
85
+
86
+ ## 记忆输出格式
87
+
88
+ - 返回所有与当前任务最相关的记忆,每条为独立对象
89
+
90
+ ## 现有记忆
91
+
92
+ <existing-memory>
93
+ {{allMemory}}
94
+ </existing-memory>
95
+
96
+ ## 检索请求
97
+
98
+ <search-query>
99
+ {{search}}
100
+ </search-query>
101
+ `;
8
102
  export function getModel(modelName = 'openai') {
9
103
  if (modelName?.includes('gpt')) {
10
104
  assert(OPENAI_API_KEY, 'Please set the OPENAI_API_KEY environment variable');
@@ -54,3 +148,14 @@ export function getModel(modelName = 'openai') {
54
148
  }
55
149
  return undefined;
56
150
  }
151
+ export function getMemory({ projectId = 'debug', ...rest }) {
152
+ // === FSMemory 配置 ===
153
+ const memoryRootDir = path.join(process.cwd(), 'project-records', projectId, 'memory');
154
+ const fsMemory = new FSMemory({
155
+ ...(rest || {}),
156
+ rootDir: memoryRootDir,
157
+ recorderOptions: { instructions: recorderInstructions },
158
+ retrieverOptions: { instructions: retrieverInstructions },
159
+ });
160
+ return fsMemory;
161
+ }
@@ -10,8 +10,8 @@ export declare const contentReviewerAgent: AIAgent<{
10
10
  level: string;
11
11
  suggestions: string[];
12
12
  dimension_scores: {
13
- score: number;
14
13
  name: string;
14
+ score: number;
15
15
  maxScore: number;
16
16
  comment: string;
17
17
  }[];
@@ -0,0 +1,115 @@
1
+ import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from '@aigne/core';
2
+ import { type FullPlanOutput, type StepWithResult } from './orchestrator-prompts.js';
3
+ /**
4
+ * Re-export orchestrator prompt templates and related types
5
+ */
6
+ export * from './orchestrator-prompts.js';
7
+ /**
8
+ * Represents a complete plan with execution results
9
+ * @hidden
10
+ */
11
+ export interface FullPlanWithResult {
12
+ /**
13
+ * The overall objective
14
+ */
15
+ objective: string;
16
+ /**
17
+ * The generated complete plan
18
+ */
19
+ plan?: FullPlanOutput;
20
+ /**
21
+ * List of executed steps with their results
22
+ */
23
+ steps: StepWithResult[];
24
+ /**
25
+ * Final result
26
+ */
27
+ result?: string;
28
+ /**
29
+ * Plan completion status
30
+ */
31
+ status?: boolean;
32
+ }
33
+ /**
34
+ * Configuration options for the Orchestrator Agent
35
+ */
36
+ export interface OrchestratorAgentOptions<I extends Message = Message, O extends Message = Message> extends AgentOptions<I, O> {
37
+ /**
38
+ * Maximum number of iterations to prevent infinite loops
39
+ * Default: 30
40
+ */
41
+ maxIterations?: number;
42
+ /**
43
+ * Number of concurrent tasks
44
+ * Default: 5
45
+ */
46
+ tasksConcurrency?: number;
47
+ /**
48
+ * Chain step results as input to the next step
49
+ * Default: false
50
+ */
51
+ chainStepResults?: boolean;
52
+ }
53
+ /**
54
+ * Orchestrator Agent Class
55
+ *
56
+ * This Agent is responsible for:
57
+ * 1. Generating an execution plan based on the objective
58
+ * 2. Breaking down the plan into steps and tasks
59
+ * 3. Coordinating the execution of steps and tasks
60
+ * 4. Synthesizing the final result
61
+ *
62
+ * Workflow:
63
+ * - Receives input objective
64
+ * - Uses planner to create execution plan
65
+ * - Executes tasks and steps according to the plan
66
+ * - Synthesizes final result through completer
67
+ */
68
+ export declare class OrchestratorAgent<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
69
+ /**
70
+ * Factory method to create an OrchestratorAgent instance
71
+ * @param options - Configuration options for the Orchestrator Agent
72
+ * @returns A new OrchestratorAgent instance
73
+ */
74
+ static from<I extends Message, O extends Message>(options: OrchestratorAgentOptions<I, O>): OrchestratorAgent<I, O>;
75
+ /**
76
+ * Creates an OrchestratorAgent instance
77
+ * @param options - Configuration options for the Orchestrator Agent
78
+ */
79
+ constructor(options: OrchestratorAgentOptions<I, O>);
80
+ private planner;
81
+ private completer;
82
+ /**
83
+ * Maximum number of iterations
84
+ * Prevents infinite execution loops
85
+ */
86
+ maxIterations?: number;
87
+ /**
88
+ * Number of concurrent tasks
89
+ * Controls how many tasks can be executed simultaneously
90
+ */
91
+ tasksConcurrency?: number;
92
+ /**
93
+ * Whether to chain step results as input to next step
94
+ */
95
+ chainStepResults?: boolean;
96
+ /**
97
+ * Process input and execute the orchestrator workflow
98
+ *
99
+ * Workflow:
100
+ * 1. Extract the objective
101
+ * 2. Loop until plan completion or maximum iterations:
102
+ * a. Generate/update execution plan
103
+ * b. If plan is complete, synthesize result
104
+ * c. Otherwise, execute steps in the plan
105
+ *
106
+ * @param input - Input message containing the objective
107
+ * @param options - Agent invocation options
108
+ * @returns Processing result
109
+ */
110
+ process(input: I, options: AgentInvokeOptions): Promise<O>;
111
+ private getFullPlanInput;
112
+ private getFullPlan;
113
+ private synthesizePlanResult;
114
+ private executeStep;
115
+ }
@@ -0,0 +1,130 @@
1
+ import type { Agent, Message } from '@aigne/core';
2
+ import { z } from 'zod';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export declare const SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE = "Synthesize the results of executing all steps in the plan into a cohesive result\n";
7
+ /**
8
+ * @hidden
9
+ */
10
+ export declare function getFullPlanSchema(agents: Agent[]): z.ZodObject<{
11
+ steps: z.ZodArray<z.ZodObject<{
12
+ description: z.ZodString;
13
+ tasks: z.ZodArray<z.ZodObject<{
14
+ description: z.ZodString;
15
+ agent: z.ZodUnion<[z.ZodLiteral<string>, z.ZodLiteral<string>, ...z.ZodLiteral<string>[]]>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ description: string;
18
+ agent: string;
19
+ }, {
20
+ description: string;
21
+ agent: string;
22
+ }>, "many">;
23
+ }, "strip", z.ZodTypeAny, {
24
+ description: string;
25
+ tasks: {
26
+ description: string;
27
+ agent: string;
28
+ }[];
29
+ }, {
30
+ description: string;
31
+ tasks: {
32
+ description: string;
33
+ agent: string;
34
+ }[];
35
+ }>, "many">;
36
+ isComplete: z.ZodBoolean;
37
+ }, "strip", z.ZodTypeAny, {
38
+ steps: {
39
+ description: string;
40
+ tasks: {
41
+ description: string;
42
+ agent: string;
43
+ }[];
44
+ }[];
45
+ isComplete: boolean;
46
+ }, {
47
+ steps: {
48
+ description: string;
49
+ tasks: {
50
+ description: string;
51
+ agent: string;
52
+ }[];
53
+ }[];
54
+ isComplete: boolean;
55
+ }>;
56
+ /**
57
+ * @hidden
58
+ */
59
+ export type FullPlanOutput = z.infer<ReturnType<typeof getFullPlanSchema>>;
60
+ /**
61
+ * @hidden
62
+ */
63
+ export type Step = FullPlanOutput['steps'][number];
64
+ /**
65
+ * @hidden
66
+ */
67
+ export type Task = Step['tasks'][number];
68
+ /**
69
+ * @hidden
70
+ */
71
+ export interface StepWithResult {
72
+ step: Step;
73
+ tasks: Array<TaskWithResult>;
74
+ result: string;
75
+ }
76
+ /**
77
+ * @hidden
78
+ */
79
+ export interface TaskWithResult {
80
+ task: Task;
81
+ result: string;
82
+ }
83
+ /**
84
+ * @hidden
85
+ */
86
+ export interface FullPlanInput extends Message {
87
+ objective: string;
88
+ steps: StepWithResult[];
89
+ plan: {
90
+ status: string;
91
+ result: string;
92
+ };
93
+ agents: {
94
+ name: string;
95
+ description?: string;
96
+ tools: {
97
+ name: string;
98
+ description?: string;
99
+ }[];
100
+ }[];
101
+ }
102
+ /**
103
+ * @hidden
104
+ */
105
+ export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{{#agents}}\n- Agent: {{name}}\n Description: {{description}}\n Functions:\n {{#tools}}\n - Tool: {{name}}\n Description: {{description}}\n {{/tools}}\n{{/agents}}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
106
+ /**
107
+ * @hidden
108
+ */
109
+ export interface TaskPromptInput extends Message {
110
+ objective: string;
111
+ step: Step;
112
+ task: Task;
113
+ steps: StepWithResult[];
114
+ }
115
+ /**
116
+ * @hidden
117
+ */
118
+ export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n";
119
+ /**
120
+ * @hidden
121
+ */
122
+ export interface SynthesizeStepPromptInput extends Message {
123
+ objective: string;
124
+ step: Step;
125
+ tasks: TaskWithResult[];
126
+ }
127
+ /**
128
+ * @hidden
129
+ */
130
+ export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{{#tasks}}\n- Task: {{task.description}}\n Result: {{result}}\n{{/tasks}}\n</tasks>\n";
@@ -5,6 +5,6 @@ export declare const generatePageMetadataAgent: AIAgent<{
5
5
  locale: string;
6
6
  sectionsData: string;
7
7
  }, {
8
- title: string;
9
8
  description: string;
9
+ title: string;
10
10
  }>;
@@ -1,43 +1,70 @@
1
1
  import { AIAgent } from '@aigne/core';
2
- export interface PlanPageStructureInput {
2
+ import { z } from 'zod';
3
+ import { ReflectionAgent } from '../workflow-agents/reflection-agent.js';
4
+ export declare const plannerParamsSchema: z.ZodObject<{
5
+ context: z.ZodString;
6
+ question: z.ZodString;
7
+ locale: z.ZodString;
8
+ outputSchema: z.ZodString;
9
+ expectedSections: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ outputSchema: string;
12
+ context: string;
13
+ question: string;
14
+ locale: string;
15
+ expectedSections: string;
16
+ }, {
17
+ outputSchema: string;
3
18
  context: string;
4
19
  question: string;
5
- initialStructurePlan?: Array<{
20
+ locale: string;
21
+ expectedSections: string;
22
+ }>;
23
+ export interface PageStructurePlannerOutput {
24
+ structurePlan: Array<{
6
25
  sectionName: string;
7
26
  sectionContentPlan: string;
8
27
  }>;
28
+ }
29
+ export declare const pageStructurePlannerWithReflection: ReflectionAgent<{
30
+ outputSchema: string;
31
+ context: string;
32
+ question: string;
9
33
  locale: string;
10
- outputSchema: any;
34
+ expectedSections: string;
11
35
  validationFeedback?: {
12
36
  isValid: boolean;
13
37
  missingSections: string[];
14
- duplicateContent: Array<{
15
- sections: string[];
38
+ duplicateContent: {
16
39
  description: string;
17
- }>;
18
- feedback: Array<{
19
- sectionName: string;
20
- feedback: string;
21
- }>;
22
- generalFeedback: string;
23
- };
24
- }
25
- export interface PageStructurePlannerOutput {
26
- structurePlan: Array<{
40
+ sections: string[];
41
+ score: number;
42
+ suggestion: string;
43
+ }[];
44
+ } | undefined;
45
+ structurePlan?: {
27
46
  sectionName: string;
28
47
  sectionContentPlan: string;
29
- }>;
30
- }
48
+ }[] | undefined;
49
+ }, {
50
+ isApproved: boolean;
51
+ validationFeedback: {
52
+ isValid: boolean;
53
+ missingSections: string[];
54
+ duplicateContent: {
55
+ description: string;
56
+ sections: string[];
57
+ score: number;
58
+ suggestion: string;
59
+ }[];
60
+ };
61
+ }>;
31
62
  export declare const pageStructurePlannerAgent: AIAgent<{
63
+ outputSchema: string;
32
64
  context: string;
33
65
  question: string;
34
66
  locale: string;
35
- outputSchema: string;
36
67
  expectedSections: string;
37
- initialStructurePlan: {
38
- sectionName: string;
39
- sectionContentPlan: string;
40
- }[];
41
68
  validationFeedback?: {
42
69
  isValid: boolean;
43
70
  missingSections: string[];
@@ -45,9 +72,19 @@ export declare const pageStructurePlannerAgent: AIAgent<{
45
72
  description: string;
46
73
  sections: string[];
47
74
  score: number;
75
+ suggestion: string;
48
76
  }[];
49
77
  } | undefined;
78
+ structurePlan?: {
79
+ sectionName: string;
80
+ sectionContentPlan: string;
81
+ }[] | undefined;
50
82
  }, {
83
+ outputSchema: string;
84
+ context: string;
85
+ question: string;
86
+ locale: string;
87
+ expectedSections: string;
51
88
  structurePlan: {
52
89
  sectionName: string;
53
90
  sectionContentPlan: string;
@@ -0,0 +1,24 @@
1
+ import { FunctionAgent } from '@aigne/core';
2
+ export declare const routerDataCacheGeneratorAgent: FunctionAgent<{
3
+ context: string;
4
+ componentList: {
5
+ data: {
6
+ name: string;
7
+ description: string;
8
+ id: string;
9
+ component: string;
10
+ rawData?: any;
11
+ }[];
12
+ summary: {
13
+ total: number;
14
+ basicComponents: Record<string, string>;
15
+ customComponents: Record<string, string>;
16
+ };
17
+ };
18
+ templateYaml: string;
19
+ locale?: string | undefined;
20
+ }, {
21
+ success: boolean;
22
+ dataCache?: any;
23
+ error?: string | undefined;
24
+ }>;
@@ -1,13 +1,14 @@
1
1
  import { AIAgent } from '@aigne/core';
2
- /**
3
- * 用于设计页面结构的 workflow
4
- * 1. AI 根据拿到的 collectorResult 和 componentList,生成一个页面设计模板,需要用 ASCII 图画出来,给到用户确认
5
- * 2. 用户确认后,AI 保存页面设计模板,并返回页面设计模板
6
- */
7
2
  export declare const designerAgent: AIAgent<{
3
+ componentListYaml: string;
8
4
  collectResult: string;
9
5
  }, {
10
6
  ascii: string;
11
7
  $message: string;
12
- filteredComponentList: string[];
8
+ filteredComponentList: {
9
+ name: string;
10
+ description: string;
11
+ id: string;
12
+ component: string;
13
+ }[];
13
14
  }>;
@@ -1,18 +1,66 @@
1
1
  import { FunctionAgent } from '@aigne/core';
2
+ import { z } from 'zod';
2
3
  import { ReflectionAgent } from '../workflow-agents/reflection-agent.js';
4
+ export declare const generatorParamsSchema: z.ZodObject<{
5
+ ascii: z.ZodString;
6
+ collectResult: z.ZodString;
7
+ filteredComponentList: z.ZodArray<z.ZodObject<{
8
+ id: z.ZodString;
9
+ name: z.ZodString;
10
+ component: z.ZodString;
11
+ description: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ name: string;
14
+ description: string;
15
+ id: string;
16
+ component: string;
17
+ }, {
18
+ name: string;
19
+ description: string;
20
+ id: string;
21
+ component: string;
22
+ }>, "many">;
23
+ }, "strip", z.ZodTypeAny, {
24
+ ascii: string;
25
+ collectResult: string;
26
+ filteredComponentList: {
27
+ name: string;
28
+ description: string;
29
+ id: string;
30
+ component: string;
31
+ }[];
32
+ }, {
33
+ ascii: string;
34
+ collectResult: string;
35
+ filteredComponentList: {
36
+ name: string;
37
+ description: string;
38
+ id: string;
39
+ component: string;
40
+ }[];
41
+ }>;
3
42
  export declare const generatorAgentWithReflection: ReflectionAgent<{
4
43
  ascii: string;
5
44
  collectResult: string;
6
- $message: string;
7
- filteredComponentList: string[];
8
- feedback?: string | null | undefined;
45
+ filteredComponentList: {
46
+ name: string;
47
+ description: string;
48
+ id: string;
49
+ component: string;
50
+ }[];
9
51
  }, {
10
52
  isApproved: boolean;
11
- feedback: string;
53
+ feedback: {
54
+ description: string;
55
+ line: number;
56
+ column: number;
57
+ keyword: string;
58
+ rule: string;
59
+ isRequired: boolean;
60
+ }[];
12
61
  }>;
13
- export declare const saveYamlAgent: FunctionAgent<{
14
- $message: string;
15
- yaml: string;
62
+ export declare const saveTemplateYamlAgent: FunctionAgent<{
63
+ templateYaml: string;
16
64
  }, {
17
65
  $message: string;
18
66
  } & import("@aigne/core").Message>;
@@ -2,6 +2,5 @@ export {};
2
2
  export { default as generatePageContentMultiAgent, generateSingleSectionContent, } from './agents/multi-agent-page-writer';
3
3
  export * from './agents/page-metadata-generator';
4
4
  export * from './agents/page-structure-planner';
5
- export * from './agents/page-structure-validator';
6
5
  export * from './agents/section-content-generator';
7
6
  export * from './utils/index';