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,865 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createStderrProgress, helixlifeError, helixlifeErrorCode, printOutput, renderListAsMarkdown, } from "../../core/index.js";
|
|
3
|
+
import { META_API_PREFIX } from "./constants.js";
|
|
4
|
+
import { requestMeta } from "./api.js";
|
|
5
|
+
import { createMetaNode, getMetaNodeOutput, pollMetaNodeStatus, } from "./node.js";
|
|
6
|
+
const META_NODE_TYPES = {
|
|
7
|
+
GENERATE_TOPIC: "generate_topic",
|
|
8
|
+
VERIFY_TOPIC: "verify_topic",
|
|
9
|
+
GENERATE_PICOS: "generate_picos",
|
|
10
|
+
GENERATE_SORTING_CRITERIA: "generate_sorting_criteria",
|
|
11
|
+
};
|
|
12
|
+
const PICOS_FIELD_LABELS = {
|
|
13
|
+
P: "Population / Participants",
|
|
14
|
+
I: "Intervention / Exposure",
|
|
15
|
+
C: "Comparator / Context",
|
|
16
|
+
O: "Outcome",
|
|
17
|
+
S: "Study Characteristics / Design",
|
|
18
|
+
Other: "Other",
|
|
19
|
+
};
|
|
20
|
+
/** 候选题选定后的操作选项(文案固定,禁止改写) */
|
|
21
|
+
const CONFIRMED_TOPIC_OPERATION_OPTIONS = [
|
|
22
|
+
"编辑当前选题",
|
|
23
|
+
"确认无误,下一步(生成 PICOS)",
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* 构建「已确认选题」展示与选择器指令。
|
|
27
|
+
*
|
|
28
|
+
* @param selectedIndex 已选序号(1-based),未知时为 undefined。
|
|
29
|
+
* @returns displayInstruction 与 selectorTitle。
|
|
30
|
+
*/
|
|
31
|
+
function buildConfirmedTopicGuidance(selectedIndex) {
|
|
32
|
+
const selectorTitle = selectedIndex !== undefined
|
|
33
|
+
? `已选择选题 ${selectedIndex}`
|
|
34
|
+
: "已选择选题";
|
|
35
|
+
return {
|
|
36
|
+
selectorTitle,
|
|
37
|
+
operationOptions: [...CONFIRMED_TOPIC_OPERATION_OPTIONS],
|
|
38
|
+
displayInstruction: `topic select 成功后:必须在聊天展示「${selectorTitle}」及题目原文;` +
|
|
39
|
+
`AskQuestion / 选择器的标题(title)必须原样为「${selectorTitle}」;` +
|
|
40
|
+
"一级选项固定为:编辑当前选题 / 确认无误,下一步(生成 PICOS)。" +
|
|
41
|
+
"禁止使用「请选择下一步操作」「请选择操作」「请选择」等泛化标题;" +
|
|
42
|
+
"禁止未展示已选选题就弹编辑/确认操作;禁止仍用「编辑选题」旧文案。",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const CRITERIA_DISPLAY_INSTRUCTION = "必须原样展示接口返回的 displayData。" +
|
|
46
|
+
"禁止增加标题、标签、前后缀、解释或其他包装文本;" +
|
|
47
|
+
"禁止翻译、改写、摘要、本地化、重排、拆分、合并或生成中英混排内容。";
|
|
48
|
+
/** 对齐网站「您输入选题无法生成 PICOS」弹窗文案 */
|
|
49
|
+
const VERIFY_CANDIDATES_NOTICE = {
|
|
50
|
+
title: "您输入选题无法生成 PICOS",
|
|
51
|
+
message: "您的选题无法生成 PICOS,我们根据您的输入,帮助您生成了一些 Meta 选题内容。",
|
|
52
|
+
};
|
|
53
|
+
const VERIFY_CANDIDATES_DISPLAY_INSTRUCTION = "verificationStatus=candidates_required 时:必须先原样向用户展示 verificationNotice.title 与 verificationNotice.message" +
|
|
54
|
+
"(对齐网站弹窗,禁止改写/省略),再原样输出 candidateListMarkdown,并弹 selectionOptions 选择器(含「重新生成选题」)。" +
|
|
55
|
+
"禁止跳过提示直接列候选题或改用自拟说明。";
|
|
56
|
+
function parseJsonObject(raw, optionName) {
|
|
57
|
+
const jsonText = raw?.replace(/^\uFEFF/, "").trim();
|
|
58
|
+
if (!jsonText) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const parsed = JSON.parse(jsonText);
|
|
63
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
64
|
+
throw new Error("not an object");
|
|
65
|
+
}
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `${optionName} 须为合法 JSON 对象`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function parseJsonObjectInput(raw, filePath, optionName, fileOptionName) {
|
|
73
|
+
if (filePath?.trim()) {
|
|
74
|
+
const content = await readFile(filePath.trim(), "utf8");
|
|
75
|
+
return parseJsonObject(content, fileOptionName);
|
|
76
|
+
}
|
|
77
|
+
if (!raw?.trim()) {
|
|
78
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `缺少 ${optionName} 或 ${fileOptionName}`);
|
|
79
|
+
}
|
|
80
|
+
return parseJsonObject(raw, optionName);
|
|
81
|
+
}
|
|
82
|
+
async function resolveWorkflowId(options) {
|
|
83
|
+
if (options.workflowId?.trim()) {
|
|
84
|
+
return options.workflowId.trim();
|
|
85
|
+
}
|
|
86
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少 --workflow-id。Meta 选题、PICOS 和纳排标准必须沿用已创建的工作流,禁止在节点命令中自动创建新工作流。");
|
|
87
|
+
}
|
|
88
|
+
function transformTitleData(data) {
|
|
89
|
+
return Object.fromEntries(Object.entries(data)
|
|
90
|
+
.filter(([key]) => key !== "selected")
|
|
91
|
+
.map(([key, value]) => [
|
|
92
|
+
key,
|
|
93
|
+
typeof value === "object" && value !== null
|
|
94
|
+
? value
|
|
95
|
+
: { English: String(value ?? ""), Chinese: "" },
|
|
96
|
+
]));
|
|
97
|
+
}
|
|
98
|
+
function inferTopicSource(nodeType) {
|
|
99
|
+
if (nodeType === "verify_topic" || nodeType === "verify_topic_guard") {
|
|
100
|
+
return "verify";
|
|
101
|
+
}
|
|
102
|
+
return "generate";
|
|
103
|
+
}
|
|
104
|
+
function findTopicNode(workflow, source) {
|
|
105
|
+
const candidates = source === "verify"
|
|
106
|
+
? ["verify_topic", "verify_topic_guard"]
|
|
107
|
+
: source === "generate"
|
|
108
|
+
? ["generate_topic", "generate_topic_guard"]
|
|
109
|
+
: [
|
|
110
|
+
"generate_topic",
|
|
111
|
+
"generate_topic_guard",
|
|
112
|
+
"verify_topic",
|
|
113
|
+
"verify_topic_guard",
|
|
114
|
+
];
|
|
115
|
+
return [...(workflow.nodes ?? [])]
|
|
116
|
+
.reverse()
|
|
117
|
+
.find((node) => candidates.includes(node.node_type));
|
|
118
|
+
}
|
|
119
|
+
function findLatestNode(workflow, nodeType) {
|
|
120
|
+
return [...(workflow.nodes ?? [])]
|
|
121
|
+
.reverse()
|
|
122
|
+
.find((node) => node.node_type === nodeType);
|
|
123
|
+
}
|
|
124
|
+
async function getWorkflowForSave(runnerId, options) {
|
|
125
|
+
return requestMeta(`${META_API_PREFIX}/workflow/runs/${encodeURIComponent(runnerId)}`, {
|
|
126
|
+
configPath: options.configPath,
|
|
127
|
+
action: "查询 Meta 工作流",
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async function resolveTopicSaveTarget(options) {
|
|
131
|
+
const runnerId = await resolveWorkflowId(options);
|
|
132
|
+
const workflow = await getWorkflowForSave(runnerId, options);
|
|
133
|
+
// 显式 node-id:来源优先用参数,否则按节点类型推断
|
|
134
|
+
if (options.nodeId?.trim()) {
|
|
135
|
+
const explicitNode = (workflow.nodes ?? []).find((node) => node.id === options.nodeId?.trim());
|
|
136
|
+
return {
|
|
137
|
+
runnerId,
|
|
138
|
+
nodeId: options.nodeId.trim(),
|
|
139
|
+
source: options.source ??
|
|
140
|
+
inferTopicSource(explicitNode?.node_type) ??
|
|
141
|
+
"generate",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// 先按指定 source 找;找不到再在全部选题节点中回退(避免默认 generate 在 verify 工作流上报 E2001)
|
|
145
|
+
const node = findTopicNode(workflow, options.source) ??
|
|
146
|
+
(options.source ? findTopicNode(workflow) : undefined);
|
|
147
|
+
if (!node) {
|
|
148
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "当前工作流中未找到可确认的 Meta 选题节点");
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
runnerId,
|
|
152
|
+
nodeId: node.id,
|
|
153
|
+
source: options.source ?? inferTopicSource(node.node_type),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
async function resolveNodeSaveTarget(options, nodeType, label) {
|
|
157
|
+
const runnerId = await resolveWorkflowId(options);
|
|
158
|
+
if (options.nodeId?.trim()) {
|
|
159
|
+
return { runnerId, nodeId: options.nodeId.trim() };
|
|
160
|
+
}
|
|
161
|
+
const workflow = await getWorkflowForSave(runnerId, options);
|
|
162
|
+
const node = findLatestNode(workflow, nodeType);
|
|
163
|
+
if (!node) {
|
|
164
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `当前工作流中未找到可保存的 ${label} 节点`);
|
|
165
|
+
}
|
|
166
|
+
return { runnerId, nodeId: node.id };
|
|
167
|
+
}
|
|
168
|
+
function extractNodeOutput(node) {
|
|
169
|
+
if (node.output &&
|
|
170
|
+
typeof node.output === "object" &&
|
|
171
|
+
"output" in node.output) {
|
|
172
|
+
return node.output.output;
|
|
173
|
+
}
|
|
174
|
+
return node.output ?? {};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 将 Meta 选题节点的原始输出转换为题目数组。
|
|
178
|
+
*
|
|
179
|
+
* 后台可能返回 TitleN 映射、题目对象数组或字符串数组;CLI 对外仅保留
|
|
180
|
+
* 每个候选项中承载题目内容的 English 字段。English 是后台字段名,
|
|
181
|
+
* 不表示题目内容必须使用英文。
|
|
182
|
+
*
|
|
183
|
+
* @param output Meta 选题节点的原始输出。
|
|
184
|
+
* @returns 已去除空值和首尾空格的题目数组。
|
|
185
|
+
*/
|
|
186
|
+
function normalizeTopicTitles(output) {
|
|
187
|
+
if (Array.isArray(output)) {
|
|
188
|
+
return output
|
|
189
|
+
.map((item) => {
|
|
190
|
+
if (typeof item === "string") {
|
|
191
|
+
return item.trim();
|
|
192
|
+
}
|
|
193
|
+
if (item && typeof item === "object") {
|
|
194
|
+
return extractTopicTitle(item);
|
|
195
|
+
}
|
|
196
|
+
return "";
|
|
197
|
+
})
|
|
198
|
+
.filter(Boolean);
|
|
199
|
+
}
|
|
200
|
+
if (!output || typeof output !== "object") {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
return Object.entries(output)
|
|
204
|
+
.filter(([key]) => key !== "selected")
|
|
205
|
+
.map(([, value]) => {
|
|
206
|
+
if (typeof value === "string") {
|
|
207
|
+
return value.trim();
|
|
208
|
+
}
|
|
209
|
+
if (value && typeof value === "object") {
|
|
210
|
+
return extractTopicTitle(value);
|
|
211
|
+
}
|
|
212
|
+
return "";
|
|
213
|
+
})
|
|
214
|
+
.filter(Boolean);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 从候选题目对象中提取可展示标题。
|
|
218
|
+
*
|
|
219
|
+
* 后台当前主要使用 English 字段,但历史或转发层可能返回 title/Title/name
|
|
220
|
+
* 等字段。这里统一兼容,避免候选项退化为“选题 1”这类泛称。
|
|
221
|
+
*
|
|
222
|
+
* @param item 候选题目对象。
|
|
223
|
+
* @returns 可展示的完整题目。
|
|
224
|
+
*/
|
|
225
|
+
function extractTopicTitle(item) {
|
|
226
|
+
for (const key of ["English", "english", "title", "Title", "name", "topic"]) {
|
|
227
|
+
const value = item[key];
|
|
228
|
+
if (typeof value === "string" && value.trim()) {
|
|
229
|
+
return value.trim();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const firstString = Object.values(item).find((value) => typeof value === "string" && value.trim());
|
|
233
|
+
return typeof firstString === "string" ? firstString.trim() : "";
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* 构造 WorkBuddy 选择器可直接使用的候选项。
|
|
237
|
+
*
|
|
238
|
+
* @param titles 完整题目数组。
|
|
239
|
+
* @returns label 为简短序号文案,value 为对应完整题目的选项数组。
|
|
240
|
+
*/
|
|
241
|
+
function buildTopicSelectionOptions(titles) {
|
|
242
|
+
return titles.map((title, index) => ({
|
|
243
|
+
index: index + 1,
|
|
244
|
+
label: `选题 ${index + 1}`,
|
|
245
|
+
value: title,
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
function buildTopicCandidateListMarkdown(titles) {
|
|
249
|
+
return titles
|
|
250
|
+
.map((title, index) => `${index + 1}. ${title}`)
|
|
251
|
+
.join("\n");
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 为「已有选题」校验失败(需选候选题)附加网站同款提示与展示指令。
|
|
255
|
+
*
|
|
256
|
+
* @param result 已归一化的选题结果。
|
|
257
|
+
* @param verifiedTitle 用户原始输入的选题(可选)。
|
|
258
|
+
* @returns 带 verificationStatus / verificationNotice / displayInstruction 的结果。
|
|
259
|
+
*/
|
|
260
|
+
function withVerifyCandidatesRequired(result, verifiedTitle) {
|
|
261
|
+
const candidates = result.candidates ?? [];
|
|
262
|
+
if (!candidates.length) {
|
|
263
|
+
return {
|
|
264
|
+
...result,
|
|
265
|
+
verificationStatus: "accepted",
|
|
266
|
+
...(verifiedTitle !== undefined ? { verifiedTitle } : {}),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
...result,
|
|
271
|
+
verificationStatus: "candidates_required",
|
|
272
|
+
verificationNotice: {
|
|
273
|
+
title: VERIFY_CANDIDATES_NOTICE.title,
|
|
274
|
+
message: VERIFY_CANDIDATES_NOTICE.message,
|
|
275
|
+
},
|
|
276
|
+
displayInstruction: VERIFY_CANDIDATES_DISPLAY_INSTRUCTION,
|
|
277
|
+
...(verifiedTitle !== undefined ? { verifiedTitle } : {}),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 归一化 Meta 选题命令的完整返回结果。
|
|
282
|
+
*
|
|
283
|
+
* 除顶层 output 外,同时替换 node.output 中的原始候选对象,确保 CLI JSON
|
|
284
|
+
* 不再暴露 TitleN 等后台内部字段;workflow 中保存的节点数据不受影响。
|
|
285
|
+
*
|
|
286
|
+
* @param result Meta 选题节点的执行结果。
|
|
287
|
+
* @returns 对外输出已统一为题目数组的执行结果。
|
|
288
|
+
*/
|
|
289
|
+
function normalizeTopicResult(result) {
|
|
290
|
+
const titles = normalizeTopicTitles(result.output);
|
|
291
|
+
const selectionOptions = buildTopicSelectionOptions(titles);
|
|
292
|
+
return {
|
|
293
|
+
...result,
|
|
294
|
+
output: titles,
|
|
295
|
+
candidates: titles,
|
|
296
|
+
selectionOptions,
|
|
297
|
+
candidateListMarkdown: buildTopicCandidateListMarkdown(titles),
|
|
298
|
+
node: {
|
|
299
|
+
...result.node,
|
|
300
|
+
output: { output: titles },
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
async function runMetaTopicNode(options) {
|
|
305
|
+
const runnerId = await resolveWorkflowId(options);
|
|
306
|
+
const progress = createStderrProgress(options.format === "json");
|
|
307
|
+
progress.start(options.progressMessage);
|
|
308
|
+
try {
|
|
309
|
+
const created = await createMetaNode({
|
|
310
|
+
workflowId: runnerId,
|
|
311
|
+
nodeType: options.nodeType,
|
|
312
|
+
input: options.input,
|
|
313
|
+
configPath: options.configPath,
|
|
314
|
+
});
|
|
315
|
+
await pollMetaNodeStatus({
|
|
316
|
+
workflowId: runnerId,
|
|
317
|
+
nodeId: created.nodeId,
|
|
318
|
+
configPath: options.configPath,
|
|
319
|
+
});
|
|
320
|
+
const output = await getMetaNodeOutput({
|
|
321
|
+
workflowId: runnerId,
|
|
322
|
+
nodeId: created.nodeId,
|
|
323
|
+
configPath: options.configPath,
|
|
324
|
+
});
|
|
325
|
+
progress.finish("Meta 节点执行完成,正在输出结果...");
|
|
326
|
+
return {
|
|
327
|
+
runnerId,
|
|
328
|
+
nodeId: created.nodeId,
|
|
329
|
+
nodeType: options.nodeType,
|
|
330
|
+
status: output.data.status,
|
|
331
|
+
input: options.input,
|
|
332
|
+
output: extractNodeOutput(output.data),
|
|
333
|
+
node: output.data,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
progress.dispose();
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function printMetaTopicResult(result, format) {
|
|
342
|
+
if (format === "json") {
|
|
343
|
+
printOutput(result, "json");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
console.log(renderListAsMarkdown([
|
|
347
|
+
{
|
|
348
|
+
runnerId: result.runnerId,
|
|
349
|
+
nodeType: result.nodeType,
|
|
350
|
+
status: result.status,
|
|
351
|
+
},
|
|
352
|
+
], [
|
|
353
|
+
{ key: "runnerId", label: "runnerId" },
|
|
354
|
+
{ key: "nodeType", label: "节点类型" },
|
|
355
|
+
{ key: "status", label: "状态" },
|
|
356
|
+
]));
|
|
357
|
+
console.log("\n输出:");
|
|
358
|
+
if ((result.nodeType === META_NODE_TYPES.GENERATE_TOPIC ||
|
|
359
|
+
result.nodeType === META_NODE_TYPES.VERIFY_TOPIC) &&
|
|
360
|
+
Array.isArray(result.output)) {
|
|
361
|
+
// 已有选题校验失败时先打出网站同款提示,再列候选题
|
|
362
|
+
if (result.verificationStatus === "candidates_required" &&
|
|
363
|
+
result.verificationNotice) {
|
|
364
|
+
console.log(result.verificationNotice.title);
|
|
365
|
+
console.log(result.verificationNotice.message);
|
|
366
|
+
console.log("");
|
|
367
|
+
}
|
|
368
|
+
console.log(result.candidateListMarkdown ??
|
|
369
|
+
buildTopicCandidateListMarkdown(result.output));
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
console.log(typeof result.output === "string"
|
|
373
|
+
? result.output
|
|
374
|
+
: JSON.stringify(result.output, null, 2));
|
|
375
|
+
}
|
|
376
|
+
async function buildPicosInput(options) {
|
|
377
|
+
let titleData = parseJsonObject(options.titlesJson, "--titles-json");
|
|
378
|
+
const selectedTitle = options.title.trim();
|
|
379
|
+
if (!selectedTitle) {
|
|
380
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少 Meta 选题");
|
|
381
|
+
}
|
|
382
|
+
if (!options.titlesJson?.trim()) {
|
|
383
|
+
const runnerId = await resolveWorkflowId(options);
|
|
384
|
+
const workflow = await getWorkflowForSave(runnerId, options);
|
|
385
|
+
const topicNode = findTopicNode(workflow);
|
|
386
|
+
if (topicNode) {
|
|
387
|
+
const currentNode = await getMetaNodeOutput({
|
|
388
|
+
workflowId: runnerId,
|
|
389
|
+
nodeId: topicNode.id,
|
|
390
|
+
configPath: options.configPath,
|
|
391
|
+
});
|
|
392
|
+
titleData = buildTopicFieldsFromOutput(extractNodeOutput(currentNode.data));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
...transformTitleData(titleData),
|
|
397
|
+
title: selectedTitle,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* 将面向用户的完整 PICOS 字段名转换为后台接口使用的字段代码。
|
|
402
|
+
*
|
|
403
|
+
* 同时兼容 P、I、C、O、S、Other 原始字段,确保 Agent 提交完整字段名时
|
|
404
|
+
* 保存 PICOS 和生成纳排标准仍使用网站接口约定的参数结构。
|
|
405
|
+
*
|
|
406
|
+
* @param data PICOS 表单数据。
|
|
407
|
+
* @returns 使用后台字段代码且空值已转换为空字符串的 PICOS 数据。
|
|
408
|
+
*/
|
|
409
|
+
function normalizePicosData(data) {
|
|
410
|
+
const aliases = {
|
|
411
|
+
p: "P",
|
|
412
|
+
populationparticipants: "P",
|
|
413
|
+
i: "I",
|
|
414
|
+
interventionexposure: "I",
|
|
415
|
+
c: "C",
|
|
416
|
+
comparatorcontext: "C",
|
|
417
|
+
o: "O",
|
|
418
|
+
outcome: "O",
|
|
419
|
+
outcomes: "O",
|
|
420
|
+
s: "S",
|
|
421
|
+
studycharacteristicsdesign: "S",
|
|
422
|
+
other: "Other",
|
|
423
|
+
};
|
|
424
|
+
const normalized = {
|
|
425
|
+
P: "",
|
|
426
|
+
I: "",
|
|
427
|
+
C: "",
|
|
428
|
+
O: "",
|
|
429
|
+
S: "",
|
|
430
|
+
Other: "",
|
|
431
|
+
};
|
|
432
|
+
for (const [key, value] of Object.entries(data)) {
|
|
433
|
+
const alias = key.toLowerCase().replace(/[\s/_-]+/g, "");
|
|
434
|
+
const field = aliases[alias];
|
|
435
|
+
if (field) {
|
|
436
|
+
normalized[field] = value ?? "";
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return normalized;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* 将后台 PICOS 字段代码转换为与网站一致的完整展示名称。
|
|
443
|
+
*
|
|
444
|
+
* @param output PICOS 节点的原始输出。
|
|
445
|
+
* @returns 使用完整字段名称的 PICOS 数据。
|
|
446
|
+
*/
|
|
447
|
+
function normalizePicosOutput(output) {
|
|
448
|
+
if (!output || typeof output !== "object" || Array.isArray(output)) {
|
|
449
|
+
return {};
|
|
450
|
+
}
|
|
451
|
+
return Object.fromEntries(Object.entries(output).map(([key, value]) => [
|
|
452
|
+
PICOS_FIELD_LABELS[key] ?? key,
|
|
453
|
+
value ?? "",
|
|
454
|
+
]));
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* 归一化 PICOS 命令的完整返回结果,避免 node.output 再暴露简写字段。
|
|
458
|
+
*
|
|
459
|
+
* @param result PICOS 节点的执行结果。
|
|
460
|
+
* @returns 顶层 output 和 node.output 均使用完整字段名称的执行结果。
|
|
461
|
+
*/
|
|
462
|
+
function normalizePicosResult(result) {
|
|
463
|
+
const picos = normalizePicosOutput(result.output);
|
|
464
|
+
return {
|
|
465
|
+
...result,
|
|
466
|
+
output: picos,
|
|
467
|
+
node: {
|
|
468
|
+
...result.node,
|
|
469
|
+
output: { output: picos },
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
export async function createMetaTopic(options) {
|
|
474
|
+
const result = await runMetaTopicNode({
|
|
475
|
+
workflowId: options.workflowId,
|
|
476
|
+
nodeType: META_NODE_TYPES.GENERATE_TOPIC,
|
|
477
|
+
input: { input_the_keyword: options.input },
|
|
478
|
+
format: options.format,
|
|
479
|
+
configPath: options.configPath,
|
|
480
|
+
progressMessage: "正在生成 Meta 选题...",
|
|
481
|
+
});
|
|
482
|
+
return normalizeTopicResult(result);
|
|
483
|
+
}
|
|
484
|
+
export async function rerunMetaTopic(options) {
|
|
485
|
+
const nodeType = options.source === "verify"
|
|
486
|
+
? META_NODE_TYPES.VERIFY_TOPIC
|
|
487
|
+
: META_NODE_TYPES.GENERATE_TOPIC;
|
|
488
|
+
const target = await resolveNodeSaveTarget(options, nodeType, "候选选题");
|
|
489
|
+
const progress = createStderrProgress(options.format === "json");
|
|
490
|
+
progress.start("正在重新生成候选选题...");
|
|
491
|
+
try {
|
|
492
|
+
await requestMeta(`${META_API_PREFIX}/nodes/re-execute`, {
|
|
493
|
+
method: "POST",
|
|
494
|
+
body: {
|
|
495
|
+
run_id: target.runnerId,
|
|
496
|
+
node_id: target.nodeId,
|
|
497
|
+
node_type: nodeType,
|
|
498
|
+
},
|
|
499
|
+
configPath: options.configPath,
|
|
500
|
+
action: "重新生成候选选题",
|
|
501
|
+
});
|
|
502
|
+
await pollMetaNodeStatus({
|
|
503
|
+
workflowId: target.runnerId,
|
|
504
|
+
nodeId: target.nodeId,
|
|
505
|
+
configPath: options.configPath,
|
|
506
|
+
});
|
|
507
|
+
const output = await getMetaNodeOutput({
|
|
508
|
+
workflowId: target.runnerId,
|
|
509
|
+
nodeId: target.nodeId,
|
|
510
|
+
configPath: options.configPath,
|
|
511
|
+
});
|
|
512
|
+
progress.finish("候选选题重新生成完成,正在输出结果...");
|
|
513
|
+
const normalized = normalizeTopicResult({
|
|
514
|
+
runnerId: target.runnerId,
|
|
515
|
+
nodeId: target.nodeId,
|
|
516
|
+
nodeType,
|
|
517
|
+
status: output.data.status,
|
|
518
|
+
input: {},
|
|
519
|
+
output: extractNodeOutput(output.data),
|
|
520
|
+
node: output.data,
|
|
521
|
+
});
|
|
522
|
+
if (nodeType !== META_NODE_TYPES.VERIFY_TOPIC) {
|
|
523
|
+
return normalized;
|
|
524
|
+
}
|
|
525
|
+
return withVerifyCandidatesRequired(normalized);
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
progress.dispose();
|
|
529
|
+
throw error;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
export async function verifyMetaTopic(options) {
|
|
533
|
+
const result = await runMetaTopicNode({
|
|
534
|
+
workflowId: options.workflowId,
|
|
535
|
+
nodeType: META_NODE_TYPES.VERIFY_TOPIC,
|
|
536
|
+
input: { input_the_keyword: options.title },
|
|
537
|
+
format: options.format,
|
|
538
|
+
configPath: options.configPath,
|
|
539
|
+
progressMessage: "正在校验 Meta 选题...",
|
|
540
|
+
});
|
|
541
|
+
const normalized = normalizeTopicResult(result);
|
|
542
|
+
return withVerifyCandidatesRequired(normalized, options.title);
|
|
543
|
+
}
|
|
544
|
+
export async function selectMetaTopic(options) {
|
|
545
|
+
const selectedTitle = options.title.trim();
|
|
546
|
+
if (!selectedTitle) {
|
|
547
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, "缺少 Meta 选题");
|
|
548
|
+
}
|
|
549
|
+
const target = await resolveTopicSaveTarget(options);
|
|
550
|
+
const currentNode = await getMetaNodeOutput({
|
|
551
|
+
workflowId: target.runnerId,
|
|
552
|
+
nodeId: target.nodeId,
|
|
553
|
+
configPath: options.configPath,
|
|
554
|
+
});
|
|
555
|
+
const currentOutput = extractNodeOutput(currentNode.data);
|
|
556
|
+
const current = buildTopicFieldsFromOutput(currentOutput);
|
|
557
|
+
const titles = normalizeTopicTitles(currentOutput);
|
|
558
|
+
const matchedIndex = titles.findIndex((title) => title === selectedTitle);
|
|
559
|
+
const selectedIndex = matchedIndex >= 0 ? matchedIndex + 1 : undefined;
|
|
560
|
+
const confirmed = buildConfirmedTopicGuidance(selectedIndex);
|
|
561
|
+
const input = {
|
|
562
|
+
...current,
|
|
563
|
+
...transformTitleData(parseJsonObject(options.titlesJson, "--titles-json")),
|
|
564
|
+
selected: { English: selectedTitle, Chinese: "" },
|
|
565
|
+
};
|
|
566
|
+
const endpoint = target.source === "verify" ? "verify-topic" : "generate-topic";
|
|
567
|
+
const data = await requestMeta(`${META_API_PREFIX}/${endpoint}`, {
|
|
568
|
+
method: "PUT",
|
|
569
|
+
params: {
|
|
570
|
+
run_id: target.runnerId,
|
|
571
|
+
node_id: target.nodeId,
|
|
572
|
+
},
|
|
573
|
+
body: input,
|
|
574
|
+
configPath: options.configPath,
|
|
575
|
+
action: "保存 Meta 选题",
|
|
576
|
+
});
|
|
577
|
+
return {
|
|
578
|
+
runnerId: target.runnerId,
|
|
579
|
+
nodeId: target.nodeId,
|
|
580
|
+
source: target.source,
|
|
581
|
+
input,
|
|
582
|
+
data,
|
|
583
|
+
...(selectedIndex !== undefined ? { selectedIndex } : {}),
|
|
584
|
+
selectedTitle,
|
|
585
|
+
selectorTitle: confirmed.selectorTitle,
|
|
586
|
+
operationOptions: confirmed.operationOptions,
|
|
587
|
+
displayInstruction: confirmed.displayInstruction,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
export async function createMetaPicos(options) {
|
|
591
|
+
const result = await runMetaTopicNode({
|
|
592
|
+
workflowId: options.workflowId,
|
|
593
|
+
nodeType: META_NODE_TYPES.GENERATE_PICOS,
|
|
594
|
+
input: await buildPicosInput(options),
|
|
595
|
+
format: options.format,
|
|
596
|
+
configPath: options.configPath,
|
|
597
|
+
progressMessage: "正在生成 PICOS...",
|
|
598
|
+
});
|
|
599
|
+
return normalizePicosResult(result);
|
|
600
|
+
}
|
|
601
|
+
export async function rerunMetaPicos(options) {
|
|
602
|
+
const target = await resolveNodeSaveTarget(options, META_NODE_TYPES.GENERATE_PICOS, "PICOS");
|
|
603
|
+
const progress = createStderrProgress(options.format === "json");
|
|
604
|
+
progress.start("正在重新生成 PICOS...");
|
|
605
|
+
try {
|
|
606
|
+
await requestMeta(`${META_API_PREFIX}/nodes/re-execute`, {
|
|
607
|
+
method: "POST",
|
|
608
|
+
body: {
|
|
609
|
+
run_id: target.runnerId,
|
|
610
|
+
node_id: target.nodeId,
|
|
611
|
+
node_type: META_NODE_TYPES.GENERATE_PICOS,
|
|
612
|
+
},
|
|
613
|
+
configPath: options.configPath,
|
|
614
|
+
action: "重新生成 PICOS",
|
|
615
|
+
});
|
|
616
|
+
await pollMetaNodeStatus({
|
|
617
|
+
workflowId: target.runnerId,
|
|
618
|
+
nodeId: target.nodeId,
|
|
619
|
+
configPath: options.configPath,
|
|
620
|
+
});
|
|
621
|
+
const output = await getMetaNodeOutput({
|
|
622
|
+
workflowId: target.runnerId,
|
|
623
|
+
nodeId: target.nodeId,
|
|
624
|
+
configPath: options.configPath,
|
|
625
|
+
});
|
|
626
|
+
progress.finish("PICOS 重新生成完成,正在输出结果...");
|
|
627
|
+
return normalizePicosResult({
|
|
628
|
+
runnerId: target.runnerId,
|
|
629
|
+
nodeId: target.nodeId,
|
|
630
|
+
nodeType: META_NODE_TYPES.GENERATE_PICOS,
|
|
631
|
+
status: output.data.status,
|
|
632
|
+
input: {},
|
|
633
|
+
output: extractNodeOutput(output.data),
|
|
634
|
+
node: output.data,
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
catch (error) {
|
|
638
|
+
progress.dispose();
|
|
639
|
+
throw error;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
export async function saveMetaPicos(options) {
|
|
643
|
+
const target = await resolveNodeSaveTarget(options, META_NODE_TYPES.GENERATE_PICOS, "PICOS");
|
|
644
|
+
const patch = normalizePicosData(await parseJsonObjectInput(options.picosJson, options.picosFile, "--picos-json", "--picos-file"));
|
|
645
|
+
const currentNode = await getMetaNodeOutput({
|
|
646
|
+
workflowId: target.runnerId,
|
|
647
|
+
nodeId: target.nodeId,
|
|
648
|
+
configPath: options.configPath,
|
|
649
|
+
});
|
|
650
|
+
const current = normalizePicosData(extractNodeOutput(currentNode.data) ?? {});
|
|
651
|
+
const input = { ...current, ...patch };
|
|
652
|
+
const data = await requestMeta(`${META_API_PREFIX}/generate-picos`, {
|
|
653
|
+
method: "PUT",
|
|
654
|
+
params: {
|
|
655
|
+
run_id: target.runnerId,
|
|
656
|
+
node_id: target.nodeId,
|
|
657
|
+
},
|
|
658
|
+
body: input,
|
|
659
|
+
configPath: options.configPath,
|
|
660
|
+
action: "保存 PICOS",
|
|
661
|
+
});
|
|
662
|
+
return {
|
|
663
|
+
runnerId: target.runnerId,
|
|
664
|
+
nodeId: target.nodeId,
|
|
665
|
+
source: "picos",
|
|
666
|
+
input,
|
|
667
|
+
data,
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
export async function createMetaCriteria(options) {
|
|
671
|
+
let rawInput;
|
|
672
|
+
if (options.picosJson?.trim() || options.picosFile?.trim()) {
|
|
673
|
+
rawInput = await parseJsonObjectInput(options.picosJson, options.picosFile, "--picos-json", "--picos-file");
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
const target = await resolveNodeSaveTarget(options, META_NODE_TYPES.GENERATE_PICOS, "PICOS");
|
|
677
|
+
const currentNode = await getMetaNodeOutput({
|
|
678
|
+
workflowId: target.runnerId,
|
|
679
|
+
nodeId: target.nodeId,
|
|
680
|
+
configPath: options.configPath,
|
|
681
|
+
});
|
|
682
|
+
rawInput =
|
|
683
|
+
extractNodeOutput(currentNode.data) ?? {};
|
|
684
|
+
}
|
|
685
|
+
const input = normalizePicosData(rawInput);
|
|
686
|
+
const result = await runMetaTopicNode({
|
|
687
|
+
workflowId: options.workflowId,
|
|
688
|
+
nodeType: META_NODE_TYPES.GENERATE_SORTING_CRITERIA,
|
|
689
|
+
input,
|
|
690
|
+
format: options.format,
|
|
691
|
+
configPath: options.configPath,
|
|
692
|
+
progressMessage: "正在生成纳排标准...",
|
|
693
|
+
});
|
|
694
|
+
return {
|
|
695
|
+
...result,
|
|
696
|
+
displayInstruction: CRITERIA_DISPLAY_INSTRUCTION,
|
|
697
|
+
displayData: result.output,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
export async function rerunMetaCriteria(options) {
|
|
701
|
+
const target = await resolveNodeSaveTarget(options, META_NODE_TYPES.GENERATE_SORTING_CRITERIA, "纳排标准");
|
|
702
|
+
const progress = createStderrProgress(options.format === "json");
|
|
703
|
+
progress.start("正在重新生成纳排标准...");
|
|
704
|
+
try {
|
|
705
|
+
await requestMeta(`${META_API_PREFIX}/nodes/re-execute`, {
|
|
706
|
+
method: "POST",
|
|
707
|
+
body: {
|
|
708
|
+
run_id: target.runnerId,
|
|
709
|
+
node_id: target.nodeId,
|
|
710
|
+
node_type: META_NODE_TYPES.GENERATE_SORTING_CRITERIA,
|
|
711
|
+
},
|
|
712
|
+
configPath: options.configPath,
|
|
713
|
+
action: "重新生成纳排标准",
|
|
714
|
+
});
|
|
715
|
+
await pollMetaNodeStatus({
|
|
716
|
+
workflowId: target.runnerId,
|
|
717
|
+
nodeId: target.nodeId,
|
|
718
|
+
configPath: options.configPath,
|
|
719
|
+
});
|
|
720
|
+
const output = await getMetaNodeOutput({
|
|
721
|
+
workflowId: target.runnerId,
|
|
722
|
+
nodeId: target.nodeId,
|
|
723
|
+
configPath: options.configPath,
|
|
724
|
+
});
|
|
725
|
+
const displayData = extractNodeOutput(output.data);
|
|
726
|
+
progress.finish("纳排标准重新生成完成,正在输出结果...");
|
|
727
|
+
return {
|
|
728
|
+
runnerId: target.runnerId,
|
|
729
|
+
nodeId: target.nodeId,
|
|
730
|
+
nodeType: META_NODE_TYPES.GENERATE_SORTING_CRITERIA,
|
|
731
|
+
status: output.data.status,
|
|
732
|
+
input: {},
|
|
733
|
+
output: displayData,
|
|
734
|
+
displayInstruction: CRITERIA_DISPLAY_INSTRUCTION,
|
|
735
|
+
displayData,
|
|
736
|
+
node: output.data,
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
catch (error) {
|
|
740
|
+
progress.dispose();
|
|
741
|
+
throw error;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
export async function saveMetaCriteria(options) {
|
|
745
|
+
const target = await resolveNodeSaveTarget(options, META_NODE_TYPES.GENERATE_SORTING_CRITERIA, "纳排标准");
|
|
746
|
+
const patch = await parseJsonObjectInput(options.criteriaJson, options.criteriaFile, "--criteria-json", "--criteria-file");
|
|
747
|
+
const currentNode = await getMetaNodeOutput({
|
|
748
|
+
workflowId: target.runnerId,
|
|
749
|
+
nodeId: target.nodeId,
|
|
750
|
+
configPath: options.configPath,
|
|
751
|
+
});
|
|
752
|
+
const currentOutput = extractNodeOutput(currentNode.data);
|
|
753
|
+
const current = currentOutput && typeof currentOutput === "object" && !Array.isArray(currentOutput)
|
|
754
|
+
? currentOutput
|
|
755
|
+
: {};
|
|
756
|
+
const input = { ...current, ...patch };
|
|
757
|
+
const data = await requestMeta(`${META_API_PREFIX}/generate-sorting-criteria`, {
|
|
758
|
+
method: "PUT",
|
|
759
|
+
params: {
|
|
760
|
+
run_id: target.runnerId,
|
|
761
|
+
node_id: target.nodeId,
|
|
762
|
+
},
|
|
763
|
+
body: input,
|
|
764
|
+
configPath: options.configPath,
|
|
765
|
+
action: "保存纳排标准",
|
|
766
|
+
});
|
|
767
|
+
return {
|
|
768
|
+
runnerId: target.runnerId,
|
|
769
|
+
nodeId: target.nodeId,
|
|
770
|
+
source: "criteria",
|
|
771
|
+
input,
|
|
772
|
+
data,
|
|
773
|
+
displayInstruction: CRITERIA_DISPLAY_INSTRUCTION,
|
|
774
|
+
displayData: data,
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
export async function runCreateMetaTopic(options) {
|
|
778
|
+
const result = await createMetaTopic(options);
|
|
779
|
+
printMetaTopicResult(result, options.format ?? "markdown");
|
|
780
|
+
}
|
|
781
|
+
export async function runVerifyMetaTopic(options) {
|
|
782
|
+
const result = await verifyMetaTopic(options);
|
|
783
|
+
printMetaTopicResult(result, options.format ?? "markdown");
|
|
784
|
+
}
|
|
785
|
+
export async function runSelectMetaTopic(options) {
|
|
786
|
+
const result = await selectMetaTopic(options);
|
|
787
|
+
printOutput(result, options.format ?? "markdown");
|
|
788
|
+
}
|
|
789
|
+
export async function runCreateMetaPicos(options) {
|
|
790
|
+
const result = await createMetaPicos(options);
|
|
791
|
+
printMetaTopicResult(result, options.format ?? "markdown");
|
|
792
|
+
}
|
|
793
|
+
export async function runRerunMetaTopic(options) {
|
|
794
|
+
printMetaTopicResult(await rerunMetaTopic(options), options.format ?? "markdown");
|
|
795
|
+
}
|
|
796
|
+
function buildTopicFieldsFromOutput(output) {
|
|
797
|
+
if (Array.isArray(output)) {
|
|
798
|
+
return Object.fromEntries(normalizeTopicTitles(output).map((title, index) => [
|
|
799
|
+
`Title${index + 1}`,
|
|
800
|
+
{ English: title, Chinese: "" },
|
|
801
|
+
]));
|
|
802
|
+
}
|
|
803
|
+
if (output && typeof output === "object") {
|
|
804
|
+
return output;
|
|
805
|
+
}
|
|
806
|
+
return {};
|
|
807
|
+
}
|
|
808
|
+
export async function runRerunMetaPicos(options) {
|
|
809
|
+
printMetaTopicResult(await rerunMetaPicos(options), options.format ?? "markdown");
|
|
810
|
+
}
|
|
811
|
+
export async function runSaveMetaPicos(options) {
|
|
812
|
+
const result = await saveMetaPicos(options);
|
|
813
|
+
printOutput(result, options.format ?? "markdown");
|
|
814
|
+
}
|
|
815
|
+
export async function runCreateMetaCriteria(options) {
|
|
816
|
+
const result = await createMetaCriteria(options);
|
|
817
|
+
if ((options.format ?? "markdown") === "markdown") {
|
|
818
|
+
console.log(typeof result.displayData === "string"
|
|
819
|
+
? result.displayData
|
|
820
|
+
: JSON.stringify(result.displayData, null, 2));
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
printOutput({
|
|
824
|
+
runnerId: result.runnerId,
|
|
825
|
+
nodeId: result.nodeId,
|
|
826
|
+
nodeType: result.nodeType,
|
|
827
|
+
status: result.status,
|
|
828
|
+
displayInstruction: result.displayInstruction,
|
|
829
|
+
displayData: result.displayData,
|
|
830
|
+
}, "json");
|
|
831
|
+
}
|
|
832
|
+
export async function runSaveMetaCriteria(options) {
|
|
833
|
+
const result = await saveMetaCriteria(options);
|
|
834
|
+
if ((options.format ?? "markdown") === "markdown") {
|
|
835
|
+
console.log(typeof result.displayData === "string"
|
|
836
|
+
? result.displayData
|
|
837
|
+
: JSON.stringify(result.displayData, null, 2));
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
printOutput({
|
|
841
|
+
runnerId: result.runnerId,
|
|
842
|
+
nodeId: result.nodeId,
|
|
843
|
+
source: result.source,
|
|
844
|
+
displayInstruction: result.displayInstruction,
|
|
845
|
+
displayData: result.displayData,
|
|
846
|
+
}, "json");
|
|
847
|
+
}
|
|
848
|
+
export async function runRerunMetaCriteria(options) {
|
|
849
|
+
const result = await rerunMetaCriteria(options);
|
|
850
|
+
if ((options.format ?? "markdown") === "markdown") {
|
|
851
|
+
console.log(typeof result.displayData === "string"
|
|
852
|
+
? result.displayData
|
|
853
|
+
: JSON.stringify(result.displayData, null, 2));
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
printOutput({
|
|
857
|
+
runnerId: result.runnerId,
|
|
858
|
+
nodeId: result.nodeId,
|
|
859
|
+
nodeType: result.nodeType,
|
|
860
|
+
status: result.status,
|
|
861
|
+
displayInstruction: result.displayInstruction,
|
|
862
|
+
displayData: result.displayData,
|
|
863
|
+
}, "json");
|
|
864
|
+
}
|
|
865
|
+
//# sourceMappingURL=topic.js.map
|