@aigne/doc-smith 0.8.15-beta.1 → 0.8.15-beta.10

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 (87) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/agents/clear/choose-contents.mjs +4 -4
  3. package/agents/clear/clear-auth-tokens.mjs +8 -8
  4. package/agents/clear/clear-deployment-config.mjs +2 -2
  5. package/agents/clear/clear-document-config.mjs +3 -3
  6. package/agents/clear/clear-document-structure.mjs +10 -10
  7. package/agents/clear/clear-generated-docs.mjs +103 -14
  8. package/agents/clear/clear-media-description.mjs +7 -7
  9. package/agents/evaluate/document-structure.yaml +3 -1
  10. package/agents/evaluate/document.yaml +3 -1
  11. package/agents/evaluate/index.yaml +1 -3
  12. package/agents/generate/check-diagram.mjs +1 -1
  13. package/agents/generate/check-need-generate-structure.mjs +2 -7
  14. package/agents/generate/draw-diagram.yaml +4 -0
  15. package/agents/generate/generate-structure.yaml +117 -65
  16. package/agents/generate/index.yaml +3 -3
  17. package/agents/generate/{merge-d2-diagram.yaml → merge-diagram.yaml} +7 -6
  18. package/agents/generate/update-document-structure.yaml +1 -1
  19. package/agents/generate/user-review-document-structure.mjs +1 -0
  20. package/agents/generate/utils/merge-document-structures.mjs +30 -0
  21. package/agents/init/check.mjs +3 -1
  22. package/agents/init/index.mjs +37 -7
  23. package/agents/media/load-media-description.mjs +12 -24
  24. package/agents/publish/publish-docs.mjs +3 -8
  25. package/agents/schema/document-execution-structure.yaml +1 -1
  26. package/agents/schema/document-structure-item.yaml +23 -0
  27. package/agents/schema/document-structure-refine-item.yaml +20 -0
  28. package/agents/schema/document-structure.yaml +1 -1
  29. package/agents/translate/index.yaml +1 -4
  30. package/agents/translate/record-translation-history.mjs +6 -2
  31. package/agents/translate/translate-multilingual.yaml +1 -1
  32. package/agents/update/batch-generate-document.yaml +1 -1
  33. package/agents/update/batch-update-document.yaml +1 -1
  34. package/agents/update/check-document.mjs +35 -13
  35. package/agents/update/check-generate-diagram.mjs +26 -0
  36. package/agents/update/generate-diagram.yaml +29 -0
  37. package/agents/update/generate-document.yaml +17 -30
  38. package/agents/update/handle-document-update.yaml +10 -1
  39. package/agents/update/save-and-translate-document.mjs +18 -47
  40. package/agents/update/update-document-detail.yaml +2 -1
  41. package/agents/update/update-single-document.yaml +1 -1
  42. package/agents/update/user-review-document.mjs +6 -5
  43. package/agents/utils/choose-docs.mjs +2 -1
  44. package/agents/utils/load-sources.mjs +62 -45
  45. package/agents/utils/{save-docs.mjs → post-generate.mjs} +2 -51
  46. package/agents/utils/save-doc-translation.mjs +27 -0
  47. package/agents/utils/{save-single-doc.mjs → save-doc.mjs} +17 -12
  48. package/agents/utils/save-sidebar.mjs +59 -0
  49. package/agents/utils/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +7 -7
  50. package/aigne.yaml +16 -8
  51. package/package.json +2 -1
  52. package/prompts/common/document/content-rules-core.md +6 -6
  53. package/prompts/common/document/media-file-list-usage-rules.md +12 -0
  54. package/prompts/common/document/openapi-usage-rules.md +36 -0
  55. package/prompts/common/document/role-and-personality.md +1 -2
  56. package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
  57. package/prompts/common/document-structure/document-structure-rules.md +8 -8
  58. package/prompts/common/document-structure/output-constraints.md +3 -3
  59. package/prompts/detail/custom/custom-components.md +38 -3
  60. package/prompts/detail/d2-diagram/rules.md +11 -14
  61. package/prompts/detail/d2-diagram/system-prompt.md +0 -14
  62. package/prompts/detail/d2-diagram/user-prompt.md +39 -0
  63. package/prompts/detail/generate/document-rules.md +3 -3
  64. package/prompts/detail/generate/system-prompt.md +2 -6
  65. package/prompts/detail/generate/user-prompt.md +20 -61
  66. package/prompts/detail/update/system-prompt.md +2 -6
  67. package/prompts/detail/update/user-prompt.md +7 -6
  68. package/prompts/evaluate/document.md +0 -4
  69. package/prompts/structure/check-document-structure.md +4 -4
  70. package/prompts/structure/generate/system-prompt.md +0 -31
  71. package/prompts/structure/generate/user-prompt.md +68 -29
  72. package/prompts/structure/review/structure-review-system.md +79 -0
  73. package/prompts/structure/update/system-prompt.md +1 -1
  74. package/prompts/structure/update/user-prompt.md +4 -4
  75. package/prompts/translate/code-block.md +13 -3
  76. package/prompts/translate/translate-document.md +1 -1
  77. package/types/document-structure-schema.mjs +3 -3
  78. package/utils/docs-finder-utils.mjs +48 -0
  79. package/utils/extract-api.mjs +32 -0
  80. package/utils/file-utils.mjs +56 -101
  81. package/utils/history-utils.mjs +20 -8
  82. package/utils/load-config.mjs +1 -1
  83. package/utils/markdown-checker.mjs +35 -1
  84. package/utils/utils.mjs +67 -65
  85. package/agents/generate/document-structure-tools/generate-sub-structure.mjs +0 -131
  86. package/agents/generate/generate-structure-without-tools.yaml +0 -65
  87. package/prompts/common/document/media-handling-rules.md +0 -9
