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 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../../src/core/api/sse.ts"],"names":[],"mappings":"AAMA,gCAAgC;AAChC,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAgC,EAChC,OAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE;QAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,OAAO;QACT,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QACD,IAAI,OAAuB,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,4BAA4B;YAC5B,OAAO;QACT,CAAC;QACD,oCAAoC;QACpC,6CAA6C;QAC7C,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,IAAI,CAAC;QACH,mBAAmB;QACnB,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM;YACR,CAAC;YAED,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;YAE5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;oBACrC,YAAY,CAAC,IAAI,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QAED,qBAAqB;QACrB,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,YAAY,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,8CAA8C;QAC9C,+DAA+D;QAC/D,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type TokenCheckStatus = "valid" | "unauthorized" | "error";
|
|
2
|
+
export interface TokenCheckResult {
|
|
3
|
+
status: TokenCheckStatus;
|
|
4
|
+
message: string;
|
|
5
|
+
code?: string | number;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthorizeOptions {
|
|
8
|
+
openBrowser?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface AuthResult {
|
|
11
|
+
token: string;
|
|
12
|
+
linkUrl: string;
|
|
13
|
+
finalUrl: string;
|
|
14
|
+
browserOpened: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface CheckTokenResponse {
|
|
17
|
+
success?: boolean;
|
|
18
|
+
code?: number | string;
|
|
19
|
+
msg?: string;
|
|
20
|
+
message?: string;
|
|
21
|
+
data?: {
|
|
22
|
+
success?: boolean;
|
|
23
|
+
code?: number | string;
|
|
24
|
+
msg?: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function buildAuthLinkUrl(linkUrl: string): string;
|
|
29
|
+
export declare function openBrowser(url: string): boolean;
|
|
30
|
+
export declare function interpretCheckToken(httpStatus: number, payload: CheckTokenResponse): TokenCheckResult;
|
|
31
|
+
export declare function checkToken(token: string | undefined): Promise<TokenCheckResult>;
|
|
32
|
+
export declare function startAuthorization(options?: AuthorizeOptions): Promise<AuthResult>;
|
|
33
|
+
export declare function reauthorize(options?: AuthorizeOptions): Promise<AuthResult>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AA8BA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,cAAc,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAGD,MAAM,WAAW,gBAAgB;IAE/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAGD,MAAM,WAAW,UAAU;IAEzB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,MAAM,CAAC;IAEjB,aAAa,EAAE,OAAO,CAAC;CACxB;AAcD,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmBhD;AAgDD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,kBAAkB,GAC1B,gBAAgB,CAqClB;AAID,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA6B3B;AAMD,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,UAAU,CAAC,CASrB;AAGD,wBAAsB,WAAW,CAC/B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAGrB"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
import { platform } from "node:os";
|
|
3
|
+
import { helixlifeError, helixlifeErrorCode } from "../errors.js";
|
|
4
|
+
import { getDefaultAuthBaseUrl } from "../types/config.js";
|
|
5
|
+
import { saveTokenFile, clearTokenFile } from "../token/index.js";
|
|
6
|
+
import { fetchWithTimeout } from "../api/http.js";
|
|
7
|
+
// 授权类请求超时(毫秒):授权/检测接口耗时短,无需业务级 60s,避免网络挂起时长时间无响应
|
|
8
|
+
const AUTH_REQUEST_TIMEOUT_MS = 30_000;
|
|
9
|
+
// 授权接口基址:由本地 config.json 的 agent_api 覆盖(运行时重读),缺省为生产默认。
|
|
10
|
+
// 去除结尾多余的 / 避免拼接双斜杠。
|
|
11
|
+
function getAuthBaseUrl() {
|
|
12
|
+
return getDefaultAuthBaseUrl().replace(/\/+$/, "");
|
|
13
|
+
}
|
|
14
|
+
// 检测授权接口路径:每次重算,确保 config set 后立即联动
|
|
15
|
+
function getAuthUrlEndpoint() {
|
|
16
|
+
return `${getAuthBaseUrl()}/api/v1/agent/skills/auth-url`;
|
|
17
|
+
}
|
|
18
|
+
// 检测授权接口路径:每次重算
|
|
19
|
+
function getCheckTokenEndpoint() {
|
|
20
|
+
return `${getAuthBaseUrl()}/api/v1/agent/skills/check-token`;
|
|
21
|
+
}
|
|
22
|
+
// 规范化授权链接(去除首尾空白)
|
|
23
|
+
export function buildAuthLinkUrl(linkUrl) {
|
|
24
|
+
return linkUrl.trim();
|
|
25
|
+
}
|
|
26
|
+
// 跨平台自动唤起浏览器打开授权链接,失败时返回 false 由调用方回退到提示复制
|
|
27
|
+
export function openBrowser(url) {
|
|
28
|
+
const os = platform();
|
|
29
|
+
let command;
|
|
30
|
+
if (os === "win32") {
|
|
31
|
+
command = `start "" "${url}"`;
|
|
32
|
+
}
|
|
33
|
+
else if (os === "darwin") {
|
|
34
|
+
command = `open "${url}"`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
command = `xdg-open "${url}"`;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
exec(command, () => {
|
|
41
|
+
// 唤起为异步执行,失败无法同步感知,此处保持静默;调用方以提示复制兜底
|
|
42
|
+
});
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// 调用获取授权链接接口,返回 token_key 与 link_url
|
|
50
|
+
async function fetchAuthUrl() {
|
|
51
|
+
let response;
|
|
52
|
+
try {
|
|
53
|
+
response = await fetchWithTimeout(getAuthUrlEndpoint(), { method: "GET", headers: { Accept: "application/json" } }, AUTH_REQUEST_TIMEOUT_MS);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
throw new helixlifeError(helixlifeErrorCode.NETWORK_ERROR, "获取授权链接失败,请检查网络后重试");
|
|
57
|
+
}
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
throw new helixlifeError(helixlifeErrorCode.REQUEST_FAILED, `获取授权链接失败 (${response.status}): ${response.statusText}`);
|
|
60
|
+
}
|
|
61
|
+
const payload = (await response.json().catch(() => ({})));
|
|
62
|
+
const data = payload.data ?? {};
|
|
63
|
+
if (!data.token_key || !data.link_url) {
|
|
64
|
+
const hint = payload.msg ?? payload.message ?? `错误码 ${payload.code ?? "未知"}`;
|
|
65
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_RESPONSE, `授权接口返回异常:${hint}`);
|
|
66
|
+
}
|
|
67
|
+
return { tokenKey: data.token_key, linkUrl: data.link_url };
|
|
68
|
+
}
|
|
69
|
+
// 检测授权接口对「未授权 / 待授权 / token 无效或不存在 / 已过期」统一返回该错误码
|
|
70
|
+
const CHECK_TOKEN_UNAUTHORIZED_CODE = "40004";
|
|
71
|
+
// 将检测授权接口响应归一化为三态结果
|
|
72
|
+
//
|
|
73
|
+
// 实测(dev agent.youlika.net)响应约定:
|
|
74
|
+
// - 已授权: { success: true, code: 200000000, message: "", data: null }
|
|
75
|
+
// - 未授权/待授权:{ success: false, code: 40004, message: "{#title}不存在" }(新建未确认、无效、不存在、过期均返回此码)
|
|
76
|
+
// - 其他错误: success:false 且 code 非 40004(权限不足、账号异常、限流等)—— 仅提示,不引导重新授权
|
|
77
|
+
export function interpretCheckToken(httpStatus, payload) {
|
|
78
|
+
const success = payload.success === true || payload.data?.success === true;
|
|
79
|
+
const rawMessage = payload.message ??
|
|
80
|
+
payload.msg ??
|
|
81
|
+
payload.data?.message ??
|
|
82
|
+
payload.data?.msg ??
|
|
83
|
+
"";
|
|
84
|
+
const code = payload.code ?? payload.data?.code;
|
|
85
|
+
// 后台部分文案是未渲染的 i18n 模板(如 "{#title}不存在"),对用户无意义,做兜底替换
|
|
86
|
+
const message = rawMessage.includes("{#") ? "" : rawMessage;
|
|
87
|
+
if (success) {
|
|
88
|
+
return { status: "valid", message: message || "已授权" };
|
|
89
|
+
}
|
|
90
|
+
// 未授权判定(需引导重新授权):以 HTTP 401 与后台未授权码 40004 为主判据
|
|
91
|
+
//(新建未确认 / 无效 / 不存在 / 过期均返回 40004);正则仅作后台文案漂移时的最后兜底。
|
|
92
|
+
const unauthorized = httpStatus === 401 ||
|
|
93
|
+
String(code ?? "") === CHECK_TOKEN_UNAUTHORIZED_CODE ||
|
|
94
|
+
/未授权|未登录|请登录/.test(rawMessage);
|
|
95
|
+
if (unauthorized) {
|
|
96
|
+
return {
|
|
97
|
+
status: "unauthorized",
|
|
98
|
+
message: message || "未授权或登录已过期",
|
|
99
|
+
code,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
status: "error",
|
|
104
|
+
message: message || `检测授权失败(HTTP ${httpStatus},code ${code ?? "未知"})`,
|
|
105
|
+
code,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// 检测授权:调用 check-token 接口校验 token 是否有效,返回三态结果。
|
|
109
|
+
// 注意:不抛异常(网络错误也归一化为 error 态),由调用方按状态决策。
|
|
110
|
+
export async function checkToken(token) {
|
|
111
|
+
const trimmed = token?.trim();
|
|
112
|
+
if (!trimmed) {
|
|
113
|
+
return { status: "unauthorized", message: "本地无有效 token" };
|
|
114
|
+
}
|
|
115
|
+
const url = `${getCheckTokenEndpoint()}?token_key=${encodeURIComponent(trimmed)}`;
|
|
116
|
+
let response;
|
|
117
|
+
try {
|
|
118
|
+
response = await fetchWithTimeout(url, { method: "GET", headers: { Accept: "application/json" } }, AUTH_REQUEST_TIMEOUT_MS);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return { status: "error", message: "检测授权失败,请检查网络后重试" };
|
|
122
|
+
}
|
|
123
|
+
const payload = (await response
|
|
124
|
+
.json()
|
|
125
|
+
.catch(() => ({})));
|
|
126
|
+
const result = interpretCheckToken(response.status, payload);
|
|
127
|
+
// 失效即清:判定为未授权时统一在此清除本地失效 token,命令层无需重复处理
|
|
128
|
+
if (result.status === "unauthorized") {
|
|
129
|
+
clearTokenFile();
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
// 获取授权链接流程:
|
|
134
|
+
// 1. 调用获取授权链接接口,拿到 token_key 与 link_url
|
|
135
|
+
// 2. 将 token_key 持久化写入本地 token 文件(此时尚未与账号绑定,需用户在网站确认)
|
|
136
|
+
// 3. 自动唤起浏览器,引导用户完成授权
|
|
137
|
+
export async function startAuthorization(options = {}) {
|
|
138
|
+
const { tokenKey, linkUrl } = await fetchAuthUrl();
|
|
139
|
+
saveTokenFile(tokenKey);
|
|
140
|
+
const finalUrl = buildAuthLinkUrl(linkUrl);
|
|
141
|
+
const shouldOpen = options.openBrowser !== false;
|
|
142
|
+
const browserOpened = shouldOpen ? openBrowser(finalUrl) : false;
|
|
143
|
+
return { token: tokenKey, linkUrl, finalUrl, browserOpened };
|
|
144
|
+
}
|
|
145
|
+
// 重新授权:先清空本地失效 token,再执行获取授权链接流程
|
|
146
|
+
export async function reauthorize(options = {}) {
|
|
147
|
+
clearTokenFile();
|
|
148
|
+
return startAuthorization(options);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEl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OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAC/D,CAAC;AAED,iCAAiC;AACjC,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,UAA4B,EAAE;IAE9B,cAAc,EAAE,CAAC;IACjB,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const CONFIG_DIR_NAME = "helixlife";
|
|
2
|
+
export declare const LOCAL_CONFIG_FILE_NAME = "config.json";
|
|
3
|
+
export declare const CONFIG_SET_KEYS: readonly ["api", "agent_api"];
|
|
4
|
+
export type ConfigSetKey = (typeof CONFIG_SET_KEYS)[number];
|
|
5
|
+
export interface LocalConfig {
|
|
6
|
+
api?: string;
|
|
7
|
+
agent_api?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function isValidConfigSetKey(value: unknown): value is ConfigSetKey;
|
|
10
|
+
export declare function normalizeConfigUrl(value: string): string;
|
|
11
|
+
export declare function getLocalConfigPath(): string;
|
|
12
|
+
export declare function loadLocalConfig(): LocalConfig | undefined;
|
|
13
|
+
export declare function saveLocalConfig(config: LocalConfig): void;
|
|
14
|
+
export declare function updateLocalConfigField(key: ConfigSetKey, value: string): LocalConfig;
|
|
15
|
+
export declare function clearLocalConfig(): void;
|
|
16
|
+
//# sourceMappingURL=env-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-config.d.ts","sourceRoot":"","sources":["../../src/core/env-config.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,cAAc,CAAC;AAG3C,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAGpD,eAAO,MAAM,eAAe,+BAAgC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAG5D,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAKzE;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAID,wBAAgB,eAAe,IAAI,WAAW,GAAG,SAAS,CAuBzD;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIzD;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,GACZ,WAAW,CAQb;AAGD,wBAAgB,gBAAgB,IAAI,IAAI,CAUvC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// 本地配置文件读写:与 token 文件同目录(~/.config/helixlife/)。
|
|
2
|
+
// 仅在用户显式调用 `helixlife-expert config set` 时落盘,避免隐式副作用。
|
|
3
|
+
// 存储完整接口基址覆盖(api / agent_api),缺省字段回退代码内生产默认值。
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, } from "node:fs";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
// 本地配置文件固定目录:与 user-access-token.txt 共用 ~/.config/helixlife/
|
|
8
|
+
export const CONFIG_DIR_NAME = "helixlife";
|
|
9
|
+
// 本地配置文件名(后续所有运行时可覆盖变量均写入此文件)
|
|
10
|
+
export const LOCAL_CONFIG_FILE_NAME = "config.json";
|
|
11
|
+
// 允许通过 `helixlife-expert config set` 覆盖的字段
|
|
12
|
+
export const CONFIG_SET_KEYS = ["api", "agent_api"];
|
|
13
|
+
// 判断是否为合法的可设置字段名
|
|
14
|
+
export function isValidConfigSetKey(value) {
|
|
15
|
+
return (typeof value === "string" &&
|
|
16
|
+
CONFIG_SET_KEYS.includes(value));
|
|
17
|
+
}
|
|
18
|
+
// 规范化配置值:去首尾空白与末尾多余 /
|
|
19
|
+
export function normalizeConfigUrl(value) {
|
|
20
|
+
return value.trim().replace(/\/+$/, "");
|
|
21
|
+
}
|
|
22
|
+
// 解析全平台默认配置文件路径:~/.config/helixlife/config.json
|
|
23
|
+
export function getLocalConfigPath() {
|
|
24
|
+
return join(homedir(), ".config", CONFIG_DIR_NAME, LOCAL_CONFIG_FILE_NAME);
|
|
25
|
+
}
|
|
26
|
+
// 从本地 config.json 读取完整配置。
|
|
27
|
+
// 文件不存在 / 解析失败 → 返回 undefined;非法字段静默丢弃。
|
|
28
|
+
export function loadLocalConfig() {
|
|
29
|
+
const filePath = getLocalConfigPath();
|
|
30
|
+
if (!existsSync(filePath)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const raw = readFileSync(filePath, "utf8").trim();
|
|
35
|
+
if (!raw)
|
|
36
|
+
return undefined;
|
|
37
|
+
const parsed = JSON.parse(raw);
|
|
38
|
+
const result = {};
|
|
39
|
+
if (typeof parsed.api === "string" && parsed.api.trim()) {
|
|
40
|
+
result.api = normalizeConfigUrl(parsed.api);
|
|
41
|
+
}
|
|
42
|
+
if (typeof parsed.agent_api === "string" && parsed.agent_api.trim()) {
|
|
43
|
+
result.agent_api = normalizeConfigUrl(parsed.agent_api);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// 将配置写入本地 config.json,自动创建目录;幂等。
|
|
52
|
+
export function saveLocalConfig(config) {
|
|
53
|
+
const filePath = getLocalConfigPath();
|
|
54
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
55
|
+
writeFileSync(filePath, JSON.stringify(config, null, 2), "utf8");
|
|
56
|
+
}
|
|
57
|
+
// 合并更新单个字段:保留文件中未改动的其他字段,再落盘。
|
|
58
|
+
export function updateLocalConfigField(key, value) {
|
|
59
|
+
const current = loadLocalConfig() ?? {};
|
|
60
|
+
const next = {
|
|
61
|
+
...current,
|
|
62
|
+
[key]: normalizeConfigUrl(value),
|
|
63
|
+
};
|
|
64
|
+
saveLocalConfig(next);
|
|
65
|
+
return next;
|
|
66
|
+
}
|
|
67
|
+
// 删除本地 config.json(预留扩展位,当前不暴露命令)。
|
|
68
|
+
export function clearLocalConfig() {
|
|
69
|
+
const filePath = getLocalConfigPath();
|
|
70
|
+
if (!existsSync(filePath)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
unlinkSync(filePath);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// 静默失败
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=env-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-config.js","sourceRoot":"","sources":["../../src/core/env-config.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sDAAsD;AACtD,8CAA8C;AAC9C,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAE3C,8BAA8B;AAC9B,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEpD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,WAAW,CAAU,CAAC;AAS7D,iBAAiB;AACjB,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,eAAqC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACvD,CAAC;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AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACnE,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,sBAAsB,CACpC,GAAiB,EACjB,KAAa;IAEb,MAAM,OAAO,GAAG,eAAe,EAAE,IAAI,EAAE,CAAC;IACxC,MAAM,IAAI,GAAgB;QACxB,GAAG,OAAO;QACV,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,eAAe,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,gBAAgB;IAC9B,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,UAAU,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const NOT_AUTHENTICATED_MESSAGE = "\u672C\u5730\u65E0\u6709\u6548\u51ED\u8BC1\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u540E\u53F0\u63A5\u53E3";
|
|
2
|
+
export declare const TOKEN_EXPIRED_MESSAGE = "\u5F53\u524D\u51ED\u8BC1\u65E0\u6CD5\u8BBF\u95EE\u540E\u53F0\u63A5\u53E3";
|
|
3
|
+
export declare enum helixlifeErrorCode {
|
|
4
|
+
NOT_AUTHENTICATED = "E1001",
|
|
5
|
+
TOKEN_EXPIRED = "E1004",
|
|
6
|
+
PERMISSION_DENIED = "E1005",
|
|
7
|
+
INVALID_ARGUMENT = "E2001",
|
|
8
|
+
REQUEST_FAILED = "E5000",
|
|
9
|
+
NETWORK_ERROR = "E5001",
|
|
10
|
+
INVALID_RESPONSE = "E5002"
|
|
11
|
+
}
|
|
12
|
+
export interface helixlifeErrorOptions extends ErrorOptions {
|
|
13
|
+
cause?: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare class helixlifeError extends Error {
|
|
16
|
+
readonly code: helixlifeErrorCode;
|
|
17
|
+
readonly cause?: unknown;
|
|
18
|
+
constructor(code: helixlifeErrorCode, message: string, options?: helixlifeErrorOptions);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,yBAAyB,qGAClB,CAAC;AAGrB,eAAO,MAAM,qBAAqB,6EAAiB,CAAC;AAGpD,oBAAY,kBAAkB;IAC5B,iBAAiB,UAAU;IAC3B,aAAa,UAAU;IACvB,iBAAiB,UAAU;IAC3B,gBAAgB,UAAU;IAC1B,cAAc,UAAU;IACxB,aAAa,UAAU;IACvB,gBAAgB,UAAU;CAC3B;AAGD,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAID,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,IAAI,EAAE,kBAAkB,CAAC;IACzC,SAAyB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,qBAAqB;CAOlC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// 本地无凭证时的全局统一提示文案,供 API 调用与命令层复用
|
|
2
|
+
export const NOT_AUTHENTICATED_MESSAGE = "本地无有效凭证,无法访问后台接口";
|
|
3
|
+
// 后台返回 401 时的全局统一提示文案,供 API 调用与命令层复用
|
|
4
|
+
export const TOKEN_EXPIRED_MESSAGE = "当前凭证无法访问后台接口";
|
|
5
|
+
// helixlife CLI 统一错误码定义
|
|
6
|
+
export var helixlifeErrorCode;
|
|
7
|
+
(function (helixlifeErrorCode) {
|
|
8
|
+
helixlifeErrorCode["NOT_AUTHENTICATED"] = "E1001";
|
|
9
|
+
helixlifeErrorCode["TOKEN_EXPIRED"] = "E1004";
|
|
10
|
+
helixlifeErrorCode["PERMISSION_DENIED"] = "E1005";
|
|
11
|
+
helixlifeErrorCode["INVALID_ARGUMENT"] = "E2001";
|
|
12
|
+
helixlifeErrorCode["REQUEST_FAILED"] = "E5000";
|
|
13
|
+
helixlifeErrorCode["NETWORK_ERROR"] = "E5001";
|
|
14
|
+
helixlifeErrorCode["INVALID_RESPONSE"] = "E5002";
|
|
15
|
+
})(helixlifeErrorCode || (helixlifeErrorCode = {}));
|
|
16
|
+
// 结构化 CLI 错误,供命令层与 Agent 解析
|
|
17
|
+
// 支持错误链(cause)以便调试时追溯原始错误
|
|
18
|
+
export class helixlifeError extends Error {
|
|
19
|
+
code;
|
|
20
|
+
cause;
|
|
21
|
+
constructor(code, message, options) {
|
|
22
|
+
super(message, options);
|
|
23
|
+
this.name = "helixlifeError";
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.cause = options?.cause;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,CAAC,MAAM,yBAAyB,GACpC,kBAAkB,CAAC;AAErB,qCAAqC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEpD,wBAAwB;AACxB,MAAM,CAAN,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,iDAA2B,CAAA;IAC3B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,gDAA0B,CAAA;IAC1B,8CAAwB,CAAA;IACxB,6CAAuB,CAAA;IACvB,gDAA0B,CAAA;AAC5B,CAAC,EARW,kBAAkB,KAAlB,kBAAkB,QAQ7B;AAOD,4BAA4B;AAC5B,0BAA0B;AAC1B,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvB,IAAI,CAAqB;IAChB,KAAK,CAAW;IAEzC,YACE,IAAwB,EACxB,OAAe,EACf,OAA+B;QAE/B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { helixlifeError, helixlifeErrorCode, NOT_AUTHENTICATED_MESSAGE, TOKEN_EXPIRED_MESSAGE, } from "./errors.js";
|
|
2
|
+
export { fetchWithTimeout, DEFAULT_REQUEST_TIMEOUT_MS } from "./api/http.js";
|
|
3
|
+
export { ApiClient, type BinaryResponse, type RequestOptions, } from "./api/client.js";
|
|
4
|
+
export { parseSseStream, type SseDataPayload } from "./api/sse.js";
|
|
5
|
+
export { unwrapResponse, unwrapApiData, unwrapNestedApiData, extractNestedData, extractOrderId, type ApiEnvelope, type ApiErrorEnvelope, } from "./api/response.js";
|
|
6
|
+
export { getTokenFilePath, loadTokenFromFile, TOKEN_DIR_NAME, TOKEN_FILE_NAME, } from "./token/index.js";
|
|
7
|
+
export { getDefaultBaseUrl, getDefaultAuthBaseUrl, getDefaultNewideaBaseUrl, type helixlifeConfig, } from "./types/config.js";
|
|
8
|
+
export { loadLocalConfig, saveLocalConfig, updateLocalConfigField, clearLocalConfig, getLocalConfigPath, isValidConfigSetKey, CONFIG_SET_KEYS, CONFIG_DIR_NAME, LOCAL_CONFIG_FILE_NAME, type LocalConfig, type ConfigSetKey, } from "./env-config.js";
|
|
9
|
+
export { getUserDownloadsDir, resolveUserPath, sanitizeFilename, type SanitizeFilenameOptions, } from "./paths.js";
|
|
10
|
+
export { printOutput, emitJson, stringifyJsonAscii, renderListAsMarkdown, renderListAsHtmlTable, createStderrProgress, createFormatLogger, parseOutputFormat, type OutputFormat, type ProgressReporter, } from "./output/index.js";
|
|
11
|
+
export { getPackageVersion } from "./version.js";
|
|
12
|
+
export { extractSseText, assertWorkflowSucceeded, pickWorkflowOutputText, extractReferences, collectOutputs, extractRecordId, joinOutputsAsMarkdown, type ExtractSseTextOptions, } from "./sse-utils.js";
|
|
13
|
+
export { parseIntegerOption, parseEnumOption } from "./parse.js";
|
|
14
|
+
export { isInteractiveTerminal } from "./terminal.js";
|
|
15
|
+
export { createInteractiveInterface, askOption, askOptionWithRl, } from "./interactive.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { helixlifeError, helixlifeErrorCode, NOT_AUTHENTICATED_MESSAGE, TOKEN_EXPIRED_MESSAGE, } from "./errors.js";
|
|
2
|
+
export { fetchWithTimeout, DEFAULT_REQUEST_TIMEOUT_MS } from "./api/http.js";
|
|
3
|
+
export { ApiClient, } from "./api/client.js";
|
|
4
|
+
export { parseSseStream } from "./api/sse.js";
|
|
5
|
+
export { unwrapResponse, unwrapApiData, unwrapNestedApiData, extractNestedData, extractOrderId, } from "./api/response.js";
|
|
6
|
+
export { getTokenFilePath, loadTokenFromFile, TOKEN_DIR_NAME, TOKEN_FILE_NAME, } from "./token/index.js";
|
|
7
|
+
export { getDefaultBaseUrl, getDefaultAuthBaseUrl, getDefaultNewideaBaseUrl, } from "./types/config.js";
|
|
8
|
+
export { loadLocalConfig, saveLocalConfig, updateLocalConfigField, clearLocalConfig, getLocalConfigPath, isValidConfigSetKey, CONFIG_SET_KEYS, CONFIG_DIR_NAME, LOCAL_CONFIG_FILE_NAME, } from "./env-config.js";
|
|
9
|
+
export { getUserDownloadsDir, resolveUserPath, sanitizeFilename, } from "./paths.js";
|
|
10
|
+
export { printOutput, emitJson, stringifyJsonAscii, renderListAsMarkdown, renderListAsHtmlTable, createStderrProgress, createFormatLogger, parseOutputFormat, } from "./output/index.js";
|
|
11
|
+
export { getPackageVersion } from "./version.js";
|
|
12
|
+
export { extractSseText, assertWorkflowSucceeded, pickWorkflowOutputText, extractReferences, collectOutputs, extractRecordId, joinOutputsAsMarkdown, } from "./sse-utils.js";
|
|
13
|
+
export { parseIntegerOption, parseEnumOption } from "./parse.js";
|
|
14
|
+
export { isInteractiveTerminal } from "./terminal.js";
|
|
15
|
+
export { createInteractiveInterface, askOption, askOptionWithRl, } from "./interactive.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,SAAS,GAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,GAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,GAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,GAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,qBAAqB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
/**
|
|
3
|
+
* 创建交互式 readline 接口
|
|
4
|
+
*/
|
|
5
|
+
export declare function createInteractiveInterface(): import("readline/promises").Interface;
|
|
6
|
+
/**
|
|
7
|
+
* 从带序号的选项列表中读取用户选择,回车保留默认项
|
|
8
|
+
* @param title 选项标题
|
|
9
|
+
* @param options 选项列表
|
|
10
|
+
* @param defaultValue 默认值
|
|
11
|
+
* @param formatter 可选的格式化函数 (option, index, isDefault) => displayText
|
|
12
|
+
*/
|
|
13
|
+
export declare function askOption<T extends string>(title: string, options: readonly T[], defaultValue: T, formatter?: (option: T, index: number, isDefault: boolean) => string): Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* 从带序号的选项列表中读取用户选择(非 async 版本,需外部管理 rl)
|
|
16
|
+
*/
|
|
17
|
+
export declare function askOptionWithRl<T extends string>(rl: ReturnType<typeof createInterface>, title: string, options: readonly T[], defaultValue: T, formatter?: (option: T, index: number, isDefault: boolean) => string): Promise<T>;
|
|
18
|
+
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/core/interactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD;;GAEG;AACH,wBAAgB,0BAA0B,0CAEzC;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,EAC9C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,YAAY,EAAE,CAAC,EACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,GACnE,OAAO,CAAC,CAAC,CAAC,CAiCZ;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,SAAS,MAAM,EACpD,EAAE,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,YAAY,EAAE,CAAC,EACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,GACnE,OAAO,CAAC,CAAC,CAAC,CA4BZ"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
3
|
+
import { helixlifeError, helixlifeErrorCode } from "./errors.js";
|
|
4
|
+
/**
|
|
5
|
+
* 创建交互式 readline 接口
|
|
6
|
+
*/
|
|
7
|
+
export function createInteractiveInterface() {
|
|
8
|
+
return createInterface({ input, output });
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 从带序号的选项列表中读取用户选择,回车保留默认项
|
|
12
|
+
* @param title 选项标题
|
|
13
|
+
* @param options 选项列表
|
|
14
|
+
* @param defaultValue 默认值
|
|
15
|
+
* @param formatter 可选的格式化函数 (option, index, isDefault) => displayText
|
|
16
|
+
*/
|
|
17
|
+
export async function askOption(title, options, defaultValue, formatter) {
|
|
18
|
+
const rl = createInteractiveInterface();
|
|
19
|
+
try {
|
|
20
|
+
console.log(`\n${title}:`);
|
|
21
|
+
options.forEach((option, index) => {
|
|
22
|
+
const isDefault = option === defaultValue;
|
|
23
|
+
const displayText = formatter
|
|
24
|
+
? formatter(option, index, isDefault)
|
|
25
|
+
: `${index + 1}) ${option}${isDefault ? " *" : ""}`;
|
|
26
|
+
console.log(` ${displayText}`);
|
|
27
|
+
});
|
|
28
|
+
const defaultNo = options.indexOf(defaultValue) + 1;
|
|
29
|
+
const answer = (await rl.question(`选择 [${defaultNo}]: `)).trim();
|
|
30
|
+
if (!answer) {
|
|
31
|
+
return defaultValue;
|
|
32
|
+
}
|
|
33
|
+
const index = Number.parseInt(answer, 10);
|
|
34
|
+
if (Number.isNaN(index) || index < 1 || index > options.length) {
|
|
35
|
+
const byValue = options.find((option) => option === answer);
|
|
36
|
+
if (byValue) {
|
|
37
|
+
return byValue;
|
|
38
|
+
}
|
|
39
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `无效选择: ${answer},请输入 1-${options.length}`);
|
|
40
|
+
}
|
|
41
|
+
return options[index - 1];
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
rl.close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 从带序号的选项列表中读取用户选择(非 async 版本,需外部管理 rl)
|
|
49
|
+
*/
|
|
50
|
+
export async function askOptionWithRl(rl, title, options, defaultValue, formatter) {
|
|
51
|
+
console.log(`\n${title}:`);
|
|
52
|
+
options.forEach((option, index) => {
|
|
53
|
+
const isDefault = option === defaultValue;
|
|
54
|
+
const displayText = formatter
|
|
55
|
+
? formatter(option, index, isDefault)
|
|
56
|
+
: `${index + 1}) ${option}${isDefault ? " *" : ""}`;
|
|
57
|
+
console.log(` ${displayText}`);
|
|
58
|
+
});
|
|
59
|
+
const defaultNo = options.indexOf(defaultValue) + 1;
|
|
60
|
+
const answer = (await rl.question(`选择 [${defaultNo}]: `)).trim();
|
|
61
|
+
if (!answer) {
|
|
62
|
+
return defaultValue;
|
|
63
|
+
}
|
|
64
|
+
const index = Number.parseInt(answer, 10);
|
|
65
|
+
if (Number.isNaN(index) || index < 1 || index > options.length) {
|
|
66
|
+
const byValue = options.find((option) => option === answer);
|
|
67
|
+
if (byValue) {
|
|
68
|
+
return byValue;
|
|
69
|
+
}
|
|
70
|
+
throw new helixlifeError(helixlifeErrorCode.INVALID_ARGUMENT, `无效选择: ${answer},请输入 1-${options.length}`);
|
|
71
|
+
}
|
|
72
|
+
return options[index - 1];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=interactive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/core/interactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MA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AAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;QAC5D,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,cAAc,CACtB,kBAAkB,CAAC,gBAAgB,EACnC,SAAS,MAAM,UAAU,OAAO,CAAC,MAAM,EAAE,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type OutputFormat = "markdown" | "json";
|
|
2
|
+
export declare function parseOutputFormat(raw: string): OutputFormat;
|
|
3
|
+
export interface ProgressReporter {
|
|
4
|
+
start(message: string): void;
|
|
5
|
+
update(receivedChars: number): void;
|
|
6
|
+
finish(message: string): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createStderrProgress(enabled: boolean, intervalMs?: number): ProgressReporter;
|
|
10
|
+
export declare function renderListAsMarkdown(rows: Record<string, unknown>[], columns: {
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* 将列表渲染为 HTML 表格;单元格内换行会变成 <br>,供聊天端真实换行展示。
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderListAsHtmlTable(rows: Record<string, unknown>[], columns: {
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* 将非 ASCII 字符转为 \\uXXXX,保证 JSON stdout 在 Windows GBK 管道下不被误解码。
|
|
23
|
+
* 宿主(PowerShell / GB2312 控制台)按字节流捕获时,原始中文 UTF-8 会被读成「乳腺�?」类乱码。
|
|
24
|
+
*/
|
|
25
|
+
export declare function stringifyJsonAscii(data: unknown): string;
|
|
26
|
+
export declare function emitJson(data: Record<string, unknown>): void;
|
|
27
|
+
export declare function printOutput(data: unknown, format: OutputFormat): void;
|
|
28
|
+
export declare function createFormatLogger(format: OutputFormat): (message: string) => void;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/output/index.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;AAG/C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAE3D;AAED,MAAM,WAAW,gBAAgB;IAE/B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,OAAO,IAAI,IAAI,CAAC;CACjB;AAQD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,UAAU,SAAO,GAChB,gBAAgB,CAiDlB;AAUD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,OAAO,EAAE;I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