weaver-work-cli 0.1.62 → 0.1.64
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/dist/chunks/{archive-S2VKZWQ3.js → archive-WUZKAEZ6.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-PN46RTI2.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-ZPC5VWZM.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-DHGP3NYY.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-JQDW3BIB.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-JC47AIXK.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-IKIHM77A.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-GZTSJ57Y.js} +5 -4
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-26FCCU5O.js} +5 -3
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-3PCXBG4H.js} +1 -1
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-3W5NMGDS.js} +2 -2
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-4AFWOGOV.js} +3 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-5QQKLR6H.js} +11 -11
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-6T5X6YWX.js} +5 -3
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-AFZTMYGC.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-AGSO3PIK.js} +2 -2
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-FDBAFANU.js} +76 -76
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-FJUOUSV3.js} +89 -8
- package/dist/chunks/{chunk-EGANE35F.js → chunk-HLT6B26P.js} +1 -1
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-HWA2A25Y.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-I3MOFD6Q.js} +4 -7
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-INVYKG4I.js} +140 -45
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-K7QKQRSL.js} +168 -62
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-KDFEHDIB.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-KYDXWYFB.js} +1 -1
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-Q6D6PSMH.js} +30 -24
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-RMOH2GMF.js} +2 -2
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-SCMHG23G.js} +387 -70
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-VLY5RTVO.js} +5 -3
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-WSHIOSGM.js} +5 -3
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-XHSEK2VM.js} +48 -12
- package/dist/chunks/{chunk-XT77MP54.js → chunk-YTFNMQO4.js} +410 -24
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-UUC7AFUI.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-INMS7SYQ.js} +3051 -4497
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-34CBYVQP.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-YOR4QTAJ.js} +18 -6
- package/dist/chunks/{data-FOODGAMF.js → data-QKWI5325.js} +14 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-ZONRROK4.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-2CONM7R6.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-S2ENJ6GZ.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-ZSAXU5PJ.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-FQASCY2H.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-N76QQA53.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-FCLVIWAS.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-UM665WDZ.js} +3 -3
- package/dist/chunks/{host-VTPAWDZV.js → host-2ED2KC4X.js} +4 -4
- package/dist/chunks/{host-TJ5VVHM7.js → host-2UYZEY2V.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-46NYKDQP.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-7IPZKIM4.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-P7G22WNM.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-XLCBLNJD.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-XKL27NX2.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-NDYIMASG.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-MOGNB6HN.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-3T5X7SB7.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-4WOIL3ZQ.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-P7VMUKQW.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-MMTYDHXA.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-LCSBWGJ3.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-VZXRQGS4.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-MI2BSKZX.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-OPEQNW7Y.js} +873 -17
- package/dist/chunks/{plan-BLGPZF5M.js → plan-TJAS4N5X.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-CYBGU6K6.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-3FT2F66K.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-WPGB5BDJ.js} +654 -336
- package/dist/chunks/{registry-3FYSWV3U.js → registry-BAWCWV4D.js} +3 -3
- package/dist/chunks/{registry-I4DVPDMU.js → registry-FNI5E76J.js} +12 -12
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-QRMXRSCT.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-I7QQRHEL.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-3P7EWGNZ.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-FOBSVNYW.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-U2KKTVQY.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +203 -44
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/error-actions.js +112 -0
- package/dist/shortcuts/contract/errors.js +9 -1
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +130 -274
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
- package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
- package/dist/shortcuts/contract/operations/elements-build.js +82 -56
- package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +123 -27
- package/dist/shortcuts/contract/operations/ledger.js +343 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/money.js +90 -0
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +326 -0
- package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +281 -0
- package/dist/shortcuts/contract/operations/quote.js +66 -12
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
- package/dist/shortcuts/contract/operations/triage.js +68 -15
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/data/operations/shared.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +138 -15
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/performance/flow-utils.js +363 -0
- package/dist/shortcuts/performance/manifest.js +2 -2
- package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
- package/dist/shortcuts/performance/operations/flow-list.js +213 -0
- package/dist/shortcuts/performance/operations/flow-score.js +241 -0
- package/dist/shortcuts/performance/operations/registry.js +6 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +55 -2
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +283 -345
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +126 -202
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +13 -5
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +47 -16
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +19 -18
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +78 -112
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +67 -333
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +18 -15
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +80 -84
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +38 -34
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +132 -47
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +108 -217
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +14 -20
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +13 -7
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +86 -46
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +22 -14
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +27 -26
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +252 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +15 -23
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +290 -104
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +5 -12
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +12 -18
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +33 -35
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +87 -534
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +9 -7
- package/skills/weaver-e10-meeting/references/create-guardrails.md +23 -17
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-performance/SKILL.md +45 -5
- package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
- package/skills/weaver-e10-performance/references/flow-api.md +128 -0
- package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -14
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
3
4
|
import { createServer } from 'node:http';
|
|
5
|
+
import { isConnectorMode } from '../../../core/connector.js';
|
|
4
6
|
import { CliError, ExitCode } from '../../../core/errors.js';
|
|
5
7
|
import { clearInvoiceTokenForSession } from '../../../shortcuts/invoice/host.js';
|
|
6
8
|
import { buildE10CookieHeader, E10AuthSession, clearProfileAuthFile, extractRawSetCookie, extractSessionTicket, findAuthFile, getActiveProfile, getProfileAuthPath, getProfileDir, listProfiles, profileNameFromUrl, readProfileConfig, readTeamsCheckUserInfo, resolveActiveProfileForHost, saveAuthFile, saveProfileConfig, setActiveProfile, switchActiveProfile, } from './session.js';
|
|
@@ -160,7 +162,19 @@ function validateAgentReturnUrl(value) {
|
|
|
160
162
|
}
|
|
161
163
|
return value;
|
|
162
164
|
}
|
|
163
|
-
|
|
165
|
+
/**
|
|
166
|
+
* 是否处于「机器模式」认证:连接器/宿主代跑,或 stdout 不是终端。
|
|
167
|
+
*
|
|
168
|
+
* 机器模式下没有人在浏览器前点「是否打开 XX?」弹层,若仍走桌面回跳,CLI 会一直
|
|
169
|
+
* 阻塞到 `AGENT_RETURN_TIMEOUT_MS`(15 分钟),而按「进程退出 + stdout」判定授权
|
|
170
|
+
* 结果的宿主只会看到超时失败——凭证其实早在回调那一刻就落盘了。
|
|
171
|
+
*/
|
|
172
|
+
export function isMachineAuthMode(stdout = process.stdout, connectorMode = isConnectorMode()) {
|
|
173
|
+
if (connectorMode)
|
|
174
|
+
return true;
|
|
175
|
+
return stdout.isTTY !== true;
|
|
176
|
+
}
|
|
177
|
+
export function resolveAgentReturnTarget(options = {}, env = process.env, agentType = resolveAgentType(options, env), mode = {}) {
|
|
164
178
|
const builtInTarget = builtInAgentReturnTarget(agentType);
|
|
165
179
|
const explicitUrl = optionString(options, 'agentReturnUrl') || envString(env, AGENT_RETURN_URL_ENV_KEY);
|
|
166
180
|
if (explicitUrl) {
|
|
@@ -169,6 +183,9 @@ export function resolveAgentReturnTarget(options = {}, env = process.env, agentT
|
|
|
169
183
|
url: validateAgentReturnUrl(explicitUrl),
|
|
170
184
|
};
|
|
171
185
|
}
|
|
186
|
+
// 机器模式只认显式指定的返回地址;内置映射与 `<agent_type>://` 猜测都会挂住进程。
|
|
187
|
+
if (mode.machine)
|
|
188
|
+
return null;
|
|
172
189
|
if (builtInTarget)
|
|
173
190
|
return builtInTarget;
|
|
174
191
|
const conventionalUrl = conventionalAgentReturnUrl(agentType);
|
|
@@ -300,19 +317,101 @@ export function renderE10LoginSuccessPage(userId, returnTarget = null, launchTok
|
|
|
300
317
|
: '';
|
|
301
318
|
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>weaver-work-cli 登录成功</title><style>:root{color-scheme:light}*{box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;background:radial-gradient(circle at 50% 18%,#eefbf8 0,#f6f7f9 42%,#eef1f5 100%);color:#20242a;display:grid;place-items:center;min-height:100vh;margin:0}.card{background:rgba(255,255,255,.88);border:1px solid #e6e8ec;border-radius:18px;padding:34px 38px;box-shadow:0 18px 55px rgba(18,24,40,.09);width:min(560px,calc(100vw - 40px));text-align:center}.title{font-size:24px;font-weight:700;margin-bottom:10px}.desc{color:#667085;font-size:15px;line-height:24px}.user{color:#98a2b3;font-size:12px;margin-top:18px}.overlay{position:fixed;inset:0;z-index:10;display:grid;place-items:center;padding:20px;background:rgba(28,34,41,.36);backdrop-filter:blur(5px)}.overlay[hidden]{display:none}.prompt{width:min(410px,calc(100vw - 32px));padding:32px 28px 26px;border:1px solid rgba(255,255,255,.75);border-radius:24px;background:rgba(250,250,251,.97);box-shadow:0 24px 70px rgba(15,23,42,.28);text-align:center}.app-icon{width:74px;height:74px;margin:0 auto 24px;filter:drop-shadow(0 8px 14px rgba(8,170,130,.22))}.app-icon svg{display:block;width:100%;height:100%}.prompt h1{margin:0;font-size:20px;line-height:30px;font-weight:700;letter-spacing:-.2px}.prompt p{margin:10px 0 24px;color:#667085;font-size:14px;line-height:22px}.prompt button{display:block;width:100%;min-height:40px;border:0;border-radius:12px;font:600 16px/22px inherit;cursor:pointer;transition:transform .12s ease,filter .12s ease}.prompt button+button{margin-top:10px}.prompt button:hover{filter:brightness(.98)}.prompt button:active{transform:scale(.99)}.prompt button:disabled{cursor:wait;opacity:.62}.primary{background:linear-gradient(180deg,#2f91ff,#0b74e5);color:#fff;box-shadow:0 8px 18px rgba(11,116,229,.2)}.secondary{background:#e9eaec;color:#22252a}.status{min-height:18px;margin-top:14px;color:#667085;font-size:12px;line-height:18px}</style></head><body><main class="card"><div class="title">登录授权成功</div><div class="desc">你可以关闭此页面,返回智能体或终端继续使用。</div><div class="user">${esc(userId)}</div></main>${returnAction}${returnScript}</body></html>`;
|
|
302
319
|
}
|
|
303
|
-
|
|
320
|
+
function defaultFileExists(file) {
|
|
321
|
+
try {
|
|
322
|
+
return existsSync(file);
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function firstExisting(candidates, exists) {
|
|
329
|
+
return candidates.find((candidate) => exists(candidate)) ?? null;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* 解析 Windows 上 `rundll32.exe` 的绝对路径。
|
|
333
|
+
*
|
|
334
|
+
* 必须用绝对路径:`execFile` 只走 PATH 解析(不经过 CreateProcess 的系统目录搜索),
|
|
335
|
+
* 而连接器/沙箱宿主的 PATH 常被整体重建、不含 `%SystemRoot%\System32`,
|
|
336
|
+
* 裸命令名会直接 `spawn rundll32.exe ENOENT`,表现为授权页「打开应用」返回 500。
|
|
337
|
+
* 系统盘不一定是 C,所以用 `SystemRoot`/`windir` 拼,不硬编码 `C:\Windows`。
|
|
338
|
+
*/
|
|
339
|
+
export function resolveWindowsRundll32Path(env = process.env, exists = defaultFileExists) {
|
|
340
|
+
const systemRoot = (env.SystemRoot || env.windir || env.WINDIR || 'C:\\Windows')
|
|
341
|
+
.replace(/[\\/]+$/, '');
|
|
342
|
+
return firstExisting([
|
|
343
|
+
// 常规路径;32 位进程下会被 WOW64 重定向到 SysWOW64,同样可正常 ShellExecute。
|
|
344
|
+
`${systemRoot}\\System32\\rundll32.exe`,
|
|
345
|
+
// 仅 32 位进程可见的虚拟目录,作为兜底;64 位进程探测会返回 false。
|
|
346
|
+
`${systemRoot}\\Sysnative\\rundll32.exe`,
|
|
347
|
+
], exists) ?? 'rundll32.exe';
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* 关闭本地回调服务,并保证 `onClosed` 一定被调用。
|
|
351
|
+
*
|
|
352
|
+
* 浏览器/HTTP 客户端会保持 keep-alive 连接,`server.close()` 的回调要等这些连接
|
|
353
|
+
* 自然断开才触发,Promise 就一直不 resolve、`{"status":"authorized"}` 也就永远不
|
|
354
|
+
* 输出——宿主(如豆包)以「进程退出」判定授权成功时,会误报鉴权失败。
|
|
355
|
+
* 这里先关空闲连接,再在 `graceMs` 后强制关闭残留连接并兜底回调。
|
|
356
|
+
*/
|
|
357
|
+
export function closeHttpServer(server, onClosed, graceMs = 500) {
|
|
358
|
+
let closed = false;
|
|
359
|
+
let timer = null;
|
|
360
|
+
const done = () => {
|
|
361
|
+
if (closed)
|
|
362
|
+
return;
|
|
363
|
+
closed = true;
|
|
364
|
+
if (timer)
|
|
365
|
+
clearTimeout(timer);
|
|
366
|
+
onClosed();
|
|
367
|
+
};
|
|
368
|
+
try {
|
|
369
|
+
server.close(done);
|
|
370
|
+
server.closeIdleConnections?.();
|
|
371
|
+
timer = setTimeout(() => {
|
|
372
|
+
try {
|
|
373
|
+
server.closeAllConnections?.();
|
|
374
|
+
}
|
|
375
|
+
catch {
|
|
376
|
+
/* ignore: 连接已关闭 */
|
|
377
|
+
}
|
|
378
|
+
done();
|
|
379
|
+
}, graceMs);
|
|
380
|
+
timer.unref?.();
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
done();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* 解析「用系统默认处理器打开 URL」的命令。
|
|
388
|
+
*
|
|
389
|
+
* 三个平台都用绝对路径优先、裸命令名兜底:宿主清空 PATH 时裸名会 ENOENT,
|
|
390
|
+
* 但正常桌面环境里绝对路径也一定存在,因此回退不会改变既有行为。
|
|
391
|
+
*/
|
|
392
|
+
export function resolveBrowserOpenCommand(url, platform = process.platform, options = {}) {
|
|
393
|
+
const exists = options.exists ?? defaultFileExists;
|
|
394
|
+
const env = options.env ?? process.env;
|
|
304
395
|
if (platform === 'win32') {
|
|
305
|
-
return { file:
|
|
396
|
+
return { file: resolveWindowsRundll32Path(env, exists), args: ['url.dll,FileProtocolHandler', url] };
|
|
397
|
+
}
|
|
398
|
+
if (platform === 'darwin') {
|
|
399
|
+
return { file: firstExisting(['/usr/bin/open'], exists) ?? 'open', args: [url] };
|
|
306
400
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
401
|
+
return { file: firstExisting(['/usr/bin/xdg-open', '/bin/xdg-open'], exists) ?? 'xdg-open', args: [url] };
|
|
402
|
+
}
|
|
403
|
+
function describeOpenFailure(error) {
|
|
404
|
+
if (error instanceof Error) {
|
|
405
|
+
const code = error.code;
|
|
406
|
+
return code ? `${code}: ${error.message}` : error.message;
|
|
407
|
+
}
|
|
408
|
+
return String(error);
|
|
310
409
|
}
|
|
311
410
|
function openUrlInBrowser(url, ctx) {
|
|
312
411
|
const command = resolveBrowserOpenCommand(url);
|
|
313
412
|
execFile(command.file, command.args, (error) => {
|
|
314
413
|
if (error) {
|
|
315
|
-
ctx.logger.warn(
|
|
414
|
+
ctx.logger.warn(`Could not open browser automatically (${command.file}: ${describeOpenFailure(error)}). Copy the login URL manually.`);
|
|
316
415
|
}
|
|
317
416
|
});
|
|
318
417
|
}
|
|
@@ -353,7 +452,25 @@ export function resolvePromotionKeyword(agentType) {
|
|
|
353
452
|
const matched = PROMOTION_KEYWORD_RULES.find(({ aliases }) => aliases.some((alias) => normalized.startsWith(alias)));
|
|
354
453
|
return matched ? matched.keyword : '';
|
|
355
454
|
}
|
|
356
|
-
|
|
455
|
+
/**
|
|
456
|
+
* 推广来源标识(`promotionSource`):E10「推广来源」字典里的泛微标识。
|
|
457
|
+
*
|
|
458
|
+
* 字典由 E10 侧维护(千问-et 连接器 188、豆包-et 连接器 187、workbuddy-et 连接器 186),
|
|
459
|
+
* 这里按 `promotionKeyword` 反查。字典里没有对应行的(如小 e、Codex)不下发,
|
|
460
|
+
* 由 E10 按未标注来源处理,不要臆造编号。
|
|
461
|
+
*/
|
|
462
|
+
const PROMOTION_SOURCES = {
|
|
463
|
+
qianwen: '188',
|
|
464
|
+
doubao: '187',
|
|
465
|
+
workbuddy: '186',
|
|
466
|
+
};
|
|
467
|
+
/** 由推广关键字反查 `promotionSource`;字典里没有时返回空串(调用方不下发该参数)。 */
|
|
468
|
+
export function resolvePromotionSource(promotionKeyword) {
|
|
469
|
+
if (!promotionKeyword)
|
|
470
|
+
return '';
|
|
471
|
+
return PROMOTION_SOURCES[promotionKeyword] || '';
|
|
472
|
+
}
|
|
473
|
+
export function buildE10AuthorizeUrl(baseUrl, redirectUri, agentType, promotionKeyword = resolvePromotionKeyword(agentType), promotionSource = resolvePromotionSource(promotionKeyword)) {
|
|
357
474
|
const authorizeParams = new URLSearchParams({
|
|
358
475
|
redirect_uri: redirectUri,
|
|
359
476
|
response_type: 'code',
|
|
@@ -363,6 +480,8 @@ export function buildE10AuthorizeUrl(baseUrl, redirectUri, agentType, promotionK
|
|
|
363
480
|
});
|
|
364
481
|
if (promotionKeyword)
|
|
365
482
|
authorizeParams.set('promotionKeyword', promotionKeyword);
|
|
483
|
+
if (promotionSource)
|
|
484
|
+
authorizeParams.set('promotionSource', promotionSource);
|
|
366
485
|
return `${baseUrl}/papi/sso/oauth2.0/authorize?${authorizeParams.toString()}`;
|
|
367
486
|
}
|
|
368
487
|
/** Node's HTTP parser exposes the first unread bytes when TLS is sent to an HTTP listener. */
|
|
@@ -481,9 +600,15 @@ async function oidcExchange(code, redirectUri, baseUrl, tenantKeyFallback, agent
|
|
|
481
600
|
redirect: 'manual',
|
|
482
601
|
});
|
|
483
602
|
const tokenData = await readJsonObject(tokenResp);
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
603
|
+
// E10 的业务失败是 HTTP 200 + `{"status":400,"code":"1010"}`,只看 HTTP 状态码会把
|
|
604
|
+
// 失败当成功继续往下走,最终以「无法解析 ETEAMSID」这种误导性错误收场。
|
|
605
|
+
const businessStatus = Number(tokenData.status);
|
|
606
|
+
const businessFailed = Number.isFinite(businessStatus) && businessStatus >= 400;
|
|
607
|
+
if (tokenResp.status >= 400 || businessFailed) {
|
|
608
|
+
const message = readString(tokenData, 'message', 'msg', 'error_description', 'error')
|
|
609
|
+
|| `OAuth token exchange failed: ${businessFailed ? businessStatus : tokenResp.status}`;
|
|
610
|
+
const code = readString(tokenData, 'code');
|
|
611
|
+
throw new CliError(code ? `${message} (code ${code})` : message, ExitCode.AuthError);
|
|
487
612
|
}
|
|
488
613
|
let eteamsId = readString(tokenData, 'eteamsId', 'eteamsid');
|
|
489
614
|
let userId = readString(tokenData, 'id', 'userId', 'employeeId');
|
|
@@ -657,7 +782,7 @@ async function runXiaoELogin(ctx, options) {
|
|
|
657
782
|
}).catch((logError) => ctx.logger.debug(`Could not persist XiaoE auth error log: ${logError instanceof Error ? logError.message : String(logError)}`));
|
|
658
783
|
throw error;
|
|
659
784
|
}
|
|
660
|
-
async function runBrowserLogin(ctx, options) {
|
|
785
|
+
async function runBrowserLogin(ctx, options, loginMode = {}) {
|
|
661
786
|
const commandOpts = asOptions(options);
|
|
662
787
|
const globalOptions = ctx.getGlobalOptions();
|
|
663
788
|
const profileFromGlobal = globalOptions.profile;
|
|
@@ -672,40 +797,54 @@ async function runBrowserLogin(ctx, options) {
|
|
|
672
797
|
const hostKey = target.hostKey;
|
|
673
798
|
const baseUrl = normalizeUrl(explicitBaseUrl || target.cfg.baseUrl || resolveDefaultE10BaseUrl(ctx.env));
|
|
674
799
|
const tenantKey = optionString(commandOpts, 'tenantKey');
|
|
675
|
-
const
|
|
676
|
-
const
|
|
677
|
-
|
|
800
|
+
const explicitPort = optionString(commandOpts, 'port');
|
|
801
|
+
const portText = explicitPort || '19800';
|
|
802
|
+
let port = Number(portText);
|
|
803
|
+
if (!/^\d+$/u.test(portText) || !Number.isInteger(port) || port < 0 || port > 65535) {
|
|
678
804
|
throw new CliError('Invalid --port value', ExitCode.UsageError);
|
|
679
805
|
}
|
|
680
|
-
|
|
806
|
+
// `auth init` 必须在回调后完成平台契约,显式返回地址也不能拖住其 stdout 和退出。
|
|
807
|
+
const machineMode = loginMode.machine === true || isMachineAuthMode();
|
|
808
|
+
const agentReturnTarget = loginMode.machine === true ? null
|
|
809
|
+
: resolveAgentReturnTarget(commandOpts, ctx.env, agentType, { machine: machineMode });
|
|
681
810
|
const agentReturnToken = agentReturnTarget ? randomBytes(24).toString('base64url') : '';
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
811
|
+
const successHeaders = {
|
|
812
|
+
'cache-control': 'no-store',
|
|
813
|
+
'content-security-policy': agentReturnTarget
|
|
814
|
+
? `default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-${agentReturnToken}'; connect-src 'self'`
|
|
815
|
+
: `default-src 'none'; style-src 'unsafe-inline'`,
|
|
816
|
+
'content-type': 'text/html; charset=utf-8',
|
|
817
|
+
'referrer-policy': 'no-referrer',
|
|
818
|
+
'x-content-type-options': 'nosniff',
|
|
819
|
+
'x-frame-options': 'DENY',
|
|
820
|
+
};
|
|
821
|
+
let redirectUri = '';
|
|
822
|
+
if (machineMode && !agentReturnTarget) {
|
|
823
|
+
// 连接器/非交互宿主:回调成功即收口,不等弹层,避免宿主按「进程退出」判定时超时失败。
|
|
824
|
+
ctx.logger.info('Machine mode: closing the callback server right after authorization.');
|
|
825
|
+
}
|
|
685
826
|
ctx.logger.info('Waiting for E10 authorization callback...');
|
|
686
827
|
return await new Promise((resolve, reject) => {
|
|
687
828
|
let settled = false;
|
|
688
829
|
let timer = null;
|
|
689
830
|
let pendingLoginResult = null;
|
|
690
831
|
let tlsCallbackDetected = false;
|
|
832
|
+
let exchanging = false;
|
|
833
|
+
let retriedPort = false;
|
|
691
834
|
const finish = (error, result) => {
|
|
692
835
|
if (settled)
|
|
693
836
|
return;
|
|
694
837
|
settled = true;
|
|
695
838
|
if (timer)
|
|
696
839
|
clearTimeout(timer);
|
|
697
|
-
|
|
840
|
+
// keep-alive 连接会拖住 server.close() 的回调,必须强制释放,
|
|
841
|
+
// 否则依赖「进程退出」判定授权结果的宿主会一直等不到 stdout。
|
|
842
|
+
closeHttpServer(server, () => {
|
|
698
843
|
if (error)
|
|
699
844
|
reject(error);
|
|
700
845
|
else
|
|
701
846
|
resolve(result);
|
|
702
|
-
};
|
|
703
|
-
try {
|
|
704
|
-
server.close(complete);
|
|
705
|
-
}
|
|
706
|
-
catch {
|
|
707
|
-
complete();
|
|
708
|
-
}
|
|
847
|
+
});
|
|
709
848
|
};
|
|
710
849
|
const server = createServer(async (req, res) => {
|
|
711
850
|
const callbackUrl = new URL(req.url || '/', `http://127.0.0.1:${port}`);
|
|
@@ -739,8 +878,10 @@ async function runBrowserLogin(ctx, options) {
|
|
|
739
878
|
res.end('{"ok":true}');
|
|
740
879
|
finish(null, result);
|
|
741
880
|
}
|
|
742
|
-
catch {
|
|
743
|
-
|
|
881
|
+
catch (openError) {
|
|
882
|
+
// 把真实的 spawn 失败原因(如 ENOENT)打到日志,否则只剩「请确认应用已安装」,
|
|
883
|
+
// 排查时无法区分「没装应用」和「找不到 rundll32 / PATH 被清空」。
|
|
884
|
+
ctx.logger.warn(`Could not open ${agentReturnTarget.label} automatically (${describeOpenFailure(openError)}).`);
|
|
744
885
|
res.writeHead(500, { 'cache-control': 'no-store', 'content-type': 'text/plain; charset=utf-8' });
|
|
745
886
|
res.end(`无法打开 ${agentReturnTarget.label},请确认应用已安装。`);
|
|
746
887
|
}
|
|
@@ -751,6 +892,17 @@ async function runBrowserLogin(ctx, options) {
|
|
|
751
892
|
res.end('Not found');
|
|
752
893
|
return;
|
|
753
894
|
}
|
|
895
|
+
// 授权码只能换票一次,刷新或并发回调不能重放换票并把已成功的登录变成失败。
|
|
896
|
+
if (pendingLoginResult) {
|
|
897
|
+
res.writeHead(200, successHeaders);
|
|
898
|
+
res.end(renderE10LoginSuccessPage(pendingLoginResult.userId, agentReturnTarget, agentReturnToken));
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
if (exchanging || settled) {
|
|
902
|
+
res.writeHead(409, { 'cache-control': 'no-store', 'content-type': 'text/plain; charset=utf-8' });
|
|
903
|
+
res.end('Authorization callback already received.');
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
754
906
|
const error = callbackUrl.searchParams.get('error');
|
|
755
907
|
const code = callbackUrl.searchParams.get('code');
|
|
756
908
|
const redirectAgentType = explicitAgentType
|
|
@@ -779,24 +931,15 @@ async function runBrowserLogin(ctx, options) {
|
|
|
779
931
|
timer = null;
|
|
780
932
|
}
|
|
781
933
|
try {
|
|
934
|
+
exchanging = true;
|
|
782
935
|
const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal, hostKey);
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
'content-security-policy': agentReturnTarget
|
|
786
|
-
? `default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-${agentReturnToken}'; connect-src 'self'`
|
|
787
|
-
: `default-src 'none'; style-src 'unsafe-inline'`,
|
|
788
|
-
'content-type': 'text/html; charset=utf-8',
|
|
789
|
-
'referrer-policy': 'no-referrer',
|
|
790
|
-
'x-content-type-options': 'nosniff',
|
|
791
|
-
'x-frame-options': 'DENY',
|
|
792
|
-
};
|
|
793
|
-
res.writeHead(200, responseHeaders);
|
|
936
|
+
pendingLoginResult = result;
|
|
937
|
+
res.writeHead(200, successHeaders);
|
|
794
938
|
res.end(renderE10LoginSuccessPage(result.userId, agentReturnTarget, agentReturnToken));
|
|
795
939
|
if (!agentReturnTarget) {
|
|
796
940
|
finish(null, result);
|
|
797
941
|
return;
|
|
798
942
|
}
|
|
799
|
-
pendingLoginResult = result;
|
|
800
943
|
if (timer)
|
|
801
944
|
clearTimeout(timer);
|
|
802
945
|
timer = setTimeout(() => finish(null, result), AGENT_RETURN_TIMEOUT_MS);
|
|
@@ -809,6 +952,12 @@ async function runBrowserLogin(ctx, options) {
|
|
|
809
952
|
}
|
|
810
953
|
});
|
|
811
954
|
server.on('error', (error) => {
|
|
955
|
+
if (error.code === 'EADDRINUSE' && !explicitPort && !retriedPort) {
|
|
956
|
+
retriedPort = true;
|
|
957
|
+
ctx.logger.warn(`Port ${port} is already in use. Using an available callback port.`);
|
|
958
|
+
server.listen(0, '127.0.0.1');
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
812
961
|
const message = error.code === 'EADDRINUSE'
|
|
813
962
|
? `Port ${port} is already in use. Retry with --port ${port + 1}.`
|
|
814
963
|
: error.code === 'EACCES'
|
|
@@ -836,10 +985,20 @@ async function runBrowserLogin(ctx, options) {
|
|
|
836
985
|
}
|
|
837
986
|
socket.destroy();
|
|
838
987
|
});
|
|
839
|
-
server.
|
|
988
|
+
server.once('listening', () => {
|
|
989
|
+
const address = server.address();
|
|
990
|
+
if (!address || typeof address === 'string') {
|
|
991
|
+
finish(new CliError('Could not resolve local OAuth callback port.', ExitCode.UsageError));
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
port = address.port;
|
|
995
|
+
redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
996
|
+
const loginUrl = buildE10AuthorizeUrl(baseUrl, redirectUri, agentType);
|
|
997
|
+
ctx.logger.info('Open browser login: ' + loginUrl);
|
|
840
998
|
ctx.logger.info('Local callback server: ' + redirectUri);
|
|
841
999
|
openUrlInBrowser(loginUrl, ctx);
|
|
842
1000
|
});
|
|
1001
|
+
server.listen(port, '127.0.0.1');
|
|
843
1002
|
timer = setTimeout(() => {
|
|
844
1003
|
finish(new CliError('Login timed out after 5 minutes.', ExitCode.AuthError));
|
|
845
1004
|
}, 300_000);
|
|
@@ -987,7 +1146,7 @@ function registerBrowserLoginCommand(auth, action, name, description, machine =
|
|
|
987
1146
|
.description(description)
|
|
988
1147
|
.option('--base-url <url>', 'E10 base URL (defaults to https://weapp.eteams.cn)')
|
|
989
1148
|
.option('--tenant-key <key>', 'Tenant key fallback after login')
|
|
990
|
-
.option('--port <n>', 'Local OAuth callback port
|
|
1149
|
+
.option('--port <n>', 'Local OAuth callback port (default: 19800 with automatic fallback; 0 selects an available port)')
|
|
991
1150
|
.option('--agent_type <value>', 'Agent type sent to E10 authorize endpoint')
|
|
992
1151
|
.option('--agent-type <value>', 'Alias of --agent_type')
|
|
993
1152
|
.option('--agent-return-url <url>', 'Desktop application URL linked by the login success page');
|
|
@@ -1000,7 +1159,7 @@ function registerBrowserLoginCommand(auth, action, name, description, machine =
|
|
|
1000
1159
|
// 平台型连接器契约:stdout 只出严格 JSON,进度与授权链接走 stderr。
|
|
1001
1160
|
ctx.logger.machineMode = true;
|
|
1002
1161
|
try {
|
|
1003
|
-
const result = await runBrowserLogin(ctx, options);
|
|
1162
|
+
const result = await runBrowserLogin(ctx, options, { machine: true });
|
|
1004
1163
|
ctx.output.raw(JSON.stringify({
|
|
1005
1164
|
status: 'authorized',
|
|
1006
1165
|
employeeId: result.userId || '',
|
|
@@ -79,12 +79,16 @@ const XIAOE_SCRIPT_DIAGNOSTIC_MAX_LENGTH = 2_000;
|
|
|
79
79
|
* - `0000` / `200` 成功,`data.eteamId` 是 E10 一次性票据;
|
|
80
80
|
* - `3006` Authorization 缺失或被拒(`token无效,禁止登录!`)→ 登录态失效;
|
|
81
81
|
* - `2001` `未找到可用的e10系统`——domain 在该小E 账号下匹配不到已绑定的 E10
|
|
82
|
-
*
|
|
82
|
+
* 系统。匹配是**严格字符串**:必须 `https://` + 主机名,**带端口也会失配**
|
|
83
|
+
* (实测 `https://www.e-cology.com.cn:443` 就是 2001,去掉端口才 0000),
|
|
84
|
+
* 带路径同样失配;主机名大小写不影响;
|
|
85
|
+
* - `3005` 同一个 小E 账号在别处登录(旧会话被顶掉);
|
|
83
86
|
* - `4000` domain 命中 eteams 但该账号没建过通用型应用。
|
|
84
87
|
* 只打裸业务码没法区分这几种,恢复日志会全部归到「凭证不可用」。
|
|
85
88
|
*/
|
|
86
89
|
const XIAOE_EXCHANGE_CODE_HINTS = {
|
|
87
|
-
'2001': 'The XiaoE account is not bound to an E10 system on this domain; check the E10 baseUrl and the XiaoE-side binding.',
|
|
90
|
+
'2001': 'The XiaoE account is not bound to an E10 system on this domain; check the E10 baseUrl and the XiaoE-side binding. The domain must be a bare https:// host: a port or a path never matches.',
|
|
91
|
+
'3005': 'The same XiaoE account signed in elsewhere; sign in to the XiaoE client again.',
|
|
88
92
|
'3006': 'The XiaoE session token was rejected; sign in to the XiaoE client again.',
|
|
89
93
|
'4000': 'No generic app has been created for this domain on the eteams side.',
|
|
90
94
|
};
|
|
@@ -184,6 +184,23 @@ function responseText(response) {
|
|
|
184
184
|
}
|
|
185
185
|
return '';
|
|
186
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* 业务侧的「无权限」文案。E10 某些接口(如 /api/bs/hr/**、/api/bs/hrm/**)在**用户权限不足**时
|
|
189
|
+
* 也返回 `code: 401` + `message: 没有权限`,与「登录态失效」同码。
|
|
190
|
+
*
|
|
191
|
+
* 2026-11-18 实测:`ehr.hr.report.dept.table` 被这两条混同后,CLI 会先尝试一次 XiaoE 会话恢复
|
|
192
|
+
* (约 1.1 s)再重发同一个请求,命中同样的 401,最终才报错——一次权限不足 = 两次请求 + 1.1 s 白等。
|
|
193
|
+
* 因此带这些文案的 401 一律按**业务错误**处理,不触发认证恢复。
|
|
194
|
+
*/
|
|
195
|
+
const PERMISSION_DENIED_MARKERS = [
|
|
196
|
+
'没有权限',
|
|
197
|
+
'无权限',
|
|
198
|
+
'权限不足',
|
|
199
|
+
'无操作权限',
|
|
200
|
+
'permission denied',
|
|
201
|
+
'forbidden',
|
|
202
|
+
'access denied',
|
|
203
|
+
];
|
|
187
204
|
/**
|
|
188
205
|
* Detect only explicit authentication rejection signals. A bare HTTP 403 is
|
|
189
206
|
* deliberately excluded because E10 also uses it for ordinary permission
|
|
@@ -192,11 +209,20 @@ function responseText(response) {
|
|
|
192
209
|
* 3xx 只在「跳到登录页」或「无法判定」时才算认证失败:下载接口把文件交接给
|
|
193
210
|
* 文件服务时同样返回 302,那不是登录失效,重新登录既无用也会白白换一次票据。
|
|
194
211
|
*/
|
|
195
|
-
export function isE10AuthenticationRequired(response) {
|
|
212
|
+
export function isE10AuthenticationRequired(response, options = {}) {
|
|
196
213
|
if (isE10SessionExpiredResponse(response))
|
|
197
214
|
return true;
|
|
198
|
-
if (responseCodes(response.value).some((code) => AUTH_REQUIRED_CODES.has(code)))
|
|
215
|
+
if (responseCodes(response.value).some((code) => AUTH_REQUIRED_CODES.has(code))) {
|
|
216
|
+
// 文案明确是「权限不足」→ 业务错误,不做会话恢复(见 PERMISSION_DENIED_MARKERS 注释)。
|
|
217
|
+
// 该判定只在调用方显式声明 scope(当前为 /api/recruit/*)时启用:其他模块保持历史行为,
|
|
218
|
+
// 由调用方决定是否收窄,避免全局改变非目标模块的失败路径。
|
|
219
|
+
if (options.permissionDeniedAsBusiness) {
|
|
220
|
+
const text = responseText(response).toLowerCase();
|
|
221
|
+
if (PERMISSION_DENIED_MARKERS.some((marker) => text.includes(marker.toLowerCase())))
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
199
224
|
return true;
|
|
225
|
+
}
|
|
200
226
|
const text = responseText(response).toLowerCase();
|
|
201
227
|
if (!text)
|
|
202
228
|
return false;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CliError, ExitCode } from '../../core/errors.js';
|
|
2
2
|
import { classifyE10Redirect, isE10AuthenticationRequired, recoverXiaoEAuthSession, sameE10SessionIdentity, } from './auth-recovery.js';
|
|
3
3
|
import { startFetchTiming } from './fetch-timing.js';
|
|
4
|
+
import { startRequestTrace } from './request-trace.js';
|
|
4
5
|
import { readErrorCauseCode } from './network-error.js';
|
|
5
6
|
import { E10_XIAOE_RECOVERY_FAILED_MESSAGE } from './auth/messages.js';
|
|
6
7
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
@@ -77,7 +78,11 @@ export class E10RequestRuntime {
|
|
|
77
78
|
if (!mutable.streamBody
|
|
78
79
|
// 已交接给文件服务的响应不是 E10 的接口回答,登录态不该由它判定。
|
|
79
80
|
&& !attempt.fromFileRedirect
|
|
80
|
-
&& isE10AuthenticationRequired(authenticationProbe(mutable, attempt.parsed)
|
|
81
|
+
&& isE10AuthenticationRequired(authenticationProbe(mutable, attempt.parsed), {
|
|
82
|
+
// 🔴 范围收窄(2026-11-18 用户口径):只有招聘接口才把「没有权限」当业务错误;
|
|
83
|
+
// 其他模块(出勤/薪酬/人事基础等)保持历史行为,不因本优化改变失败路径。
|
|
84
|
+
permissionDeniedAsBusiness: mutable.path.startsWith('/api/recruit/'),
|
|
85
|
+
})
|
|
81
86
|
&& await this.recoverExpiredSession(requestEteamsId)) {
|
|
82
87
|
// Authentication rejection is a definitive pre-business failure. Retry
|
|
83
88
|
// exactly once with the new session; never retry transport/partial errors.
|
|
@@ -95,7 +100,11 @@ export class E10RequestRuntime {
|
|
|
95
100
|
const url = withQuery(this.session.getBaseUrl(), request.path, request.query);
|
|
96
101
|
const headers = this.composeHeaders(request, trustedHeaders);
|
|
97
102
|
const init = this.buildFetchInit(request, headers);
|
|
98
|
-
const
|
|
103
|
+
const traceDone = startRequestTrace(request);
|
|
104
|
+
const response = await this.fetchWithTimeout(url, init, request.timeoutMs).catch((error) => {
|
|
105
|
+
traceDone?.({ ok: false, note: 'fetch-error' });
|
|
106
|
+
throw error;
|
|
107
|
+
});
|
|
99
108
|
// 二进制下载:E10 常以 302 把文件交接给文件服务/对象存储。这里直接跟过去
|
|
100
109
|
// 取字节,既不会把「文件流」当成登录失效,也不会触发无谓的重新登录。
|
|
101
110
|
const followed = request.responseType === 'binary'
|
|
@@ -111,7 +120,10 @@ export class E10RequestRuntime {
|
|
|
111
120
|
});
|
|
112
121
|
}
|
|
113
122
|
return {
|
|
114
|
-
parsed: await this.readResponse(followed.response, request.responseType, request.bigIntStrings, request.maxResponseBytes, request.timeoutMs)
|
|
123
|
+
parsed: await this.readResponse(followed.response, request.responseType, request.bigIntStrings, request.maxResponseBytes, request.timeoutMs).then((parsed) => {
|
|
124
|
+
traceDone?.({ ok: followed.response.ok, status: followed.response.status });
|
|
125
|
+
return parsed;
|
|
126
|
+
}),
|
|
115
127
|
fromFileRedirect: followed.followed,
|
|
116
128
|
};
|
|
117
129
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 请求级耗时追踪(`E10_TRACE_REQ=1` 开启)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么放在 `E10RequestRuntime`:所有 shortcut(ehr / recruit-stage / workflow …)都从这里发请求,
|
|
5
|
+
* 一处埋点即可覆盖全部能力,不需要每个 operation 各写一遍 `mark()`。
|
|
6
|
+
*
|
|
7
|
+
* 输出规范:
|
|
8
|
+
* - 每条请求一行 `[req N] GET /api/xxx 123ms`,写 **stderr**,不影响 `--json` 的 stdout 纯净度;
|
|
9
|
+
* - 进程退出时补一行 `[req-summary] count=.. total=..`,并按 path 聚合给出热点。
|
|
10
|
+
*
|
|
11
|
+
* 未开启时 `startRequestTrace()` 返回 `null`,调用方走 `?.()` 短路,非追踪路径零额外开销。
|
|
12
|
+
*/
|
|
13
|
+
const items = [];
|
|
14
|
+
let exitHookRegistered = false;
|
|
15
|
+
let seqCounter = 0;
|
|
16
|
+
/** 进程内起点:用来观察「第一个请求发出前,CLI 自己花了多少时间」 */
|
|
17
|
+
const startedAtBase = Date.now();
|
|
18
|
+
function enabled() {
|
|
19
|
+
return process.env.E10_TRACE_REQ === '1';
|
|
20
|
+
}
|
|
21
|
+
function ensureExitHook() {
|
|
22
|
+
if (exitHookRegistered)
|
|
23
|
+
return;
|
|
24
|
+
exitHookRegistered = true;
|
|
25
|
+
process.on('exit', () => {
|
|
26
|
+
if (items.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const total = items.reduce((sum, item) => sum + item.ms, 0);
|
|
29
|
+
const lines = [
|
|
30
|
+
`[req-summary] count=${items.length} total=${total}ms avg=${Math.round(total / items.length)}ms`,
|
|
31
|
+
];
|
|
32
|
+
// 按路径前缀(前 3 段)聚合,暴露「同一接口被反复调用」的 N+1
|
|
33
|
+
const groups = new Map();
|
|
34
|
+
for (const item of items) {
|
|
35
|
+
const key = item.path.split('/').filter(Boolean).slice(0, 3).join('/');
|
|
36
|
+
const prev = groups.get(key) ?? { count: 0, ms: 0 };
|
|
37
|
+
groups.set(key, { count: prev.count + 1, ms: prev.ms + item.ms });
|
|
38
|
+
}
|
|
39
|
+
for (const [key, value] of [...groups.entries()].sort((a, b) => b[1].ms - a[1].ms)) {
|
|
40
|
+
lines.push(`[req-group] /${key} ×${value.count} ${value.ms}ms`);
|
|
41
|
+
}
|
|
42
|
+
process.stderr.write(`${lines.join('\n')}\n`);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function startRequestTrace(request) {
|
|
46
|
+
if (!enabled())
|
|
47
|
+
return null;
|
|
48
|
+
ensureExitHook();
|
|
49
|
+
seqCounter += 1;
|
|
50
|
+
const seq = seqCounter;
|
|
51
|
+
const method = (request.method ?? 'GET').toUpperCase();
|
|
52
|
+
const offset = Date.now() - startedAtBase;
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
let done = false;
|
|
55
|
+
return (outcome) => {
|
|
56
|
+
if (done)
|
|
57
|
+
return;
|
|
58
|
+
done = true;
|
|
59
|
+
const ms = Date.now() - startedAt;
|
|
60
|
+
items.push({ seq, method, path: request.path, ms, ok: outcome.ok, note: outcome.note });
|
|
61
|
+
const status = outcome.status === undefined ? '' : ` ${outcome.status}`;
|
|
62
|
+
const note = outcome.note ? ` ${outcome.note}` : '';
|
|
63
|
+
process.stderr.write(`[req ${String(seq).padStart(2)}] t=+${offset}ms ${method} ${request.path} ${ms}ms${status}${note}\n`);
|
|
64
|
+
};
|
|
65
|
+
}
|