@@ -1,68 +1,120 @@
1
+ type: team
1
2
  name: generateStructure
2
3
  description: Generate the structure and organization of your documentation
3
- instructions:
4
- - role: system
5
- url: ../../prompts/structure/generate/system-prompt.md
6
- - role: user
7
- url: ../../prompts/structure/generate/user-prompt.md
8
4
  skills:
9
- - ./document-structure-tools/generate-sub-structure.mjs
10
- task_render_mode: collapse
11
- task_title: Generate the structure of the documentation
12
- tool_calls_concurrency: 5
13
- input_schema:
14
- type: object
15
- properties:
16
- rules:
17
- type: string
18
- description: Your specific requirements for documentation structure
19
- locale:
20
- type: string
21
- description: Primary language for documentation (e.g., zh, en, ja)
22
- datasources:
23
- type: string
24
- description: Project content and context to help generate documentation structure
25
- targetAudience:
26
- type: string
27
- description: Target audience for the documentation
28
- nodeName:
29
- type: string
30
- description: Specific section or page name to focus on
31
- glossary:
32
- type: string
33
- description: Glossary for consistent terminology
34
- feedback:
35
- type: string
36
- description: Tell us how to improve the documentation structure
37
- userPreferences:
38
- type: string
39
- description: Your saved preferences for structure and documentation style
40
- docsType:
41
- type: string
42
- description: "Documentation type (options: general, getting-started, reference, faq)"
43
- default: general
44
- required:
45
- - rules
46
- - datasources
47
- output_schema:
48
- type: object
49
- properties:
50
- projectName:
51
- type: string
52
- description: Project name identified from your content sources
53
- projectDesc:
54
- type: string
55
- description: Brief project description generated from content analysis (under 50 words)
56
- documentStructure: ../schema/document-structure.yaml
57
- documentStructureTree:
58
- type: string
59
- description: |
60
- Visual tree structure showing documentation hierarchy with indented levels for easy review:
61
- ```
62
- - Home
63
- - Getting Started
64
- - Installation
65
- - Requirements
66
- ```
67
- required:
68
- - documentStructure
5
+ - type: team
6
+ name: generateStructureWorker
7
+ iterate_on: dataSources
8
+ skills:
9
+ - type: ai
10
+ model:
11
+ reasoning_effort: 500
12
+ instructions:
13
+ - role: system
14
+ url: ../../prompts/structure/generate/system-prompt.md
15
+ - role: user
16
+ url: ../../prompts/structure/generate/user-prompt.md
17
+ task_render_mode: collapse
18
+ task_title: Generate the structure of the documentation
19
+ tool_calls_concurrency: 5
20
+ input_schema:
21
+ type: object
22
+ properties:
23
+ rules:
24
+ type: string
25
+ description: Your specific requirements for documentation structure
26
+ locale:
27
+ type: string
28
+ description: Primary language for documentation (e.g., zh, en, ja)
29
+ dataSourceChunk:
30
+ type: string
31
+ description: Project content and context to help generate documentation structure
32
+ targetAudience:
33
+ type: string
34
+ description: Target audience for the documentation
35
+ nodeName:
36
+ type: string
37
+ description: Specific section or page name to focus on
38
+ glossary:
39
+ type: string
40
+ description: Glossary for consistent terminology
41
+ feedback:
42
+ type: string
43
+ description: Tell us how to improve the documentation structure
44
+ userPreferences:
45
+ type: string
46
+ description: Your saved preferences for structure and documentation style
47
+ docsType:
48
+ type: string
49
+ description: "Documentation type (options: general, getting-started, reference, faq)"
50
+ default: general
51
+ required:
52
+ - rules
53
+ - dataSourceChunk
54
+ output_schema:
55
+ type: object
56
+ properties:
57
+ projectName:
58
+ type: string
59
+ description: Project name identified from your content sources
60
+ projectDesc:
61
+ type: string
62
+ description: Brief project description generated from content analysis (under 50 words)
63
+ structures:
64
+ type: array
65
+ description: List of document structure items to add or update
66
+ items: ../schema/document-structure-item.yaml
67
+
68
+ - ./utils/merge-document-structures.mjs
69
+
70
+ - type: function
71
+ name: aggregateDocumentStructure
72
+ process: |
73
+ return {
74
+ documentStructure: options.context.userContext.originalDocumentStructure.map((i, index) => ({
75
+ ...i,
76
+ id: i.title.toLowerCase().replace(/\s+/g, '-'),
77
+ index
78
+ })),
79
+ projectName: options.context.userContext.projectName,
80
+ projectDesc: options.context.userContext.projectDesc,
81
+ }
82
+
83
+ - type: ai
84
+ name: refineStructure
85
+ model:
86
+ reasoning_effort: 500
87
+ instructions:
88
+ - role: system
89
+ url: ../../prompts/structure/review/structure-review-system.md
90
+ output_schema:
91
+ type: object
92
+ properties:
93
+ structures:
94
+ type: array
95
+ description: Document structure items that need to be updated or changed
96
+ items: ../schema/document-structure-refine-item.yaml
97
+ required:
98
+ - structures
99
+
100
+ - type: function
101
+ name: finalizeDocumentStructure
102
+ process: |
103
+ return {
104
+ projectName: input.projectName,
105
+ projectDesc: input.projectDesc,
106
+ documentStructure: input.structures.map(refinedItem => {
107
+ // Find original item to get sourceIds and other fields
108
+ const originalItem = input.documentStructure.find(orig => orig.id === refinedItem.id)
109
+
110
+ const newItem = {
111
+ title: refinedItem.title,
112
+ description: refinedItem.description,
113
+ path: refinedItem.path,
114
+ parentId: refinedItem.parentPath || null, // Convert parentPath to parentId
115
+ sourceIds: originalItem?.sourceIds || [],
116
+ }
117
+
118
+ return newItem
119
+ })
120
+ }
@@ -23,6 +23,7 @@ skills:
23
23
  savePath:
