parallel-codegen.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. {
  2. "version": "3.16",
  3. "name": "Parallel-CodeGen",
  4. "description": "Fully parallel code generation: ProjectMeta -> default Theme/Theme.vth + project database -> all VL files in parallel.",
  5. "registry": {
  6. "params": [
  7. "userRequest(STRING)",
  8. "targetLang(STRING)"
  9. ],
  10. "services": [],
  11. "apis": [],
  12. "components": [],
  13. "vars": [
  14. "$projectMeta(OBJECT)",
  15. "$projectMetaStr(STRING)",
  16. "$vdbContent(STRING)",
  17. "$codeValidation(OBJECT)",
  18. "$vthContent(STRING)"
  19. ],
  20. "files": {
  21. "inputs": [],
  22. "artifacts": [
  23. "Process/ProjectMeta.json",
  24. "Database/*",
  25. "Services/*",
  26. "ExtComponents/*",
  27. "Sections/*",
  28. "Apps/*",
  29. "Theme/*"
  30. ]
  31. },
  32. "docs": {
  33. "1": "VL Syntax Rules",
  34. "100": "Agent-GenDatabase: .vdb generation",
  35. "102": "Agent-GenServiceDomain: .vs generation",
  36. "103": "Agent-GenComponent: .cp generation",
  37. "104": "Agent-GenSection: .sc generation",
  38. "105": "Agent-GenApp: .vx generation",
  39. "107": "Agent-RepairVLFile: Targeted repair for failed VL files",
  40. "111": "Agent-MetaDirect: Generate ProjectMeta directly from user request"
  41. }
  42. },
  43. "steps": [
  44. {
  45. "id": "ClearFiles_005_ClearExisting",
  46. "meta": {
  47. "title": "0. Clear existing VL files before regeneration"
  48. },
  49. "in": {},
  50. "out": {},
  51. "next": "LLM_010_GenMeta"
  52. },
  53. {
  54. "id": "LLM_010_GenMeta",
  55. "meta": {
  56. "title": "1. Generate ProjectMeta"
  57. },
  58. "in": {
  59. "docs": [
  60. "1",
  61. "111"
  62. ],
  63. "max_tokens": 16000,
  64. "stream": true,
  65. "messages": [
  66. {
  67. "role": "user",
  68. "content": "User Request:"
  69. },
  70. {
  71. "role": "user",
  72. "content": "=userRequest"
  73. },
  74. {
  75. "role": "user",
  76. "content": "Target Language: =targetLang"
  77. },
  78. {
  79. "role": "user",
  80. "content": "Generate the complete ProjectMeta JSON. REQUIRED top-level keys: specVersion, projectName, projectDescription, vlVersion, config, database, theme, dataSchema, services, components, sections, apps. REQUIREMENTS: - projectName MUST be PascalCase English-only. - config.themeFile MUST be \"Theme/Theme.vth\". - database.file MUST be \"Database/<ProjectName>.vdb\". - theme.file MUST be \"Theme/Theme.vth\". - every service MUST have filePath \"Services/<DomainId>.vs\". - every component MUST have filePath \"ExtComponents/<Id>.cp\". - every section MUST have filePath \"Sections/<Id>.sc\" and explicit consumesServices[] / usesComponents[]. - every app MUST have filePath \"Apps/<Id>.vx\". Output ONLY valid JSON."
  81. }
  82. ],
  83. "output_config": {
  84. "format": {
  85. "type": "json_object"
  86. }
  87. }
  88. },
  89. "out": {
  90. "$projectMeta": "=_result",
  91. "$projectMetaStr": "=_result",
  92. "/Process/ProjectMeta.json": "=_result",
  93. "/.vl-code/ProjectMeta.json": "=_result"
  94. },
  95. "next": "Fork_015_Foundation"
  96. },
  97. {
  98. "id": "Fork_015_Foundation",
  99. "meta": {
  100. "title": "2. Seed default Theme + generate Database (parallel)"
  101. },
  102. "children": [
  103. "LLM_020_GenDB",
  104. "SeedTheme_018_DefaultTheme"
  105. ],
  106. "next": "Fork_AllCode"
  107. },
  108. {
  109. "id": "LLM_020_GenDB",
  110. "meta": {
  111. "title": "2a. Generate Database Schema (.vdb)"
  112. },
  113. "in": {
  114. "docs": [
  115. "1",
  116. "100"
  117. ],
  118. "max_tokens": 8192,
  119. "stream": true,
  120. "messages": [
  121. {
  122. "role": "user",
  123. "content": "ProjectMeta:"
  124. },
  125. {
  126. "role": "user",
  127. "content": "=$projectMetaStr"
  128. },
  129. {
  130. "role": "user",
  131. "content": "Generate the .vdb database schema file based on the databases defined in ProjectMeta."
  132. }
  133. ]
  134. },
  135. "out": {
  136. "$vdbContent": "=_result",
  137. "/{$projectMeta.database.file || ('Database/' + $projectMeta.projectName + '.vdb')}": "=_result"
  138. },
  139. "next": "RETURN"
  140. },
  141. {
  142. "id": "SeedTheme_018_DefaultTheme",
  143. "meta": {
  144. "title": "2b. Seed default Theme/Theme.vth"
  145. },
  146. "in": {
  147. "path": "Theme/Theme.vth"
  148. },
  149. "out": {
  150. "$vthContent": "=_result",
  151. "/Theme/Theme.vth": "=_result"
  152. },
  153. "next": "RETURN"
  154. },
  155. {
  156. "id": "Fork_AllCode",
  157. "meta": {
  158. "title": "3. Generate ALL code in parallel"
  159. },
  160. "children": [
  161. "Loop_Services",
  162. "Loop_Components",
  163. "Loop_Sections",
  164. "Loop_Apps"
  165. ],
  166. "next": "Set_080_SkipValidation"
  167. },
  168. {
  169. "id": "Loop_Services",
  170. "meta": {
  171. "title": "3a. Generate Service Domains (parallel)"
  172. },
  173. "source": "=$projectMeta.services",
  174. "mode": "parallel",
  175. "children": [
  176. "LLM_040_GenService"
  177. ]
  178. },
  179. {
  180. "id": "LLM_040_GenService",
  181. "meta": {
  182. "title": "Service: =_item.domainId"
  183. },
  184. "in": {
  185. "docs": [
  186. "1",
  187. "102"
  188. ],
  189. "max_tokens": 8192,
  190. "stream": true,
  191. "messages": [
  192. {
  193. "role": "user",
  194. "content": "ProjectMeta:"
  195. },
  196. {
  197. "role": "user",
  198. "content": "=$projectMetaStr"
  199. },
  200. {
  201. "role": "user",
  202. "content": "Database Schema:"
  203. },
  204. {
  205. "role": "user",
  206. "content": "=$vdbContent"
  207. },
  208. {
  209. "role": "user",
  210. "content": "Generate the .vs service domain file for:"
  211. },
  212. {
  213. "role": "user",
  214. "content": "=_item"
  215. },
  216. {
  217. "role": "user",
  218. "content": "Backend query-safety rules: build filter arrays incrementally. If an optional STRING/INT filter is empty, null, 0, or -1 (used as 'all'), DO NOT include that condition in select/count queries. Never generate conditions like [\"field\",\"*eq\",\"\"] or [\"field\",\"*contains\",\"\"] for optional filters. Prefer `_conditions([]) = []` plus IF checks and `_conditions.push(...)`."
  219. }
  220. ]
  221. },
  222. "out": {
  223. "/{_item.filePath}": "=_result"
  224. },
  225. "onError": "skip"
  226. },
  227. {
  228. "id": "Loop_Components",
  229. "meta": {
  230. "title": "3b. Generate Components"
  231. },
  232. "source": "=$projectMeta.components",
  233. "mode": "parallel",
  234. "children": [
  235. "LLM_050_GenComponent"
  236. ]
  237. },
  238. {
  239. "id": "LLM_050_GenComponent",
  240. "meta": {
  241. "title": "Component: =_item.id"
  242. },
  243. "in": {
  244. "docs": [
  245. "1",
  246. "103"
  247. ],
  248. "max_tokens": 8192,
  249. "stream": true,
  250. "messages": [
  251. {
  252. "role": "user",
  253. "content": "ProjectMeta:"
  254. },
  255. {
  256. "role": "user",
  257. "content": "=$projectMetaStr"
  258. },
  259. {
  260. "role": "user",
  261. "content": "Generate the .cp component file for:"
  262. },
  263. {
  264. "role": "user",
  265. "content": "=_item"
  266. }
  267. ]
  268. },
  269. "out": {
  270. "/{_item.filePath}": "=_result"
  271. },
  272. "onError": "skip"
  273. },
  274. {
  275. "id": "Loop_Sections",
  276. "meta": {
  277. "title": "3c. Generate Sections (parallel)"
  278. },
  279. "source": "=$projectMeta.sections",
  280. "mode": "parallel",
  281. "children": [
  282. "LLM_060_GenSection"
  283. ]
  284. },
  285. {
  286. "id": "LLM_060_GenSection",
  287. "meta": {
  288. "title": "Section: =_item.id"
  289. },
  290. "in": {
  291. "docs": [
  292. "1",
  293. "104"
  294. ],
  295. "max_tokens": 16000,
  296. "stream": true,
  297. "messages": [
  298. {
  299. "role": "user",
  300. "content": "ProjectMeta:"
  301. },
  302. {
  303. "role": "user",
  304. "content": "=$projectMetaStr"
  305. },
  306. {
  307. "role": "user",
  308. "content": "Database Schema:"
  309. },
  310. {
  311. "role": "user",
  312. "content": "=$vdbContent"
  313. },
  314. {
  315. "role": "user",
  316. "content": "Generate the .sc section file for:"
  317. },
  318. {
  319. "role": "user",
  320. "content": "=_item"
  321. },
  322. {
  323. "role": "user",
  324. "content": "Compile-safety rules: 1) style: values must be static string literals only; NEVER use ternary, concat, variables, or any expression inside style:. If appearance depends on data, split the node with If blocks or use StateStyle conditions; never write style:($cond ? \"a\" : \"b\"). 2) NEVER emit CSS-only skin properties such as border-collapse. 3) Use only services that actually exist in ProjectMeta / generated services, and keep ServiceDomain / Service names aligned with declared ids. 4) Prefer VL-safe layout props over raw CSS. 5) NEVER bind events directly on <For-*> nodes; bind the event on the interactive child inside the loop instead. 6) NEVER emit deprecated <StateStyle-*> trigger:\"hover\" blocks. Output only valid .sc source."
  325. }
  326. ]
  327. },
  328. "out": {
  329. "/{_item.filePath}": "=_result"
  330. },
  331. "onError": "retry",
  332. "retryCount": 1
  333. },
  334. {
  335. "id": "Loop_Apps",
  336. "meta": {
  337. "title": "3d. Generate Apps"
  338. },
  339. "source": "=$projectMeta.apps",
  340. "mode": "parallel",
  341. "children": [
  342. "LLM_070_GenApp"
  343. ]
  344. },
  345. {
  346. "id": "LLM_070_GenApp",
  347. "meta": {
  348. "title": "App: =_item.id"
  349. },
  350. "in": {
  351. "docs": [
  352. "1",
  353. "105"
  354. ],
  355. "max_tokens": 8192,
  356. "stream": true,
  357. "messages": [
  358. {
  359. "role": "user",
  360. "content": "ProjectMeta:"
  361. },
  362. {
  363. "role": "user",
  364. "content": "=$projectMetaStr"
  365. },
  366. {
  367. "role": "user",
  368. "content": "Generate the .vx app file for:"
  369. },
  370. {
  371. "role": "user",
  372. "content": "=_item"
  373. },
  374. {
  375. "role": "user",
  376. "content": "Compile-safety rules: generate only VL-valid .vx source. Do not invent raw CSS properties, and only reference sections/components that exist in ProjectMeta."
  377. }
  378. ]
  379. },
  380. "out": {
  381. "/{_item.filePath}": "=_result"
  382. },
  383. "onError": "retry",
  384. "retryCount": 1
  385. },
  386. {
  387. "id": "Set_080_SkipValidation",
  388. "meta": {
  389. "title": "4. Skip validation (generation-only mode)"
  390. },
  391. "target": "$codeValidation",
  392. "value": "={\"success\":true,\"skipped\":true,\"reason\":\"validation disabled\"}",
  393. "next": "Stop_Done"
  394. },
  395. {
  396. "id": "Stop_Done",
  397. "meta": {
  398. "title": "Done"
  399. }
  400. }
  401. ]
  402. }