helixlife-expert-cli 0.1.0

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 (523) hide show
  1. package/README.md +159 -0
  2. package/cli/bin/helixlife-expert.js +3 -0
  3. package/cli/dist/core/api/client.d.ts +31 -0
  4. package/cli/dist/core/api/client.d.ts.map +1 -0
  5. package/cli/dist/core/api/client.js +183 -0
  6. package/cli/dist/core/api/client.js.map +1 -0
  7. package/cli/dist/core/api/http.d.ts +3 -0
  8. package/cli/dist/core/api/http.d.ts.map +1 -0
  9. package/cli/dist/core/api/http.js +22 -0
  10. package/cli/dist/core/api/http.js.map +1 -0
  11. package/cli/dist/core/api/response.d.ts +48 -0
  12. package/cli/dist/core/api/response.d.ts.map +1 -0
  13. package/cli/dist/core/api/response.js +84 -0
  14. package/cli/dist/core/api/response.js.map +1 -0
  15. package/cli/dist/core/api/sse.d.ts +6 -0
  16. package/cli/dist/core/api/sse.d.ts.map +1 -0
  17. package/cli/dist/core/api/sse.js +60 -0
  18. package/cli/dist/core/api/sse.js.map +1 -0
  19. package/cli/dist/core/auth/index.d.ts +35 -0
  20. package/cli/dist/core/auth/index.d.ts.map +1 -0
  21. package/cli/dist/core/auth/index.js +150 -0
  22. package/cli/dist/core/auth/index.js.map +1 -0
  23. package/cli/dist/core/env-config.d.ts +16 -0
  24. package/cli/dist/core/env-config.d.ts.map +1 -0
  25. package/cli/dist/core/env-config.js +80 -0
  26. package/cli/dist/core/env-config.js.map +1 -0
  27. package/cli/dist/core/errors.d.ts +20 -0
  28. package/cli/dist/core/errors.d.ts.map +1 -0
  29. package/cli/dist/core/errors.js +28 -0
  30. package/cli/dist/core/errors.js.map +1 -0
  31. package/cli/dist/core/index.d.ts +16 -0
  32. package/cli/dist/core/index.d.ts.map +1 -0
  33. package/cli/dist/core/index.js +16 -0
  34. package/cli/dist/core/index.js.map +1 -0
  35. package/cli/dist/core/interactive.d.ts +18 -0
  36. package/cli/dist/core/interactive.d.ts.map +1 -0
  37. package/cli/dist/core/interactive.js +74 -0
  38. package/cli/dist/core/interactive.js.map +1 -0
  39. package/cli/dist/core/output/index.d.ts +29 -0
  40. package/cli/dist/core/output/index.d.ts.map +1 -0
  41. package/cli/dist/core/output/index.js +153 -0
  42. package/cli/dist/core/output/index.js.map +1 -0
  43. package/cli/dist/core/parse.d.ts +9 -0
  44. package/cli/dist/core/parse.d.ts.map +1 -0
  45. package/cli/dist/core/parse.js +31 -0
  46. package/cli/dist/core/parse.js.map +1 -0
  47. package/cli/dist/core/paths.d.ts +21 -0
  48. package/cli/dist/core/paths.d.ts.map +1 -0
  49. package/cli/dist/core/paths.js +65 -0
  50. package/cli/dist/core/paths.js.map +1 -0
  51. package/cli/dist/core/sse-utils.d.ts +49 -0
  52. package/cli/dist/core/sse-utils.d.ts.map +1 -0
  53. package/cli/dist/core/sse-utils.js +181 -0
  54. package/cli/dist/core/sse-utils.js.map +1 -0
  55. package/cli/dist/core/terminal.d.ts +2 -0
  56. package/cli/dist/core/terminal.d.ts.map +1 -0
  57. package/cli/dist/core/terminal.js +6 -0
  58. package/cli/dist/core/terminal.js.map +1 -0
  59. package/cli/dist/core/token/index.d.ts +5 -0
  60. package/cli/dist/core/token/index.d.ts.map +1 -0
  61. package/cli/dist/core/token/index.js +26 -0
  62. package/cli/dist/core/token/index.js.map +1 -0
  63. package/cli/dist/core/types/config.d.ts +8 -0
  64. package/cli/dist/core/types/config.d.ts.map +1 -0
  65. package/cli/dist/core/types/config.js +30 -0
  66. package/cli/dist/core/types/config.js.map +1 -0
  67. package/cli/dist/core/version.d.ts +2 -0
  68. package/cli/dist/core/version.d.ts.map +1 -0
  69. package/cli/dist/core/version.js +10 -0
  70. package/cli/dist/core/version.js.map +1 -0
  71. package/cli/dist/index.d.ts +2 -0
  72. package/cli/dist/index.d.ts.map +1 -0
  73. package/cli/dist/index.js +23 -0
  74. package/cli/dist/index.js.map +1 -0
  75. package/cli/dist/modules/analysis/constants.d.ts +3 -0
  76. package/cli/dist/modules/analysis/constants.d.ts.map +1 -0
  77. package/cli/dist/modules/analysis/constants.js +3 -0
  78. package/cli/dist/modules/analysis/constants.js.map +1 -0
  79. package/cli/dist/modules/analysis/index.d.ts +3 -0
  80. package/cli/dist/modules/analysis/index.d.ts.map +1 -0
  81. package/cli/dist/modules/analysis/index.js +23 -0
  82. package/cli/dist/modules/analysis/index.js.map +1 -0
  83. package/cli/dist/modules/auth/index.d.ts +3 -0
  84. package/cli/dist/modules/auth/index.d.ts.map +1 -0
  85. package/cli/dist/modules/auth/index.js +76 -0
  86. package/cli/dist/modules/auth/index.js.map +1 -0
  87. package/cli/dist/modules/expert-scaffold.d.ts +27 -0
  88. package/cli/dist/modules/expert-scaffold.d.ts.map +1 -0
  89. package/cli/dist/modules/expert-scaffold.js +25 -0
  90. package/cli/dist/modules/expert-scaffold.js.map +1 -0
  91. package/cli/dist/modules/fund/clinical/apps.d.ts +19 -0
  92. package/cli/dist/modules/fund/clinical/apps.d.ts.map +1 -0
  93. package/cli/dist/modules/fund/clinical/apps.js +14 -0
  94. package/cli/dist/modules/fund/clinical/apps.js.map +1 -0
  95. package/cli/dist/modules/fund/clinical/command-utils.d.ts +4 -0
  96. package/cli/dist/modules/fund/clinical/command-utils.d.ts.map +1 -0
  97. package/cli/dist/modules/fund/clinical/command-utils.js +40 -0
  98. package/cli/dist/modules/fund/clinical/command-utils.js.map +1 -0
  99. package/cli/dist/modules/fund/clinical/commands/article-create.d.ts +9 -0
  100. package/cli/dist/modules/fund/clinical/commands/article-create.d.ts.map +1 -0
  101. package/cli/dist/modules/fund/clinical/commands/article-create.js +99 -0
  102. package/cli/dist/modules/fund/clinical/commands/article-create.js.map +1 -0
  103. package/cli/dist/modules/fund/clinical/commands/article-download.d.ts +30 -0
  104. package/cli/dist/modules/fund/clinical/commands/article-download.d.ts.map +1 -0
  105. package/cli/dist/modules/fund/clinical/commands/article-download.js +153 -0
  106. package/cli/dist/modules/fund/clinical/commands/article-download.js.map +1 -0
  107. package/cli/dist/modules/fund/clinical/commands/four-elements-create.d.ts +7 -0
  108. package/cli/dist/modules/fund/clinical/commands/four-elements-create.d.ts.map +1 -0
  109. package/cli/dist/modules/fund/clinical/commands/four-elements-create.js +81 -0
  110. package/cli/dist/modules/fund/clinical/commands/four-elements-create.js.map +1 -0
  111. package/cli/dist/modules/fund/clinical/commands/four-elements-precheck.d.ts +7 -0
  112. package/cli/dist/modules/fund/clinical/commands/four-elements-precheck.d.ts.map +1 -0
  113. package/cli/dist/modules/fund/clinical/commands/four-elements-precheck.js +76 -0
  114. package/cli/dist/modules/fund/clinical/commands/four-elements-precheck.js.map +1 -0
  115. package/cli/dist/modules/fund/clinical/commands/four-elements-update.d.ts +16 -0
  116. package/cli/dist/modules/fund/clinical/commands/four-elements-update.d.ts.map +1 -0
  117. package/cli/dist/modules/fund/clinical/commands/four-elements-update.js +108 -0
  118. package/cli/dist/modules/fund/clinical/commands/four-elements-update.js.map +1 -0
  119. package/cli/dist/modules/fund/clinical/commands/sample-size.d.ts +14 -0
  120. package/cli/dist/modules/fund/clinical/commands/sample-size.d.ts.map +1 -0
  121. package/cli/dist/modules/fund/clinical/commands/sample-size.js +164 -0
  122. package/cli/dist/modules/fund/clinical/commands/sample-size.js.map +1 -0
  123. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-create.d.ts +25 -0
  124. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-create.d.ts.map +1 -0
  125. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-create.js +228 -0
  126. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-create.js.map +1 -0
  127. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-parameters.d.ts +45 -0
  128. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-parameters.d.ts.map +1 -0
  129. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-parameters.js +211 -0
  130. package/cli/dist/modules/fund/clinical/commands/topic-evaluation-parameters.js.map +1 -0
  131. package/cli/dist/modules/fund/clinical/constants.d.ts +85 -0
  132. package/cli/dist/modules/fund/clinical/constants.d.ts.map +1 -0
  133. package/cli/dist/modules/fund/clinical/constants.js +161 -0
  134. package/cli/dist/modules/fund/clinical/constants.js.map +1 -0
  135. package/cli/dist/modules/fund/clinical/form-rules.d.ts +56 -0
  136. package/cli/dist/modules/fund/clinical/form-rules.d.ts.map +1 -0
  137. package/cli/dist/modules/fund/clinical/form-rules.js +542 -0
  138. package/cli/dist/modules/fund/clinical/form-rules.js.map +1 -0
  139. package/cli/dist/modules/fund/clinical/four-elements.d.ts +46 -0
  140. package/cli/dist/modules/fund/clinical/four-elements.d.ts.map +1 -0
  141. package/cli/dist/modules/fund/clinical/four-elements.js +190 -0
  142. package/cli/dist/modules/fund/clinical/four-elements.js.map +1 -0
  143. package/cli/dist/modules/fund/clinical/index.d.ts +3 -0
  144. package/cli/dist/modules/fund/clinical/index.d.ts.map +1 -0
  145. package/cli/dist/modules/fund/clinical/index.js +176 -0
  146. package/cli/dist/modules/fund/clinical/index.js.map +1 -0
  147. package/cli/dist/modules/fund/clinical/parameters.d.ts +51 -0
  148. package/cli/dist/modules/fund/clinical/parameters.d.ts.map +1 -0
  149. package/cli/dist/modules/fund/clinical/parameters.js +145 -0
  150. package/cli/dist/modules/fund/clinical/parameters.js.map +1 -0
  151. package/cli/dist/modules/fund/clinical/sample-size.d.ts +130 -0
  152. package/cli/dist/modules/fund/clinical/sample-size.d.ts.map +1 -0
  153. package/cli/dist/modules/fund/clinical/sample-size.js +356 -0
  154. package/cli/dist/modules/fund/clinical/sample-size.js.map +1 -0
  155. package/cli/dist/modules/fund/clinical/session-cache.d.ts +25 -0
  156. package/cli/dist/modules/fund/clinical/session-cache.d.ts.map +1 -0
  157. package/cli/dist/modules/fund/clinical/session-cache.js +100 -0
  158. package/cli/dist/modules/fund/clinical/session-cache.js.map +1 -0
  159. package/cli/dist/modules/fund/clinical/sse-utils.d.ts +22 -0
  160. package/cli/dist/modules/fund/clinical/sse-utils.d.ts.map +1 -0
  161. package/cli/dist/modules/fund/clinical/sse-utils.js +80 -0
  162. package/cli/dist/modules/fund/clinical/sse-utils.js.map +1 -0
  163. package/cli/dist/modules/fund/constants.d.ts +3 -0
  164. package/cli/dist/modules/fund/constants.d.ts.map +1 -0
  165. package/cli/dist/modules/fund/constants.js +3 -0
  166. package/cli/dist/modules/fund/constants.js.map +1 -0
  167. package/cli/dist/modules/fund/index.d.ts +3 -0
  168. package/cli/dist/modules/fund/index.d.ts.map +1 -0
  169. package/cli/dist/modules/fund/index.js +28 -0
  170. package/cli/dist/modules/fund/index.js.map +1 -0
  171. package/cli/dist/modules/fund/nsfc/apps.d.ts +54 -0
  172. package/cli/dist/modules/fund/nsfc/apps.d.ts.map +1 -0
  173. package/cli/dist/modules/fund/nsfc/apps.js +76 -0
  174. package/cli/dist/modules/fund/nsfc/apps.js.map +1 -0
  175. package/cli/dist/modules/fund/nsfc/article-cache.d.ts +14 -0
  176. package/cli/dist/modules/fund/nsfc/article-cache.d.ts.map +1 -0
  177. package/cli/dist/modules/fund/nsfc/article-cache.js +79 -0
  178. package/cli/dist/modules/fund/nsfc/article-cache.js.map +1 -0
  179. package/cli/dist/modules/fund/nsfc/commands/article-create.d.ts +8 -0
  180. package/cli/dist/modules/fund/nsfc/commands/article-create.d.ts.map +1 -0
  181. package/cli/dist/modules/fund/nsfc/commands/article-create.js +108 -0
  182. package/cli/dist/modules/fund/nsfc/commands/article-create.js.map +1 -0
  183. package/cli/dist/modules/fund/nsfc/commands/article-download.d.ts +42 -0
  184. package/cli/dist/modules/fund/nsfc/commands/article-download.d.ts.map +1 -0
  185. package/cli/dist/modules/fund/nsfc/commands/article-download.js +189 -0
  186. package/cli/dist/modules/fund/nsfc/commands/article-download.js.map +1 -0
  187. package/cli/dist/modules/fund/nsfc/commands/format-convert.d.ts +9 -0
  188. package/cli/dist/modules/fund/nsfc/commands/format-convert.d.ts.map +1 -0
  189. package/cli/dist/modules/fund/nsfc/commands/format-convert.js +98 -0
  190. package/cli/dist/modules/fund/nsfc/commands/format-convert.js.map +1 -0
  191. package/cli/dist/modules/fund/nsfc/commands/hypothesis-analyze.d.ts +12 -0
  192. package/cli/dist/modules/fund/nsfc/commands/hypothesis-analyze.d.ts.map +1 -0
  193. package/cli/dist/modules/fund/nsfc/commands/hypothesis-analyze.js +351 -0
  194. package/cli/dist/modules/fund/nsfc/commands/hypothesis-analyze.js.map +1 -0
  195. package/cli/dist/modules/fund/nsfc/commands/hypothesis-create.d.ts +21 -0
  196. package/cli/dist/modules/fund/nsfc/commands/hypothesis-create.d.ts.map +1 -0
  197. package/cli/dist/modules/fund/nsfc/commands/hypothesis-create.js +197 -0
  198. package/cli/dist/modules/fund/nsfc/commands/hypothesis-create.js.map +1 -0
  199. package/cli/dist/modules/fund/nsfc/commands/hypothesis-figure.d.ts +9 -0
  200. package/cli/dist/modules/fund/nsfc/commands/hypothesis-figure.d.ts.map +1 -0
  201. package/cli/dist/modules/fund/nsfc/commands/hypothesis-figure.js +120 -0
  202. package/cli/dist/modules/fund/nsfc/commands/hypothesis-figure.js.map +1 -0
  203. package/cli/dist/modules/fund/nsfc/commands/hypothesis-genes-select.d.ts +11 -0
  204. package/cli/dist/modules/fund/nsfc/commands/hypothesis-genes-select.d.ts.map +1 -0
  205. package/cli/dist/modules/fund/nsfc/commands/hypothesis-genes-select.js +125 -0
  206. package/cli/dist/modules/fund/nsfc/commands/hypothesis-genes-select.js.map +1 -0
  207. package/cli/dist/modules/fund/nsfc/commands/hypothesis-pick.d.ts +11 -0
  208. package/cli/dist/modules/fund/nsfc/commands/hypothesis-pick.d.ts.map +1 -0
  209. package/cli/dist/modules/fund/nsfc/commands/hypothesis-pick.js +109 -0
  210. package/cli/dist/modules/fund/nsfc/commands/hypothesis-pick.js.map +1 -0
  211. package/cli/dist/modules/fund/nsfc/commands/outline-confirm.d.ts +9 -0
  212. package/cli/dist/modules/fund/nsfc/commands/outline-confirm.d.ts.map +1 -0
  213. package/cli/dist/modules/fund/nsfc/commands/outline-confirm.js +64 -0
  214. package/cli/dist/modules/fund/nsfc/commands/outline-confirm.js.map +1 -0
  215. package/cli/dist/modules/fund/nsfc/commands/outline-create.d.ts +8 -0
  216. package/cli/dist/modules/fund/nsfc/commands/outline-create.d.ts.map +1 -0
  217. package/cli/dist/modules/fund/nsfc/commands/outline-create.js +103 -0
  218. package/cli/dist/modules/fund/nsfc/commands/outline-create.js.map +1 -0
  219. package/cli/dist/modules/fund/nsfc/commands/research-path-confirm.d.ts +9 -0
  220. package/cli/dist/modules/fund/nsfc/commands/research-path-confirm.d.ts.map +1 -0
  221. package/cli/dist/modules/fund/nsfc/commands/research-path-confirm.js +176 -0
  222. package/cli/dist/modules/fund/nsfc/commands/research-path-confirm.js.map +1 -0
  223. package/cli/dist/modules/fund/nsfc/commands/tech-roadmap.d.ts +9 -0
  224. package/cli/dist/modules/fund/nsfc/commands/tech-roadmap.d.ts.map +1 -0
  225. package/cli/dist/modules/fund/nsfc/commands/tech-roadmap.js +190 -0
  226. package/cli/dist/modules/fund/nsfc/commands/tech-roadmap.js.map +1 -0
  227. package/cli/dist/modules/fund/nsfc/constants.d.ts +96 -0
  228. package/cli/dist/modules/fund/nsfc/constants.d.ts.map +1 -0
  229. package/cli/dist/modules/fund/nsfc/constants.js +156 -0
  230. package/cli/dist/modules/fund/nsfc/constants.js.map +1 -0
  231. package/cli/dist/modules/fund/nsfc/graph-render.d.ts +25 -0
  232. package/cli/dist/modules/fund/nsfc/graph-render.d.ts.map +1 -0
  233. package/cli/dist/modules/fund/nsfc/graph-render.js +212 -0
  234. package/cli/dist/modules/fund/nsfc/graph-render.js.map +1 -0
  235. package/cli/dist/modules/fund/nsfc/index.d.ts +4 -0
  236. package/cli/dist/modules/fund/nsfc/index.d.ts.map +1 -0
  237. package/cli/dist/modules/fund/nsfc/index.js +238 -0
  238. package/cli/dist/modules/fund/nsfc/index.js.map +1 -0
  239. package/cli/dist/modules/fund/nsfc/mermaid-render.d.ts +18 -0
  240. package/cli/dist/modules/fund/nsfc/mermaid-render.d.ts.map +1 -0
  241. package/cli/dist/modules/fund/nsfc/mermaid-render.js +47 -0
  242. package/cli/dist/modules/fund/nsfc/mermaid-render.js.map +1 -0
  243. package/cli/dist/modules/fund/nsfc/parse-hypothesis.d.ts +76 -0
  244. package/cli/dist/modules/fund/nsfc/parse-hypothesis.d.ts.map +1 -0
  245. package/cli/dist/modules/fund/nsfc/parse-hypothesis.js +278 -0
  246. package/cli/dist/modules/fund/nsfc/parse-hypothesis.js.map +1 -0
  247. package/cli/dist/modules/fund/nsfc/parse-outline.d.ts +23 -0
  248. package/cli/dist/modules/fund/nsfc/parse-outline.d.ts.map +1 -0
  249. package/cli/dist/modules/fund/nsfc/parse-outline.js +91 -0
  250. package/cli/dist/modules/fund/nsfc/parse-outline.js.map +1 -0
  251. package/cli/dist/modules/fund/nsfc/png-watermark.d.ts +24 -0
  252. package/cli/dist/modules/fund/nsfc/png-watermark.d.ts.map +1 -0
  253. package/cli/dist/modules/fund/nsfc/png-watermark.js +78 -0
  254. package/cli/dist/modules/fund/nsfc/png-watermark.js.map +1 -0
  255. package/cli/dist/modules/fund/nsfc/prompt-hypothesis.d.ts +20 -0
  256. package/cli/dist/modules/fund/nsfc/prompt-hypothesis.d.ts.map +1 -0
  257. package/cli/dist/modules/fund/nsfc/prompt-hypothesis.js +107 -0
  258. package/cli/dist/modules/fund/nsfc/prompt-hypothesis.js.map +1 -0
  259. package/cli/dist/modules/fund/nsfc/prompt-step2.d.ts +18 -0
  260. package/cli/dist/modules/fund/nsfc/prompt-step2.d.ts.map +1 -0
  261. package/cli/dist/modules/fund/nsfc/prompt-step2.js +107 -0
  262. package/cli/dist/modules/fund/nsfc/prompt-step2.js.map +1 -0
  263. package/cli/dist/modules/fund/nsfc/request-body.d.ts +47 -0
  264. package/cli/dist/modules/fund/nsfc/request-body.d.ts.map +1 -0
  265. package/cli/dist/modules/fund/nsfc/request-body.js +38 -0
  266. package/cli/dist/modules/fund/nsfc/request-body.js.map +1 -0
  267. package/cli/dist/modules/fund/nsfc/session-cache.d.ts +48 -0
  268. package/cli/dist/modules/fund/nsfc/session-cache.d.ts.map +1 -0
  269. package/cli/dist/modules/fund/nsfc/session-cache.js +90 -0
  270. package/cli/dist/modules/fund/nsfc/session-cache.js.map +1 -0
  271. package/cli/dist/modules/fund/nsfc/sse-utils.d.ts +22 -0
  272. package/cli/dist/modules/fund/nsfc/sse-utils.d.ts.map +1 -0
  273. package/cli/dist/modules/fund/nsfc/sse-utils.js +81 -0
  274. package/cli/dist/modules/fund/nsfc/sse-utils.js.map +1 -0
  275. package/cli/dist/modules/fund/nsfc/upload.d.ts +3 -0
  276. package/cli/dist/modules/fund/nsfc/upload.d.ts.map +1 -0
  277. package/cli/dist/modules/fund/nsfc/upload.js +59 -0
  278. package/cli/dist/modules/fund/nsfc/upload.js.map +1 -0
  279. package/cli/dist/modules/fund/nsfc/validate.d.ts +30 -0
  280. package/cli/dist/modules/fund/nsfc/validate.d.ts.map +1 -0
  281. package/cli/dist/modules/fund/nsfc/validate.js +91 -0
  282. package/cli/dist/modules/fund/nsfc/validate.js.map +1 -0
  283. package/cli/dist/modules/literature/commands/workflow-list.d.ts +5 -0
  284. package/cli/dist/modules/literature/commands/workflow-list.d.ts.map +1 -0
  285. package/cli/dist/modules/literature/commands/workflow-list.js +9 -0
  286. package/cli/dist/modules/literature/commands/workflow-list.js.map +1 -0
  287. package/cli/dist/modules/literature/commands/workflow-params.d.ts +6 -0
  288. package/cli/dist/modules/literature/commands/workflow-params.d.ts.map +1 -0
  289. package/cli/dist/modules/literature/commands/workflow-params.js +9 -0
  290. package/cli/dist/modules/literature/commands/workflow-params.js.map +1 -0
  291. package/cli/dist/modules/literature/commands/workflow-run.d.ts +7 -0
  292. package/cli/dist/modules/literature/commands/workflow-run.d.ts.map +1 -0
  293. package/cli/dist/modules/literature/commands/workflow-run.js +10 -0
  294. package/cli/dist/modules/literature/commands/workflow-run.js.map +1 -0
  295. package/cli/dist/modules/literature/constants.d.ts +20 -0
  296. package/cli/dist/modules/literature/constants.d.ts.map +1 -0
  297. package/cli/dist/modules/literature/constants.js +56 -0
  298. package/cli/dist/modules/literature/constants.js.map +1 -0
  299. package/cli/dist/modules/literature/index.d.ts +3 -0
  300. package/cli/dist/modules/literature/index.d.ts.map +1 -0
  301. package/cli/dist/modules/literature/index.js +63 -0
  302. package/cli/dist/modules/literature/index.js.map +1 -0
  303. package/cli/dist/modules/meta/analysis.d.ts +127 -0
  304. package/cli/dist/modules/meta/analysis.d.ts.map +1 -0
  305. package/cli/dist/modules/meta/analysis.js +1165 -0
  306. package/cli/dist/modules/meta/analysis.js.map +1 -0
  307. package/cli/dist/modules/meta/api.d.ts +11 -0
  308. package/cli/dist/modules/meta/api.d.ts.map +1 -0
  309. package/cli/dist/modules/meta/api.js +40 -0
  310. package/cli/dist/modules/meta/api.js.map +1 -0
  311. package/cli/dist/modules/meta/commands.d.ts +3 -0
  312. package/cli/dist/modules/meta/commands.d.ts.map +1 -0
  313. package/cli/dist/modules/meta/commands.js +1185 -0
  314. package/cli/dist/modules/meta/commands.js.map +1 -0
  315. package/cli/dist/modules/meta/constants.d.ts +8 -0
  316. package/cli/dist/modules/meta/constants.d.ts.map +1 -0
  317. package/cli/dist/modules/meta/constants.js +9 -0
  318. package/cli/dist/modules/meta/constants.js.map +1 -0
  319. package/cli/dist/modules/meta/extraction.d.ts +206 -0
  320. package/cli/dist/modules/meta/extraction.d.ts.map +1 -0
  321. package/cli/dist/modules/meta/extraction.js +1248 -0
  322. package/cli/dist/modules/meta/extraction.js.map +1 -0
  323. package/cli/dist/modules/meta/index.d.ts +3 -0
  324. package/cli/dist/modules/meta/index.d.ts.map +1 -0
  325. package/cli/dist/modules/meta/index.js +19 -0
  326. package/cli/dist/modules/meta/index.js.map +1 -0
  327. package/cli/dist/modules/meta/node.d.ts +70 -0
  328. package/cli/dist/modules/meta/node.d.ts.map +1 -0
  329. package/cli/dist/modules/meta/node.js +167 -0
  330. package/cli/dist/modules/meta/node.js.map +1 -0
  331. package/cli/dist/modules/meta/plot-params.d.ts +82 -0
  332. package/cli/dist/modules/meta/plot-params.d.ts.map +1 -0
  333. package/cli/dist/modules/meta/plot-params.js +1179 -0
  334. package/cli/dist/modules/meta/plot-params.js.map +1 -0
  335. package/cli/dist/modules/meta/prisma-flow-docx.d.ts +23 -0
  336. package/cli/dist/modules/meta/prisma-flow-docx.d.ts.map +1 -0
  337. package/cli/dist/modules/meta/prisma-flow-docx.js +302 -0
  338. package/cli/dist/modules/meta/prisma-flow-docx.js.map +1 -0
  339. package/cli/dist/modules/meta/retrieve.d.ts +113 -0
  340. package/cli/dist/modules/meta/retrieve.d.ts.map +1 -0
  341. package/cli/dist/modules/meta/retrieve.js +913 -0
  342. package/cli/dist/modules/meta/retrieve.js.map +1 -0
  343. package/cli/dist/modules/meta/screening.d.ts +179 -0
  344. package/cli/dist/modules/meta/screening.d.ts.map +1 -0
  345. package/cli/dist/modules/meta/screening.js +1255 -0
  346. package/cli/dist/modules/meta/screening.js.map +1 -0
  347. package/cli/dist/modules/meta/topic.d.ts +110 -0
  348. package/cli/dist/modules/meta/topic.d.ts.map +1 -0
  349. package/cli/dist/modules/meta/topic.js +865 -0
  350. package/cli/dist/modules/meta/topic.js.map +1 -0
  351. package/cli/dist/modules/meta/types.d.ts +49 -0
  352. package/cli/dist/modules/meta/types.d.ts.map +1 -0
  353. package/cli/dist/modules/meta/types.js +2 -0
  354. package/cli/dist/modules/meta/types.js.map +1 -0
  355. package/cli/dist/modules/meta/workflow.d.ts +154 -0
  356. package/cli/dist/modules/meta/workflow.d.ts.map +1 -0
  357. package/cli/dist/modules/meta/workflow.js +956 -0
  358. package/cli/dist/modules/meta/workflow.js.map +1 -0
  359. package/cli/dist/modules/meta/writing.d.ts +83 -0
  360. package/cli/dist/modules/meta/writing.d.ts.map +1 -0
  361. package/cli/dist/modules/meta/writing.js +1077 -0
  362. package/cli/dist/modules/meta/writing.js.map +1 -0
  363. package/cli/dist/modules/proposal/artifacts.d.ts +18 -0
  364. package/cli/dist/modules/proposal/artifacts.d.ts.map +1 -0
  365. package/cli/dist/modules/proposal/artifacts.js +43 -0
  366. package/cli/dist/modules/proposal/artifacts.js.map +1 -0
  367. package/cli/dist/modules/proposal/commands/basic-create.d.ts +22 -0
  368. package/cli/dist/modules/proposal/commands/basic-create.d.ts.map +1 -0
  369. package/cli/dist/modules/proposal/commands/basic-create.js +81 -0
  370. package/cli/dist/modules/proposal/commands/basic-create.js.map +1 -0
  371. package/cli/dist/modules/proposal/commands/basic-result.d.ts +24 -0
  372. package/cli/dist/modules/proposal/commands/basic-result.d.ts.map +1 -0
  373. package/cli/dist/modules/proposal/commands/basic-result.js +96 -0
  374. package/cli/dist/modules/proposal/commands/basic-result.js.map +1 -0
  375. package/cli/dist/modules/proposal/commands/bioinfo-params.d.ts +5 -0
  376. package/cli/dist/modules/proposal/commands/bioinfo-params.d.ts.map +1 -0
  377. package/cli/dist/modules/proposal/commands/bioinfo-params.js +9 -0
  378. package/cli/dist/modules/proposal/commands/bioinfo-params.js.map +1 -0
  379. package/cli/dist/modules/proposal/commands/bioinfo-run.d.ts +6 -0
  380. package/cli/dist/modules/proposal/commands/bioinfo-run.d.ts.map +1 -0
  381. package/cli/dist/modules/proposal/commands/bioinfo-run.js +10 -0
  382. package/cli/dist/modules/proposal/commands/bioinfo-run.js.map +1 -0
  383. package/cli/dist/modules/proposal/commands/clinical-list.d.ts +5 -0
  384. package/cli/dist/modules/proposal/commands/clinical-list.d.ts.map +1 -0
  385. package/cli/dist/modules/proposal/commands/clinical-list.js +9 -0
  386. package/cli/dist/modules/proposal/commands/clinical-list.js.map +1 -0
  387. package/cli/dist/modules/proposal/commands/clinical-params.d.ts +6 -0
  388. package/cli/dist/modules/proposal/commands/clinical-params.d.ts.map +1 -0
  389. package/cli/dist/modules/proposal/commands/clinical-params.js +9 -0
  390. package/cli/dist/modules/proposal/commands/clinical-params.js.map +1 -0
  391. package/cli/dist/modules/proposal/commands/clinical-run.d.ts +7 -0
  392. package/cli/dist/modules/proposal/commands/clinical-run.d.ts.map +1 -0
  393. package/cli/dist/modules/proposal/commands/clinical-run.js +10 -0
  394. package/cli/dist/modules/proposal/commands/clinical-run.js.map +1 -0
  395. package/cli/dist/modules/proposal/constants.d.ts +34 -0
  396. package/cli/dist/modules/proposal/constants.d.ts.map +1 -0
  397. package/cli/dist/modules/proposal/constants.js +75 -0
  398. package/cli/dist/modules/proposal/constants.js.map +1 -0
  399. package/cli/dist/modules/proposal/index.d.ts +3 -0
  400. package/cli/dist/modules/proposal/index.d.ts.map +1 -0
  401. package/cli/dist/modules/proposal/index.js +95 -0
  402. package/cli/dist/modules/proposal/index.js.map +1 -0
  403. package/cli/dist/modules/proposal/newidea-env.d.ts +28 -0
  404. package/cli/dist/modules/proposal/newidea-env.d.ts.map +1 -0
  405. package/cli/dist/modules/proposal/newidea-env.js +69 -0
  406. package/cli/dist/modules/proposal/newidea-env.js.map +1 -0
  407. package/cli/dist/modules/proposal/newidea-runner.d.ts +25 -0
  408. package/cli/dist/modules/proposal/newidea-runner.d.ts.map +1 -0
  409. package/cli/dist/modules/proposal/newidea-runner.js +158 -0
  410. package/cli/dist/modules/proposal/newidea-runner.js.map +1 -0
  411. package/cli/dist/modules/proposal/parse.d.ts +25 -0
  412. package/cli/dist/modules/proposal/parse.d.ts.map +1 -0
  413. package/cli/dist/modules/proposal/parse.js +173 -0
  414. package/cli/dist/modules/proposal/parse.js.map +1 -0
  415. package/cli/dist/modules/sci/apps.d.ts +48 -0
  416. package/cli/dist/modules/sci/apps.d.ts.map +1 -0
  417. package/cli/dist/modules/sci/apps.js +43 -0
  418. package/cli/dist/modules/sci/apps.js.map +1 -0
  419. package/cli/dist/modules/sci/article-cache.d.ts +32 -0
  420. package/cli/dist/modules/sci/article-cache.d.ts.map +1 -0
  421. package/cli/dist/modules/sci/article-cache.js +163 -0
  422. package/cli/dist/modules/sci/article-cache.js.map +1 -0
  423. package/cli/dist/modules/sci/article-validate.d.ts +11 -0
  424. package/cli/dist/modules/sci/article-validate.d.ts.map +1 -0
  425. package/cli/dist/modules/sci/article-validate.js +43 -0
  426. package/cli/dist/modules/sci/article-validate.js.map +1 -0
  427. package/cli/dist/modules/sci/commands/article-create.d.ts +46 -0
  428. package/cli/dist/modules/sci/commands/article-create.d.ts.map +1 -0
  429. package/cli/dist/modules/sci/commands/article-create.js +315 -0
  430. package/cli/dist/modules/sci/commands/article-create.js.map +1 -0
  431. package/cli/dist/modules/sci/commands/article-download.d.ts +50 -0
  432. package/cli/dist/modules/sci/commands/article-download.d.ts.map +1 -0
  433. package/cli/dist/modules/sci/commands/article-download.js +281 -0
  434. package/cli/dist/modules/sci/commands/article-download.js.map +1 -0
  435. package/cli/dist/modules/sci/commands/outline.d.ts +36 -0
  436. package/cli/dist/modules/sci/commands/outline.d.ts.map +1 -0
  437. package/cli/dist/modules/sci/commands/outline.js +491 -0
  438. package/cli/dist/modules/sci/commands/outline.js.map +1 -0
  439. package/cli/dist/modules/sci/commands/template.d.ts +9 -0
  440. package/cli/dist/modules/sci/commands/template.d.ts.map +1 -0
  441. package/cli/dist/modules/sci/commands/template.js +12 -0
  442. package/cli/dist/modules/sci/commands/template.js.map +1 -0
  443. package/cli/dist/modules/sci/commands.d.ts +3 -0
  444. package/cli/dist/modules/sci/commands.d.ts.map +1 -0
  445. package/cli/dist/modules/sci/commands.js +108 -0
  446. package/cli/dist/modules/sci/commands.js.map +1 -0
  447. package/cli/dist/modules/sci/constants.d.ts +117 -0
  448. package/cli/dist/modules/sci/constants.d.ts.map +1 -0
  449. package/cli/dist/modules/sci/constants.js +152 -0
  450. package/cli/dist/modules/sci/constants.js.map +1 -0
  451. package/cli/dist/modules/sci/content-source.d.ts +18 -0
  452. package/cli/dist/modules/sci/content-source.d.ts.map +1 -0
  453. package/cli/dist/modules/sci/content-source.js +54 -0
  454. package/cli/dist/modules/sci/content-source.js.map +1 -0
  455. package/cli/dist/modules/sci/index.d.ts +3 -0
  456. package/cli/dist/modules/sci/index.d.ts.map +1 -0
  457. package/cli/dist/modules/sci/index.js +19 -0
  458. package/cli/dist/modules/sci/index.js.map +1 -0
  459. package/cli/dist/modules/sci/outline-transform.d.ts +16 -0
  460. package/cli/dist/modules/sci/outline-transform.d.ts.map +1 -0
  461. package/cli/dist/modules/sci/outline-transform.js +67 -0
  462. package/cli/dist/modules/sci/outline-transform.js.map +1 -0
  463. package/cli/dist/modules/sci/precheck-cache.d.ts +23 -0
  464. package/cli/dist/modules/sci/precheck-cache.d.ts.map +1 -0
  465. package/cli/dist/modules/sci/precheck-cache.js +141 -0
  466. package/cli/dist/modules/sci/precheck-cache.js.map +1 -0
  467. package/cli/dist/modules/sci/prompt-article.d.ts +12 -0
  468. package/cli/dist/modules/sci/prompt-article.d.ts.map +1 -0
  469. package/cli/dist/modules/sci/prompt-article.js +37 -0
  470. package/cli/dist/modules/sci/prompt-article.js.map +1 -0
  471. package/cli/dist/modules/sci/prompt-precheck.d.ts +16 -0
  472. package/cli/dist/modules/sci/prompt-precheck.d.ts.map +1 -0
  473. package/cli/dist/modules/sci/prompt-precheck.js +61 -0
  474. package/cli/dist/modules/sci/prompt-precheck.js.map +1 -0
  475. package/cli/dist/modules/sci/sse-utils.d.ts +50 -0
  476. package/cli/dist/modules/sci/sse-utils.d.ts.map +1 -0
  477. package/cli/dist/modules/sci/sse-utils.js +207 -0
  478. package/cli/dist/modules/sci/sse-utils.js.map +1 -0
  479. package/cli/dist/modules/shared/result-wrapper.d.ts +71 -0
  480. package/cli/dist/modules/shared/result-wrapper.d.ts.map +1 -0
  481. package/cli/dist/modules/shared/result-wrapper.js +95 -0
  482. package/cli/dist/modules/shared/result-wrapper.js.map +1 -0
  483. package/cli/dist/modules/shared/workflow-app/api.d.ts +6 -0
  484. package/cli/dist/modules/shared/workflow-app/api.d.ts.map +1 -0
  485. package/cli/dist/modules/shared/workflow-app/api.js +31 -0
  486. package/cli/dist/modules/shared/workflow-app/api.js.map +1 -0
  487. package/cli/dist/modules/shared/workflow-app/command.d.ts +30 -0
  488. package/cli/dist/modules/shared/workflow-app/command.d.ts.map +1 -0
  489. package/cli/dist/modules/shared/workflow-app/command.js +183 -0
  490. package/cli/dist/modules/shared/workflow-app/command.js.map +1 -0
  491. package/cli/dist/modules/shared/workflow-app/constants.d.ts +12 -0
  492. package/cli/dist/modules/shared/workflow-app/constants.d.ts.map +1 -0
  493. package/cli/dist/modules/shared/workflow-app/constants.js +21 -0
  494. package/cli/dist/modules/shared/workflow-app/constants.js.map +1 -0
  495. package/cli/dist/modules/shared/workflow-app/form.d.ts +21 -0
  496. package/cli/dist/modules/shared/workflow-app/form.d.ts.map +1 -0
  497. package/cli/dist/modules/shared/workflow-app/form.js +123 -0
  498. package/cli/dist/modules/shared/workflow-app/form.js.map +1 -0
  499. package/cli/dist/modules/shared/workflow-app/index.d.ts +8 -0
  500. package/cli/dist/modules/shared/workflow-app/index.d.ts.map +1 -0
  501. package/cli/dist/modules/shared/workflow-app/index.js +7 -0
  502. package/cli/dist/modules/shared/workflow-app/index.js.map +1 -0
  503. package/cli/dist/modules/shared/workflow-app/run.d.ts +15 -0
  504. package/cli/dist/modules/shared/workflow-app/run.d.ts.map +1 -0
  505. package/cli/dist/modules/shared/workflow-app/run.js +71 -0
  506. package/cli/dist/modules/shared/workflow-app/run.js.map +1 -0
  507. package/cli/dist/modules/shared/workflow-app/types.d.ts +74 -0
  508. package/cli/dist/modules/shared/workflow-app/types.d.ts.map +1 -0
  509. package/cli/dist/modules/shared/workflow-app/types.js +3 -0
  510. package/cli/dist/modules/shared/workflow-app/types.js.map +1 -0
  511. package/cli/dist/modules/site-configs.d.ts +4 -0
  512. package/cli/dist/modules/site-configs.d.ts.map +1 -0
  513. package/cli/dist/modules/site-configs.js +21 -0
  514. package/cli/dist/modules/site-configs.js.map +1 -0
  515. package/cli/dist/modules/upgrade/index.d.ts +6 -0
  516. package/cli/dist/modules/upgrade/index.d.ts.map +1 -0
  517. package/cli/dist/modules/upgrade/index.js +105 -0
  518. package/cli/dist/modules/upgrade/index.js.map +1 -0
  519. package/cli/dist/program.d.ts +3 -0
  520. package/cli/dist/program.d.ts.map +1 -0
  521. package/cli/dist/program.js +69 -0
  522. package/cli/dist/program.js.map +1 -0
  523. package/package.json +37 -0