24
24
  $get: outputDir
25
25
  fileName: structure-plan.json
26
+ - ../utils/save-sidebar.mjs
26
27
  - type: transform
27
28
  name: transformData
28
29
  task_render_mode: hide
@@ -37,8 +38,7 @@ skills:
37
38
  'translates': [$map(translateLanguages, function($lang) { {"language": $lang} })]
38
39
  }
39
40
  ])
40
- }),
41
- "datasources": ""
41
+ })
42
42
  }
43
43
  ])
44
44
  - ../utils/format-document-structure.mjs
@@ -47,7 +47,7 @@ skills:
47
47
  - url: ../utils/check-feedback-refiner.mjs
48
48
  default_input:
49
49
  stage: document_structure
50
- - ../utils/save-docs.mjs
50
+ - ../utils/post-generate.mjs
51
51
 
52
52
  input_schema:
53
53
  type: object
@@ -1,14 +1,15 @@
1
- name: mergeD2DiagramToDocument
2
- description: Merge D2 Diagram source code into document
1
+ name: mergeDiagramToDocument
2
+ description: Merge Diagram source code into document
3
3
  instructions: |
4
4
  You are an AI assistant that helps to merge d2 diagram into document.
5
5
 
6
- <datasources>
6
+ <detail_data_source>
7
7
  {{ content }}
