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,107 @@
1
+ // Step1 交互提示:对齐 writing-type-configs nsfc-v2 字段出现顺序
2
+ // blank+有前期:您的情况 → 补充材料 → 疾病名称
3
+ // blank+无前期:您的情况 → 研究主题(无上传)
4
+ // existing:假说 → 疾病名称 → 可选补充材料
5
+ import { askOptionWithRl, createInteractiveInterface, helixlifeError, helixlifeErrorCode, isInteractiveTerminal, } from "../../../core/index.js";
6
+ import { NSFC_HAS_HYPOTHESIS_OPTIONS, NSFC_PRIOR_RESULT_OPTIONS, NSFC_PROJECT_LEVEL_OPTIONS, NSFC_PROJECT_TYPE_OPTIONS, NSFC_QUERY_MAX_BLANK_DISEASE, NSFC_QUERY_MAX_BLANK_THEME, NSFC_QUERY_MAX_EXISTING_HYPOTHESIS, NSFC_DISEASE_MAX, NSFC_UPLOAD_EXT, NSFC_UPLOAD_MAX_MB, } from "./constants.js";
7
+ function printFieldGuide(hasHypothesis, priorResult) {
8
+ console.log("\n—— 必填 / 非必填说明 ——");
9
+ console.log("必填选项:项目级别" +
10
+ (hasHypothesis === "blank" ? ";您的情况(是否有前期研究结果)" : ""));
11
+ console.log("条件必填:项目级别为「国家级」时须选项目类型(面上 / 地区 / 青年)");
12
+ if (hasHypothesis === "blank") {
13
+ if (priorResult === "yes") {
14
+ console.log(`必填上传:补充材料(${NSFC_UPLOAD_EXT.join("/")},单文件,≤${NSFC_UPLOAD_MAX_MB}MB)——先于疾病名称`);
15
+ console.log(`必填输入:疾病名称(≤${NSFC_QUERY_MAX_BLANK_DISEASE} 字)——勿问「研究主题」`);
16
+ }
17
+ else {
18
+ console.log(`必填输入:您的研究主题(≤${NSFC_QUERY_MAX_BLANK_THEME} 字)`);
19
+ console.log("非必填上传:本路径无需补充材料,禁止索要附件");
20
+ }
21
+ }
22
+ else {
23
+ console.log(`必填输入:您的疾病名称(≤${NSFC_DISEASE_MAX} 字)——先于科学假说`);
24
+ console.log(`必填输入:您的科学假说(≤${NSFC_QUERY_MAX_EXISTING_HYPOTHESIS} 字)`);
25
+ console.log(`非必填上传:补充材料(${NSFC_UPLOAD_EXT.join("/")},单文件,≤${NSFC_UPLOAD_MAX_MB}MB)——最后询问`);
26
+ }
27
+ console.log("——————————————\n");
28
+ }
29
+ export async function promptNsfcHypothesisCreate(partial) {
30
+ if (!isInteractiveTerminal()) {
31
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "非交互终端请通过命令行参数提供全部必填项,并加 -y/--yes");
32
+ }
33
+ const rl = createInteractiveInterface();
34
+ try {
35
+ let hasHypothesis = partial.hasHypothesis;
36
+ if (!hasHypothesis) {
37
+ const values = NSFC_HAS_HYPOTHESIS_OPTIONS.map((o) => o.value);
38
+ hasHypothesis = await askOptionWithRl(rl, "是否已有科学假说", values, "blank", (value, index) => {
39
+ const opt = NSFC_HAS_HYPOTHESIS_OPTIONS[index];
40
+ return `${index + 1}) ${opt.label}`;
41
+ });
42
+ }
43
+ let projectLevel = partial.projectLevel;
44
+ if (!projectLevel) {
45
+ projectLevel = await askOptionWithRl(rl, "项目级别", NSFC_PROJECT_LEVEL_OPTIONS, "国家级");
46
+ }
47
+ let project = partial.project;
48
+ if (projectLevel === "国家级" && !project) {
49
+ project = await askOptionWithRl(rl, "项目类型", NSFC_PROJECT_TYPE_OPTIONS, "面上项目");
50
+ }
51
+ let priorResult = partial.priorResult;
52
+ if (hasHypothesis === "blank" && !priorResult) {
53
+ const values = NSFC_PRIOR_RESULT_OPTIONS.map((o) => o.value);
54
+ priorResult = await askOptionWithRl(rl, "您的情况", values, "yes", (value, index) => {
55
+ const opt = NSFC_PRIOR_RESULT_OPTIONS[index];
56
+ return `${index + 1}) ${opt.label}`;
57
+ });
58
+ }
59
+ printFieldGuide(hasHypothesis, priorResult);
60
+ let attachPath = partial.attachPath?.trim();
61
+ let query = partial.query?.trim();
62
+ let disease = partial.disease?.trim();
63
+ if (hasHypothesis === "blank" && priorResult === "yes") {
64
+ // 对齐前端 content.blank:补充材料(ifs 有前期)→ textarea 疾病名称
65
+ if (!attachPath) {
66
+ attachPath = (await rl.question(`请输入补充材料本地路径(${NSFC_UPLOAD_EXT.join("/")},必填):\n> `)).trim();
67
+ }
68
+ if (!query) {
69
+ query = (await rl.question(`请输入疾病名称(≤${NSFC_QUERY_MAX_BLANK_DISEASE} 字):\n> `)).trim();
70
+ }
71
+ }
72
+ else if (hasHypothesis === "blank" && priorResult === "no") {
73
+ // 无前期:仅研究主题,不问上传
74
+ if (!query) {
75
+ query = (await rl.question(`请输入您的研究主题(≤${NSFC_QUERY_MAX_BLANK_THEME} 字):\n> `)).trim();
76
+ }
77
+ attachPath = undefined;
78
+ }
79
+ else {
80
+ // existing:对齐 content.existing 左栏「疾病名称→补充材料」+ 右栏科学假说
81
+ // Agent/交互顺序:疾病名称 → 科学假说 → 可选附件
82
+ if (!disease) {
83
+ disease = (await rl.question(`请输入您的疾病名称(≤${NSFC_DISEASE_MAX} 字):\n> `)).trim();
84
+ }
85
+ if (!query) {
86
+ query = (await rl.question(`请输入您的科学假说(≤${NSFC_QUERY_MAX_EXISTING_HYPOTHESIS} 字):\n> `)).trim();
87
+ }
88
+ if (partial.attachPath === undefined) {
89
+ const optional = (await rl.question(`补充材料本地路径(可选,回车跳过;${NSFC_UPLOAD_EXT.join("/")}):\n> `)).trim();
90
+ attachPath = optional || undefined;
91
+ }
92
+ }
93
+ return {
94
+ hasHypothesis,
95
+ projectLevel,
96
+ project: projectLevel === "国家级" ? project : undefined,
97
+ priorResult: hasHypothesis === "blank" ? priorResult : undefined,
98
+ query: query ?? "",
99
+ disease,
100
+ attachPath,
101
+ };
102
+ }
103
+ finally {
104
+ rl.close();
105
+ }
106
+ }
107
+ //# sourceMappingURL=prompt-hypothesis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt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AAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { NsfcHypothesisItem, NsfcMissingInfoBlock } from "./parse-hypothesis.js";
2
+ export declare function promptSelectGene(genes: NsfcHypothesisItem[]): Promise<{
3
+ gene: string;
4
+ mechanism: string;
5
+ results: string;
6
+ }>;
7
+ export declare function promptPickHypothesis(hypotheses: NsfcHypothesisItem[]): Promise<{
8
+ index?: number;
9
+ custom?: string;
10
+ }>;
11
+ export interface MissingPickResult {
12
+ picks: {
13
+ title: string;
14
+ value: string;
15
+ }[];
16
+ }
17
+ export declare function promptMissingInfoPicks(blocks: NsfcMissingInfoBlock[]): Promise<MissingPickResult>;
18
+ //# sourceMappingURL=prompt-step2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-step2.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/prompt-step2.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAO/B,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,kBAAkB,EAAE,GAC1B,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA+C/D;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,kBAAkB,EAAE,GAC/B,OAAO,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA0C9C;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,EAAE,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAqD5B"}
@@ -0,0 +1,107 @@
1
+ // Step2 TTY 交互:基因 / 假说 / 缺失信息
2
+ import { askOptionWithRl, createInteractiveInterface, helixlifeError, helixlifeErrorCode, isInteractiveTerminal, } from "../../../core/index.js";
3
+ import { formatGeneResearchDirections, isMissingInfoCustomOption, shortMissingInfoLabel, } from "./parse-hypothesis.js";
4
+ export async function promptSelectGene(genes) {
5
+ if (!genes.length) {
6
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "无可选候选基因,请重新执行 hypothesis analyze");
7
+ }
8
+ if (!isInteractiveTerminal()) {
9
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "非交互终端请通过 --gene / --mechanism / --results 提供选型");
10
+ }
11
+ const rl = createInteractiveInterface();
12
+ try {
13
+ console.log("\n候选基因:\n");
14
+ genes.forEach((g, i) => {
15
+ const gene = g.gene || g.id;
16
+ const directions = formatGeneResearchDirections(g);
17
+ console.log(`候选基因 ${i + 1}:${gene}`);
18
+ if (directions) {
19
+ console.log(`研究方向:\n${directions.split(";").map((d) => `- ${d}`).join("\n")}`);
20
+ }
21
+ console.log("");
22
+ });
23
+ const indices = genes.map((_, i) => String(i));
24
+ const selected = await askOptionWithRl(rl, "选择候选基因(单选)", indices, "0", (_v, index) => {
25
+ const g = genes[index];
26
+ return `${index + 1}) ${g.gene || g.id}`;
27
+ });
28
+ const item = genes[Number(selected)];
29
+ return {
30
+ gene: item.gene || item.id,
31
+ mechanism: item.mechanism || item.original_text || "",
32
+ results: item.results || "",
33
+ };
34
+ }
35
+ finally {
36
+ rl.close();
37
+ }
38
+ }
39
+ export async function promptPickHypothesis(hypotheses) {
40
+ if (!hypotheses.length) {
41
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "无可选假说,请重新执行 analyze / genes select");
42
+ }
43
+ if (!isInteractiveTerminal()) {
44
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "非交互终端请通过 --hypothesis-index 或 --custom / --custom-file 提供假说");
45
+ }
46
+ const rl = createInteractiveInterface();
47
+ try {
48
+ const options = [...hypotheses.map((_, i) => String(i)), "custom"];
49
+ const selected = await askOptionWithRl(rl, "选择科学假说(或自定义)", options, "0", (value, index) => {
50
+ if (value === "custom") {
51
+ return `${index + 1}) 自定义假说`;
52
+ }
53
+ const n = Number(value) + 1;
54
+ const cn = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"][Number(value)];
55
+ return `${index + 1}) 假说${cn ?? n}`;
56
+ });
57
+ if (selected === "custom") {
58
+ const custom = (await rl.question("请输入自定义科学假说:\n> ")).trim();
59
+ return { custom };
60
+ }
61
+ return { index: Number(selected) };
62
+ }
63
+ finally {
64
+ rl.close();
65
+ }
66
+ }
67
+ export async function promptMissingInfoPicks(blocks) {
68
+ if (!blocks.length) {
69
+ return { picks: [] };
70
+ }
71
+ if (!isInteractiveTerminal()) {
72
+ throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "非交互终端请通过 --picks-file 提供缺失信息选型");
73
+ }
74
+ const rl = createInteractiveInterface();
75
+ try {
76
+ const picks = [];
77
+ for (let bi = 0; bi < blocks.length; bi += 1) {
78
+ const block = blocks[bi];
79
+ if (!block.select.length)
80
+ continue;
81
+ const optionValues = block.select.map((_, i) => String(i));
82
+ console.log(`\n缺失信息 [${bi + 1}/${blocks.length}]: ${block.title || "(无标题)"}`);
83
+ block.select.forEach((o, j) => {
84
+ console.log(` ${j + 1}) ${o}`);
85
+ });
86
+ const selected = await askOptionWithRl(rl, "请选择(须从当前选项中选择)", optionValues, "0", (value, index) => {
87
+ const full = block.select[Number(value)] ?? "";
88
+ return `${index + 1}) ${shortMissingInfoLabel(full)}`;
89
+ });
90
+ const opt = block.select[Number(selected)] ?? "";
91
+ if (isMissingInfoCustomOption(opt)) {
92
+ const custom = (await rl.question("请输入自定义内容(≤200 字):\n> "))
93
+ .trim()
94
+ .slice(0, 200);
95
+ picks.push({ title: block.title, value: custom || opt });
96
+ }
97
+ else {
98
+ picks.push({ title: block.title, value: opt });
99
+ }
100
+ }
101
+ return { picks };
102
+ }
103
+ finally {
104
+ rl.close();
105
+ }
106
+ }
107
+ //# sourceMappingURL=prompt-step2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-step2.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/prompt-step2.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAA2B;IAE3B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,kCAAkC,CACnC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC7B,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,gDAAgD,CACjD,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;YAC5B,MAAM,UAAU,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACrC,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,UAAU,UAAU,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E;gBACf,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC/C,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YACxD,CAAC,CACF,CAAC;YAEF,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;YACjD,IAAI,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;qBACxD,IAAI,EAAE;qBACN,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;gBACjB,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { NsfcHasHypothesis, NsfcPriorResult, NsfcProjectLevel, NsfcProjectType } from "./constants.js";
2
+ /** 上传材料项,对齐前端 FileUploadItem 成功态 */
3
+ export interface NsfcUploadFileItem {
4
+ file_name: string;
5
+ suffix: string;
6
+ content?: string;
7
+ word_count?: number;
8
+ }
9
+ export interface NsfcHypothesisInputs {
10
+ projectLevel: NsfcProjectLevel;
11
+ project?: NsfcProjectType;
12
+ /** blank:有/无前期研究结果文案;existing:疾病名称 */
13
+ value?: string;
14
+ /** blank 主文本(疾病名或研究主题) */
15
+ input?: string;
16
+ /** existing 主文本(科学假说) */
17
+ text?: string;
18
+ /** blank + 有前期:必填附件 */
19
+ file?: NsfcUploadFileItem[];
20
+ /** existing:可选附件 */
21
+ file1?: NsfcUploadFileItem[];
22
+ }
23
+ export interface NsfcHypothesisRequestBody {
24
+ query: string;
25
+ inputs: NsfcHypothesisInputs;
26
+ }
27
+ export interface BuildNsfcHypothesisBodyParams {
28
+ hasHypothesis: NsfcHasHypothesis;
29
+ projectLevel: NsfcProjectLevel;
30
+ project?: NsfcProjectType;
31
+ priorResult?: NsfcPriorResult;
32
+ /** 主文本:blank 为疾病/主题;existing 为科学假说 */
33
+ query: string;
34
+ /** existing 必填疾病名;blank+有前期时通常等于 query */
35
+ disease?: string;
36
+ attachFiles?: NsfcUploadFileItem[];
37
+ }
38
+ export declare function buildNsfcHypothesisBody(params: BuildNsfcHypothesisBodyParams): NsfcHypothesisRequestBody;
39
+ export declare function buildNsfcHandoff(params: {
40
+ hasHypothesis: NsfcHasHypothesis;
41
+ priorResult?: NsfcPriorResult;
42
+ }): {
43
+ hasHypothesis: NsfcHasHypothesis;
44
+ nextSubStep: import("./constants.js").NsfcNextSubStep;
45
+ outlineAppSuffix: "" | "-none-hypothesis";
46
+ };
47
+ //# sourceMappingURL=request-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-body.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/request-body.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAOxB,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5B,oBAAoB;IACpB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,iBAAiB,CAAC;IACjC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,6BAA6B,GACpC,yBAAyB,CA8B3B;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;;;;EASA"}
@@ -0,0 +1,38 @@
1
+ import { NSFC_PRIOR_RESULT_LABEL, resolveNextSubStep, resolveOutlineAppSuffix, } from "./constants.js";
2
+ export function buildNsfcHypothesisBody(params) {
3
+ const inputs = {
4
+ projectLevel: params.projectLevel,
5
+ };
6
+ if (params.projectLevel === "国家级") {
7
+ inputs.project = params.project ?? "面上项目";
8
+ }
9
+ if (params.hasHypothesis === "blank") {
10
+ inputs.input = params.query;
11
+ inputs.value =
12
+ params.priorResult === "yes"
13
+ ? NSFC_PRIOR_RESULT_LABEL.yes
14
+ : NSFC_PRIOR_RESULT_LABEL.no;
15
+ if (params.attachFiles?.length) {
16
+ inputs.file = params.attachFiles;
17
+ }
18
+ }
19
+ else {
20
+ inputs.text = params.query;
21
+ inputs.value = params.disease ?? "";
22
+ if (params.attachFiles?.length) {
23
+ inputs.file1 = params.attachFiles;
24
+ }
25
+ }
26
+ return {
27
+ query: params.query,
28
+ inputs,
29
+ };
30
+ }
31
+ export function buildNsfcHandoff(params) {
32
+ return {
33
+ hasHypothesis: params.hasHypothesis,
34
+ nextSubStep: resolveNextSubStep(params.hasHypothesis, params.priorResult),
35
+ outlineAppSuffix: resolveOutlineAppSuffix(params.hasHypothesis),
36
+ };
37
+ }
38
+ //# sourceMappingURL=request-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-body.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/request-body.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AA0CxB,MAAM,UAAU,uBAAuB,CACrC,MAAqC;IAErC,MAAM,MAAM,GAAyB;QACnC,YAAY,EAAE,MAAM,CAAC,YAAY;KAClC,CAAC;IAEF,IAAI,MAAM,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;QAClC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM,CAAC,aAAa,KAAK,OAAO,EAAE,CAAC;QACrC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK;YACV,MAAM,CAAC,WAAW,KAAK,KAAK;gBAC1B,CAAC,CAAC,uBAAuB,CAAC,GAAG;gBAC7B,CAAC,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACjC,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;QACnC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;YAC/B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAGhC;IACC,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE,kBAAkB,CAC7B,MAAM,CAAC,aAAa,EACpB,MAAM,CAAC,WAAW,CACnB;QACD,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,aAAa,CAAC;KAChE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { NsfcHasHypothesis, NsfcNextSubStep } from "./constants.js";
2
+ import type { NsfcHypothesisItem, NsfcMissingInfoBlock } from "./parse-hypothesis.js";
3
+ export interface NsfcSessionCachePayload {
4
+ orderId: string;
5
+ query: string;
6
+ inputs: Record<string, unknown>;
7
+ hasHypothesis: NsfcHasHypothesis;
8
+ nextSubStep: NsfcNextSubStep;
9
+ outlineAppSuffix: "-none-hypothesis" | "";
10
+ /** 文章分析背景 */
11
+ backgroundReport?: string;
12
+ /** 候选基因 */
13
+ genes?: NsfcHypothesisItem[];
14
+ /** 假说列表(pick 前) */
15
+ hypotheses?: NsfcHypothesisItem[];
16
+ /** 研究路径原文 */
17
+ researchPathText?: string;
18
+ /** 研究路径原始 result */
19
+ researchPathResult?: unknown;
20
+ missingInfo?: NsfcMissingInfoBlock[];
21
+ genePreResultsText?: string;
22
+ /** 已选基因(genes select 后) */
23
+ selectedGene?: string;
24
+ selectedMechanism?: string;
25
+ selectedResults?: string;
26
+ /** pick 确认后的假说 */
27
+ confirmedHypothesis?: string;
28
+ outlineParams?: {
29
+ query: string;
30
+ inputs: Record<string, unknown>;
31
+ };
32
+ /** 提纲正文(create / research-path confirm / confirm --file) */
33
+ outline?: string;
34
+ /** Step3 outline confirm 后为 true */
35
+ outlineConfirmed?: boolean;
36
+ /** Step4 全文 Markdown */
37
+ article?: string;
38
+ /** 格式转换后的 Markdown */
39
+ convertedArticle?: string;
40
+ workflowRunId?: string;
41
+ }
42
+ export declare function __setNsfcSessionCacheDirForTesting(dir: string): void;
43
+ export declare function getNsfcSessionCacheDir(): string;
44
+ export declare function resolveNsfcSessionCachePath(orderId: string): string;
45
+ export declare function saveNsfcSessionCache(payload: NsfcSessionCachePayload): Promise<boolean>;
46
+ export declare function loadNsfcSessionCache(orderId: string): Promise<NsfcSessionCachePayload | null>;
47
+ export declare function updateNsfcSessionCache(orderId: string, patch: Partial<NsfcSessionCachePayload>): Promise<NsfcSessionCachePayload | null>;
48
+ //# sourceMappingURL=session-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-cache.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/session-cache.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,EAAE,eAAe,CAAC;IAC7B,gBAAgB,EAAE,kBAAkB,GAAG,EAAE,CAAC;I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CAAC,uBAAuB,GAAG,IAAI,CAAC,CAgBzC;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,GACtC,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAMzC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * NSFC Step2 跨进程会话缓存(系统临时目录 helixlife-nsfc-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-cache");
9
+ const CACHE_FILE_PREFIX = "session-";
10
+ const CACHE_FILE_EXT = ".json";
11
+ export function __setNsfcSessionCacheDirForTesting(dir) {
12
+ CACHE_DIR = dir;
13
+ }
14
+ export function getNsfcSessionCacheDir() {
15
+ return CACHE_DIR;
16
+ }
17
+ export function resolveNsfcSessionCachePath(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
+ async function persist(payload) {
40
+ if (!payload.orderId?.trim()) {
41
+ throw new Error("orderId 不能为空");
42
+ }
43
+ await ensureCacheDir();
44
+ const finalPath = resolveNsfcSessionCachePath(payload.orderId);
45
+ const nonce = randomBytes(6).toString("hex");
46
+ const tempPath = `${finalPath}.${nonce}.tmp`;
47
+ await writeFile(tempPath, JSON.stringify(payload), "utf8");
48
+ await atomicReplace(tempPath, finalPath);
49
+ await chmod(finalPath, 0o600);
50
+ }
51
+ export async function saveNsfcSessionCache(payload) {
52
+ try {
53
+ await persist(payload);
54
+ return true;
55
+ }
56
+ catch (error) {
57
+ console.warn(`[nsfc-cache] 写入失败 orderId=${payload.orderId}: ${error.message}`);
58
+ return false;
59
+ }
60
+ }
61
+ export async function loadNsfcSessionCache(orderId) {
62
+ if (!orderId?.trim())
63
+ return null;
64
+ const path = resolveNsfcSessionCachePath(orderId);
65
+ let raw;
66
+ try {
67
+ raw = await readFile(path, "utf8");
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ try {
73
+ const entry = JSON.parse(raw);
74
+ if (!entry.orderId)
75
+ entry.orderId = orderId;
76
+ return entry;
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ }
82
+ export async function updateNsfcSessionCache(orderId, patch) {
83
+ const existing = await loadNsfcSessionCache(orderId);
84
+ if (!existing)
85
+ return null;
86
+ const next = { ...existing, ...patch, orderId };
87
+ await saveNsfcSessionCache(next);
88
+ return next;
89
+ }
90
+ //# sourceMappingURL=session-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-cache.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/session-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;AAOjC,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;AAEvD,MAAM,iBAAiB,GAAG,UAAU,CAAC;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;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAe,EACf,KAAuC;IAEvC,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,IAAI,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC;IAChD,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type OutputFormat } from "../../../core/index.js";
2
+ export interface StreamNsfcWorkflowOptions {
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 StreamNsfcWorkflowResult {
15
+ text: string;
16
+ elapsedTime?: number;
17
+ workflowRunId?: string;
18
+ outputs?: Record<string, unknown>;
19
+ }
20
+ export declare function streamNsfcWorkflow(options: StreamNsfcWorkflowOptions): Promise<StreamNsfcWorkflowResult>;
21
+ export declare function formatElapsedHint(elapsedTime?: number): string;
22
+ //# sourceMappingURL=sse-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-utils.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/sse-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,yBAAyB;IACxC,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,wBAAwB;IACvC,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,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CA+FnC;AAED,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,81 @@
1
+ // NSFC SSE workflow:允许仅返回结构化 outputs(无正文 text)
2
+ import { ApiClient, helixlifeError, helixlifeErrorCode, createStderrProgress, extractSseText, pickWorkflowOutputText, assertWorkflowSucceeded, } from "../../../core/index.js";
3
+ export async function streamNsfcWorkflow(options) {
4
+ const client = new ApiClient();
5
+ const chunks = [];
6
+ let receivedLength = 0;
7
+ let overrideText;
8
+ let succeeded = false;
9
+ let elapsedTime;
10
+ let workflowRunId;
11
+ let finishedOutputs;
12
+ let streamedAny = false;
13
+ const streamToStdout = options.format !== "json";
14
+ if (streamToStdout) {
15
+ console.log(`${options.startLabel}\n`);
16
+ }
17
+ const progress = createStderrProgress(!streamToStdout);
18
+ progress.start(options.progressLabel);
19
+ try {
20
+ await client.requestSse(options.path, { method: "POST", body: options.body }, (payload) => {
21
+ assertWorkflowSucceeded(payload, options.failureMessage, [
22
+ "workflow_finished",
23
+ ]);
24
+ const chunk = extractSseText(payload, { nested: true });
25
+ if (chunk) {
26
+ chunks.push(chunk);
27
+ receivedLength += chunk.length;
28
+ progress.update(receivedLength);
29
+ if (streamToStdout) {
30
+ process.stdout.write(chunk);
31
+ streamedAny = true;
32
+ }
33
+ }
34
+ if (payload.event === "workflow_finished") {
35
+ const data = payload.data;
36
+ if (typeof data === "object" && data !== null) {
37
+ const record = data;
38
+ if (record.status === "succeeded") {
39
+ succeeded = true;
40
+ }
41
+ if (typeof record.elapsed_time === "number") {
42
+ elapsedTime = record.elapsed_time;
43
+ }
44
+ const outputs = record.outputs;
45
+ if (typeof outputs === "object" && outputs !== null) {
46
+ finishedOutputs = outputs;
47
+ const finishedText = pickWorkflowOutputText(finishedOutputs);
48
+ if (finishedText) {
49
+ overrideText = finishedText;
50
+ if (streamToStdout && !streamedAny) {
51
+ process.stdout.write(`${finishedText}\n`);
52
+ streamedAny = true;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ if (typeof payload.workflow_run_id === "string") {
58
+ workflowRunId = payload.workflow_run_id;
59
+ }
60
+ }
61
+ });
62
+ }
63
+ catch (error) {
64
+ progress.dispose();
65
+ throw error;
66
+ }
67
+ progress.finish(options.finishLabel);
68
+ const text = overrideText ?? chunks.join("");
69
+ const hasOutputs = finishedOutputs !== undefined && Object.keys(finishedOutputs).length > 0;
70
+ if (!text && !(options.allowEmptyText && hasOutputs)) {
71
+ throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, options.emptyMessage);
72
+ }
73
+ if (!succeeded) {
74
+ throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, options.failureMessage);
75
+ }
76
+ return { text, elapsedTime, workflowRunId, outputs: finishedOutputs };
77
+ }
78
+ export function formatElapsedHint(elapsedTime) {
79
+ return elapsedTime !== undefined ? `,耗时 ${elapsedTime.toFixed(1)} 秒` : "";
80
+ }
81
+ //# sourceMappingURL=sse-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-utils.js","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/sse-utils.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EACL,SAAS,E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1C,CAAC;YACH,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,KAAK,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,UAAU,GACd,eAAe,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAE3E,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,UAAU,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,OAAO,CAAC,YAAY,CACrB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,cAAc,EACjC,OAAO,CAAC,cAAc,CACvB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAoB;IACpD,OAAO,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { NsfcUploadFileItem } from "./request-body.js";
2
+ export declare function uploadNsfcAttach(filePath: string): Promise<NsfcUploadFileItem>;
3
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../src/modules/fund/nsfc/upload.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAQ5D,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CA2E7B"}