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,153 @@
|
|
|
1
|
+
// Commander --format 选项归一化(仅 json 走 JSON 模式,其余均视为 markdown)
|
|
2
|
+
export function parseOutputFormat(raw) {
|
|
3
|
+
return raw === "json" ? "json" : "markdown";
|
|
4
|
+
}
|
|
5
|
+
// 创建写入 stderr 的进度心跳上报器
|
|
6
|
+
//
|
|
7
|
+
// 背景:JSON 模式下 stdout 只在最后一次性输出结果,生成期间若无任何信号,
|
|
8
|
+
// 上游 Agent/管道无法区分「仍在生成」与「卡死/已结束」;若 stdout 被重定向到文件,
|
|
9
|
+
// 观察方更是完全看不到进度。因此进度统一走 stderr,并用墙钟定时器兜底,
|
|
10
|
+
// 即便服务端长时间静默也能持续输出「仍在运行」的心跳。
|
|
11
|
+
export function createStderrProgress(enabled, intervalMs = 3000) {
|
|
12
|
+
let startedAt = 0;
|
|
13
|
+
let received = 0;
|
|
14
|
+
let timer;
|
|
15
|
+
const clearTimer = () => {
|
|
16
|
+
if (timer) {
|
|
17
|
+
clearInterval(timer);
|
|
18
|
+
timer = undefined;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const elapsedSeconds = () => ((Date.now() - startedAt) / 1000).toFixed(0);
|
|
22
|
+
return {
|
|
23
|
+
start(message) {
|
|
24
|
+
if (!enabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
startedAt = Date.now();
|
|
28
|
+
received = 0;
|
|
29
|
+
process.stderr.write(`${message}\n`);
|
|
30
|
+
timer = setInterval(() => {
|
|
31
|
+
process.stderr.write(`... 生成中:已用 ${elapsedSeconds()}s,已接收 ${received} 字\n`);
|
|
32
|
+
}, intervalMs);
|
|
33
|
+
// 心跳定时器不应阻止进程在主逻辑结束后退出
|
|
34
|
+
if (timer && typeof timer.unref === "function") {
|
|
35
|
+
timer.unref();
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
update(receivedChars) {
|
|
39
|
+
received = receivedChars;
|
|
40
|
+
},
|
|
41
|
+
finish(message) {
|
|
42
|
+
if (!enabled) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
clearTimer();
|
|
46
|
+
process.stderr.write(`${message}(耗时 ${((Date.now() - startedAt) / 1000).toFixed(1)}s)\n`);
|
|
47
|
+
},
|
|
48
|
+
dispose() {
|
|
49
|
+
clearTimer();
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// 转义 Markdown 表格单元格:竖线转义、换行折叠为空格,避免破坏表格结构
|
|
54
|
+
function escapeTableCell(value) {
|
|
55
|
+
return String(value ?? "")
|
|
56
|
+
.replace(/\|/g, "\\|")
|
|
57
|
+
.replace(/\r?\n|\u2028|\u2029/g, " ");
|
|
58
|
+
}
|
|
59
|
+
// 将列表数据渲染为 Markdown 表格,便于 Agent 直接展示
|
|
60
|
+
export function renderListAsMarkdown(rows, columns) {
|
|
61
|
+
if (rows.length === 0) {
|
|
62
|
+
return "_暂无数据_";
|
|
63
|
+
}
|
|
64
|
+
const header = `| ${columns.map((c) => escapeTableCell(c.label)).join(" | ")} |`;
|
|
65
|
+
const separator = `| ${columns.map(() => "---").join(" | ")} |`;
|
|
66
|
+
const body = rows
|
|
67
|
+
.map((row) => {
|
|
68
|
+
const cells = columns.map((c) => escapeTableCell(row[c.key]));
|
|
69
|
+
return `| ${cells.join(" | ")} |`;
|
|
70
|
+
})
|
|
71
|
+
.join("\n");
|
|
72
|
+
return `${header}\n${separator}\n${body}`;
|
|
73
|
+
}
|
|
74
|
+
/** HTML 文本转义(保留后续主动插入的 <br>) */
|
|
75
|
+
function escapeHtmlText(value) {
|
|
76
|
+
return value
|
|
77
|
+
.replace(/&/g, "&")
|
|
78
|
+
.replace(/</g, "<")
|
|
79
|
+
.replace(/>/g, ">")
|
|
80
|
+
.replace(/"/g, """);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 将单元格内换行(\n / U+2028 等)转为 <br>,并对纯文本做 HTML 转义。
|
|
84
|
+
* 用于需要「同一单元格内上下堆叠」的场景(Markdown 管道表会剥掉 <br>)。
|
|
85
|
+
*/
|
|
86
|
+
function formatHtmlTableCell(value) {
|
|
87
|
+
return String(value ?? "")
|
|
88
|
+
.split(/\r?\n|\u2028|\u2029/)
|
|
89
|
+
.map((part) => escapeHtmlText(part))
|
|
90
|
+
.join("<br>");
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 将列表渲染为 HTML 表格;单元格内换行会变成 <br>,供聊天端真实换行展示。
|
|
94
|
+
*/
|
|
95
|
+
export function renderListAsHtmlTable(rows, columns) {
|
|
96
|
+
if (rows.length === 0) {
|
|
97
|
+
return "<p><em>暂无数据</em></p>";
|
|
98
|
+
}
|
|
99
|
+
const thead = `<tr>${columns
|
|
100
|
+
.map((column) => `<th>${escapeHtmlText(column.label)}</th>`)
|
|
101
|
+
.join("")}</tr>`;
|
|
102
|
+
const tbody = rows
|
|
103
|
+
.map((row) => {
|
|
104
|
+
const cells = columns
|
|
105
|
+
.map((column) => `<td>${formatHtmlTableCell(row[column.key])}</td>`)
|
|
106
|
+
.join("");
|
|
107
|
+
return `<tr>${cells}</tr>`;
|
|
108
|
+
})
|
|
109
|
+
.join("\n");
|
|
110
|
+
return `<table>\n<thead>\n${thead}\n</thead>\n<tbody>\n${tbody}\n</tbody>\n</table>`;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 将非 ASCII 字符转为 \\uXXXX,保证 JSON stdout 在 Windows GBK 管道下不被误解码。
|
|
114
|
+
* 宿主(PowerShell / GB2312 控制台)按字节流捕获时,原始中文 UTF-8 会被读成「乳腺�?」类乱码。
|
|
115
|
+
*/
|
|
116
|
+
export function stringifyJsonAscii(data) {
|
|
117
|
+
return JSON.stringify(data, null, 2).replace(/[-]/g, (ch) => "\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0"));
|
|
118
|
+
}
|
|
119
|
+
/** 向 stdout 写入 UTF-8 文本(避免 console 走系统代码页) */
|
|
120
|
+
function writeStdoutUtf8(text) {
|
|
121
|
+
process.stdout.write(Buffer.from(text.endsWith("\n") ? text : `${text}\n`, "utf8"));
|
|
122
|
+
}
|
|
123
|
+
// 以缩进 JSON 输出到 stdout,供命令层统一机器可读输出,便于宿主 Agent 解析
|
|
124
|
+
export function emitJson(data) {
|
|
125
|
+
writeStdoutUtf8(stringifyJsonAscii(data));
|
|
126
|
+
}
|
|
127
|
+
// 按指定格式输出命令结果到 stdout
|
|
128
|
+
export function printOutput(data, format) {
|
|
129
|
+
if (format === "json") {
|
|
130
|
+
writeStdoutUtf8(stringifyJsonAscii(data));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(data) && data.length > 0 && typeof data[0] === "object" && data[0] !== null) {
|
|
134
|
+
const keys = Object.keys(data[0]);
|
|
135
|
+
const columns = keys.map((key) => ({ key, label: key }));
|
|
136
|
+
writeStdoutUtf8(renderListAsMarkdown(data, columns));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
writeStdoutUtf8(String(data));
|
|
140
|
+
}
|
|
141
|
+
// 创建格式化的日志输出函数
|
|
142
|
+
// JSON 模式下所有状态文本走 stderr,避免污染 stdout(最终 JSON 结果走 printOutput)
|
|
143
|
+
export function createFormatLogger(format) {
|
|
144
|
+
return (message) => {
|
|
145
|
+
if (format === "json") {
|
|
146
|
+
process.stderr.write(message + "\n");
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
console.log(message);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/output/index.ts"],"names":[],"mappings":"AAGA,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,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GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9F,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAA4B,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACzD,eAAe,CAAC,oBAAoB,CAAC,IAAiC,EAAE,OAAO,CAAC,CAAC,CAAC;QAClF,OAAO;IACT,CAAC;IAED,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,eAAe;AACf,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,OAAO,CAAC,OAAe,EAAE,EAAE;QACzB,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function parseIntegerOption(raw: string | number | undefined, name: string, options?: {
|
|
2
|
+
min?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
}): number;
|
|
5
|
+
export declare function parseEnumOption<T extends string>(raw: string | undefined, candidates: readonly T[], options: {
|
|
6
|
+
label: string;
|
|
7
|
+
defaultValue?: T;
|
|
8
|
+
}): T;
|
|
9
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3C,MAAM,CA+BR;AAID,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,CAAA;CAAE,GAC3C,CAAC,CAYH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { helixlifeError, helixlifeErrorCode } from "./errors.js";
|
|
2
|
+
// 整数参数校验:拒绝 NaN / 小数 / 越界,避免非法值透传到业务层导致崩溃
|
|
3
|
+
export function parseIntegerOption(raw, name, options = {}) {
|
|
4
|
+
if (raw === undefined || raw === null || raw === "") {
|
|
5
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `缺少参数 ${name}`);
|
|
6
|
+
}
|
|
7
|
+
const value = Number(raw);
|
|
8
|
+
if (!Number.isFinite(value) || !Number.isInteger(value)) {
|
|
9
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `参数 ${name} 必须为整数,收到: ${raw}`);
|
|
10
|
+
}
|
|
11
|
+
if (options.min !== undefined && value < options.min) {
|
|
12
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `参数 ${name} 不能小于 ${options.min},收到: ${raw}`);
|
|
13
|
+
}
|
|
14
|
+
if (options.max !== undefined && value > options.max) {
|
|
15
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `参数 ${name} 不能大于 ${options.max},收到: ${raw}`);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
// 枚举参数校验:raw 去空后须命中候选集,否则回退默认值或抛错
|
|
20
|
+
// options.defaultValue 存在时,空输入返回默认值;不存在时空输入按非法处理
|
|
21
|
+
export function parseEnumOption(raw, candidates, options) {
|
|
22
|
+
const value = (raw ?? options.defaultValue ?? "").trim();
|
|
23
|
+
if (!value && options.defaultValue !== undefined) {
|
|
24
|
+
return options.defaultValue;
|
|
25
|
+
}
|
|
26
|
+
if (candidates.includes(value)) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `无效${options.label}: ${raw},可选: ${candidates.join(" | ")}`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE,0CAA0C;AAC1C,MAAM,UAAU,kBAAkB,CAChC,GAAgC,EAChC,IAAY,EACZ,UAA0C,EAAE;IAE5C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,QAAQ,IAAI,EAAE,CACf,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,MAAM,IAAI,cAAc,GAAG,EAAE,CAC9B,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QACrD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,MAAM,IAAI,SAAS,OAAO,CAAC,GAAG,QAAQ,GAAG,EAAE,CAC5C,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QACrD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,MAAM,IAAI,SAAS,OAAO,CAAC,GAAG,QAAQ,GAAG,EAAE,CAC5C,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,kCAAkC;AAClC,iDAAiD;AACjD,MAAM,UAAU,eAAe,CAC7B,GAAuB,EACvB,UAAwB,EACxB,OAA4C;IAE5C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzD,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACjD,OAAO,OAAO,CAAC,YAAY,CAAC;IAC9B,CAAC;IACD,IAAK,UAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,KAAU,CAAC;IACpB,CAAC;IACD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,KAAK,OAAO,CAAC,KAAK,KAAK,GAAG,QAAQ,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function getUserDownloadsDir(): string;
|
|
2
|
+
export interface SanitizeFilenameOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 文件名主体(不含扩展名)最大码点数。
|
|
5
|
+
* 默认 80;传 `null` 表示不截断(对齐官网整题文件名,仅做非法字符清洗)。
|
|
6
|
+
*/
|
|
7
|
+
maxLength?: number | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 清理文件名中的非法/控制字符,可选截断,避免 Windows 等系统写入失败。
|
|
11
|
+
* 若含扩展名(如 .docx),只截断 stem,保留扩展名。
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeFilename(name: string, options?: SanitizeFilenameOptions): string;
|
|
14
|
+
/**
|
|
15
|
+
* 解析用户传入的文件路径,兼容 Windows 上 Git Bash / MSYS 与 Node.js 的路径语义差异。
|
|
16
|
+
*
|
|
17
|
+
* 典型问题:Git Bash 将 `/tmp/foo` 映射到 `%TEMP%\foo`,而 Node 的 `path.resolve('/tmp/foo')`
|
|
18
|
+
* 会得到 `C:\tmp\foo`,导致 Agent 写入的文件与 CLI 读取位置不一致。
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveUserPath(rawPath: string): string;
|
|
21
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAsBR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6BvD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { homedir, tmpdir } from "node:os";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
// 获取用户系统下载目录,供 docx 等文件默认保存
|
|
4
|
+
export function getUserDownloadsDir() {
|
|
5
|
+
const home = homedir();
|
|
6
|
+
// Windows 与 macOS/Linux 均使用 ~/Downloads 作为默认下载路径
|
|
7
|
+
return join(home, "Downloads");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 清理文件名中的非法/控制字符,可选截断,避免 Windows 等系统写入失败。
|
|
11
|
+
* 若含扩展名(如 .docx),只截断 stem,保留扩展名。
|
|
12
|
+
*/
|
|
13
|
+
export function sanitizeFilename(name, options = {}) {
|
|
14
|
+
const maxLength = options.maxLength === undefined ? 80 : options.maxLength;
|
|
15
|
+
let base = name.normalize("NFC");
|
|
16
|
+
// 剥控制字符与换行,避免正文换行泄漏进路径
|
|
17
|
+
base = base.replace(/[\u0000-\u001f\u007f]/g, " ");
|
|
18
|
+
base = base.replace(/[<>:"/\\|?*]/g, "_");
|
|
19
|
+
base = base.replace(/\s+/g, " ").trim();
|
|
20
|
+
const extMatch = base.match(/^(.+?)(\.[A-Za-z0-9]{1,8})$/);
|
|
21
|
+
let stem = extMatch ? extMatch[1].trim() : base;
|
|
22
|
+
const ext = extMatch ? extMatch[2] : "";
|
|
23
|
+
if (maxLength != null) {
|
|
24
|
+
const chars = [...stem];
|
|
25
|
+
if (chars.length > maxLength) {
|
|
26
|
+
stem = chars.slice(0, maxLength).join("").trim();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!stem) {
|
|
30
|
+
stem = "未命名";
|
|
31
|
+
}
|
|
32
|
+
return `${stem}${ext}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 解析用户传入的文件路径,兼容 Windows 上 Git Bash / MSYS 与 Node.js 的路径语义差异。
|
|
36
|
+
*
|
|
37
|
+
* 典型问题:Git Bash 将 `/tmp/foo` 映射到 `%TEMP%\foo`,而 Node 的 `path.resolve('/tmp/foo')`
|
|
38
|
+
* 会得到 `C:\tmp\foo`,导致 Agent 写入的文件与 CLI 读取位置不一致。
|
|
39
|
+
*/
|
|
40
|
+
export function resolveUserPath(rawPath) {
|
|
41
|
+
if (!rawPath?.trim()) {
|
|
42
|
+
return resolve(rawPath);
|
|
43
|
+
}
|
|
44
|
+
if (process.platform !== "win32") {
|
|
45
|
+
return resolve(rawPath);
|
|
46
|
+
}
|
|
47
|
+
const slashes = rawPath.replace(/\\/g, "/");
|
|
48
|
+
// MSYS/Git Bash 盘符前缀:/c/Users/... → C:\Users\...
|
|
49
|
+
const driveMatch = slashes.match(/^\/([a-zA-Z])(\/.*)?$/);
|
|
50
|
+
if (driveMatch) {
|
|
51
|
+
const rest = driveMatch[2] ?? "";
|
|
52
|
+
return resolve(`${driveMatch[1].toUpperCase()}:${rest}`);
|
|
53
|
+
}
|
|
54
|
+
// POSIX 临时目录:对齐 Git Bash / MSYS2 语义(/tmp → os.tmpdir())
|
|
55
|
+
if (slashes === "/tmp" || slashes.startsWith("/tmp/")) {
|
|
56
|
+
const rest = slashes.slice("/tmp".length).replace(/^\//, "");
|
|
57
|
+
return rest ? join(tmpdir(), ...rest.split("/")) : tmpdir();
|
|
58
|
+
}
|
|
59
|
+
if (slashes === "/var/tmp" || slashes.startsWith("/var/tmp/")) {
|
|
60
|
+
const rest = slashes.slice("/var/tmp".length).replace(/^\//, "");
|
|
61
|
+
return rest ? join(tmpdir(), ...rest.split("/")) : tmpdir();
|
|
62
|
+
}
|
|
63
|
+
return resolve(rawPath);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,4BAA4B;AAC5B,MAAM,UAAU,mBAAmB;IACjC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,iDAAiD;IACjD,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACjC,CAAC;AAUD;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QACjE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9D,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type SseDataPayload } from "./index.js";
|
|
2
|
+
export interface ExtractSseTextOptions {
|
|
3
|
+
/** 是否检查嵌套的 data.text/data.answer 字段 */
|
|
4
|
+
nested?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 从 SSE 事件载荷中提取可追加的流式文本片段
|
|
8
|
+
* @param payload SSE 事件载荷
|
|
9
|
+
* @param options 提取选项
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractSseText(payload: SseDataPayload, options?: ExtractSseTextOptions): string;
|
|
12
|
+
/**
|
|
13
|
+
* 校验 SSE workflow 是否成功完成
|
|
14
|
+
* @param payload SSE 事件载荷
|
|
15
|
+
* @param failureMessage 失败时的错误消息
|
|
16
|
+
* @param terminalEvents 终端事件列表(检测是否收到)
|
|
17
|
+
*/
|
|
18
|
+
export declare function assertWorkflowSucceeded(payload: SseDataPayload, failureMessage: string, terminalEvents?: string[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* 从 workflow outputs 提取正文,优先 result/text/output 并排除 reference 字段
|
|
21
|
+
* @param outputs workflow 输出对象
|
|
22
|
+
* @param maxDepth 最大递归深度,默认 3
|
|
23
|
+
*/
|
|
24
|
+
export declare function pickWorkflowOutputText(outputs: Record<string, unknown> | undefined, maxDepth?: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* 从 workflow outputs 提取参考文献列表。
|
|
27
|
+
*
|
|
28
|
+
* 与网站 Proofread/Writing 一致:outputs.reference / outputs.references
|
|
29
|
+
* 可能是 string[],也可能是换行分隔的 string(JOVA 常见)。
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractReferences(outputs: Record<string, unknown> | undefined): string[];
|
|
32
|
+
/**
|
|
33
|
+
* 从 SSE 事件流收集按 output id 分组的正文(用于 Application 模块)
|
|
34
|
+
* @param events SSE 事件列表
|
|
35
|
+
* @param options 提取选项
|
|
36
|
+
*/
|
|
37
|
+
export declare function collectOutputs(events: SseDataPayload[], options?: ExtractSseTextOptions): Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* 从 SSE 事件流提取 record_id
|
|
40
|
+
* @param events SSE 事件列表
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractRecordId(events: SseDataPayload[]): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* 合并多 output 为单一 markdown 文本(用于导出)
|
|
45
|
+
* @param outputs 按 output id 分组的文本
|
|
46
|
+
* @param labels 可选的 output 标签映射
|
|
47
|
+
*/
|
|
48
|
+
export declare function joinOutputsAsMarkdown(outputs: Record<string, string>, labels?: Record<string, string>): string;
|
|
49
|
+
//# sourceMappingURL=sse-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-utils.d.ts","sourceRoot":"","sources":["../../src/core/sse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAgCR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,MAAM,EACtB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,IAAI,CAyBN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC5C,QAAQ,SAAI,GACX,MAAM,CAKR;AA0CD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC3C,MAAM,EAAE,CAmBV;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EAAE,EACxB,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CAQR"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { helixlifeError, helixlifeErrorCode, } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* 从 SSE 事件载荷中提取可追加的流式文本片段
|
|
4
|
+
* @param payload SSE 事件载荷
|
|
5
|
+
* @param options 提取选项
|
|
6
|
+
*/
|
|
7
|
+
export function extractSseText(payload, options = {}) {
|
|
8
|
+
if (typeof payload.answer === "string") {
|
|
9
|
+
return payload.answer;
|
|
10
|
+
}
|
|
11
|
+
if (typeof payload.text === "string") {
|
|
12
|
+
return payload.text;
|
|
13
|
+
}
|
|
14
|
+
if (options.nested) {
|
|
15
|
+
const data = payload.data;
|
|
16
|
+
if (typeof data === "object" && data !== null) {
|
|
17
|
+
const record = data;
|
|
18
|
+
if (typeof record.text === "string") {
|
|
19
|
+
return record.text;
|
|
20
|
+
}
|
|
21
|
+
if (typeof record.answer === "string") {
|
|
22
|
+
return record.answer;
|
|
23
|
+
}
|
|
24
|
+
// 新增:支持 result、content、output 等常见字段
|
|
25
|
+
if (typeof record.result === "string") {
|
|
26
|
+
return record.result;
|
|
27
|
+
}
|
|
28
|
+
if (typeof record.content === "string") {
|
|
29
|
+
return record.content;
|
|
30
|
+
}
|
|
31
|
+
if (typeof record.output === "string") {
|
|
32
|
+
return record.output;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 校验 SSE workflow 是否成功完成
|
|
40
|
+
* @param payload SSE 事件载荷
|
|
41
|
+
* @param failureMessage 失败时的错误消息
|
|
42
|
+
* @param terminalEvents 终端事件列表(检测是否收到)
|
|
43
|
+
*/
|
|
44
|
+
export function assertWorkflowSucceeded(payload, failureMessage, terminalEvents) {
|
|
45
|
+
if (payload.event === "error") {
|
|
46
|
+
const message = typeof payload.message === "string"
|
|
47
|
+
? payload.message
|
|
48
|
+
: "SSE 流返回错误事件";
|
|
49
|
+
throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, message);
|
|
50
|
+
}
|
|
51
|
+
if (terminalEvents && payload.event) {
|
|
52
|
+
// 检查是否为终端事件
|
|
53
|
+
if (terminalEvents.includes(payload.event)) {
|
|
54
|
+
const data = payload.data;
|
|
55
|
+
if (typeof data === "object" && data !== null) {
|
|
56
|
+
const status = data.status;
|
|
57
|
+
if (status === "failed") {
|
|
58
|
+
const error = typeof data.error === "string"
|
|
59
|
+
? data.error
|
|
60
|
+
: failureMessage;
|
|
61
|
+
throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 从 workflow outputs 提取正文,优先 result/text/output 并排除 reference 字段
|
|
69
|
+
* @param outputs workflow 输出对象
|
|
70
|
+
* @param maxDepth 最大递归深度,默认 3
|
|
71
|
+
*/
|
|
72
|
+
export function pickWorkflowOutputText(outputs, maxDepth = 3) {
|
|
73
|
+
if (!outputs) {
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
return pickWorkflowOutputTextRecursive(outputs, 0, maxDepth);
|
|
77
|
+
}
|
|
78
|
+
function pickWorkflowOutputTextRecursive(outputs, depth, maxDepth) {
|
|
79
|
+
if (depth > maxDepth) {
|
|
80
|
+
return "";
|
|
81
|
+
}
|
|
82
|
+
if (typeof outputs.result === "string" && outputs.result.trim()) {
|
|
83
|
+
return outputs.result;
|
|
84
|
+
}
|
|
85
|
+
if (typeof outputs.text === "string" && outputs.text.trim()) {
|
|
86
|
+
return outputs.text;
|
|
87
|
+
}
|
|
88
|
+
if (typeof outputs.output === "string" && outputs.output.trim()) {
|
|
89
|
+
return outputs.output;
|
|
90
|
+
}
|
|
91
|
+
const parts = Object.entries(outputs)
|
|
92
|
+
.filter(([key, value]) => key !== "reference" && typeof value === "string")
|
|
93
|
+
.map(([, value]) => value);
|
|
94
|
+
const joined = parts.join("\n\n").trim();
|
|
95
|
+
if (joined) {
|
|
96
|
+
return joined;
|
|
97
|
+
}
|
|
98
|
+
const first = Object.values(outputs)[0];
|
|
99
|
+
if (typeof first === "string") {
|
|
100
|
+
return first;
|
|
101
|
+
}
|
|
102
|
+
if (typeof first === "object" && first !== null) {
|
|
103
|
+
return pickWorkflowOutputTextRecursive(first, depth + 1, maxDepth);
|
|
104
|
+
}
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 从 workflow outputs 提取参考文献列表。
|
|
109
|
+
*
|
|
110
|
+
* 与网站 Proofread/Writing 一致:outputs.reference / outputs.references
|
|
111
|
+
* 可能是 string[],也可能是换行分隔的 string(JOVA 常见)。
|
|
112
|
+
*/
|
|
113
|
+
export function extractReferences(outputs) {
|
|
114
|
+
if (!outputs) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
const raw = outputs.reference ?? outputs.references;
|
|
118
|
+
if (Array.isArray(raw)) {
|
|
119
|
+
return raw
|
|
120
|
+
.filter((item) => typeof item === "string")
|
|
121
|
+
.map((item) => item.trim())
|
|
122
|
+
.filter(Boolean);
|
|
123
|
+
}
|
|
124
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
125
|
+
return raw
|
|
126
|
+
.split(/\r?\n/)
|
|
127
|
+
.map((line) => line.trim())
|
|
128
|
+
.filter(Boolean);
|
|
129
|
+
}
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 从 SSE 事件流收集按 output id 分组的正文(用于 Application 模块)
|
|
134
|
+
* @param events SSE 事件列表
|
|
135
|
+
* @param options 提取选项
|
|
136
|
+
*/
|
|
137
|
+
export function collectOutputs(events, options = {}) {
|
|
138
|
+
const buffers = {};
|
|
139
|
+
for (const event of events) {
|
|
140
|
+
const chunk = extractSseText(event, options);
|
|
141
|
+
if (!chunk) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const outputId = typeof event.output === "string" && event.output
|
|
145
|
+
? event.output
|
|
146
|
+
: "_default";
|
|
147
|
+
if (!buffers[outputId]) {
|
|
148
|
+
buffers[outputId] = [];
|
|
149
|
+
}
|
|
150
|
+
buffers[outputId].push(chunk);
|
|
151
|
+
}
|
|
152
|
+
// 使用数组累积,避免 O(n²) 字符串拼接
|
|
153
|
+
return Object.fromEntries(Object.entries(buffers).map(([k, v]) => [k, v.join("")]));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 从 SSE 事件流提取 record_id
|
|
157
|
+
* @param events SSE 事件列表
|
|
158
|
+
*/
|
|
159
|
+
export function extractRecordId(events) {
|
|
160
|
+
for (const event of events) {
|
|
161
|
+
if (typeof event.record_id === "string" && event.record_id) {
|
|
162
|
+
return event.record_id;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 合并多 output 为单一 markdown 文本(用于导出)
|
|
169
|
+
* @param outputs 按 output id 分组的文本
|
|
170
|
+
* @param labels 可选的 output 标签映射
|
|
171
|
+
*/
|
|
172
|
+
export function joinOutputsAsMarkdown(outputs, labels) {
|
|
173
|
+
const parts = Object.entries(outputs)
|
|
174
|
+
.filter(([, value]) => value.trim())
|
|
175
|
+
.map(([id, value]) => {
|
|
176
|
+
const label = labels?.[id];
|
|
177
|
+
return label ? `## ${label}\n\n${value.trim()}` : value.trim();
|
|
178
|
+
});
|
|
179
|
+
return parts.join("\n\n");
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=sse-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-utils.js","sourceRoot":"","sources":["../../src/core/sse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,YAAY,CAAC;AAQpB;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAuB,EACvB,UAAiC,EAAE;IAEnC,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACD,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,IAA+B,CAAC;YAC/C,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACpC,OAAO,MAAM,CAAC,IAAI,CAAC;YACrB,CAAC;YACD,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACtC,OAAO,MAAM,CAAC,MAAM,CAAC;YACvB,CAAC;YACD,oCAAoC;YAC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UAAU,qBAAqB,CACnC,OAA+B,EAC/B,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3B,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC,CAAC,CAAC;IACL,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/core/terminal.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/core/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAEhE,8CAA8C;AAC9C,MAAM,UAAU,qBAAqB;IACnC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const TOKEN_DIR_NAME = "helixlife";
|
|
2
|
+
export declare const TOKEN_FILE_NAME = "user-access-token.txt";
|
|
3
|
+
export declare function getTokenFilePath(): string;
|
|
4
|
+
export declare function loadTokenFromFile(): string | undefined;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/token/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,cAAc,CAAC;AAG1C,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAGvD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAYtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
// 凭证固定落盘目录名
|
|
5
|
+
export const TOKEN_DIR_NAME = "helixlife";
|
|
6
|
+
// 凭证固定文件名
|
|
7
|
+
export const TOKEN_FILE_NAME = "user-access-token.txt";
|
|
8
|
+
// 解析全平台默认 token 文件路径:~/.config/helixlife/user-access-token.txt
|
|
9
|
+
export function getTokenFilePath() {
|
|
10
|
+
return join(homedir(), ".config", TOKEN_DIR_NAME, TOKEN_FILE_NAME);
|
|
11
|
+
}
|
|
12
|
+
// 从本地 token 文件读取凭证,供 API 请求附加 Authorization
|
|
13
|
+
export function loadTokenFromFile() {
|
|
14
|
+
const filePath = getTokenFilePath();
|
|
15
|
+
if (!existsSync(filePath)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const content = readFileSync(filePath, "utf8").trim();
|
|
20
|
+
return content || undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/token/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,YAAY;AACZ,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,UAAU;AACV,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEvD,+DAA+D;AAC/D,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;AACrE,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,iBAAiB;IAC/B,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QACtD,OAAO,OAAO,IAAI,SAAS,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface helixlifeConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function getDefaultBaseUrl(): string;
|
|
6
|
+
export declare function getDefaultAuthBaseUrl(): string;
|
|
7
|
+
export declare function getDefaultNewideaBaseUrl(): string;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/types/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4BD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAGD,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAGD,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD"}
|