8
- </datasources>
9
- <datasources>
8
+ </detail_data_source>
9
+
10
+ <diagram_source_code>
10
11
  {{ diagramSourceCode }}
11
- </datasources>
12
+ </diagram_source_code>
12
13
 
13
14
  Given the source content of a document and the D2 diagram source code, your task is to:
14
15
  - **Keep the original content as soon as possible.**
@@ -16,7 +16,7 @@ input_schema:
16
16
  locale:
17
17
  type: string
18
18
  description: User language, e.g. zh, en
19
- datasources:
19
+ dataSourceChunk:
20
20
  type: string
21
21
  description: Context for documentation structure
22
22
  glossary:
@@ -140,6 +140,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
140
140
  // Call refineDocumentStructure agent with feedback
141
141
  await options.context.invoke(refineAgent, {
142
142
  ...rest,
143
+ dataSourceChunk: rest.dataSources[0].dataSourceChunk,
143
144
  feedback: feedback.trim(),
144
145
  documentStructure: currentStructure,
145
146
  userPreferences,
@@ -0,0 +1,30 @@
1
+ export default async function mergeDocumentStructures(input, options) {
2
+ if (input.projectName) {
3
+ options.context.userContext.projectName = input.projectName;
4
+ }
5
+ if (input.projectDesc) {
6
+ options.context.userContext.projectDesc = input.projectDesc;
7
+ }
8
+
9
+ input.projectName = options.context.userContext.projectName;
10
+ input.projectDesc = options.context.userContext.projectDesc;
11
+
12
+ options.context.userContext.originalDocumentStructure ??= [];
13
+
14
+ const originalStructures = options.context.userContext.originalDocumentStructure;
15
+
16
+ if (input.structures) {
17
+ for (const item of input.structures) {
18
+ const old = originalStructures.find((s) => s.path === item.path);
19
+ if (old) {
20
+ Object.assign(old, item);
21
+ } else {
22
+ originalStructures.push(item);
23
+ }
24
+ }
25
+ }
26
+
27
+ options.context.userContext.originalDocumentStructure = originalStructures;
28
+
29
+ return {};
30
+ }
@@ -10,5 +10,7 @@ export default async function checkNeedGenerate({ docsDir, locale, documentExecu
10
10
  );
11
11
  process.exit(0);
12
12
  }
13
- return {};
13
+ return {
14
+ message: 'Documents found in the docs directory, skipping "generate" step',
15
+ };
14
16
  }
@@ -20,6 +20,7 @@ import {
20
20
  isGlobPattern,
21
21
  validatePath,
22
22
  } from "../../utils/utils.mjs";
23
+ import { isRemoteFile } from "../../utils/file-utils.mjs";
23
24
 
24
25
  const _PRESS_ENTER_TO_FINISH = "Press Enter to finish";
25
26
 
@@ -244,19 +245,21 @@ export default async function init(
244
245
  input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
245
246
 
246
247
  // 8. Content sources
247
- console.log("\n🔍 [8/9]: Content Sources");
248
+ console.log("\n🔍 [8/9]: Data Sources");
249
+ console.log("Please specify the data source we should analyze to generate your documentation.");
248
250
  console.log(
249
- "Please specify the folders and files we should analyze to generate your documentation (e.g., ./src, ./docs, ./README.md).",
251
+ ` 1. Use paths like ${chalk.green("./src")}, ${chalk.green("./README.md")} or ${chalk.green("!./src/private")}.`,
250
252
  );
251
253
  console.log(
252
- "💡 You can also use glob patterns like src/**/*.js or docs/**/*.md for more specific file matching.",
254
+ ` 2. Use globs like ${chalk.green("src/**/*.js")} or ${chalk.green("!private/**/*.js")} for more specific file matching.`,
253
255
  );
256
+ console.log(` 3. Use URLs like ${chalk.green("https://example.com/openapi.yaml")}.`);
254
257
  console.log("💡 If you leave this empty, we will scan the entire directory.");
255
258
 
256
259
  const sourcePaths = [];
257
260
  while (true) {
258
261
  const selectedPath = await options.prompts.search({
259
- message: "Please enter a file or folder path, or a glob pattern:",
262
+ message: "Please enter a valid data source:",
260
263
  source: async (input) => {
261
264
  if (!input || input.trim() === "") {
262
265
  return [
@@ -268,13 +271,23 @@ export default async function init(
268
271
  ];
269
272
  }
270
273
 
274
+ let isIgnore = false;
271
275
  const searchTerm = input.trim();
276
+ let cleanSearchTerm = searchTerm;
277
+ if (cleanSearchTerm.startsWith("!")) {
278
+ isIgnore = true;
279
+ cleanSearchTerm = searchTerm.slice(1);
280
+ }
272
281
 
273
282
  // Search for matching files and folders in current directory
274
- const availablePaths = getAvailablePaths(searchTerm);
283
+ const availablePaths = getAvailablePaths(cleanSearchTerm);
275
284
 
276
285
  // Also add option to use as glob pattern
277
- const options = [...availablePaths];
286
+ const options = [...availablePaths].map((x) => ({
287
+ ...x,
288
+ name: isIgnore ? `!${x.name}` : x.name,
289
+ value: isIgnore ? `!${x.value}` : x.value,
290
+ }));
278
291
 
279
292
  // Check if input looks like a glob pattern
280
293
  const isGlobPatternResult = isGlobPattern(searchTerm);
@@ -287,6 +300,14 @@ export default async function init(
287
300
  });
288
301
  }
289
302
 
303
+ if (!isIgnore && isRemoteFile(searchTerm)) {
304
+ options.push({
305
+ name: searchTerm,
306
+ value: searchTerm,
307
+ description: "Use this remote url for content source.",
308
+ });
309
+ }
310
+
290
311
  return options;
291
312
  },
292
313
  });
@@ -301,6 +322,14 @@ export default async function init(
301
322
  // Check if it's a glob pattern
302
323
  const isGlobPatternResult = isGlobPattern(trimmedPath);
303
324
 
325
+ if (isRemoteFile(trimmedPath)) {
326
+ // For remote urls, just add them without validation
327
+ if (sourcePaths.includes(trimmedPath)) {
328
+ console.log(`⚠️ URL already exists: ${trimmedPath}`);
329
+ continue;
330
+ }
331
+ sourcePaths.push(trimmedPath);
332
+ }
304
333
  if (isGlobPatternResult) {
305
334
  // For glob patterns, just add them without validation
306
335
  if (sourcePaths.includes(trimmedPath)) {
@@ -309,8 +338,9 @@ export default async function init(
309
338
  }
310
339
  sourcePaths.push(trimmedPath);
311
340
  } else {
341
+ const cleanTrimmedPath = trimmedPath.startsWith("!") ? trimmedPath.slice(1) : trimmedPath;
312
342
  // Use validatePath to check if path is valid for regular paths
313
- const validation = validatePath(trimmedPath);
343
+ const validation = validatePath(cleanTrimmedPath);
314
344
 
315
345
  if (!validation.isValid) {
316
346
  console.log(`⚠️ ${validation.error}`);
@@ -163,31 +163,19 @@ export default async function loadMediaDescription(input, options) {
163
163
  let enhancedAssetsContent = "# Available Media Assets for Documentation\n\n";
164
164
 
165
165
  if (mediaFiles.length > 0) {
166
- enhancedAssetsContent += "```yaml\n";
167
- enhancedAssetsContent += "assets:\n";
168
-
169
- for (const asset of mediaFiles) {
170
- enhancedAssetsContent += ` - name: "${asset.name}"\n`;
171
- enhancedAssetsContent += ` path: "${asset.path}"\n`;
172
- enhancedAssetsContent += ` type: "${asset.type}"\n`;
173
-
174
- // Add description for images and videos
175
- if (asset.type === "image" || asset.type === "video") {
176
- const mediaHash = mediaHashMap.get(asset.path);
177
- const cachedDesc = cache[mediaHash];
178
- if (cachedDesc?.description) {
179
- enhancedAssetsContent += ` description: "${cachedDesc.description}"\n`;
180
- }
181
- }
182
-
183
- // Add dimensions for images and videos
184
- if (asset.width && asset.height) {
185
- enhancedAssetsContent += ` width: ${asset.width}\n`;
186
- enhancedAssetsContent += ` height: ${asset.height}\n`;
166
+ const assets = mediaFiles.map((x) => {
167
+ const mediaHash = mediaHashMap.get(x.path);
168
+ const description = cache[mediaHash]?.description;
169
+ const result = {
170
+ name: x.name,
171
+ path: x.path,
172
+ };
173
+ if (description) {
174
+ result.description = description;
187
175
  }
188
- }
189
-
190
- enhancedAssetsContent += "```\n";
176
+ return result;
177
+ });
178
+ enhancedAssetsContent += stringify(assets);
191
179
  }
192
180
 
193
181
  return {
@@ -14,14 +14,9 @@ import {
14
14
  } from "../../utils/constants/index.mjs";
15
15
  import { beforePublishHook, ensureTmpDir } from "../../utils/d2-utils.mjs";
16
16
  import { deploy } from "../../utils/deploy.mjs";
17
- import {
18
- getGithubRepoUrl,
19
- isHttp,
20
- loadConfigFromFile,
21
- saveValueToConfig,
22
- } from "../../utils/utils.mjs";
17
+ import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
23
18
  import updateBranding from "../utils/update-branding.mjs";
24
- import { downloadAndUploadImage } from "../../utils/file-utils.mjs";
19
+ import { isRemoteFile, downloadAndUploadImage } from "../../utils/file-utils.mjs";
25
20
 
26
21
  const BASE_URL = process.env.DOC_SMITH_BASE_URL || CLOUD_SERVICE_URL_PROD;
27
22
 
@@ -205,7 +200,7 @@ export default async function publishDocs(
205
200
  let finalPath = null;
206
201
 
207
202
  // Handle project logo download if it's a URL
208
- if (projectInfo.icon && isHttp(projectInfo.icon)) {
203
+ if (projectInfo.icon && isRemoteFile(projectInfo.icon)) {
209
204
  const { url: uploadedImageUrl, downloadFinalPath } = await downloadAndUploadImage(
210
205
  projectInfo.icon,
211
206
  docsDir,
@@ -25,7 +25,7 @@ items:
25
25
  type: array
26
26
  items:
27
27
  type: string
28
- description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, cannot be empty
28
+ description: Associated sourceId from `<data_sources>` for subsequent translation and content generation, must come from sourceId in `<data_sources>`, cannot have fake ids, cannot be empty
29
29
  required:
30
30
  - title
31
31
  - description
@@ -0,0 +1,23 @@
1
+ type: object
2
+ description: Document structure item representing a node in the document hierarchy
3
+ properties:
4
+ title:
5
+ type: string
6
+ description:
7
+ type: string
8
+ path:
9
+ type: string
10
+ description: Path in URL format, cannot be empty, cannot contain spaces or special characters, must start with /, no need to include language level, e.g., /zh/about should return /about
11
+ parentPath:
12
+ type: string
13
+ description: Parent node path, if null indicates it is a top-level node
14
+ sourceIds:
15
+ type: array
16
+ description: Associated sourceId from `<data_sources>` for subsequent translation and content generation, must come from sourceId in `<data_sources>`, cannot have fake ids, **cannot be empty**
17
+ items:
18
+ type: string
19
+ required:
20
+ - title
21
+ - description
22
+ - path
23
+ - sourceIds
@@ -0,0 +1,20 @@
1
+ type: object
2
+ description: Document structure item representing a node in the document hierarchy
3
+ properties:
4
+ id:
5
+ type: string
6
+ description: Unique identifier for the document structure item
7
+ title:
8
+ type: string
9
+ description:
10
+ type: string
11
+ path:
12
+ type: string
13
+ description: Path in URL format, cannot be empty, cannot contain spaces or special characters, must start with /, no need to include language level, e.g., /zh/about should return /about
14
+ parentPath:
15
+ type: string
16
+ description: Parent node path, if null indicates it is a top-level node
17
+ required:
18
+ - title
19
+ - description
20
+ - path
@@ -16,7 +16,7 @@ items:
16
16
  description: Parent node path, if null indicates it is a top-level node
17
17
  sourceIds:
18
18
  type: array
19
- description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, **cannot be empty**
19
+ description: Associated sourceId from `<data_sources>` for subsequent translation and content generation, must come from sourceId in `<data_sources>`, cannot have fake ids, **cannot be empty**
20
20
  items:
21
21
  type: string
22
22
  required:
@@ -33,15 +33,12 @@ skills:
33
33
  name: batchTranslateDocument
34
34
  skills:
35
35
  - ../translate/translate-multilingual.yaml
36
- - url: ./record-translation-history.mjs
37
- - url: ../utils/save-single-doc.mjs
38
- default_input:
39
- isTranslate: true
40
36
  iterate_on: selectedDocs
41
37
  concurrency: 10
42
38
  - url: ../utils/check-feedback-refiner.mjs
43
39
  default_input:
44
40
  stage: translation_refine
41
+ - url: ./record-translation-history.mjs
45
42
  - url: ../utils/action-success.mjs
46
43
  default_input:
47
44
  action: '✅ Translation completed'
@@ -1,16 +1,20 @@
1
1
  import { recordUpdate } from "../../utils/history-utils.mjs";
2
2
 
3
- export default function recordTranslationHistory({ feedback, path }) {
3
+ export default function recordTranslationHistory({ selectedPaths, feedback }) {
4
4
  // Skip if no feedback provided
5
5
  if (!feedback?.trim()) {
6
6
  return {};
7
7
  }
8
8
 
9
+ if (!Array.isArray(selectedPaths) || selectedPaths.length === 0) {
10
+ return {};
11
+ }
12
+
9
13
  // Record translation history for this document
10
14
  recordUpdate({
11
15
  operation: "translation_update",
12
16
  feedback: feedback.trim(),
13
- documentPath: path,
17
+ docPaths: selectedPaths,
14
18
  });
15
19
 
16
20
  return {};
@@ -22,6 +22,7 @@ skills:
22
22
  max_iterations: 5
23
23
  return_last_on_max_iterations: true
24
24
  task_title: Translate '{{ title }}' to '{{ language }}'
25
+ - ../utils/save-doc-translation.mjs
25
26
  input_schema:
26
27
  type: object
27
28
  properties:
@@ -48,4 +49,3 @@ output_schema:
48
49
  type: string
49
50
  iterate_on: translates
50
51
  concurrency: 3
51
-
@@ -6,7 +6,7 @@ skills:
6
6
  input_schema:
7
7
  type: object
8
8
  properties:
9
- datasources:
9
+ detailDataSource:
10
10
  type: string
11
11
  description: Context for documentation structure generation, used to assist generate documentation structure
12
12
  documentExecutionStructure: ../schema/document-execution-structure.yaml
@@ -4,4 +4,4 @@ name: batchUpdateDocument
4
4
  skills:
5
5
  - ../update/handle-document-update.yaml
6
6
  iterate_on: selectedDocs
7
- concurrency: 10
7
+ concurrency: 10