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,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* newidea invocation 输出解析(纯函数,便于单测)
|
|
3
|
+
*
|
|
4
|
+
* newidea CLI 的 --json 输出前后可能夹带非 JSON 噪声行(更新提示、进度日志),
|
|
5
|
+
* 因此不能直接 JSON.parse(stdout)。
|
|
6
|
+
*/
|
|
7
|
+
import { helixlifeError, helixlifeErrorCode } from "../../core/index.js";
|
|
8
|
+
const SUCCESS_STATUSES = new Set([
|
|
9
|
+
"success",
|
|
10
|
+
"succeeded",
|
|
11
|
+
"completed",
|
|
12
|
+
"complete",
|
|
13
|
+
"finished",
|
|
14
|
+
]);
|
|
15
|
+
const FAILED_STATUSES = new Set([
|
|
16
|
+
"failed",
|
|
17
|
+
"failure",
|
|
18
|
+
"error",
|
|
19
|
+
"cancelled",
|
|
20
|
+
"canceled",
|
|
21
|
+
"timeout",
|
|
22
|
+
]);
|
|
23
|
+
// 从首个 '{' 或 '[' 起做括号配对扫描,跳过字符串字面量内的括号
|
|
24
|
+
function findBalancedEnd(text, start) {
|
|
25
|
+
const open = text[start];
|
|
26
|
+
const close = open === "{" ? "}" : "]";
|
|
27
|
+
let depth = 0;
|
|
28
|
+
let inString = false;
|
|
29
|
+
let escaped = false;
|
|
30
|
+
for (let i = start; i < text.length; i += 1) {
|
|
31
|
+
const ch = text[i];
|
|
32
|
+
if (inString) {
|
|
33
|
+
if (escaped) {
|
|
34
|
+
escaped = false;
|
|
35
|
+
}
|
|
36
|
+
else if (ch === "\\") {
|
|
37
|
+
escaped = true;
|
|
38
|
+
}
|
|
39
|
+
else if (ch === '"') {
|
|
40
|
+
inString = false;
|
|
41
|
+
}
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (ch === '"') {
|
|
45
|
+
inString = true;
|
|
46
|
+
}
|
|
47
|
+
else if (ch === open) {
|
|
48
|
+
depth += 1;
|
|
49
|
+
}
|
|
50
|
+
else if (ch === close) {
|
|
51
|
+
depth -= 1;
|
|
52
|
+
if (depth === 0) {
|
|
53
|
+
return i;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return -1;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 从 CLI stdout 中提取首个完整 JSON 值(对象或数组)。
|
|
61
|
+
*/
|
|
62
|
+
export function extractJsonFromStdout(stdout) {
|
|
63
|
+
const text = stdout ?? "";
|
|
64
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
65
|
+
const ch = text[i];
|
|
66
|
+
if (ch !== "{" && ch !== "[") {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const end = findBalancedEnd(text, i);
|
|
70
|
+
if (end < 0) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(text.slice(i, end + 1));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// 该候选不是合法 JSON(例如日志里的花括号),继续向后找
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, `无法从 newidea 输出中解析 JSON:${text.slice(0, 300)}`);
|
|
81
|
+
}
|
|
82
|
+
function asRecord(value) {
|
|
83
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
84
|
+
? value
|
|
85
|
+
: null;
|
|
86
|
+
}
|
|
87
|
+
function pickString(source, keys) {
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
const value = source[key];
|
|
90
|
+
if (typeof value === "string" && value.trim()) {
|
|
91
|
+
return value.trim();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 从 `invocation start` / `last` 的返回中提取 run_record_id。
|
|
98
|
+
* 兼容下划线与驼峰,并向下一层 data / record / result 探一层。
|
|
99
|
+
*/
|
|
100
|
+
export function parseRunRecordId(raw) {
|
|
101
|
+
const record = asRecord(raw);
|
|
102
|
+
if (!record) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const direct = pickString(record, [
|
|
106
|
+
"run_record_id",
|
|
107
|
+
"runRecordId",
|
|
108
|
+
"record_id",
|
|
109
|
+
"recordId",
|
|
110
|
+
]);
|
|
111
|
+
if (direct) {
|
|
112
|
+
return direct;
|
|
113
|
+
}
|
|
114
|
+
for (const key of ["data", "record", "result"]) {
|
|
115
|
+
const nested = asRecord(record[key]);
|
|
116
|
+
if (nested) {
|
|
117
|
+
const found = pickString(nested, [
|
|
118
|
+
"run_record_id",
|
|
119
|
+
"runRecordId",
|
|
120
|
+
"record_id",
|
|
121
|
+
"recordId",
|
|
122
|
+
]);
|
|
123
|
+
if (found) {
|
|
124
|
+
return found;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 归一 `invocation process` 返回:状态、错误、产物链接与事件条数。
|
|
132
|
+
*/
|
|
133
|
+
export function normalizeInvocationProcess(raw) {
|
|
134
|
+
const record = asRecord(raw);
|
|
135
|
+
if (!record) {
|
|
136
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "newidea 进度查询返回结构异常(非对象)");
|
|
137
|
+
}
|
|
138
|
+
const source = asRecord(record.data) ?? record;
|
|
139
|
+
const rawStatus = typeof source.status === "string" ? source.status.trim() : "";
|
|
140
|
+
const normalized = rawStatus.toLowerCase();
|
|
141
|
+
const errorValue = source.error;
|
|
142
|
+
let error = null;
|
|
143
|
+
if (typeof errorValue === "string" && errorValue.trim()) {
|
|
144
|
+
error = errorValue.trim();
|
|
145
|
+
}
|
|
146
|
+
else if (asRecord(errorValue)) {
|
|
147
|
+
const nested = asRecord(errorValue);
|
|
148
|
+
error = pickString(nested, ["message", "detail", "reason"]) ?? null;
|
|
149
|
+
}
|
|
150
|
+
let status;
|
|
151
|
+
if (SUCCESS_STATUSES.has(normalized)) {
|
|
152
|
+
status = "success";
|
|
153
|
+
}
|
|
154
|
+
else if (FAILED_STATUSES.has(normalized) || error) {
|
|
155
|
+
// 未标记失败但带 error 文本时同样按失败处理,避免无限轮询
|
|
156
|
+
status = "failed";
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
status = "running";
|
|
160
|
+
}
|
|
161
|
+
const artifactsValue = source.artifacts;
|
|
162
|
+
let artifacts = null;
|
|
163
|
+
if (typeof artifactsValue === "string" && artifactsValue.trim()) {
|
|
164
|
+
artifacts = artifactsValue.trim();
|
|
165
|
+
}
|
|
166
|
+
else if (Array.isArray(artifactsValue)) {
|
|
167
|
+
const first = artifactsValue.find((item) => typeof item === "string" && Boolean(item.trim()));
|
|
168
|
+
artifacts = first ? first.trim() : null;
|
|
169
|
+
}
|
|
170
|
+
const itemCount = Array.isArray(source.items) ? source.items.length : 0;
|
|
171
|
+
return { status, rawStatus, error, artifacts, itemCount };
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/modules/proposal/parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAezE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,SAAS;IACT,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,QAAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,UAAU;IACV,SAAS;CACV,CAAC,CAAC;AAEH,sCAAsC;AACtC,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IAClD,MAAM,IAAI,GAAG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C;QACF,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAExE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface CreateSciOrderBody {
|
|
2
|
+
index: number;
|
|
3
|
+
count: number;
|
|
4
|
+
query?: string;
|
|
5
|
+
inputs?: Record<string, string | number>;
|
|
6
|
+
files?: string[];
|
|
7
|
+
parent_order_id: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateSciOrderResult {
|
|
10
|
+
success?: boolean;
|
|
11
|
+
data?: {
|
|
12
|
+
msg?: string;
|
|
13
|
+
data?: {
|
|
14
|
+
order_id?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
message?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface SciExecuteBody {
|
|
21
|
+
response_mode: "streaming";
|
|
22
|
+
query: string;
|
|
23
|
+
inputs: Record<string, string | number>;
|
|
24
|
+
app_id: string;
|
|
25
|
+
app_name: string;
|
|
26
|
+
app_mode: "workflow";
|
|
27
|
+
app_type: 0 | 1;
|
|
28
|
+
index: number;
|
|
29
|
+
order_id: string;
|
|
30
|
+
end: boolean;
|
|
31
|
+
count: number;
|
|
32
|
+
parent_order_id: string | null;
|
|
33
|
+
}
|
|
34
|
+
export declare function buildSciExecuteBody(params: {
|
|
35
|
+
query: string;
|
|
36
|
+
inputs: Record<string, string | number>;
|
|
37
|
+
appId: string;
|
|
38
|
+
appName: string;
|
|
39
|
+
appType?: 0 | 1;
|
|
40
|
+
index: number;
|
|
41
|
+
orderId: string;
|
|
42
|
+
end: boolean;
|
|
43
|
+
count?: number;
|
|
44
|
+
parentOrderId?: string | null;
|
|
45
|
+
}): SciExecuteBody;
|
|
46
|
+
export declare function createSciOrder(body: CreateSciOrderBody): Promise<CreateSciOrderResult>;
|
|
47
|
+
export declare function extractSciOrderId(order: CreateSciOrderResult): string;
|
|
48
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/modules/sci/apps.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAGD,MAAM,WAAW,oBAAoB;IACnC,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,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,WAAW,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,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;AAGD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,GAAG,cAAc,CAejB;AAGD,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAM/B;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAkBrE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// SCI /apps/* 接口共享层:订单创建与 SSE execute 请求体基底
|
|
2
|
+
import { ApiClient, helixlifeError, helixlifeErrorCode, } from "../../core/index.js";
|
|
3
|
+
import { SCI_ORDER_API_PATH } from "./constants.js";
|
|
4
|
+
// 组装 SSE execute 请求体
|
|
5
|
+
export function buildSciExecuteBody(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: params.appType ?? 1,
|
|
14
|
+
index: params.index,
|
|
15
|
+
order_id: params.orderId,
|
|
16
|
+
end: params.end,
|
|
17
|
+
count: params.count ?? 1,
|
|
18
|
+
parent_order_id: params.parentOrderId ?? null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// 调用后台创建 SCI 订单
|
|
22
|
+
export async function createSciOrder(body) {
|
|
23
|
+
const client = new ApiClient();
|
|
24
|
+
return client.request(SCI_ORDER_API_PATH, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// 从订单响应中提取 order_id
|
|
30
|
+
export function extractSciOrderId(order) {
|
|
31
|
+
const orderId = order.data?.data?.order_id;
|
|
32
|
+
if (typeof orderId === "string" && orderId) {
|
|
33
|
+
return orderId;
|
|
34
|
+
}
|
|
35
|
+
if (order.success === false) {
|
|
36
|
+
const message = (typeof order.message === "string" && order.message) ||
|
|
37
|
+
order.data?.msg ||
|
|
38
|
+
"SCI 订单创建失败,请稍后重试";
|
|
39
|
+
throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, message);
|
|
40
|
+
}
|
|
41
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "SCI 订单响应缺少 order_id,请重试");
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/modules/sci/apps.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAyCpD,qBAAqB;AACrB,MAAM,UAAU,mBAAmB,CAAC,MAWnC;IACC,OAAO;QACL,aAAa,EAAE,WAAW;QAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAA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}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SciTemplateType } from "./constants.js";
|
|
2
|
+
export interface SciArticleCachePayload {
|
|
3
|
+
orderId: string;
|
|
4
|
+
template: SciTemplateType;
|
|
5
|
+
language: string;
|
|
6
|
+
article: string;
|
|
7
|
+
references: string[];
|
|
8
|
+
workflowRunId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function __setSciArticleCacheDirForTesting(dir: string): void;
|
|
11
|
+
export declare function getSciArticleCacheDir(): string;
|
|
12
|
+
export declare function resolveSciArticleCachePath(orderId: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* 写入缓存并等待落盘完成。
|
|
15
|
+
*
|
|
16
|
+
* 步骤② 必须 await 本函数,确保进程退出前临时文件已可见(跨进程步骤③ 才能命中)。
|
|
17
|
+
* 返回 true 表示落盘成功;失败仅 stderr 警告,不抛错阻断主流程。
|
|
18
|
+
*/
|
|
19
|
+
export declare function saveSciArticleCache(payload: SciArticleCachePayload): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* 读取缓存条目。文件不存在 / 读失败 / 载荷非法一律返回 null。
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadSciArticleCache(orderId: string): Promise<SciArticleCachePayload | null>;
|
|
24
|
+
/**
|
|
25
|
+
* 取走缓存条目(读后即删)。步骤③ docx/md 成功落盘后调用。
|
|
26
|
+
*/
|
|
27
|
+
export declare function popSciArticleCache(orderId: string): Promise<SciArticleCachePayload | null>;
|
|
28
|
+
/**
|
|
29
|
+
* 删除指定 orderId 的全文缓存(若存在)。步骤② 开始前清理脏缓存。
|
|
30
|
+
*/
|
|
31
|
+
export declare function clearSciArticleCache(orderId: string): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=article-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article-cache.d.ts","sourceRoot":"","sources":["../../../src/modules/sci/article-cache.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAStD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAGD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKlE;AAqDD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAYxC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAexC;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzE"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCI 全文系统临时目录缓存
|
|
3
|
+
*
|
|
4
|
+
* 设计目标:跨 CLI 进程传递步骤② 生成的全文 Markdown,步骤③ 成功后立即清理。
|
|
5
|
+
*
|
|
6
|
+
* 与 JOVA 综述工作台 helixlife-jova-cache/ 对齐:
|
|
7
|
+
* - 存储路径为系统临时目录 helixlife-sci-cache/(不污染用户目录)
|
|
8
|
+
* - 删除时机为步骤③ docx/md 成功后 pop,而非持久化到用户目录
|
|
9
|
+
*
|
|
10
|
+
* 跨进程可见性:helixlife 每条命令是独立 Node 进程,必须落盘才能跨进程复用。
|
|
11
|
+
*/
|
|
12
|
+
import { randomBytes } from "node:crypto";
|
|
13
|
+
import { chmod, mkdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { isCompleteSciArticleMarkdown } from "./article-validate.js";
|
|
17
|
+
// 系统临时目录:mac/linux /tmp/helixlife-sci-cache/;Windows %TEMP%\helixlife-sci-cache\
|
|
18
|
+
let CACHE_DIR = join(tmpdir(), "helixlife-sci-cache");
|
|
19
|
+
const CACHE_FILE_PREFIX = "article-";
|
|
20
|
+
const CACHE_FILE_EXT = ".json";
|
|
21
|
+
// 仅供单元测试:覆盖缓存目录,避免污染真实系统临时目录
|
|
22
|
+
export function __setSciArticleCacheDirForTesting(dir) {
|
|
23
|
+
CACHE_DIR = dir;
|
|
24
|
+
}
|
|
25
|
+
export function getSciArticleCacheDir() {
|
|
26
|
+
return CACHE_DIR;
|
|
27
|
+
}
|
|
28
|
+
// 根据 orderId 计算缓存文件路径(供 E2E / 诊断使用)
|
|
29
|
+
export function resolveSciArticleCachePath(orderId) {
|
|
30
|
+
return join(CACHE_DIR, `${CACHE_FILE_PREFIX}${sanitizeOrderId(orderId)}${CACHE_FILE_EXT}`);
|
|
31
|
+
}
|
|
32
|
+
async function ensureCacheDir() {
|
|
33
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
34
|
+
}
|
|
35
|
+
// 安全过滤 orderId,避免路径穿越
|
|
36
|
+
function sanitizeOrderId(orderId) {
|
|
37
|
+
return orderId.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
38
|
+
}
|
|
39
|
+
// 原子替换:先写 .tmp 再 rename;Windows 目标已存在时先删再 rename
|
|
40
|
+
async function atomicReplace(tempPath, finalPath) {
|
|
41
|
+
try {
|
|
42
|
+
await rename(tempPath, finalPath);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (process.platform === "win32") {
|
|
46
|
+
await rm(finalPath, { force: true });
|
|
47
|
+
await rename(tempPath, finalPath);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// 实际落盘逻辑,失败时抛错
|
|
54
|
+
async function persistSciArticleCache(payload) {
|
|
55
|
+
if (!payload.orderId?.trim()) {
|
|
56
|
+
throw new Error("orderId 不能为空");
|
|
57
|
+
}
|
|
58
|
+
if (!payload.article?.trim()) {
|
|
59
|
+
throw new Error("article 不能为空");
|
|
60
|
+
}
|
|
61
|
+
await ensureCacheDir();
|
|
62
|
+
const finalPath = resolveSciArticleCachePath(payload.orderId);
|
|
63
|
+
const nonce = randomBytes(6).toString("hex");
|
|
64
|
+
const tempPath = `${finalPath}.${nonce}.tmp`;
|
|
65
|
+
const normalized = {
|
|
66
|
+
...payload,
|
|
67
|
+
language: payload.language ?? "中文",
|
|
68
|
+
references: Array.isArray(payload.references) ? payload.references : [],
|
|
69
|
+
};
|
|
70
|
+
await writeFile(tempPath, JSON.stringify(normalized), "utf8");
|
|
71
|
+
await atomicReplace(tempPath, finalPath);
|
|
72
|
+
// 仅当前用户可读,避免同机其他用户读取临时全文
|
|
73
|
+
await chmod(finalPath, 0o600);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 写入缓存并等待落盘完成。
|
|
77
|
+
*
|
|
78
|
+
* 步骤② 必须 await 本函数,确保进程退出前临时文件已可见(跨进程步骤③ 才能命中)。
|
|
79
|
+
* 返回 true 表示落盘成功;失败仅 stderr 警告,不抛错阻断主流程。
|
|
80
|
+
*/
|
|
81
|
+
export async function saveSciArticleCache(payload) {
|
|
82
|
+
try {
|
|
83
|
+
await persistSciArticleCache(payload);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.warn(`[sci-cache] 写入失败 orderId=${payload.orderId}: ${error.message}`);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 读取缓存条目。文件不存在 / 读失败 / 载荷非法一律返回 null。
|
|
93
|
+
*/
|
|
94
|
+
export async function loadSciArticleCache(orderId) {
|
|
95
|
+
if (!orderId?.trim()) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const path = resolveSciArticleCachePath(orderId);
|
|
99
|
+
let raw;
|
|
100
|
+
try {
|
|
101
|
+
raw = await readFile(path, "utf8");
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return parseCachePayload(raw, orderId);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 取走缓存条目(读后即删)。步骤③ docx/md 成功落盘后调用。
|
|
110
|
+
*/
|
|
111
|
+
export async function popSciArticleCache(orderId) {
|
|
112
|
+
if (!orderId?.trim()) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const path = resolveSciArticleCachePath(orderId);
|
|
116
|
+
let raw;
|
|
117
|
+
try {
|
|
118
|
+
raw = await readFile(path, "utf8");
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
await rm(path, { force: true }).catch(() => {
|
|
124
|
+
/* 删失败不影响主流程 */
|
|
125
|
+
});
|
|
126
|
+
return parseCachePayload(raw, orderId);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 删除指定 orderId 的全文缓存(若存在)。步骤② 开始前清理脏缓存。
|
|
130
|
+
*/
|
|
131
|
+
export async function clearSciArticleCache(orderId) {
|
|
132
|
+
if (!orderId?.trim()) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const path = resolveSciArticleCachePath(orderId);
|
|
136
|
+
await rm(path, { force: true }).catch(() => {
|
|
137
|
+
/* 不存在或删失败不影响主流程 */
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// 解析磁盘 JSON 为缓存载荷;仅标题无正文的脏缓存视为无效
|
|
141
|
+
function parseCachePayload(raw, orderId) {
|
|
142
|
+
try {
|
|
143
|
+
const entry = JSON.parse(raw);
|
|
144
|
+
if (typeof entry.article !== "string" || !entry.article) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (!isCompleteSciArticleMarkdown(entry.article)) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
orderId: entry.orderId ?? orderId,
|
|
152
|
+
template: entry.template ?? "basic",
|
|
153
|
+
language: entry.language ?? "中文",
|
|
154
|
+
article: entry.article,
|
|
155
|
+
references: Array.isArray(entry.references) ? entry.references : [],
|
|
156
|
+
workflowRunId: entry.workflowRunId,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=article-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article-cache.js","sourceRoot":"","sources":["../../../src/modules/sci/article-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;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,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,iFAAiF;AACjF,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC,CAAC;AAEtD,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,cAAc,GAAG,OAAO,CAAC;AAW/B,6BAA6B;AAC7B,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C;AACL,CAAC;AAED,iCAAiC;AACjC,SAAS,iBAAiB,CACxB,GAAW,EACX,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoC,CAAC;QACjE,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,OAAO;YACjC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,OAAO;YACnC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;YAChC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;YACnE,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 正文最短字符数:低于此且无二级标题则视为不完整 */
|
|
2
|
+
export declare const SCI_ARTICLE_BODY_MIN_CHARS = 100;
|
|
3
|
+
/**
|
|
4
|
+
* 判断合并后的全文是否完整(标题 + 实质正文,拒绝仅 H1)。
|
|
5
|
+
*/
|
|
6
|
+
export declare function isCompleteSciArticleMarkdown(article: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 校验 title/body 两段均完整;不通过则抛错(禁止写缓存)。
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertSciArticleComplete(sections: string[]): void;
|
|
11
|
+
//# sourceMappingURL=article-validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article-validate.d.ts","sourceRoot":"","sources":["../../../src/modules/sci/article-validate.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAoBrE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAwBjE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { helixlifeError, helixlifeErrorCode } from "../../core/index.js";
|
|
2
|
+
/** 正文最短字符数:低于此且无二级标题则视为不完整 */
|
|
3
|
+
export const SCI_ARTICLE_BODY_MIN_CHARS = 100;
|
|
4
|
+
/**
|
|
5
|
+
* 判断合并后的全文是否完整(标题 + 实质正文,拒绝仅 H1)。
|
|
6
|
+
*/
|
|
7
|
+
export function isCompleteSciArticleMarkdown(article) {
|
|
8
|
+
const trimmed = article.trim();
|
|
9
|
+
if (!trimmed) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const lines = trimmed.split(/\r?\n/);
|
|
13
|
+
const h1Index = lines.findIndex((line) => /^#\s+\S/.test(line.trim()));
|
|
14
|
+
if (h1Index < 0) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const body = lines
|
|
18
|
+
.slice(h1Index + 1)
|
|
19
|
+
.join("\n")
|
|
20
|
+
.trim();
|
|
21
|
+
if (!body) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return (body.length >= SCI_ARTICLE_BODY_MIN_CHARS || /^##\s+\S/m.test(body));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 校验 title/body 两段均完整;不通过则抛错(禁止写缓存)。
|
|
28
|
+
*/
|
|
29
|
+
export function assertSciArticleComplete(sections) {
|
|
30
|
+
if (sections.length < 2) {
|
|
31
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "全文生成不完整:缺少标题或正文,请重试 outline confirm create");
|
|
32
|
+
}
|
|
33
|
+
const title = sections[0]?.trim() ?? "";
|
|
34
|
+
const body = sections[1]?.trim() ?? "";
|
|
35
|
+
if (!title) {
|
|
36
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "全文生成不完整:标题为空,请重试 outline confirm create");
|
|
37
|
+
}
|
|
38
|
+
if (!body ||
|
|
39
|
+
(body.length < SCI_ARTICLE_BODY_MIN_CHARS && !/^##\s+\S/m.test(body))) {
|
|
40
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, "全文生成不完整:正文为空或过短(仅有标题不能视为成功),请重试 outline confirm create");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=article-validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article-validate.js","sourceRoot":"","sources":["../../../src/modules/sci/article-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAe;IAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvE,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,KAAK;SACf,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;SAClB,IAAI,CAAC,IAAI,CAAC;SACV,IAAI,EAAE,CAAC;IACV,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,IAAI,CAAC,MAAM,IAAI,0BAA0B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CACpE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAkB;IACzD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,4CAA4C,CAC7C,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,yCAAyC,CAC1C,CAAC;IACJ,CAAC;IACD,IACE,CAAC,IAAI;QACL,CAAC,IAAI,CAAC,MAAM,GAAG,0BAA0B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACrE,CAAC;QACD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,wDAAwD,CACzD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type OutputFormat } from "../../../core/index.js";
|
|
2
|
+
import { type SciLanguage } from "../constants.js";
|
|
3
|
+
export type { SciArticleCreateResult } from "../constants.js";
|
|
4
|
+
export interface CreateSciArticleOptions {
|
|
5
|
+
orderId?: string;
|
|
6
|
+
template?: string;
|
|
7
|
+
file?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
stdin?: boolean;
|
|
10
|
+
language?: string;
|
|
11
|
+
/** Step1 方法段落,与官网 Writing.getParams.methods 对齐 */
|
|
12
|
+
methods?: string;
|
|
13
|
+
/** Step1 结果段落,与官网 Writing.getParams.results 对齐 */
|
|
14
|
+
results?: string;
|
|
15
|
+
methodsFile?: string;
|
|
16
|
+
resultsFile?: string;
|
|
17
|
+
/** blank 默认空;existing 模式可传合并后的方法结果 */
|
|
18
|
+
methodAndResult?: string;
|
|
19
|
+
yes?: boolean;
|
|
20
|
+
format?: OutputFormat;
|
|
21
|
+
}
|
|
22
|
+
/** 检查是否为有效 Markdown(提纲格式:至少含 # 标题) */
|
|
23
|
+
export declare function isValidOutlineMarkdown(text: string): boolean;
|
|
24
|
+
/** 从提纲 Markdown 提取首个标题文本(对齐官网 outline_title) */
|
|
25
|
+
export declare function extractOutlineTitle(outline: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* 组装全文 execute inputs(对齐官网 Writing.getParams SCI existing)
|
|
28
|
+
* keywords ≈ outlineParams.query(existing 常为空,不用 results 冒充)
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildSciArticleInputs(options: {
|
|
31
|
+
outline: string;
|
|
32
|
+
language: SciLanguage;
|
|
33
|
+
methods: string;
|
|
34
|
+
results: string;
|
|
35
|
+
methodAndResult?: string;
|
|
36
|
+
}): Record<string, string | number>;
|
|
37
|
+
/**
|
|
38
|
+
* 标题段规范化:官网 title 工作流前强制写入 "# "
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeSciTitleSection(text: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* 合并 title + body 各段(官网 list.join("\\n"))
|
|
43
|
+
*/
|
|
44
|
+
export declare function assembleSciArticleMarkdown(sections: string[]): string;
|
|
45
|
+
export declare function runCreateSciArticle(options?: CreateSciArticleOptions): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=article-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article-create.d.ts","sourceRoot":"","sources":["../../../../src/modules/sci/commands/article-create.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,iBAAiB,CAAC;AAqDzB,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAMD,sCAAsC;AACtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED,gDAAgD;AAChD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D;AAOD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAA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