@@ -0,0 +1,190 @@
1
+ import { helixlifeError, helixlifeErrorCode, } from "../../../core/index.js";
2
+ export const EMPTY_CLINICAL_FOUR_ELEMENTS_DRAFT = {
3
+ design: "",
4
+ purpose: "",
5
+ outcome: "",
6
+ sample: "",
7
+ sampleParam: "",
8
+ designEditableFields: [],
9
+ };
10
+ /**
11
+ * 对齐原站 ClinicalFourElementsCheck:
12
+ * `canEditDesign = (design_editable_fields?.length ?? 0) > 0`
13
+ */
14
+ export function canEditFourElementsDesign(draft) {
15
+ return (draft.designEditableFields?.length ?? 0) > 0;
16
+ }
17
+ function asText(value) {
18
+ return typeof value === "string" ? value : String(value ?? "");
19
+ }
20
+ function parseDesignEditableFields(value) {
21
+ if (!Array.isArray(value))
22
+ return [];
23
+ const result = [];
24
+ for (const item of value) {
25
+ if (!item || typeof item !== "object")
26
+ continue;
27
+ const raw = item;
28
+ const field = asText(raw.field).trim();
29
+ if (!field)
30
+ continue;
31
+ const options = Array.isArray(raw.value_option)
32
+ ? raw.value_option
33
+ .filter((option) => !!option && typeof option === "object")
34
+ .map((option) => ({
35
+ label: asText(option.label).trim(),
36
+ description: asText(option.description).trim(),
37
+ }))
38
+ .filter((option) => option.label)
39
+ : [];
40
+ result.push({
41
+ field,
42
+ ori_label: asText(raw.ori_label).trim(),
43
+ new_label: asText(raw.new_label).trim(),
44
+ value_option: options,
45
+ });
46
+ }
47
+ return result;
48
+ }
49
+ /** 初次四要素/目的同步 outputs:优先 new_*,兼容旧字段。 */
50
+ export function pickClinicalFourElementsFromOutputs(outputs) {
51
+ return {
52
+ design: asText(outputs.new_design_text ?? outputs.design_text),
53
+ purpose: asText(outputs.new_purpose_text ?? outputs.purpose_text),
54
+ outcome: asText(outputs.new_outcome_text ?? outputs.outcome_text),
55
+ sample: asText(outputs.sample_text),
56
+ // 网页初次生成和目的同步均不读取 sample_param;个性化计算后才赋值。
57
+ sampleParam: "",
58
+ designEditableFields: parseDesignEditableFields(outputs.design_editable_fields),
59
+ };
60
+ }
61
+ /** 仅用非空工作流结果覆盖本地草稿,避免迟到空值抹掉编辑。 */
62
+ export function mergeClinicalFourElementsDraft(previous, outputs) {
63
+ const next = pickClinicalFourElementsFromOutputs(outputs);
64
+ return {
65
+ design: next.design.trim() ? next.design : previous.design,
66
+ purpose: next.purpose.trim() ? next.purpose : previous.purpose,
67
+ outcome: next.outcome.trim() ? next.outcome : previous.outcome,
68
+ sample: next.sample.trim() ? next.sample : previous.sample,
69
+ sampleParam: previous.sampleParam,
70
+ designEditableFields: next.designEditableFields.length > 0
71
+ ? next.designEditableFields
72
+ : previous.designEditableFields,
73
+ };
74
+ }
75
+ export function patchOutcomeSampleFromOutputs(draft, outputs) {
76
+ const next = pickClinicalFourElementsFromOutputs(outputs);
77
+ return {
78
+ ...draft,
79
+ outcome: next.outcome.trim() ? next.outcome : draft.outcome,
80
+ sample: next.sample.trim() ? next.sample : draft.sample,
81
+ // 目的变更后旧的个性化参数包已不再与新结局一致。
82
+ sampleParam: "",
83
+ };
84
+ }
85
+ export function buildPurposeSyncInputs(topicInputs, draft) {
86
+ return {
87
+ ...topicInputs,
88
+ purpose_text: draft.purpose,
89
+ design_text: draft.design,
90
+ };
91
+ }
92
+ export function fourElementsDraftToWorkflowInputs(draft) {
93
+ return {
94
+ new_design_text: draft.design,
95
+ new_purpose_text: draft.purpose,
96
+ new_outcome_text: draft.outcome,
97
+ sample_param: draft.sampleParam.trim() || draft.sample,
98
+ };
99
+ }
100
+ export function validateFourElementsText(value, label) {
101
+ const text = value.trim();
102
+ if (!text) {
103
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `${label}不能为空`);
104
+ }
105
+ if (text.length > 500) {
106
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `${label}不能超过 500 个字符`);
107
+ }
108
+ return text;
109
+ }
110
+ export function validateFourElementsDraft(draft) {
111
+ const errors = {};
112
+ if (!draft.design.trim())
113
+ errors.design = "研究设计不能为空";
114
+ if (!draft.purpose.trim())
115
+ errors.purpose = "研究目的不能为空";
116
+ if (!draft.outcome.trim())
117
+ errors.outcome = "结局指标不能为空";
118
+ if (!(draft.sampleParam.trim() || draft.sample.trim())) {
119
+ errors.sample = "样本量计算不能为空";
120
+ }
121
+ return errors;
122
+ }
123
+ /** 研究设计只能选择工作流字典内的 label。 */
124
+ export function applyDesignEditableFieldSelections(draft, selections) {
125
+ if (draft.designEditableFields.length === 0) {
126
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "当前研究设计没有可修改字段");
127
+ }
128
+ const known = new Set(draft.designEditableFields.map((field) => field.field));
129
+ for (const key of Object.keys(selections)) {
130
+ if (!known.has(key)) {
131
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `研究设计字段 ${key} 不可修改`);
132
+ }
133
+ }
134
+ const nextFields = draft.designEditableFields.map((field) => {
135
+ const requested = selections[field.field]?.trim();
136
+ const fallback = field.new_label.trim() || field.value_option[0]?.label.trim() || "";
137
+ const selected = requested || fallback;
138
+ const allowed = field.value_option.map((option) => option.label);
139
+ if (!selected || !allowed.includes(selected)) {
140
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `${field.field} 的取值无效,可选: ${allowed.join(" | ")}`);
141
+ }
142
+ return { ...field, new_label: selected };
143
+ });
144
+ let design = draft.design;
145
+ for (let index = 0; index < draft.designEditableFields.length; index += 1) {
146
+ const before = draft.designEditableFields[index];
147
+ const after = nextFields[index];
148
+ const replacement = after.new_label.trim();
149
+ let current = before.new_label.trim();
150
+ if (!current || !design.includes(current)) {
151
+ current = before.ori_label.trim();
152
+ }
153
+ if (current && replacement && current !== replacement) {
154
+ design = design.split(current).join(replacement);
155
+ }
156
+ }
157
+ return { ...draft, design, designEditableFields: nextFields };
158
+ }
159
+ const PRECHECK_INPUT_KEYS = [
160
+ "new_design_text",
161
+ "new_purpose_text",
162
+ "new_outcome_text",
163
+ "sample_param",
164
+ ];
165
+ export function isFourElementsDraftDrifted(snapshot, draft) {
166
+ if (!snapshot)
167
+ return true;
168
+ const current = fourElementsDraftToWorkflowInputs(draft);
169
+ return PRECHECK_INPUT_KEYS.some((key) => String(snapshot[key] ?? "").trim() !==
170
+ String(current[key] ?? "").trim());
171
+ }
172
+ export function parseFourElementsProofreadOutputs(outputs) {
173
+ return {
174
+ content: asText(outputs.content).trim(),
175
+ outcome: outputs.result === "failed" ? "failed" : "success",
176
+ };
177
+ }
178
+ /** 对齐网页 Proofread 的临床 Markdown 标题预处理。 */
179
+ export function preprocessClinicalMarkdown(markdown) {
180
+ let text = markdown;
181
+ text = text.replace(/^###\s*申请人及团队信息\s*(?:\r?\n|$)/m, "## 申请人及团队信息\n");
182
+ text = text.replace(/\n###\s*申请人及团队信息\s*(?:\r?\n|$)/g, "\n\n## 申请人及团队信息\n");
183
+ text = text.replace(/^###\s*关键词\s*(?:\r?\n|$)/m, "## 关键词\n");
184
+ text = text.replace(/\n###\s*关键词\s*(?:\r?\n|$)/g, "\n\n## 关键词\n");
185
+ text = text.replace(/^###\s*Key\s*Words\s*(?:\r?\n|$)/gim, "## Key Words\n");
186
+ text = text.replace(/\n###\s*Key\s*Words\s*(?:\r?\n|$)/gi, "\n\n## Key Words\n");
187
+ text = text.replace(/^#\s*1\.\s*研究目的\s*(?:\r?\n|$)/m, "## 1. 研究目的\n");
188
+ return text.replace(/\n#\s*1\.\s*研究目的\s*(?:\r?\n|$)/g, "\n\n## 1. 研究目的\n");
189
+ }
190
+ //# sourceMappingURL=four-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"four-elements.js","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/four-elements.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AA8B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OAAO,CACjB,gCAAgC,EAChC,cAAc,CACf,CAAC;IACF,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,EACjC,kBAAkB,CACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerClinicalCommands(clinical: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBzC,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA4NhE"}
@@ -0,0 +1,176 @@
1
+ import { parseOutputFormat } from "../../../core/index.js";
2
+ import { runTopicEvaluationParameters } from "./commands/topic-evaluation-parameters.js";
3
+ import { runCreateTopicEvaluation } from "./commands/topic-evaluation-create.js";
4
+ import { runCreateFourElements } from "./commands/four-elements-create.js";
5
+ import { runUpdateFourElementsDesign, runUpdateFourElementsOutcome, runUpdateFourElementsPurpose, } from "./commands/four-elements-update.js";
6
+ import { runCalculateSampleSize, runSampleSizeParameters, } from "./commands/sample-size.js";
7
+ import { runPrecheckFourElements } from "./commands/four-elements-precheck.js";
8
+ import { runCreateClinicalArticle } from "./commands/article-create.js";
9
+ import { runDownloadClinicalArticle } from "./commands/article-download.js";
10
+ // 注册临床工作台子模块下的全部子命令
11
+ export function registerClinicalCommands(clinical) {
12
+ const topicEvaluation = clinical
13
+ .command("topic-evaluation")
14
+ .description("选题评估(第一步)");
15
+ // 参数查询:返回表单字段定义
16
+ topicEvaluation
17
+ .command("parameters")
18
+ .description("一次性查询表单字段及全部固定联动分支")
19
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
20
+ .action(async (opts) => {
21
+ await runTopicEvaluationParameters({
22
+ format: parseOutputFormat(opts.format),
23
+ });
24
+ });
25
+ // 选题评估:采集 → 校验 → 预检
26
+ topicEvaluation
27
+ .command("create")
28
+ .description("选题评估:采集表单 → 校验 → 调预检工作流 → 返回预检结果")
29
+ .option("--inputs-file <path>", "JSON 文件 {key: value},Agent 主推")
30
+ .option("--inputs <json>", "内联 JSON 对象(短输入)")
31
+ .option("--research-objective <value>", "研究类别(取值见 topic-evaluation parameters)")
32
+ .option("-y, --yes", "跳过交互确认,直接使用参数(需提供 inputs)")
33
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
34
+ .action(async (opts) => {
35
+ await runCreateTopicEvaluation({
36
+ inputsFile: opts.inputsFile,
37
+ inputs: opts.inputs,
38
+ researchObjective: opts.researchObjective,
39
+ yes: opts.yes,
40
+ format: parseOutputFormat(opts.format),
41
+ });
42
+ });
43
+ const fourElements = clinical
44
+ .command("four-elements")
45
+ .description("确认四要素(第二步)");
46
+ fourElements
47
+ .command("create")
48
+ .description("根据 Step1 输入生成研究设计、研究目的、结局指标和样本量")
49
+ .requiredOption("--inputs-file <path>", "Step1 data.inputs JSON 文件")
50
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
51
+ .action(async (opts) => {
52
+ await runCreateFourElements({
53
+ inputsFile: opts.inputsFile,
54
+ format: parseOutputFormat(opts.format),
55
+ });
56
+ });
57
+ fourElements
58
+ .command("design")
59
+ .description("研究设计受限字段管理")
60
+ .command("update")
61
+ .description("按工作流返回的字典选项修改研究设计")
62
+ .requiredOption("--session-id <id>", "四要素生成步骤返回的本地 sessionId")
63
+ .requiredOption("--selections-file <path>", "字段选择 JSON 文件")
64
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
65
+ .action(async (opts) => {
66
+ await runUpdateFourElementsDesign({
67
+ sessionId: opts.sessionId,
68
+ selectionsFile: opts.selectionsFile,
69
+ format: parseOutputFormat(opts.format),
70
+ });
71
+ });
72
+ fourElements
73
+ .command("purpose")
74
+ .description("研究目的管理")
75
+ .command("update")
76
+ .description("修改研究目的并重新生成结局指标和样本量")
77
+ .requiredOption("--session-id <id>", "临床流程本地 sessionId")
78
+ .requiredOption("--file <path>", "研究目的 UTF-8 文件")
79
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
80
+ .action(async (opts) => {
81
+ await runUpdateFourElementsPurpose({
82
+ sessionId: opts.sessionId,
83
+ file: opts.file,
84
+ format: parseOutputFormat(opts.format),
85
+ });
86
+ });
87
+ fourElements
88
+ .command("outcome")
89
+ .description("结局指标管理")
90
+ .command("update")
91
+ .description("自定义修改结局指标")
92
+ .requiredOption("--session-id <id>", "临床流程本地 sessionId")
93
+ .requiredOption("--file <path>", "结局指标 UTF-8 文件")
94
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
95
+ .action(async (opts) => {
96
+ await runUpdateFourElementsOutcome({
97
+ sessionId: opts.sessionId,
98
+ file: opts.file,
99
+ format: parseOutputFormat(opts.format),
100
+ });
101
+ });
102
+ const sampleSize = fourElements
103
+ .command("sample-size")
104
+ .description("样本量计算");
105
+ sampleSize
106
+ .command("parameters")
107
+ .description("逐级查询样本量分类及叶子参数表单")
108
+ .option("--path <ids...>", "已选择的分类 id 路径")
109
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
110
+ .action(async (opts) => {
111
+ await runSampleSizeParameters({
112
+ path: opts.path,
113
+ format: parseOutputFormat(opts.format),
114
+ });
115
+ });
116
+ sampleSize
117
+ .command("calculate")
118
+ .description("校验动态参数并计算样本量")
119
+ .requiredOption("--session-id <id>", "临床流程本地 sessionId")
120
+ .requiredOption("--path <ids...>", "完整分类 id 路径")
121
+ .requiredOption("--params-file <path>", "动态参数 JSON 文件")
122
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
123
+ .action(async (opts) => {
124
+ await runCalculateSampleSize({
125
+ sessionId: opts.sessionId,
126
+ path: opts.path,
127
+ paramsFile: opts.paramsFile,
128
+ format: parseOutputFormat(opts.format),
129
+ });
130
+ });
131
+ fourElements
132
+ .command("precheck")
133
+ .description("预检四要素;成功后方可生成全文")
134
+ .requiredOption("--session-id <id>", "临床流程本地 sessionId")
135
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
136
+ .action(async (opts) => {
137
+ await runPrecheckFourElements({
138
+ sessionId: opts.sessionId,
139
+ format: parseOutputFormat(opts.format),
140
+ });
141
+ });
142
+ const article = clinical
143
+ .command("article")
144
+ .description("临床申请书全文(第三步)");
145
+ article
146
+ .command("create")
147
+ .description("四要素预检成功后生成完整全文")
148
+ .requiredOption("--session-id <id>", "临床流程本地 sessionId")
149
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
150
+ .action(async (opts) => {
151
+ await runCreateClinicalArticle({
152
+ sessionId: opts.sessionId,
153
+ format: parseOutputFormat(opts.format),
154
+ });
155
+ });
156
+ article
157
+ .command("download")
158
+ .description("导出原始引文格式 Markdown 和 Word")
159
+ .option("--session-id <id>", "全文生成步骤返回的本地 sessionId")
160
+ .option("--file <path>", "全文 Markdown 文件(缓存缺失时兜底)")
161
+ .option("--references-file <path>", "参考文献 JSON 数组文件")
162
+ .option("-o, --output <path>", "输出 docx 路径或目录")
163
+ .option("--produce-id <id>", "AIGC produce_id,默认 workflow_run_id")
164
+ .option("--format <format>", "输出格式:markdown | json", "markdown")
165
+ .action(async (opts) => {
166
+ await runDownloadClinicalArticle({
167
+ sessionId: opts.sessionId,
168
+ file: opts.file,
169
+ referencesFile: opts.referencesFile,
170
+ output: opts.output,
171
+ produceId: opts.produceId,
172
+ format: parseOutputFormat(opts.format),
173
+ });
174
+ });
175
+ }
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OA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,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { type OutputFormat } from "../../../core/index.js";
2
+ import { type TopicEvaluationField, type TopicEvaluationFieldType } from "./constants.js";
3
+ /** 应用 label 覆盖 + 强制必填 + 优先排序(对齐 processTopicEvaluationFields) */
4
+ export declare function processTopicEvaluationFields(variables: TopicEvaluationField[]): TopicEvaluationField[];
5
+ /** clinical/apps/parameters 响应结构 */
6
+ export interface ClinicalParametersResponse {
7
+ success?: boolean;
8
+ data?: {
9
+ msg?: string;
10
+ data?: {
11
+ user_input_form?: unknown[];
12
+ };
13
+ };
14
+ message?: string;
15
+ [key: string]: unknown;
16
+ }
17
+ /** 拉取选题评估参数并解析为字段列表 */
18
+ export declare function fetchClinicalTopicEvaluationFields(): Promise<TopicEvaluationField[]>;
19
+ /** 用于 parameters 子命令的输出项 */
20
+ export interface TopicEvaluationParameterItem {
21
+ key: string;
22
+ name: string;
23
+ type: TopicEvaluationFieldType;
24
+ required: boolean;
25
+ /** 网页红色 * 的文字表达:必填 / 选填;提问时必须展示 */
26
+ requiredLabel: "必填" | "选填";
27
+ max_length?: number | null;
28
+ options: string[];
29
+ /** 对齐网页输入框 placeholder;自由文本采集时必须原样使用 */
30
+ placeholder?: string;
31
+ /**
32
+ * 自由文本完整提问句,Agent 必须原样使用:
33
+ * `{name}({requiredLabel}):{placeholder}`
34
+ */
35
+ prompt?: string;
36
+ /**
37
+ * 该字段仅在这些研究类别下可见。
38
+ * 缺省表示始终可见。顶层 fields 仅为目录,不得仅凭 required 采集。
39
+ */
40
+ visibleForObjectives?: string[];
41
+ }
42
+ export declare function fieldToParameterItem(field: TopicEvaluationField, researchObjective?: string): TopicEvaluationParameterItem;
43
+ /** 兜底:当 parameters 接口不可用时使用的内置字段定义(对齐源码常见 user_input_form) */
44
+ export declare const FALLBACK_TOPIC_EVALUATION_FIELDS: TopicEvaluationField[];
45
+ /** 拉取字段,接口失败时回退到内置定义 */
46
+ export declare function fetchClinicalTopicEvaluationFieldsWithFallback(): Promise<{
47
+ fields: TopicEvaluationField[];
48
+ fallback: boolean;
49
+ }>;
50
+ export type { OutputFormat };
51
+ //# sourceMappingURL=parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/parameters.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,gBAAgB,CAAC;AAoDxB,iEAAiE;AACjE,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CAkBtG;AAED,oCAAoC;AACpC,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE;YACL,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,uBAAuB;AACvB,wBAAsB,kCAAkC,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAa1F;AAED,4BAA4B;AAC5B,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,wBAAwB,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,EAC3B,iBAAiB,CAAC,EAAE,MAAM,GACzB,4BAA4B,CA0B9B;AAED,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,EAAE,oBAAoB,EAiBjE,CAAC;AAEH,wBAAwB;AACxB,wBAAsB,8CAA8C,IAAI,OAAO,CAAC;IAC9E,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAmBD;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,145 @@
1
+ // 临床选题评估参数拉取与解析
2
+ // 移植自 helix-workbench-platform/src/hooks/useClinicalTopicEvaluationParameters.ts
3
+ import { ApiClient, helixlifeError, helixlifeErrorCode, } from "../../../core/index.js";
4
+ import { CLINICAL_PARAMETERS_API_PATH, CLINICAL_TOPIC_EVALUATION_APP_ID, FORM_LABEL_MAP, FORM_ORDER, REQUIRED_KEY_SET, } from "./constants.js";
5
+ import { getFieldDisplayName, getFieldVisibleObjectives, resolveTopicEvaluationFieldPlaceholder, } from "./form-rules.js";
6
+ function parseUserInputRow(item) {
7
+ if (item.paragraph)
8
+ return { type: "paragraph", content: item.paragraph };
9
+ if (item["text-input"])
10
+ return { type: "string", content: item["text-input"] };
11
+ if (item.number)
12
+ return { type: "number", content: item.number };
13
+ if (item.select)
14
+ return { type: "select", content: item.select };
15
+ return null;
16
+ }
17
+ function rowToField(parsed) {
18
+ const { type, content } = parsed;
19
+ const variable = content?.variable;
20
+ if (!variable)
21
+ return null;
22
+ const base = {
23
+ key: variable,
24
+ name: String(content?.label ?? ""),
25
+ required: Boolean(content?.required),
26
+ max_length: content?.max_length ?? null,
27
+ options: Array.isArray(content?.options)
28
+ ? (content?.options).map(String)
29
+ : [],
30
+ };
31
+ if (type === "paragraph")
32
+ return { ...base, type: "paragraph", required: base.required };
33
+ if (type === "string")
34
+ return { ...base, type: "string", required: base.required };
35
+ if (type === "number")
36
+ return { ...base, type: "number", options: [] };
37
+ if (type === "select")
38
+ return { ...base, type: "select", required: base.required };
39
+ return null;
40
+ }
41
+ function userInputFormToFields(userInputForm) {
42
+ if (!userInputForm?.length)
43
+ return [];
44
+ const out = [];
45
+ for (const raw of userInputForm) {
46
+ const item = raw;
47
+ const parsed = parseUserInputRow(item);
48
+ if (!parsed)
49
+ continue;
50
+ const field = rowToField(parsed);
51
+ if (field)
52
+ out.push(field);
53
+ }
54
+ return out;
55
+ }
56
+ /** 应用 label 覆盖 + 强制必填 + 优先排序(对齐 processTopicEvaluationFields) */
57
+ export function processTopicEvaluationFields(variables) {
58
+ const orderMap = new Map(FORM_ORDER.map((key, index) => [key, index]));
59
+ const mapped = variables.map((item) => {
60
+ const withRequired = REQUIRED_KEY_SET.has(item.key)
61
+ ? { ...item, required: true }
62
+ : item;
63
+ const labelOverride = FORM_LABEL_MAP[withRequired.key];
64
+ return labelOverride !== undefined ? { ...withRequired, name: labelOverride } : withRequired;
65
+ });
66
+ return mapped.sort((a, b) => {
67
+ const ao = orderMap.get(a.key) ?? Number.MAX_SAFE_INTEGER;
68
+ const bo = orderMap.get(b.key) ?? Number.MAX_SAFE_INTEGER;
69
+ return ao - bo;
70
+ });
71
+ }
72
+ /** 拉取选题评估参数并解析为字段列表 */
73
+ export async function fetchClinicalTopicEvaluationFields() {
74
+ const client = new ApiClient();
75
+ const res = await client.request(CLINICAL_PARAMETERS_API_PATH, {
76
+ method: "GET",
77
+ params: { app_id: CLINICAL_TOPIC_EVALUATION_APP_ID },
78
+ });
79
+ const raw = res?.data?.data?.user_input_form ?? [];
80
+ const fields = userInputFormToFields(raw);
81
+ return processTopicEvaluationFields(fields);
82
+ }
83
+ export function fieldToParameterItem(field, researchObjective) {
84
+ const name = getFieldDisplayName(field, researchObjective);
85
+ const requiredLabel = field.required ? "必填" : "选填";
86
+ const placeholder = resolveTopicEvaluationFieldPlaceholder(field, researchObjective);
87
+ const isFreeText = field.type === "paragraph" ||
88
+ field.type === "string" ||
89
+ field.type === "number";
90
+ const visibleForObjectives = getFieldVisibleObjectives(field.key);
91
+ return {
92
+ key: field.key,
93
+ name,
94
+ type: field.type,
95
+ required: field.required,
96
+ requiredLabel,
97
+ max_length: field.max_length ?? null,
98
+ options: field.options,
99
+ placeholder,
100
+ prompt: isFreeText
101
+ ? `${name}(${requiredLabel}):${placeholder}`
102
+ : undefined,
103
+ ...(visibleForObjectives ? { visibleForObjectives } : {}),
104
+ };
105
+ }
106
+ /** 兜底:当 parameters 接口不可用时使用的内置字段定义(对齐源码常见 user_input_form) */
107
+ export const FALLBACK_TOPIC_EVALUATION_FIELDS = processTopicEvaluationFields([
108
+ { key: "Research_Objective", name: "研究类别", required: true, type: "select", options: ["疗效", "病因", "预后", "诊断"] },
109
+ { key: "Study_design", name: "研究设计", required: true, type: "select", options: ["队列研究", "临床试验", "病例对照", "横断面"] },
110
+ { key: "Temporal_direction", name: "时间方向", required: true, type: "select", options: ["前瞻性", "回顾性"] },
111
+ { key: "hospitals", name: "中心数", required: true, type: "select", options: ["单中心", "多中心"] },
112
+ { key: "P", name: "研究人群(Population)", required: true, type: "paragraph", max_length: 300, options: [] },
113
+ { key: "I", name: "干预(Intervention)", required: true, type: "paragraph", max_length: 300, options: [] },
114
+ { key: "C", name: "对照(Control)", required: false, type: "paragraph", max_length: 300, options: [] },
115
+ { key: "exposure_range1", name: "大类1", required: false, type: "select", options: ["环境因素", "行为因素", "遗传因素", "生理代谢", "社会心理"] },
116
+ { key: "exposure_range2", name: "大类2", required: false, type: "select", options: ["环境因素", "行为因素", "遗传因素", "生理代谢", "社会心理"] },
117
+ { key: "exposure_type1", name: "具体因素", required: false, type: "string", max_length: 100, options: [] },
118
+ { key: "exposure_type2", name: "具体因素", required: false, type: "string", max_length: 100, options: [] },
119
+ { key: "O", name: "主要结局", required: true, type: "paragraph", max_length: 300, options: [] },
120
+ { key: "F", name: "预后因子", required: true, type: "paragraph", max_length: 300, options: [] },
121
+ { key: "Prognosis_model", name: "是否建立预后模型", required: true, type: "select", options: ["是", "否"] },
122
+ { key: "Assess_prognosis", name: "是否评估干预对预后的影响", required: true, type: "select", options: ["是", "否"] },
123
+ { key: "diagnostic_model", name: "是否建立诊断模型", required: true, type: "select", options: ["是", "否"] },
124
+ ]);
125
+ /** 拉取字段,接口失败时回退到内置定义 */
126
+ export async function fetchClinicalTopicEvaluationFieldsWithFallback() {
127
+ try {
128
+ const fields = await fetchClinicalTopicEvaluationFields();
129
+ if (fields.length === 0) {
130
+ return { fields: FALLBACK_TOPIC_EVALUATION_FIELDS, fallback: true };
131
+ }
132
+ return { fields, fallback: false };
133
+ }
134
+ catch (error) {
135
+ if (error instanceof helixlifeError) {
136
+ // 未授权/网络错误等不回退,直接抛出
137
+ if (error.code === helixlifeErrorCode.NOT_AUTHENTICATED ||
138
+ error.code === helixlifeErrorCode.TOKEN_EXPIRED) {
139
+ throw error;
140
+ }
141
+ }
142
+ return { fields: FALLBACK_TOPIC_EVALUATION_FIELDS, fallback: true };
143
+ }
144
+ }
145
+ //# sourceMappingURL=parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/parameters.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,iFAAiF;AACjF,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,GAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,gBAAgB,GAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,sCAAsC,GACvC,MAAM,iBAAiB,CAAC;AAIzB,SAAS,iBAAiB,CAAC,IAA6B;IACtD,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EA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