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,22 @@
1
+ import { type OutputFormat } from "../../../core/index.js";
2
+ export interface StreamClinicalWorkflowOptions {
3
+ path: string;
4
+ body: unknown;
5
+ format?: OutputFormat;
6
+ startLabel: string;
7
+ progressLabel: string;
8
+ finishLabel: string;
9
+ failureMessage: string;
10
+ emptyMessage: string;
11
+ /** 为 true 时:有 outputs 即可成功,不强制要求 text */
12
+ allowEmptyText?: boolean;
13
+ }
14
+ export interface StreamClinicalWorkflowResult {
15
+ text: string;
16
+ elapsedTime?: number;
17
+ workflowRunId?: string;
18
+ outputs?: Record<string, unknown>;
19
+ }
20
+ /** 通用 SSE workflow 流式请求 */
21
+ export declare function streamClinicalWorkflow(options: StreamClinicalWorkflowOptions): Promise<StreamClinicalWorkflowResult>;
22
+ //# sourceMappingURL=sse-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-utils.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/sse-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,2BAA2B;AAC3B,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,4BAA4B,CAAC,CAyFvC"}
@@ -0,0 +1,80 @@
1
+ // 临床工作台 SSE workflow 流式请求:增量打印、进度心跳与结束态收集
2
+ // 仿 sci/sse-utils.ts 的 streamSseWorkflow,允许仅返回结构化 outputs(预检无正文 text)
3
+ import { ApiClient, helixlifeError, helixlifeErrorCode, createStderrProgress, extractSseText, assertWorkflowSucceeded, pickWorkflowOutputText, } from "../../../core/index.js";
4
+ /** 通用 SSE workflow 流式请求 */
5
+ export async function streamClinicalWorkflow(options) {
6
+ const client = new ApiClient();
7
+ const chunks = [];
8
+ let receivedLength = 0;
9
+ let overrideText;
10
+ let succeeded = false;
11
+ let elapsedTime;
12
+ let workflowRunId;
13
+ let finishedOutputs;
14
+ let streamedAny = false;
15
+ const streamToStdout = options.format !== "json";
16
+ if (streamToStdout) {
17
+ console.log(`${options.startLabel}\n`);
18
+ }
19
+ else {
20
+ process.stderr.write(`\n${options.startLabel}\n`);
21
+ }
22
+ const progress = createStderrProgress(!streamToStdout);
23
+ progress.start(options.progressLabel);
24
+ try {
25
+ await client.requestSse(options.path, { method: "POST", body: options.body }, (payload) => {
26
+ assertWorkflowSucceeded(payload, options.failureMessage, ["workflow_finished"]);
27
+ const chunk = extractSseText(payload, { nested: true });
28
+ if (chunk) {
29
+ chunks.push(chunk);
30
+ receivedLength += chunk.length;
31
+ progress.update(receivedLength);
32
+ if (streamToStdout) {
33
+ process.stdout.write(chunk);
34
+ streamedAny = true;
35
+ }
36
+ }
37
+ if (payload.event === "workflow_finished") {
38
+ const data = payload.data;
39
+ if (typeof data === "object" && data !== null) {
40
+ const record = data;
41
+ if (record.status === "succeeded") {
42
+ succeeded = true;
43
+ }
44
+ if (typeof record.elapsed_time === "number") {
45
+ elapsedTime = record.elapsed_time;
46
+ }
47
+ const outputs = record.outputs;
48
+ if (typeof outputs === "object" && outputs !== null) {
49
+ finishedOutputs = outputs;
50
+ const finishedText = pickWorkflowOutputText(finishedOutputs);
51
+ if (finishedText) {
52
+ overrideText = finishedText;
53
+ if (streamToStdout && !streamedAny) {
54
+ process.stdout.write(`${finishedText}\n`);
55
+ streamedAny = true;
56
+ }
57
+ }
58
+ }
59
+ }
60
+ if (typeof payload.workflow_run_id === "string") {
61
+ workflowRunId = payload.workflow_run_id;
62
+ }
63
+ }
64
+ });
65
+ }
66
+ catch (error) {
67
+ progress.dispose();
68
+ throw error;
69
+ }
70
+ progress.finish(options.finishLabel);
71
+ const text = overrideText ?? chunks.join("");
72
+ if (!text && !options.allowEmptyText) {
73
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, `${options.emptyMessage}(后端可能未返回有效输出内容,或接口响应超时)`);
74
+ }
75
+ if (!succeeded) {
76
+ throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, options.failureMessage);
77
+ }
78
+ return { text, elapsedTime, workflowRunId, outputs: finishedOutputs };
79
+ }
80
+ //# sourceMappingURL=sse-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-utils.js","sourceRoot":"","sources":["../../../../src/modules/fund/clinical/sse-utils.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,sEAAsE;AACtE,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAsBhC,2BAA2B;AAC3B,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,YAA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O,CAAC,WAAW,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE7C,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QACrC,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,GAAG,OAAO,CAAC,YAAY,yBAAyB,CACjD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,cAAc,CAAC,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const FUND_EXPERT_ID = "fund";
2
+ export declare const FUND_EXPERT_TITLE = "\u57FA\u91D1\u5199\u4F5C\u4E13\u5BB6";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/modules/fund/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,iBAAiB,yCAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export const FUND_EXPERT_ID = "fund";
2
+ export const FUND_EXPERT_TITLE = "基金写作专家";
3
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/modules/fund/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerFundCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/fund/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwB3D"}
@@ -0,0 +1,28 @@
1
+ import { emitJson } from "../../core/index.js";
2
+ import { FUND_EXPERT_ID, FUND_EXPERT_TITLE } from "./constants.js";
3
+ import { registerNsfcCommands } from "./nsfc/index.js";
4
+ import { registerClinicalCommands } from "./clinical/index.js";
5
+ // 注册基金写作专家命名空间:helixlife-expert fund <nsfc|clinical> …
6
+ export function registerFundCommands(program) {
7
+ const fund = program.command(FUND_EXPERT_ID).description(FUND_EXPERT_TITLE);
8
+ fund
9
+ .command("info")
10
+ .description("查看基金写作专家模块状态")
11
+ .action(() => {
12
+ emitJson({
13
+ ok: true,
14
+ expert: FUND_EXPERT_ID,
15
+ title: FUND_EXPERT_TITLE,
16
+ implemented: true,
17
+ });
18
+ });
19
+ const nsfc = fund
20
+ .command("nsfc")
21
+ .description("国自然基金申请书(四步:假说 → 确认 → 提纲 → 全文)");
22
+ registerNsfcCommands(nsfc);
23
+ const clinical = fund
24
+ .command("clinical")
25
+ .description("临床申请书(三步:选题评估 → 四要素 → 全文)");
26
+ registerClinicalCommands(clinical);
27
+ }
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/fund/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,uDAAuD;AACvD,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAE5E,IAAI;SACD,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,cAAc,CAAC;SAC3B,MAAM,CAAC,GAAG,EAAE;QACX,QAAQ,CAAC;YACP,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,MAAM,IAAI,GAAG,IAAI;SACd,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,gCAAgC,CAAC,CAAC;IACjD,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,IAAI;SAClB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAC5C,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,54 @@
1
+ export interface CreateNsfcOrderBody {
2
+ index: number;
3
+ count: number;
4
+ query?: string;
5
+ inputs?: Record<string, unknown>;
6
+ files?: string[];
7
+ parent_order_id: string | null;
8
+ }
9
+ export interface CreateNsfcOrderResult {
10
+ success?: boolean;
11
+ data?: {
12
+ msg?: string;
13
+ data?: {
14
+ order_id?: string;
15
+ };
16
+ };
17
+ message?: string;
18
+ /** true:orders 接口不可用时的本地会话 ID(对齐前端假说流可不建单) */
19
+ synthetic?: boolean;
20
+ [key: string]: unknown;
21
+ }
22
+ export interface NsfcExecuteBody {
23
+ response_mode: "streaming";
24
+ query: string;
25
+ inputs: Record<string, unknown>;
26
+ app_id: string;
27
+ app_name: string;
28
+ app_mode: "workflow";
29
+ app_type: 1;
30
+ index: number;
31
+ order_id: string;
32
+ end: boolean;
33
+ count: number;
34
+ parent_order_id: string | null;
35
+ }
36
+ export declare function buildNsfcExecuteBody(params: {
37
+ query?: string;
38
+ inputs: Record<string, unknown>;
39
+ appId: string;
40
+ appName: string;
41
+ index?: number;
42
+ orderId: string;
43
+ end?: boolean;
44
+ count?: number;
45
+ parentOrderId?: string | null;
46
+ }): NsfcExecuteBody;
47
+ /**
48
+ * 创建基金工作台订单。
49
+ * 当前部分环境未部署 nsfc-v2/apps/orders(404);假说类工作流前端本就不建单,
50
+ * 此时回退为本地 UUID,仍可走 apps/execute。
51
+ */
52
+ export declare function createNsfcOrder(body: CreateNsfcOrderBody): Promise<CreateNsfcOrderResult>;
53
+ export declare function extractNsfcOrderId(order: CreateNsfcOrderResult): string;
54
+ //# sourceMappingURL=apps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/apps.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE;YACL,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,WAAW,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,GAAG,eAAe,CAelB;AAwBD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,qBAAqB,CAAC,CAiBhC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAkBvE"}
@@ -0,0 +1,76 @@
1
+ // NSFC-v2 /apps/*:订单创建与 SSE execute 请求体
2
+ import { randomUUID } from "node:crypto";
3
+ import { ApiClient, helixlifeError, helixlifeErrorCode, } from "../../../core/index.js";
4
+ import { NSFC_ORDER_API_PATH } from "./constants.js";
5
+ export function buildNsfcExecuteBody(params) {
6
+ return {
7
+ response_mode: "streaming",
8
+ query: params.query ?? "",
9
+ inputs: params.inputs,
10
+ app_id: params.appId,
11
+ app_name: params.appName,
12
+ app_mode: "workflow",
13
+ app_type: 1,
14
+ index: params.index ?? 0,
15
+ order_id: params.orderId,
16
+ end: params.end ?? false,
17
+ count: params.count ?? 1,
18
+ parent_order_id: params.parentOrderId ?? null,
19
+ };
20
+ }
21
+ function isOrdersUnavailableError(error) {
22
+ if (!(error instanceof helixlifeError))
23
+ return false;
24
+ if (error.code !== helixlifeErrorCode.REQUEST_FAILED)
25
+ return false;
26
+ return (/\(404\)/.test(error.message) ||
27
+ /请求的资源不存在/.test(error.message) ||
28
+ /未定义路由/.test(error.message));
29
+ }
30
+ function syntheticOrderResult() {
31
+ const orderId = randomUUID();
32
+ return {
33
+ success: true,
34
+ synthetic: true,
35
+ data: {
36
+ msg: "local-session-order",
37
+ data: { order_id: orderId },
38
+ },
39
+ };
40
+ }
41
+ /**
42
+ * 创建基金工作台订单。
43
+ * 当前部分环境未部署 nsfc-v2/apps/orders(404);假说类工作流前端本就不建单,
44
+ * 此时回退为本地 UUID,仍可走 apps/execute。
45
+ */
46
+ export async function createNsfcOrder(body) {
47
+ const client = new ApiClient();
48
+ try {
49
+ return await client.request(NSFC_ORDER_API_PATH, {
50
+ method: "POST",
51
+ body,
52
+ });
53
+ }
54
+ catch (error) {
55
+ if (isOrdersUnavailableError(error)) {
56
+ const fallback = syntheticOrderResult();
57
+ console.warn(`[nsfc] apps/orders 不可用,使用本地会话 orderId=${fallback.data?.data?.order_id}`);
58
+ return fallback;
59
+ }
60
+ throw error;
61
+ }
62
+ }
63
+ export function extractNsfcOrderId(order) {
64
+ const orderId = order.data?.data?.order_id;
65
+ if (typeof orderId === "string" && orderId) {
66
+ return orderId;
67
+ }
68
+ if (order.success === false) {
69
+ const message = (typeof order.message === "string" && order.message) ||
70
+ order.data?.msg ||
71
+ "基金工作台订单创建失败,请稍后重试";
72
+ throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, message);
73
+ }
74
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "基金工作台订单响应缺少 order_id,请重试");
75
+ }
76
+ //# sourceMappingURL=apps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/apps.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAwCrD,MAAM,UAAU,oBAAoB,CAAC,MAUpC;IACC,OAAO;QACL,aAAa,EAAE,WAAW;QAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,KAAK;QACpB,QAAQ,EAAE,MAAM,CAAC,OAAO;QACxB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC,OAAO;QACxB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,KAAK;QACxB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC,aAAa,IAAI,IAAI;KAC9C,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAc;IAC9C,IAAI,CAAC,CAAC,KAAK,YAAY,cAAc,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC,cAAc;QAAE,OAAO,KAAK,CAAC;IACnE,OAAO,CACL,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC7B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,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GAAG;YACf,mBAAmB,CAAC;QACtB,MAAM,IAAI,cAAc,CAAC,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,0BAA0B,CAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface NsfcArticleCachePayload {
2
+ orderId: string;
3
+ article: string;
4
+ hypothesis: string;
5
+ program: string;
6
+ workflowRunId?: string;
7
+ }
8
+ export declare function __setNsfcArticleCacheDirForTesting(dir: string): void;
9
+ export declare function getNsfcArticleCacheDir(): string;
10
+ export declare function resolveNsfcArticleCachePath(orderId: string): string;
11
+ export declare function saveNsfcArticleCache(payload: NsfcArticleCachePayload): Promise<boolean>;
12
+ export declare function loadNsfcArticleCache(orderId: string): Promise<NsfcArticleCachePayload | null>;
13
+ export declare function popNsfcArticleCache(orderId: string): Promise<NsfcArticleCachePayload | null>;
14
+ //# sourceMappingURL=article-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article-cache.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/article-cache.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnE;AA0BD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAUzC;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAOzC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * NSFC 全文跨进程缓存(系统临时目录 helixlife-nsfc-article-cache/)
3
+ */
4
+ import { randomBytes } from "node:crypto";
5
+ import { chmod, mkdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
6
+ import { tmpdir } from "node:os";
7
+ import { join } from "node:path";
8
+ let CACHE_DIR = join(tmpdir(), "helixlife-nsfc-article-cache");
9
+ const CACHE_FILE_PREFIX = "article-";
10
+ const CACHE_FILE_EXT = ".json";
11
+ export function __setNsfcArticleCacheDirForTesting(dir) {
12
+ CACHE_DIR = dir;
13
+ }
14
+ export function getNsfcArticleCacheDir() {
15
+ return CACHE_DIR;
16
+ }
17
+ export function resolveNsfcArticleCachePath(orderId) {
18
+ return join(CACHE_DIR, `${CACHE_FILE_PREFIX}${sanitizeOrderId(orderId)}${CACHE_FILE_EXT}`);
19
+ }
20
+ function sanitizeOrderId(orderId) {
21
+ return orderId.replace(/[^a-zA-Z0-9_.-]/g, "_");
22
+ }
23
+ async function ensureCacheDir() {
24
+ await mkdir(CACHE_DIR, { recursive: true });
25
+ }
26
+ async function atomicReplace(tempPath, finalPath) {
27
+ try {
28
+ await rename(tempPath, finalPath);
29
+ }
30
+ catch (error) {
31
+ if (process.platform === "win32") {
32
+ await rm(finalPath, { force: true });
33
+ await rename(tempPath, finalPath);
34
+ return;
35
+ }
36
+ throw error;
37
+ }
38
+ }
39
+ export async function saveNsfcArticleCache(payload) {
40
+ try {
41
+ if (!payload.orderId?.trim() || !payload.article?.trim()) {
42
+ throw new Error("orderId / article 不能为空");
43
+ }
44
+ await ensureCacheDir();
45
+ const finalPath = resolveNsfcArticleCachePath(payload.orderId);
46
+ const nonce = randomBytes(6).toString("hex");
47
+ const tempPath = `${finalPath}.${nonce}.tmp`;
48
+ await writeFile(tempPath, JSON.stringify(payload), "utf8");
49
+ await atomicReplace(tempPath, finalPath);
50
+ await chmod(finalPath, 0o600);
51
+ return true;
52
+ }
53
+ catch (error) {
54
+ console.warn(`[nsfc-article-cache] 写入失败 orderId=${payload.orderId}: ${error.message}`);
55
+ return false;
56
+ }
57
+ }
58
+ export async function loadNsfcArticleCache(orderId) {
59
+ if (!orderId?.trim())
60
+ return null;
61
+ try {
62
+ const raw = await readFile(resolveNsfcArticleCachePath(orderId), "utf8");
63
+ const entry = JSON.parse(raw);
64
+ if (!entry.article)
65
+ return null;
66
+ return { ...entry, orderId: entry.orderId || orderId };
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ }
72
+ export async function popNsfcArticleCache(orderId) {
73
+ const cached = await loadNsfcArticleCache(orderId);
74
+ if (!cached)
75
+ return null;
76
+ await rm(resolveNsfcArticleCachePath(orderId), { force: true }).catch(() => undefined);
77
+ return cached;
78
+ }
79
+ //# sourceMappingURL=article-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article-cache.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/article-cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,EAAE,EACF,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,8BAA8B,CAAC,CAAC;AAE/D,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,cAAc,GAAG,OAAO,CAAC;AAU/B,MAAM,UAAU,kCAAkC,CAAC,GAAW;IAC5D,SAAS,GAAG,GAAG,CAA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AC;IACzB,MAAM,EAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CACnE,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface CreateNsfcArticleOptions {
3
+ orderId?: string;
4
+ yes?: boolean;
5
+ format?: OutputFormat;
6
+ }
7
+ export declare function runCreateNsfcArticle(options: CreateNsfcArticleOptions): Promise<void>;
8
+ //# sourceMappingURL=article-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article-create.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/article-create.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAuBnC,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAgJf"}
@@ -0,0 +1,108 @@
1
+ // Step4:生成全文
2
+ import { helixlifeError, helixlifeErrorCode, printOutput, createFormatLogger, } from "../../../../core/index.js";
3
+ import { wrapWorkbenchResult } from "../../../shared/result-wrapper.js";
4
+ import { buildNsfcExecuteBody, createNsfcOrder, extractNsfcOrderId, } from "../apps.js";
5
+ import { saveNsfcArticleCache } from "../article-cache.js";
6
+ import { NSFC_APP_NAMES, NSFC_ARTICLE_APP_ID, NSFC_EXECUTE_API_PATH, } from "../constants.js";
7
+ import { buildNsfcOutlineSlimBody, stringifyNsfcOutlineWorkflowInput, } from "../parse-outline.js";
8
+ import { loadNsfcSessionCache, saveNsfcSessionCache, } from "../session-cache.js";
9
+ import { formatElapsedHint, streamNsfcWorkflow } from "../sse-utils.js";
10
+ export async function runCreateNsfcArticle(options) {
11
+ const format = options.format ?? "markdown";
12
+ const log = createFormatLogger(format);
13
+ if (!options.orderId?.trim()) {
14
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "article create 必须提供 --order-id");
15
+ }
16
+ const session = await loadNsfcSessionCache(options.orderId);
17
+ if (!session) {
18
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId}`);
19
+ }
20
+ const outline = String(session.outline ?? "").trim();
21
+ if (!outline) {
22
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少确认提纲:请先 outline create / outline confirm");
23
+ }
24
+ if (!session.outlineConfirmed) {
25
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "提纲尚未确认:请先执行 outline confirm");
26
+ }
27
+ const slim = buildNsfcOutlineSlimBody(session);
28
+ const hypothesis = slim.query;
29
+ if (!hypothesis) {
30
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少科学假说文本,无法生成全文");
31
+ }
32
+ const inputJson = stringifyNsfcOutlineWorkflowInput(outline, hypothesis, true);
33
+ log("接口正在处理中,请耐心等待...");
34
+ const childOrder = await createNsfcOrder({
35
+ index: 2,
36
+ count: 1,
37
+ query: hypothesis,
38
+ inputs: { input: inputJson, program: slim.inputs.program },
39
+ parent_order_id: session.orderId,
40
+ });
41
+ const childOrderId = extractNsfcOrderId(childOrder);
42
+ const body = buildNsfcExecuteBody({
43
+ query: hypothesis,
44
+ inputs: {
45
+ input: inputJson,
46
+ program: slim.inputs.program,
47
+ },
48
+ appId: NSFC_ARTICLE_APP_ID,
49
+ appName: NSFC_APP_NAMES.article,
50
+ orderId: childOrderId,
51
+ index: 2,
52
+ parentOrderId: session.orderId,
53
+ end: true,
54
+ });
55
+ const stream = await streamNsfcWorkflow({
56
+ path: NSFC_EXECUTE_API_PATH,
57
+ body,
58
+ format,
59
+ startLabel: "申请书全文生成中…",
60
+ progressLabel: "全文生成进行中",
61
+ finishLabel: "全文生成完成",
62
+ failureMessage: "全文生成失败,请稍后重试",
63
+ emptyMessage: "全文生成结果为空",
64
+ });
65
+ const fromOutput = typeof stream.outputs?.output === "string"
66
+ ? stream.outputs.output.trim()
67
+ : typeof stream.outputs?.text === "string"
68
+ ? stream.outputs.text.trim()
69
+ : "";
70
+ const article = (fromOutput || stream.text).trim();
71
+ if (!article) {
72
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "全文生成结果为空");
73
+ }
74
+ await saveNsfcSessionCache({
75
+ ...session,
76
+ article,
77
+ workflowRunId: stream.workflowRunId,
78
+ });
79
+ const cacheReady = await saveNsfcArticleCache({
80
+ orderId: session.orderId,
81
+ article,
82
+ hypothesis,
83
+ program: slim.inputs.program,
84
+ workflowRunId: stream.workflowRunId,
85
+ });
86
+ const result = {
87
+ article,
88
+ hypothesis,
89
+ program: slim.inputs.program,
90
+ ready: true,
91
+ };
92
+ if (format === "json") {
93
+ printOutput(wrapWorkbenchResult(result, { step: "article", subType: "nsfc" }, {
94
+ orderId: session.orderId,
95
+ workflowRunId: stream.workflowRunId,
96
+ cacheReady,
97
+ hasHypothesis: session.hasHypothesis,
98
+ nextSubStep: session.nextSubStep,
99
+ outlineAppSuffix: session.outlineAppSuffix,
100
+ readyForArticle: true,
101
+ }), "json");
102
+ return;
103
+ }
104
+ console.log(`\n## 申请书全文${formatElapsedHint(stream.elapsedTime)}\n`);
105
+ console.log(article);
106
+ console.log("\n请执行 article download 导出原始引文 MD+Word;可选技术路线图 / 假说机制图 / 格式转换。");
107
+ }
108
+ //# sourceMappingURL=article-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article-create.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/article-create.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,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mB,CACjB,MAAM,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EACpC;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU;YACV,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,eAAe,EAAE,IAAI;SACtB,CACF,EACD,MAAM,CACP,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,aAAa,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CACT,+DAA+D,CAChE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface DownloadNsfcArticleOptions {
3
+ orderId?: string;
4
+ file?: string;
5
+ output?: string;
6
+ produceId?: string;
7
+ format?: OutputFormat;
8
+ }
9
+ export interface NsfcArticleDownloadResult {
10
+ mdPath: string;
11
+ mdSize: number;
12
+ docxPath: string;
13
+ docxSize: number;
14
+ contentType: string | null;
15
+ filename?: string;
16
+ }
17
+ /**
18
+ * 将标题候选收成安全导出 basename(不含扩展名)。
19
+ * 对齐官网:整题作文件名、不截断;CLI 仅替换 Windows 非法字符以便 writeFile。
20
+ */
21
+ export declare function toNsfcExportBasename(titleCandidate: string): string;
22
+ /**
23
+ * 从全文 Markdown 提取项目标题(对齐官网 getTitleFromArticle)。
24
+ * 标签行「标题」无值时跳过,取下一行正文;「标题:xxx」同行取值;否则取首个非空内容行。
25
+ */
26
+ export declare function extractNsfcArticleTitle(markdown: string): string;
27
+ declare function convertMarkdownToDocx(markdown: string, produceId: string): Promise<{
28
+ buffer: Buffer;
29
+ contentType: string | null;
30
+ filename?: string;
31
+ }>;
32
+ /**
33
+ * 确定 docx 输出路径。
34
+ * article download 传入标题 basename;format-convert 可传固定 defaultName。
35
+ * 不再依赖转换 API 的 Content-Disposition 文件名。
36
+ */
37
+ declare function resolveDocxPath(outputOption: string | undefined, preferredFilename?: string, defaultName?: string): string;
38
+ declare function resolveMarkdownPath(docxPath: string): string;
39
+ export declare function runDownloadNsfcArticle(options: DownloadNsfcArticleOptions): Promise<NsfcArticleDownloadResult>;
40
+ /** 供 format-convert 复用的 docx 转换 */
41
+ export { convertMarkdownToDocx, resolveDocxPath, resolveMarkdownPath };
42
+ //# sourceMappingURL=article-download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article-download.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/article-download.ts"],"names":[],"mappings":"AAGA,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAWnC,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAqCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CASnE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyBhE;AAYD,iBAAe,qBAAqB,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,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