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