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,120 @@
1
+ // 假说机制图:基于 Step2 科学假说,下载 PNG,不插入全文
2
+ import { mkdir, writeFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { helixlifeError, helixlifeErrorCode, getUserDownloadsDir, printOutput, createFormatLogger, resolveUserPath, } from "../../../../core/index.js";
5
+ import { wrapWorkbenchResult } from "../../../shared/result-wrapper.js";
6
+ import { buildNsfcExecuteBody, createNsfcOrder, extractNsfcOrderId, } from "../apps.js";
7
+ import { NSFC_APP_NAMES, NSFC_EXECUTE_API_PATH, NSFC_HYPOTHESIS_FIGURE_APP_ID, NSFC_HYPOTHESIS_FIGURE_STYLE, } from "../constants.js";
8
+ import { applyPngWatermark } from "../png-watermark.js";
9
+ import { loadNsfcSessionCache } from "../session-cache.js";
10
+ import { streamNsfcWorkflow } from "../sse-utils.js";
11
+ function pickFileUrl(outputs) {
12
+ if (!outputs)
13
+ return "";
14
+ const files = outputs.files;
15
+ if (Array.isArray(files) && files[0] && typeof files[0] === "object") {
16
+ const url = files[0].url;
17
+ if (typeof url === "string" && url.trim())
18
+ return url.trim();
19
+ }
20
+ // 兜底常见字段
21
+ for (const key of ["url", "image_url", "file_url"]) {
22
+ const v = outputs[key];
23
+ if (typeof v === "string" && v.trim())
24
+ return v.trim();
25
+ }
26
+ return "";
27
+ }
28
+ export async function runNsfcHypothesisFigure(options) {
29
+ const format = options.format ?? "markdown";
30
+ const log = createFormatLogger(format);
31
+ if (!options.orderId?.trim()) {
32
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "hypothesis-figure create 必须提供 --order-id");
33
+ }
34
+ const session = await loadNsfcSessionCache(options.orderId);
35
+ if (!session) {
36
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId}`);
37
+ }
38
+ const hypothesis = String(session.confirmedHypothesis ?? session.outlineParams?.query ?? "").trim();
39
+ if (!hypothesis) {
40
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少 Step2 确认的科学假说,无法生成假说机制图");
41
+ }
42
+ log("接口正在处理中,请耐心等待...");
43
+ const childOrder = await createNsfcOrder({
44
+ index: 3,
45
+ count: 1,
46
+ query: "",
47
+ inputs: {
48
+ hypothesis,
49
+ style: NSFC_HYPOTHESIS_FIGURE_STYLE,
50
+ },
51
+ parent_order_id: session.orderId,
52
+ });
53
+ const childOrderId = extractNsfcOrderId(childOrder);
54
+ const body = buildNsfcExecuteBody({
55
+ query: "",
56
+ inputs: {
57
+ hypothesis,
58
+ style: NSFC_HYPOTHESIS_FIGURE_STYLE,
59
+ },
60
+ appId: NSFC_HYPOTHESIS_FIGURE_APP_ID,
61
+ appName: NSFC_APP_NAMES.hypothesisFigure,
62
+ orderId: childOrderId,
63
+ index: 3,
64
+ parentOrderId: session.orderId,
65
+ end: false,
66
+ });
67
+ const stream = await streamNsfcWorkflow({
68
+ path: NSFC_EXECUTE_API_PATH,
69
+ body,
70
+ format,
71
+ startLabel: "假说机制图生成中…",
72
+ progressLabel: "假说机制图进行中",
73
+ finishLabel: "假说机制图完成",
74
+ failureMessage: "假说机制图生成失败",
75
+ emptyMessage: "假说机制图未返回有效结果",
76
+ allowEmptyText: true,
77
+ });
78
+ const url = pickFileUrl(stream.outputs);
79
+ if (!url) {
80
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "假说机制图未返回 files[0].url");
81
+ }
82
+ const res = await fetch(url);
83
+ if (!res.ok) {
84
+ throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, `下载假说机制图失败: HTTP ${res.status}`);
85
+ }
86
+ const buf = Buffer.from(await res.arrayBuffer());
87
+ const wm = await applyPngWatermark({
88
+ pngBuffer: buf,
89
+ produceId: stream.workflowRunId ?? "",
90
+ paddingColor: "#ffffff",
91
+ });
92
+ const outDir = options.output
93
+ ? resolveUserPath(options.output)
94
+ : getUserDownloadsDir();
95
+ await mkdir(outDir, { recursive: true });
96
+ const imagePath = join(outDir, "nsfc-hypothesis-figure.png");
97
+ await writeFile(imagePath, wm.buffer);
98
+ const result = {
99
+ imagePath,
100
+ sourceUrl: url,
101
+ watermarked: wm.watermarked,
102
+ warnings: wm.watermarked
103
+ ? undefined
104
+ : wm.error
105
+ ? [`水印失败(已保留原图):${wm.error}`]
106
+ : undefined,
107
+ note: "图片未插入全文,请 Agent 按需自行插入。PNG 含水印「AI生成」(与原站一致)。",
108
+ ready: true,
109
+ };
110
+ if (format === "json") {
111
+ printOutput(wrapWorkbenchResult(result, { step: "hypothesis-figure", subType: "nsfc" }, {
112
+ orderId: session.orderId,
113
+ workflowRunId: stream.workflowRunId,
114
+ }), "json");
115
+ return;
116
+ }
117
+ console.log("## 假说机制图已生成(未插入全文)\n");
118
+ console.log(imagePath);
119
+ }
120
+ //# sourceMappingURL=hypothesis-figure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypothesis-figure.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/hypothesis-figure.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,eAAe,GAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC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E,GAAG;QACd,WAAW,EAAE,EAAE,CAAC,WAAW;QAC3B,QAAQ,EAAE,EAAE,CAAC,WAAW;YACtB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,CAAC,KAAK;gBACR,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC;gBAC7B,CAAC,CAAC,SAAS;QACf,IAAI,EAAE,8CAA8C;QACpD,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CACT,mBAAmB,CACjB,MAAM,EACN,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,EAC9C;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CACF,EACD,MAAM,CACP,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface GenesSelectOptions {
3
+ orderId?: string;
4
+ gene?: string;
5
+ mechanism?: string;
6
+ results?: string;
7
+ yes?: boolean;
8
+ format?: OutputFormat;
9
+ }
10
+ export declare function runNsfcGenesSelect(options: GenesSelectOptions): Promise<void>;
11
+ //# sourceMappingURL=hypothesis-genes-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypothesis-genes-select.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/hypothesis-genes-select.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAwBnC,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsJf"}
@@ -0,0 +1,125 @@
1
+ // Step2:提交候选基因 → 生成假说列表(仅 background_genes)
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 { NSFC_APP_NAMES, NSFC_EXECUTE_API_PATH, NSFC_PROVINCE_PROGRAM, resolvePickFromGeneAppId, } from "../constants.js";
6
+ import { buildHypothesisSelectionOptions, tryParseHypothesisList, } from "../parse-hypothesis.js";
7
+ import { promptSelectGene } from "../prompt-step2.js";
8
+ import { loadNsfcSessionCache, saveNsfcSessionCache, } from "../session-cache.js";
9
+ import { formatElapsedHint, streamNsfcWorkflow } from "../sse-utils.js";
10
+ export async function runNsfcGenesSelect(options) {
11
+ const format = options.format ?? "markdown";
12
+ const log = createFormatLogger(format);
13
+ if (!options.orderId?.trim()) {
14
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "hypothesis genes select 必须提供 --order-id(来自 hypothesis analyze)");
15
+ }
16
+ const session = await loadNsfcSessionCache(options.orderId);
17
+ if (!session) {
18
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId},请重新执行 hypothesis analyze`);
19
+ }
20
+ if (session.nextSubStep !== "background_genes") {
21
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `当前路径为 ${session.nextSubStep},不需要 genes select`);
22
+ }
23
+ let gene = options.gene?.trim();
24
+ let mechanism = options.mechanism?.trim();
25
+ let results = options.results?.trim();
26
+ if (!gene || !mechanism) {
27
+ if (options.yes) {
28
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "使用 -y 时必须提供 --gene 与 --mechanism(及可选 --results)");
29
+ }
30
+ const picked = await promptSelectGene(session.genes ?? []);
31
+ gene = picked.gene;
32
+ mechanism = picked.mechanism;
33
+ results = picked.results;
34
+ }
35
+ const projectLevel = String(session.inputs.projectLevel ?? "");
36
+ const isProvince = projectLevel === "省部级";
37
+ const disease = String(session.inputs.input ?? session.query);
38
+ log("接口正在处理中,请耐心等待...");
39
+ // 子订单:挂在 analyze 的 order 下
40
+ const childOrder = await createNsfcOrder({
41
+ index: 1,
42
+ count: 1,
43
+ query: "",
44
+ inputs: {
45
+ disease,
46
+ level: isProvince
47
+ ? NSFC_PROVINCE_PROGRAM
48
+ : String(session.inputs.project ?? ""),
49
+ molecule: gene,
50
+ mechanism,
51
+ results: results ?? "",
52
+ },
53
+ parent_order_id: session.orderId,
54
+ });
55
+ const childOrderId = extractNsfcOrderId(childOrder);
56
+ const body = buildNsfcExecuteBody({
57
+ query: "",
58
+ inputs: {
59
+ disease,
60
+ level: isProvince
61
+ ? NSFC_PROVINCE_PROGRAM
62
+ : String(session.inputs.project ?? ""),
63
+ molecule: gene,
64
+ mechanism: mechanism,
65
+ results: results ?? "",
66
+ },
67
+ appId: resolvePickFromGeneAppId(projectLevel),
68
+ appName: NSFC_APP_NAMES.generateHypothesis,
69
+ orderId: childOrderId,
70
+ index: 1,
71
+ parentOrderId: session.orderId,
72
+ end: false,
73
+ });
74
+ const stream = await streamNsfcWorkflow({
75
+ path: NSFC_EXECUTE_API_PATH,
76
+ body,
77
+ format,
78
+ startLabel: "基于候选基因生成科学假说…",
79
+ progressLabel: "假说生成进行中",
80
+ finishLabel: "假说生成完成",
81
+ failureMessage: "科学假说生成失败,请稍后重试",
82
+ emptyMessage: "科学假说生成结果为空",
83
+ allowEmptyText: true,
84
+ });
85
+ const hypotheses = tryParseHypothesisList(stream.outputs);
86
+ if (!hypotheses.length) {
87
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "科学假说生成结果为空,请稍后重试");
88
+ }
89
+ // 继续用原 analyze orderId 作为会话 key,便于 Agent 串联
90
+ await saveNsfcSessionCache({
91
+ ...session,
92
+ selectedGene: gene,
93
+ selectedMechanism: mechanism,
94
+ selectedResults: results,
95
+ hypotheses,
96
+ workflowRunId: stream.workflowRunId,
97
+ });
98
+ const result = {
99
+ path: "background_genes",
100
+ selectedGene: gene,
101
+ hypotheses: hypotheses.map((h) => ({
102
+ id: h.id,
103
+ text: h.new_text || h.original_text,
104
+ })),
105
+ selectionOptions: buildHypothesisSelectionOptions(hypotheses),
106
+ ready: true,
107
+ };
108
+ if (format === "json") {
109
+ printOutput(wrapWorkbenchResult(result, { step: "hypothesis-genes-select", subType: "nsfc" }, {
110
+ orderId: session.orderId,
111
+ workflowRunId: stream.workflowRunId,
112
+ hasHypothesis: session.hasHypothesis,
113
+ nextSubStep: session.nextSubStep,
114
+ outlineAppSuffix: session.outlineAppSuffix,
115
+ }), "json");
116
+ return;
117
+ }
118
+ console.log(`\n## 科学假说候选${formatElapsedHint(stream.elapsedTime)}\n`);
119
+ console.log(`已选基因:${gene}\n`);
120
+ hypotheses.forEach((h, i) => {
121
+ console.log(`### ${i + 1}\n${h.new_text || h.original_text}\n`);
122
+ });
123
+ console.log("请选择或自定义假说,再执行 hypothesis pick。");
124
+ }
125
+ //# sourceMappingURL=hypothesis-genes-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypothesis-genes-select.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/hypothesis-genes-select.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,kBAAkB,GAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,oBAA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{
3
+ orderId?: string;
4
+ hypothesisIndex?: string;
5
+ custom?: string;
6
+ customFile?: string;
7
+ yes?: boolean;
8
+ format?: OutputFormat;
9
+ }
10
+ export declare function runNsfcHypothesisPick(options: HypothesisPickOptions): Promise<void>;
11
+ //# sourceMappingURL=hypothesis-pick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypothesis-pick.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/hypothesis-pick.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AASnC,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAyBD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgIf"}
@@ -0,0 +1,109 @@
1
+ // Step2:确认假说(路径 1/2)— 仅 handoff,不跑提纲(1A)
2
+ import { readFile } from "node:fs/promises";
3
+ import { helixlifeError, helixlifeErrorCode, printOutput, resolveUserPath, } from "../../../../core/index.js";
4
+ import { wrapWorkbenchResult } from "../../../shared/result-wrapper.js";
5
+ import { NSFC_PROVINCE_PROGRAM } from "../constants.js";
6
+ import { promptPickHypothesis } from "../prompt-step2.js";
7
+ import { loadNsfcSessionCache, saveNsfcSessionCache, } from "../session-cache.js";
8
+ async function resolveCustomText(options) {
9
+ if (options.custom?.trim() && options.customFile?.trim()) {
10
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "--custom 与 --custom-file 互斥");
11
+ }
12
+ if (options.customFile?.trim()) {
13
+ const p = resolveUserPath(options.customFile);
14
+ try {
15
+ return (await readFile(p, "utf8")).trim();
16
+ }
17
+ catch {
18
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `无法读取 --custom-file: ${options.customFile}`);
19
+ }
20
+ }
21
+ return options.custom?.trim() || undefined;
22
+ }
23
+ export async function runNsfcHypothesisPick(options) {
24
+ const format = options.format ?? "markdown";
25
+ if (!options.orderId?.trim()) {
26
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "hypothesis pick 必须提供 --order-id");
27
+ }
28
+ const session = await loadNsfcSessionCache(options.orderId);
29
+ if (!session) {
30
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId},请重新执行 hypothesis analyze`);
31
+ }
32
+ if (session.nextSubStep !== "hypothesis_pick" &&
33
+ session.nextSubStep !== "background_genes") {
34
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `当前路径为 ${session.nextSubStep},请使用 research-path confirm`);
35
+ }
36
+ const hypotheses = session.hypotheses ?? [];
37
+ if (!hypotheses.length) {
38
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缓存中无假说列表:background_genes 请先 genes select;hypothesis_pick 请先 analyze");
39
+ }
40
+ let confirmed = await resolveCustomText(options);
41
+ if (!confirmed && options.hypothesisIndex !== undefined) {
42
+ const idx = Number.parseInt(options.hypothesisIndex, 10);
43
+ if (Number.isNaN(idx) || idx < 0 || idx >= hypotheses.length) {
44
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `--hypothesis-index 无效(0-${hypotheses.length - 1})`);
45
+ }
46
+ confirmed = hypotheses[idx].new_text || hypotheses[idx].original_text;
47
+ }
48
+ if (!confirmed) {
49
+ if (options.yes) {
50
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "使用 -y 时必须提供 --hypothesis-index 或 --custom / --custom-file");
51
+ }
52
+ const picked = await promptPickHypothesis(hypotheses);
53
+ if (picked.custom?.trim()) {
54
+ confirmed = picked.custom.trim();
55
+ }
56
+ else if (picked.index !== undefined) {
57
+ const h = hypotheses[picked.index];
58
+ confirmed = h.new_text || h.original_text;
59
+ }
60
+ }
61
+ if (!confirmed?.trim()) {
62
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "未确认科学假说内容");
63
+ }
64
+ const projectLevel = String(session.inputs.projectLevel ?? "");
65
+ const isProvince = projectLevel === "省部级";
66
+ const program = isProvince
67
+ ? NSFC_PROVINCE_PROGRAM
68
+ : String(session.inputs.project ?? "");
69
+ const outlineParams = {
70
+ query: confirmed.trim(),
71
+ inputs: {
72
+ program,
73
+ results: session.selectedResults ?? "",
74
+ text: confirmed.trim(),
75
+ projectLevel,
76
+ ...(session.selectedGene
77
+ ? {
78
+ selectedCandidateGene: session.selectedGene,
79
+ selectedCandidateMechanism: session.selectedMechanism,
80
+ selectedCandidateResults: session.selectedResults,
81
+ }
82
+ : {}),
83
+ },
84
+ };
85
+ await saveNsfcSessionCache({
86
+ ...session,
87
+ confirmedHypothesis: confirmed.trim(),
88
+ outlineParams,
89
+ });
90
+ const result = {
91
+ confirmedHypothesis: confirmed.trim(),
92
+ outlineParams,
93
+ ready: true,
94
+ };
95
+ if (format === "json") {
96
+ printOutput(wrapWorkbenchResult(result, { step: "hypothesis-pick", subType: "nsfc" }, {
97
+ orderId: session.orderId,
98
+ hasHypothesis: session.hasHypothesis,
99
+ nextSubStep: session.nextSubStep,
100
+ outlineAppSuffix: "-none-hypothesis",
101
+ readyForOutline: true,
102
+ }), "json");
103
+ return;
104
+ }
105
+ console.log("## 假说已确认(第 2 步就绪)\n");
106
+ console.log(confirmed.trim());
107
+ console.log("\n参数已就绪。请执行 outline create 生成提纲(第 3 步)。");
108
+ }
109
+ //# sourceMappingURL=hypothesis-pick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypothesis-pick.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/hypothesis-pick.ts"],"names":[],"mappings":"AAAA,yCA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CAAC,eAAe,IAAI,EAAE;YACtC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE;YACtB,YAAY;YACZ,GAAG,CAAC,OAAO,CAAC,YAAY;gBACtB,CAAC,CAAC;oBACE,qBAAqB,EAAE,OAAO,CAAC,YAAY;oBAC3C,0BAA0B,EAAE,OAAO,CAAC,iBAAiB;oBACrD,wBAAwB,EAAE,OAAO,CAAC,eAAe;iBAClD;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;KACF,CAAC;IAEF,MAAM,oBAAoB,CAAC;QACzB,GAAG,OAAO;QACV,mBAAmB,EAAE,SAAS,CAAC,IAAI,EAAE;QACrC,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;QACb,mBAAmB,EAAE,SAAS,CAAC,IAAI,EAAE;QACrC,aAAa;QACb,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CACT,mBAAmB,CACjB,MAAM,EACN,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,EAC5C;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB,EAAE,kBAAkB;YACpC,eAAe,EAAE,IAAI;SACtB,CACF,EACD,MAAM,CACP,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface ConfirmNsfcOutlineOptions {
3
+ orderId?: string;
4
+ file?: string;
5
+ yes?: boolean;
6
+ format?: OutputFormat;
7
+ }
8
+ export declare function runConfirmNsfcOutline(options: ConfirmNsfcOutlineOptions): Promise<void>;
9
+ //# sourceMappingURL=outline-confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline-confirm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/outline-confirm.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAQnC,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAuFf"}
@@ -0,0 +1,64 @@
1
+ // Step3:确认提纲(可带 Agent 本地改稿)
2
+ import { readFile } from "node:fs/promises";
3
+ import { helixlifeError, helixlifeErrorCode, printOutput, resolveUserPath, } from "../../../../core/index.js";
4
+ import { wrapWorkbenchResult } from "../../../shared/result-wrapper.js";
5
+ import { assertOutlineHasH2 } from "../parse-outline.js";
6
+ import { loadNsfcSessionCache, saveNsfcSessionCache, } from "../session-cache.js";
7
+ export async function runConfirmNsfcOutline(options) {
8
+ const format = options.format ?? "markdown";
9
+ if (!options.orderId?.trim()) {
10
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "outline confirm 必须提供 --order-id");
11
+ }
12
+ const session = await loadNsfcSessionCache(options.orderId);
13
+ if (!session) {
14
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId},请先完成 Step2 / outline create`);
15
+ }
16
+ let outline = "";
17
+ if (options.file?.trim()) {
18
+ const filePath = resolveUserPath(options.file);
19
+ try {
20
+ outline = (await readFile(filePath, "utf8")).trim();
21
+ }
22
+ catch {
23
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `无法读取提纲文件: ${options.file}`);
24
+ }
25
+ }
26
+ else {
27
+ outline = String(session.outline ?? "").trim();
28
+ }
29
+ if (!outline) {
30
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "无提纲内容:请先 outline create,或通过 --file 提供改稿后的 Markdown");
31
+ }
32
+ try {
33
+ assertOutlineHasH2(outline);
34
+ }
35
+ catch (error) {
36
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, error.message);
37
+ }
38
+ const hypothesis = String(session.outlineParams?.query ?? session.confirmedHypothesis ?? "").trim();
39
+ await saveNsfcSessionCache({
40
+ ...session,
41
+ outline,
42
+ outlineConfirmed: true,
43
+ confirmedHypothesis: hypothesis || session.confirmedHypothesis,
44
+ });
45
+ const result = {
46
+ outline,
47
+ hypothesis,
48
+ ready: true,
49
+ };
50
+ if (format === "json") {
51
+ printOutput(wrapWorkbenchResult(result, { step: "outline-confirm", subType: "nsfc" }, {
52
+ orderId: session.orderId,
53
+ hasHypothesis: session.hasHypothesis,
54
+ nextSubStep: session.nextSubStep,
55
+ outlineAppSuffix: session.outlineAppSuffix,
56
+ readyForArticle: true,
57
+ }), "json");
58
+ return;
59
+ }
60
+ console.log("## 提纲已确认(第 3 步就绪)\n");
61
+ console.log(outline);
62
+ console.log("\n可进入第 4 步「生成全文」(命令待后续开放)。");
63
+ }
64
+ //# sourceMappingURL=outline-confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline-confirm.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/outline-confirm.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,eAAe,GAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE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AgB,EACnC,oDAAoD,CACrD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EAClC,KAAe,CAAC,OAAO,CACzB,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CACvB,OAAO,CAAC,aAAa,EAAE,KAAK,IAAI,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAClE,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,oBAAoB,CAAC;QACzB,GAAG,OAAO;QACV,OAAO;QACP,gBAAgB,EAAE,IAAI;QACtB,mBAAmB,EAAE,UAAU,IAAI,OAAO,CAAC,mBAAmB;KAC/D,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;QACb,OAAO;QACP,UAAU;QACV,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CACT,mBAAmB,CACjB,MAAM,EACN,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,EAC5C;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,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,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface CreateNsfcOutlineOptions {
3
+ orderId?: string;
4
+ yes?: boolean;
5
+ format?: OutputFormat;
6
+ }
7
+ export declare function runCreateNsfcOutline(options: CreateNsfcOutlineOptions): Promise<void>;
8
+ //# sourceMappingURL=outline-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline-create.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/outline-create.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAmBnC,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAQD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA8Hf"}
@@ -0,0 +1,103 @@
1
+ // Step3:生成 / 重新生成提纲
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 { NSFC_APP_NAMES, NSFC_EXECUTE_API_PATH, NSFC_OUTLINE_APP_ID, } from "../constants.js";
6
+ import { buildNsfcOutlineSlimBody } from "../parse-outline.js";
7
+ import { loadNsfcSessionCache, saveNsfcSessionCache, } from "../session-cache.js";
8
+ import { formatElapsedHint, streamNsfcWorkflow } from "../sse-utils.js";
9
+ function resolveOutlineAppName(suffix) {
10
+ return suffix === "-none-hypothesis"
11
+ ? NSFC_APP_NAMES.outlineNoneHypothesis
12
+ : NSFC_APP_NAMES.outline;
13
+ }
14
+ export async function runCreateNsfcOutline(options) {
15
+ const format = options.format ?? "markdown";
16
+ const log = createFormatLogger(format);
17
+ if (!options.orderId?.trim()) {
18
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "outline create 必须提供 --order-id(来自 Step2)");
19
+ }
20
+ const session = await loadNsfcSessionCache(options.orderId);
21
+ if (!session) {
22
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `会话缓存缺失:orderId=${options.orderId},请先完成 Step2`);
23
+ }
24
+ // 路径 1/2 须先 pick 写入 outlineParams;路径 3 在 research-path confirm 已写入
25
+ if (!session.outlineParams?.query && !session.confirmedHypothesis) {
26
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少确认假说:路径 1/2 请先执行 hypothesis pick;路径 3 请先 research-path confirm");
27
+ }
28
+ const slim = buildNsfcOutlineSlimBody(session);
29
+ if (!slim.query) {
30
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "提纲生成需要科学假说文本(outlineParams.query)");
31
+ }
32
+ log("接口正在处理中,请耐心等待...");
33
+ const childOrder = await createNsfcOrder({
34
+ index: 1,
35
+ count: 1,
36
+ query: slim.query,
37
+ inputs: slim.inputs,
38
+ parent_order_id: session.orderId,
39
+ });
40
+ const childOrderId = extractNsfcOrderId(childOrder);
41
+ const body = buildNsfcExecuteBody({
42
+ query: slim.query,
43
+ inputs: slim.inputs,
44
+ appId: NSFC_OUTLINE_APP_ID,
45
+ appName: resolveOutlineAppName(session.outlineAppSuffix),
46
+ orderId: childOrderId,
47
+ index: 1,
48
+ parentOrderId: session.orderId,
49
+ end: false,
50
+ });
51
+ const stream = await streamNsfcWorkflow({
52
+ path: NSFC_EXECUTE_API_PATH,
53
+ body,
54
+ format,
55
+ startLabel: "申请书提纲生成中…",
56
+ progressLabel: "提纲生成进行中",
57
+ finishLabel: "提纲生成完成",
58
+ failureMessage: "提纲生成失败,请稍后重试",
59
+ emptyMessage: "提纲生成结果为空",
60
+ });
61
+ // 优先 outputs.output(nsfc-v2 单字段),否则 stream text
62
+ const fromOutput = typeof stream.outputs?.output === "string"
63
+ ? stream.outputs.output.trim()
64
+ : "";
65
+ const outline = (fromOutput || stream.text).trim();
66
+ if (!outline) {
67
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "提纲生成结果为空");
68
+ }
69
+ await saveNsfcSessionCache({
70
+ ...session,
71
+ outlineParams: {
72
+ query: slim.query,
73
+ inputs: {
74
+ ...(session.outlineParams?.inputs ?? session.inputs),
75
+ ...slim.inputs,
76
+ },
77
+ },
78
+ confirmedHypothesis: slim.query,
79
+ outline,
80
+ outlineConfirmed: false,
81
+ workflowRunId: stream.workflowRunId,
82
+ });
83
+ const result = {
84
+ outline,
85
+ hypothesis: slim.query,
86
+ ready: true,
87
+ };
88
+ if (format === "json") {
89
+ printOutput(wrapWorkbenchResult(result, { step: "outline", subType: "nsfc" }, {
90
+ orderId: session.orderId,
91
+ workflowRunId: stream.workflowRunId,
92
+ hasHypothesis: session.hasHypothesis,
93
+ nextSubStep: session.nextSubStep,
94
+ outlineAppSuffix: session.outlineAppSuffix,
95
+ readyForOutline: true,
96
+ }), "json");
97
+ return;
98
+ }
99
+ console.log(`\n## 申请书提纲${formatElapsedHint(stream.elapsedTime)}\n`);
100
+ console.log(outline);
101
+ console.log("\n请确认提纲,或选择重新生成 / 本地修改后执行 outline confirm。");
102
+ }
103
+ //# sourceMappingURL=outline-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline-create.js","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/outline-create.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,kBAAkB,GAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAA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B,EACnC,UAAU,CACX,CAAC;IACJ,CAAC;IAED,MAAM,oBAAoB,CAAC;QACzB,GAAG,OAAO;QACV,aAAa,EAAE;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE;gBACN,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;gBACpD,GAAG,IAAI,CAAC,MAAM;aACf;SACF;QACD,mBAAmB,EAAE,IAAI,CAAC,KAAK;QAC/B,OAAO;QACP,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,MAAM,CAAC,aAAa;KACpC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;QACb,OAAO;QACP,UAAU,EAAE,IAAI,CAAC,KAAK;QACtB,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CACT,mBAAmB,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,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,4CAA4C,CAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type OutputFormat } from "../../../../core/index.js";
2
+ export interface ResearchPathConfirmOptions {
3
+ orderId?: string;
4
+ picksFile?: string;
5
+ yes?: boolean;
6
+ format?: OutputFormat;
7
+ }
8
+ export declare function runNsfcResearchPathConfirm(options: ResearchPathConfirmOptions): Promise<void>;
9
+ //# sourceMappingURL=research-path-confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research-path-confirm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/fund/nsfc/commands/research-path-confirm.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAqBnC,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAoDD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAqLf"}