weaver-work-cli 0.1.2 → 0.1.5
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 +176 -78
- package/dist/cmd/setup/index.js +5 -5
- package/dist/cmd/skills/index.js +1 -1
- package/dist/core/hooks.js +7 -0
- package/dist/index.js +0 -0
- package/dist/internal/e10/auth/commands.js +159 -54
- package/dist/internal/e10/auth/xiaoe.js +268 -0
- package/dist/internal/e10/context.js +16 -2
- package/dist/internal/e10/index.js +1 -0
- package/dist/internal/e10/request-runtime.js +345 -0
- package/dist/internal/skills/install.js +48 -6
- package/dist/internal/skills/reader.js +27 -0
- package/dist/shortcuts/archive/continuation.js +70 -0
- package/dist/shortcuts/archive/errors.js +53 -0
- package/dist/shortcuts/archive/host.js +197 -0
- package/dist/shortcuts/archive/index.js +363 -0
- package/dist/shortcuts/archive/manifest.js +45 -0
- package/dist/shortcuts/archive/operations/archive-info.js +55 -0
- package/dist/shortcuts/archive/operations/borrow-car.js +146 -0
- package/dist/shortcuts/archive/operations/borrow-list.js +200 -0
- package/dist/shortcuts/archive/operations/confirm.js +46 -0
- package/dist/shortcuts/archive/operations/download.js +238 -0
- package/dist/shortcuts/archive/operations/flow-url.js +240 -0
- package/dist/shortcuts/archive/operations/fonds.js +95 -0
- package/dist/shortcuts/archive/operations/getPageUrl.js +137 -0
- package/dist/shortcuts/archive/operations/registry.js +43 -0
- package/dist/shortcuts/archive/operations/search.js +88 -0
- package/dist/shortcuts/archive/operations/shared.js +120 -0
- package/dist/shortcuts/archive/operations/types.js +23 -0
- package/dist/shortcuts/archive/operations/upload.js +182 -0
- package/dist/shortcuts/archive/operations.js +13 -0
- package/dist/shortcuts/archive/render/search-format.js +276 -0
- package/dist/shortcuts/archive/render/search-view.js +125 -0
- package/dist/shortcuts/asset/continuation.js +70 -0
- package/dist/shortcuts/asset/errors.js +67 -0
- package/dist/shortcuts/asset/host.js +438 -0
- package/dist/shortcuts/asset/index.js +255 -0
- package/dist/shortcuts/asset/manifest.js +471 -0
- package/dist/shortcuts/asset/operations/query.js +249 -0
- package/dist/shortcuts/asset/operations/registry.js +85 -0
- package/dist/shortcuts/asset/operations/shared.js +100 -0
- package/dist/shortcuts/asset/operations/type-cache.js +49 -0
- package/dist/shortcuts/asset/operations/types.js +1 -0
- package/dist/shortcuts/asset/operations/viewlink.js +117 -0
- package/dist/shortcuts/asset/operations/write.js +435 -0
- package/dist/shortcuts/asset/operations.js +9 -0
- package/dist/shortcuts/calendar/continuation.js +70 -0
- package/dist/shortcuts/calendar/errors.js +53 -0
- package/dist/shortcuts/calendar/host.js +148 -0
- package/dist/shortcuts/calendar/index.js +125 -0
- package/dist/shortcuts/calendar/manifest.js +26 -0
- package/dist/shortcuts/calendar/operations/read.js +259 -0
- package/dist/shortcuts/calendar/operations/registry.js +31 -0
- package/dist/shortcuts/calendar/operations/shared.js +132 -0
- package/dist/shortcuts/calendar/operations/types.js +25 -0
- package/dist/shortcuts/calendar/operations/write.js +439 -0
- package/dist/shortcuts/calendar/operations.js +8 -0
- package/dist/shortcuts/ehr/continuation.js +70 -0
- package/dist/shortcuts/ehr/errors.js +53 -0
- package/dist/shortcuts/ehr/host.js +213 -0
- package/dist/shortcuts/ehr/index.js +205 -0
- package/dist/shortcuts/ehr/manifest.js +47 -0
- package/dist/shortcuts/ehr/operations/attend-read.js +373 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +514 -0
- package/dist/shortcuts/ehr/operations/hr-contact.js +363 -0
- package/dist/shortcuts/ehr/operations/hr-ds.js +298 -0
- package/dist/shortcuts/ehr/operations/hr-report.js +386 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +1629 -0
- package/dist/shortcuts/ehr/operations/recruit.js +803 -0
- package/dist/shortcuts/ehr/operations/registry.js +43 -0
- package/dist/shortcuts/ehr/operations/salary.js +319 -0
- package/dist/shortcuts/ehr/operations/shared.js +246 -0
- package/dist/shortcuts/ehr/operations/types.js +25 -0
- package/dist/shortcuts/ehr/operations.js +25 -0
- package/dist/shortcuts/esb/continuation.js +70 -0
- package/dist/shortcuts/esb/errors.js +65 -0
- package/dist/shortcuts/esb/host.js +187 -0
- package/dist/shortcuts/esb/index.js +112 -0
- package/dist/shortcuts/esb/manifest.js +91 -0
- package/dist/shortcuts/esb/operations/input-format.js +31 -0
- package/dist/shortcuts/esb/operations/registry.js +48 -0
- package/dist/shortcuts/esb/operations/shared.js +152 -0
- package/dist/shortcuts/esb/operations/trigger.js +76 -0
- package/dist/shortcuts/esb/operations/types.js +21 -0
- package/dist/shortcuts/esb/operations.js +15 -0
- package/dist/shortcuts/fna/continuation.js +70 -0
- package/dist/shortcuts/fna/errors.js +59 -0
- package/dist/shortcuts/fna/host.js +146 -0
- package/dist/shortcuts/fna/index.js +111 -0
- package/dist/shortcuts/fna/manifest.js +41 -0
- package/dist/shortcuts/fna/operations/budget.js +124 -0
- package/dist/shortcuts/fna/operations/expense-center.js +148 -0
- package/dist/shortcuts/fna/operations/invoice-writeoff.js +212 -0
- package/dist/shortcuts/fna/operations/loan.js +195 -0
- package/dist/shortcuts/fna/operations/registry.js +35 -0
- package/dist/shortcuts/fna/operations/shared.js +210 -0
- package/dist/shortcuts/fna/operations/types.js +25 -0
- package/dist/shortcuts/fna/operations.js +19 -0
- package/dist/shortcuts/hrm/errors.js +38 -0
- package/dist/shortcuts/hrm/host.js +156 -0
- package/dist/shortcuts/hrm/index.js +111 -0
- package/dist/shortcuts/hrm/manifest.js +32 -0
- package/dist/shortcuts/hrm/operations/employee.js +338 -0
- package/dist/shortcuts/hrm/operations/org.js +110 -0
- package/dist/shortcuts/hrm/operations/position.js +176 -0
- package/dist/shortcuts/hrm/operations/registry.js +33 -0
- package/dist/shortcuts/hrm/operations/shared.js +143 -0
- package/dist/shortcuts/hrm/operations/types.js +23 -0
- package/dist/shortcuts/hrm/operations.js +19 -0
- package/dist/shortcuts/index.js +24 -0
- package/dist/shortcuts/invoice/host.js +99 -94
- package/dist/shortcuts/invoice/index.js +58 -59
- package/dist/shortcuts/invoice/manifest.js +200 -3
- package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
- package/dist/shortcuts/invoice/operations/issuing.js +198 -0
- package/dist/shortcuts/invoice/operations/registry.js +17 -0
- package/dist/shortcuts/invoice/operations/reim.js +401 -0
- package/dist/shortcuts/invoice/operations/shared.js +247 -0
- package/dist/shortcuts/jiuchuanhui/cache.js +441 -0
- package/dist/shortcuts/jiuchuanhui/continuation.js +70 -0
- package/dist/shortcuts/jiuchuanhui/errors.js +59 -0
- package/dist/shortcuts/jiuchuanhui/host.js +159 -0
- package/dist/shortcuts/jiuchuanhui/index.js +109 -0
- package/dist/shortcuts/jiuchuanhui/manifest.js +469 -0
- package/dist/shortcuts/jiuchuanhui/operations/datajson.js +214 -0
- package/dist/shortcuts/jiuchuanhui/operations/esb.js +157 -0
- package/dist/shortcuts/jiuchuanhui/operations/generic.js +146 -0
- package/dist/shortcuts/jiuchuanhui/operations/registry.js +133 -0
- package/dist/shortcuts/jiuchuanhui/operations/shared.js +158 -0
- package/dist/shortcuts/jiuchuanhui/operations/types.js +1 -0
- package/dist/shortcuts/jiuchuanhui/operations.js +8 -0
- package/dist/shortcuts/mail/continuation.js +70 -0
- package/dist/shortcuts/mail/errors.js +53 -0
- package/dist/shortcuts/mail/host.js +182 -0
- package/dist/shortcuts/mail/index.js +519 -0
- package/dist/shortcuts/mail/manifest.js +38 -0
- package/dist/shortcuts/mail/operations/mail-blacklist.js +79 -0
- package/dist/shortcuts/mail/operations/mail-contacts.js +195 -0
- package/dist/shortcuts/mail/operations/mail-manage.js +335 -0
- package/dist/shortcuts/mail/operations/mail-read.js +508 -0
- package/dist/shortcuts/mail/operations/mail-send.js +474 -0
- package/dist/shortcuts/mail/operations/mail-sign.js +203 -0
- package/dist/shortcuts/mail/operations/mail-template.js +170 -0
- package/dist/shortcuts/mail/operations/registry.js +41 -0
- package/dist/shortcuts/mail/operations/shared.js +64 -0
- package/dist/shortcuts/mail/operations/types.js +27 -0
- package/dist/shortcuts/mail/operations.js +19 -0
- package/dist/shortcuts/meeting/continuation.js +70 -0
- package/dist/shortcuts/meeting/errors.js +63 -0
- package/dist/shortcuts/meeting/host.js +167 -0
- package/dist/shortcuts/meeting/index.js +123 -0
- package/dist/shortcuts/meeting/manifest.js +64 -0
- package/dist/shortcuts/meeting/operations/catalogs.js +58 -0
- package/dist/shortcuts/meeting/operations/change.js +242 -0
- package/dist/shortcuts/meeting/operations/conflicts.js +142 -0
- package/dist/shortcuts/meeting/operations/create.js +349 -0
- package/dist/shortcuts/meeting/operations/env.js +191 -0
- package/dist/shortcuts/meeting/operations/lifecycle.js +139 -0
- package/dist/shortcuts/meeting/operations/meetings.js +73 -0
- package/dist/shortcuts/meeting/operations/receipts.js +195 -0
- package/dist/shortcuts/meeting/operations/registry.js +47 -0
- package/dist/shortcuts/meeting/operations/rooms.js +132 -0
- package/dist/shortcuts/meeting/operations/shared.js +112 -0
- package/dist/shortcuts/meeting/operations/signs.js +41 -0
- package/dist/shortcuts/meeting/operations/types.js +25 -0
- package/dist/shortcuts/meeting/operations.js +19 -0
- package/dist/shortcuts/plan/continuation.js +70 -0
- package/dist/shortcuts/plan/errors.js +70 -0
- package/dist/shortcuts/plan/host.js +180 -0
- package/dist/shortcuts/plan/index.js +150 -0
- package/dist/shortcuts/plan/manifest.js +53 -0
- package/dist/shortcuts/plan/operations/link.js +256 -0
- package/dist/shortcuts/plan/operations/read.js +259 -0
- package/dist/shortcuts/plan/operations/registry.js +33 -0
- package/dist/shortcuts/plan/operations/shared.js +246 -0
- package/dist/shortcuts/plan/operations/types.js +49 -0
- package/dist/shortcuts/plan/operations/version.js +49 -0
- package/dist/shortcuts/plan/operations/write.js +710 -0
- package/dist/shortcuts/plan/operations.js +8 -0
- package/dist/shortcuts/yimiaoban/continuation.js +70 -0
- package/dist/shortcuts/yimiaoban/errors.js +61 -0
- package/dist/shortcuts/yimiaoban/host.js +469 -0
- package/dist/shortcuts/yimiaoban/index.js +271 -0
- package/dist/shortcuts/yimiaoban/manifest.js +28 -0
- package/dist/shortcuts/yimiaoban/operations/file-user.js +288 -0
- package/dist/shortcuts/yimiaoban/operations/group-read.js +477 -0
- package/dist/shortcuts/yimiaoban/operations/group-write.js +591 -0
- package/dist/shortcuts/yimiaoban/operations/msg-parse.js +429 -0
- package/dist/shortcuts/yimiaoban/operations/msg-sync.js +519 -0
- package/dist/shortcuts/yimiaoban/operations/msg-write.js +593 -0
- package/dist/shortcuts/yimiaoban/operations/person.js +102 -0
- package/dist/shortcuts/yimiaoban/operations/registry.js +38 -0
- package/dist/shortcuts/yimiaoban/operations/session.js +437 -0
- package/dist/shortcuts/yimiaoban/operations/shared.js +236 -0
- package/dist/shortcuts/yimiaoban/operations/types.js +27 -0
- package/dist/shortcuts/yimiaoban/operations/write-util.js +78 -0
- package/dist/shortcuts/yimiaoban/operations.js +8 -0
- package/docs/SKILL.md +11 -7
- package/docs/_catalog.md +28 -5
- package/docs/agent-invoice.md +19 -9
- package/docs/agent-skill-install.md +141 -22
- package/docs/calendar.md +87 -0
- package/docs/e10-auth.md +28 -9
- package/docs/ehr.md +186 -0
- package/docs/esb.md +64 -0
- package/docs/fna.md +72 -0
- package/docs/hrm.md +89 -0
- package/docs/invoice.md +61 -20
- package/docs/jiuchuanhui.md +131 -0
- package/docs/meeting.md +48 -0
- package/docs/operation-manual.md +443 -0
- package/docs/plan.md +82 -0
- package/docs/wenshuding.md +129 -0
- package/docs/yimiaoban.md +86 -0
- package/docs/ziguanjia.md +89 -0
- package/package.json +4 -4
- package/scripts/package-skill.mjs +127 -34
- package/scripts/postbuild.mjs +13 -0
- package/skill-template/business-info.json +16 -2
- package/skill-template/domains/calendar.md +15 -0
- package/skill-template/domains/esb.md +13 -0
- package/skill-template/domains/hrm.md +16 -0
- package/skill-template/domains/jiuchuanhui.md +23 -0
- package/skill-template/domains/jucailin.md +22 -0
- package/skill-template/domains/mail.md +21 -0
- package/skill-template/domains/meeting.md +3 -0
- package/skill-template/domains/plan.md +17 -0
- package/skill-template/domains/qiyecheng.md +17 -0
- package/skill-template/domains/shared.md +5 -3
- package/skill-template/domains/skill-maker.md +10 -0
- package/skill-template/domains/wenshuding.md +22 -0
- package/skill-template/domains/{invoice.md → yepiaotong.md} +4 -0
- package/skill-template/domains/yimiaoban.md +21 -0
- package/skill-template/domains/ziguanjia.md +21 -0
- package/skill-template/master-skill-template.md +12 -6
- package/skill-template/skill-template.md +26 -10
- package/skills/weaver-e10-calendar/SKILL.md +102 -0
- package/skills/weaver-e10-calendar/product.json +8 -0
- package/skills/weaver-e10-calendar/references/calendar-app-check.md +65 -0
- package/skills/weaver-e10-calendar/references/calendar-dict.md +55 -0
- package/skills/weaver-e10-calendar/references/calendar-query.md +70 -0
- package/skills/weaver-e10-calendar/references/calendar-write.md +97 -0
- package/skills/weaver-e10-calendar/references/source-manifest.json +54 -0
- package/skills/weaver-e10-esb/SKILL.md +103 -0
- package/skills/weaver-e10-esb/product.json +8 -0
- package/skills/weaver-e10-esb/references/input-format.md +52 -0
- package/skills/weaver-e10-esb/references/source-manifest.json +242 -0
- package/skills/weaver-e10-esb/references/trigger.md +99 -0
- package/skills/weaver-e10-hrm/SKILL.md +88 -0
- package/skills/weaver-e10-hrm/product.json +8 -0
- package/skills/weaver-e10-hrm/references/employee.md +109 -0
- package/skills/weaver-e10-hrm/references/org.md +95 -0
- package/skills/weaver-e10-hrm/references/position.md +95 -0
- package/skills/weaver-e10-hrm/references/source-manifest.json +121 -0
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +175 -0
- package/skills/weaver-e10-jiuchuanhui/product.json +8 -0
- package/skills/weaver-e10-jiuchuanhui/references/cache.md +110 -0
- package/skills/weaver-e10-jiuchuanhui/references/clue.md +61 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact-plan.md +56 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact-records.md +48 -0
- package/skills/weaver-e10-jiuchuanhui/references/contact.md +56 -0
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +69 -0
- package/skills/weaver-e10-jiuchuanhui/references/disabled-capabilities.md +24 -0
- package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +60 -0
- package/skills/weaver-e10-jiuchuanhui/references/general-helpers.md +59 -0
- package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +60 -0
- package/skills/weaver-e10-jiuchuanhui/references/sale.md +72 -0
- package/skills/weaver-e10-jiuchuanhui/references/source-manifest.json +2632 -0
- package/skills/weaver-e10-jucailin/SKILL.md +102 -0
- package/skills/weaver-e10-jucailin/product.json +8 -0
- package/skills/weaver-e10-jucailin/references/attend-read.md +73 -0
- package/skills/weaver-e10-jucailin/references/attend-write.md +82 -0
- package/skills/weaver-e10-jucailin/references/hr-contact.md +92 -0
- package/skills/weaver-e10-jucailin/references/hr-datasource.md +104 -0
- package/skills/weaver-e10-jucailin/references/hr-report.md +76 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +76 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +70 -0
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +35 -0
- package/skills/weaver-e10-jucailin/references/salary.md +110 -0
- package/skills/weaver-e10-jucailin/references/source-manifest.json +152 -0
- package/skills/weaver-e10-mail/SKILL.md +152 -0
- package/skills/weaver-e10-mail/product.json +8 -0
- package/skills/weaver-e10-mail/references/mail-agent-entry.md +47 -0
- package/skills/weaver-e10-mail/references/mail-attachment.md +30 -0
- package/skills/weaver-e10-mail/references/mail-blacklist.md +27 -0
- package/skills/weaver-e10-mail/references/mail-contacts.md +33 -0
- package/skills/weaver-e10-mail/references/mail-manage.md +44 -0
- package/skills/weaver-e10-mail/references/mail-read.md +76 -0
- package/skills/weaver-e10-mail/references/mail-send.md +43 -0
- package/skills/weaver-e10-mail/references/mail-sign.md +33 -0
- package/skills/weaver-e10-mail/references/mail-template.md +31 -0
- package/skills/weaver-e10-mail/references/safety-boundaries.md +32 -0
- package/skills/weaver-e10-meeting/SKILL.md +106 -0
- package/skills/weaver-e10-meeting/product.json +8 -0
- package/skills/weaver-e10-meeting/references/meeting-change.md +67 -0
- package/skills/weaver-e10-meeting/references/meeting-create.md +52 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +57 -0
- package/skills/weaver-e10-meeting/references/meeting-queries.md +61 -0
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +48 -0
- package/skills/weaver-e10-meeting/references/meeting-update.md +7 -0
- package/skills/weaver-e10-meeting/references/source-manifest.json +50 -0
- package/skills/weaver-e10-plan/SKILL.md +140 -0
- package/skills/weaver-e10-plan/product.json +8 -0
- package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +123 -0
- package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +138 -0
- package/skills/weaver-e10-plan/references/plan-report-query.md +154 -0
- package/skills/weaver-e10-plan/references/plan-report-remind.md +104 -0
- package/skills/weaver-e10-plan/references/plan-report-write.md +162 -0
- package/skills/weaver-e10-plan/references/source-manifest.json +858 -0
- package/skills/weaver-e10-qiyecheng/SKILL.md +119 -0
- package/skills/weaver-e10-qiyecheng/product.json +8 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +65 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +56 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +51 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +57 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +59 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +698 -0
- package/skills/weaver-e10-shared/SKILL.md +90 -0
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
- package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/json-output-contract.md +34 -0
- package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
- package/skills/weaver-e10-skill-maker/SKILL.md +78 -0
- package/skills/weaver-e10-skill-maker/product.json +8 -0
- package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +124 -0
- package/skills/weaver-e10-skill-maker/references/detector-validation.md +101 -0
- package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +230 -0
- package/skills/weaver-e10-skill-maker/references/post-generation-install.md +105 -0
- package/skills/weaver-e10-skill-maker/references/source-update-detection.md +261 -0
- package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +141 -0
- package/skills/weaver-e10-wenshuding/SKILL.md +158 -0
- package/skills/weaver-e10-wenshuding/product.json +8 -0
- package/skills/weaver-e10-wenshuding/references/archive-agent-entry.md +63 -0
- package/skills/weaver-e10-wenshuding/references/archive-borrow-car.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-disabled-capabilities.md +22 -0
- package/skills/weaver-e10-wenshuding/references/archive-download.md +48 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +46 -0
- package/skills/weaver-e10-wenshuding/references/archive-fonds.md +34 -0
- package/skills/weaver-e10-wenshuding/references/archive-info.md +33 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +52 -0
- package/skills/weaver-e10-wenshuding/references/archive-upload.md +41 -0
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +517 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +184 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-add.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-agent-entry.md +16 -9
- package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +204 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-delete.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-detail.md +13 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +28 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-download.md +9 -2
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-enterprise-list.md +12 -4
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +9 -2
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-import.md +16 -7
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +120 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +161 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +99 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-ocr-preview.md +12 -4
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-personal-list.md +12 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-red.md +261 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +97 -0
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-update.md +1 -1
- package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-validation-preview.md +9 -2
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1340 -0
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +845 -0
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +94 -0
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +449 -0
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +266 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +494 -0
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +1103 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +104 -0
- package/skills/weaver-e10-yimiaoban/product.json +8 -0
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +68 -0
- package/skills/weaver-e10-yimiaoban/references/error-codes.md +85 -0
- package/skills/weaver-e10-yimiaoban/references/field-resolution.md +46 -0
- package/skills/weaver-e10-yimiaoban/references/file-user-i18n.md +54 -0
- package/skills/weaver-e10-yimiaoban/references/group-read.md +55 -0
- package/skills/weaver-e10-yimiaoban/references/group-write.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +59 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +64 -0
- package/skills/weaver-e10-yimiaoban/references/person.md +44 -0
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +61 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +47 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +485 -0
- package/skills/weaver-e10-ziguanjia/SKILL.md +163 -0
- package/skills/weaver-e10-ziguanjia/product.json +8 -0
- package/skills/weaver-e10-ziguanjia/references/source-manifest.json +147 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +65 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-create.md +45 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-depre.md +48 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +22 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-purch.md +57 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-query.md +62 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-repair.md +83 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-resolve.md +49 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-return.md +70 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-update.md +45 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-use.md +60 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-viewlink.md +81 -0
- package/skills/weaver-work-cli-invoice/SKILL.md +0 -122
- package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
- package/skills/weaver-work-cli-shared/SKILL.md +0 -63
- package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -90
- package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -73
- /package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/high-risk-write.md +0 -0
- /package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/product.json +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CliError, ExitCode } from '../../core/errors.js';
|
|
2
|
+
export class EhrCliError extends CliError {
|
|
3
|
+
type;
|
|
4
|
+
subtype;
|
|
5
|
+
code;
|
|
6
|
+
retryable;
|
|
7
|
+
stage;
|
|
8
|
+
details;
|
|
9
|
+
partialData;
|
|
10
|
+
constructor(type, subtype, message, options = {}) {
|
|
11
|
+
super(message, options.exitCode ?? ExitCode.InternalError);
|
|
12
|
+
this.name = 'EhrCliError';
|
|
13
|
+
this.type = type;
|
|
14
|
+
this.subtype = subtype;
|
|
15
|
+
this.code = options.code;
|
|
16
|
+
this.retryable = options.retryable ?? false;
|
|
17
|
+
this.stage = options.stage;
|
|
18
|
+
this.details = options.details;
|
|
19
|
+
this.partialData = options.partialData;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function ehrValidationError(subtype, message, details) {
|
|
23
|
+
return new EhrCliError('validation', subtype, message, {
|
|
24
|
+
details,
|
|
25
|
+
exitCode: ExitCode.UsageError,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function ehrAuthError(subtype, message, details) {
|
|
29
|
+
return new EhrCliError('authentication', subtype, message, {
|
|
30
|
+
details,
|
|
31
|
+
exitCode: ExitCode.AuthError,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function ehrNetworkError(subtype, message, options = {}) {
|
|
35
|
+
return new EhrCliError('network', subtype, message, {
|
|
36
|
+
...options,
|
|
37
|
+
retryable: options.retryable ?? true,
|
|
38
|
+
exitCode: ExitCode.NetworkError,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function ehrConfirmationError(action, details) {
|
|
42
|
+
return new EhrCliError('confirmation', 'required', '该操作需要明确确认', {
|
|
43
|
+
details: { action, ...details },
|
|
44
|
+
exitCode: ExitCode.ConfirmationRequired,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function ehrPartialError(message, partialData, details) {
|
|
48
|
+
return new EhrCliError('partial', 'write_uncertain', message, {
|
|
49
|
+
details,
|
|
50
|
+
partialData,
|
|
51
|
+
exitCode: ExitCode.Partial,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { requireE10Session } from '../../internal/e10/context.js';
|
|
3
|
+
import { getActiveProfile } from '../../internal/e10/auth/session.js';
|
|
4
|
+
import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
|
|
5
|
+
import { ehrAuthError, ehrNetworkError, EhrCliError, ehrValidationError } from './errors.js';
|
|
6
|
+
function inferProfile(ctx) {
|
|
7
|
+
const options = ctx.getGlobalOptions();
|
|
8
|
+
return options.profile || getActiveProfile();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 判断响应是否业务成功。聚才林各子系统响应契约不统一:
|
|
12
|
+
* - 出勤接口:WeaResult{ success, data, msg }
|
|
13
|
+
* - 人事档案/社保台账:{ code, msg, status, fail, data }
|
|
14
|
+
* - 薪酬个人报表:{ status, msg, data }
|
|
15
|
+
*/
|
|
16
|
+
export function isBusinessSuccess(value) {
|
|
17
|
+
if (!value || typeof value !== 'object')
|
|
18
|
+
return false;
|
|
19
|
+
if (typeof value.success === 'boolean')
|
|
20
|
+
return value.success;
|
|
21
|
+
if (typeof value.status === 'boolean')
|
|
22
|
+
return value.status;
|
|
23
|
+
if (value.code !== undefined && value.code !== null)
|
|
24
|
+
return Number(value.code) === 200;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
export function businessMessage(value) {
|
|
28
|
+
if (!value || typeof value !== 'object')
|
|
29
|
+
return '泛微接口返回业务失败';
|
|
30
|
+
const candidates = [value.msg, value.message, value.data?.message];
|
|
31
|
+
for (const item of candidates) {
|
|
32
|
+
if (typeof item === 'string' && item.trim())
|
|
33
|
+
return item;
|
|
34
|
+
}
|
|
35
|
+
return '泛微接口返回业务失败';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 二次身份验证失败码。
|
|
39
|
+
*
|
|
40
|
+
* 关键陷阱(2026-09-04 实测):薪酬接口二次验证失败时,HTTP 仍是 200 且
|
|
41
|
+
* `status` 仍为 `true`,只是 `msg` 变成失败码、`data` 缺失。因此
|
|
42
|
+
* `isBusinessSuccess` 会误判为成功,导致认证失败被静默吞掉,输出 `data: null`,
|
|
43
|
+
* 调用方会误以为"查询成功但没有数据"。
|
|
44
|
+
*
|
|
45
|
+
* 必须在业务成功判定之外单独识别这些码并抛出明确错误。
|
|
46
|
+
*/
|
|
47
|
+
const SECOND_AUTH_FAILURE_CODES = {
|
|
48
|
+
checkSecondFailNoToken: {
|
|
49
|
+
subtype: 'second_auth_token_missing',
|
|
50
|
+
message: '二次身份验证 token 缺失:接口未收到 token。CLI 未传时会自动补 DONT_NEED,出现此错误说明该环境不接受缺省值,需由用户提供真实 token。',
|
|
51
|
+
},
|
|
52
|
+
checkSecondFail: {
|
|
53
|
+
subtype: 'second_auth_failed',
|
|
54
|
+
message: '二次身份验证失败:传入的 token 不被当前环境接受。请确认 token 有效;任何 Skill 都无法自动获取真实 token。',
|
|
55
|
+
},
|
|
56
|
+
checkSecondError: {
|
|
57
|
+
subtype: 'second_auth_error',
|
|
58
|
+
message: '二次身份验证服务异常。必须停止并说明异常,不得绕过验证读取数据。',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* 检测二次身份验证失败。返回失败信息,未失败时返回 null。
|
|
63
|
+
* 判断依据是 msg 精确等于失败码,避免误伤正常业务消息。
|
|
64
|
+
*/
|
|
65
|
+
export function detectSecondAuthFailure(value) {
|
|
66
|
+
if (!value || typeof value !== 'object')
|
|
67
|
+
return null;
|
|
68
|
+
const msg = typeof value.msg === 'string' ? value.msg.trim() : '';
|
|
69
|
+
return msg ? SECOND_AUTH_FAILURE_CODES[msg] ?? null : null;
|
|
70
|
+
}
|
|
71
|
+
function businessCode(value) {
|
|
72
|
+
if (!value || typeof value !== 'object')
|
|
73
|
+
return undefined;
|
|
74
|
+
const code = value.code ?? value.status;
|
|
75
|
+
if (typeof code === 'string' || typeof code === 'number')
|
|
76
|
+
return code;
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
export function assertPath(requestPath) {
|
|
80
|
+
if (typeof requestPath !== 'string' || !requestPath.startsWith('/') || requestPath.startsWith('//')) {
|
|
81
|
+
throw ehrValidationError('path_invalid', '请求路径必须是相对绝对路径');
|
|
82
|
+
}
|
|
83
|
+
if (/^https?:/i.test(requestPath) || /[\r\n]/.test(requestPath) || requestPath.includes('/../')) {
|
|
84
|
+
throw ehrValidationError('path_invalid', '请求路径不允许跨域或路径逃逸');
|
|
85
|
+
}
|
|
86
|
+
if (!requestPath.startsWith('/api/')) {
|
|
87
|
+
throw ehrValidationError('path_not_allowed', '聚才林只能调用 /api/ 路径');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function formBody(form) {
|
|
91
|
+
if (!form)
|
|
92
|
+
return undefined;
|
|
93
|
+
const params = new URLSearchParams();
|
|
94
|
+
for (const [key, value] of Object.entries(form)) {
|
|
95
|
+
if (value === undefined || value === null)
|
|
96
|
+
continue;
|
|
97
|
+
params.set(key, typeof value === 'string' ? value : JSON.stringify(value));
|
|
98
|
+
}
|
|
99
|
+
return params;
|
|
100
|
+
}
|
|
101
|
+
function omitEmptyQueryValues(query) {
|
|
102
|
+
if (!query)
|
|
103
|
+
return undefined;
|
|
104
|
+
return Object.fromEntries(Object.entries(query).filter(([, value]) => value !== ''));
|
|
105
|
+
}
|
|
106
|
+
function mapRuntimeNetworkError(error) {
|
|
107
|
+
if (error instanceof E10ApiError && error.type === 'network') {
|
|
108
|
+
throw ehrNetworkError(error.subtype, error.message, {
|
|
109
|
+
retryable: error.retryable,
|
|
110
|
+
details: error.details,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
export function createEhrHost(ctx, dependencies = {}) {
|
|
116
|
+
let e10Session = null;
|
|
117
|
+
let sessionContext = null;
|
|
118
|
+
const requireSession = dependencies.requireSession || requireE10Session;
|
|
119
|
+
async function ensureSession() {
|
|
120
|
+
if (!e10Session) {
|
|
121
|
+
e10Session = await requireSession(ctx);
|
|
122
|
+
sessionContext = {
|
|
123
|
+
baseUrl: e10Session.getBaseUrl(),
|
|
124
|
+
profile: inferProfile(ctx),
|
|
125
|
+
userId: e10Session.userId,
|
|
126
|
+
tenantKey: e10Session.tenantKey,
|
|
127
|
+
eteamsId: e10Session.eteamsId,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return e10Session;
|
|
131
|
+
}
|
|
132
|
+
async function getSession() {
|
|
133
|
+
await ensureSession();
|
|
134
|
+
return sessionContext;
|
|
135
|
+
}
|
|
136
|
+
async function runtime() {
|
|
137
|
+
return createE10RequestRuntime(ctx, await ensureSession(), {
|
|
138
|
+
interceptors: dependencies.interceptors,
|
|
139
|
+
fetch: dependencies.fetch,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async function request(request) {
|
|
143
|
+
const { method, path, query, body, operation, form, multipart, headers: extraHeaders = {}, timeoutMs = 30_000, } = request;
|
|
144
|
+
assertPath(path);
|
|
145
|
+
const resolvedMethod = method || (body === undefined && form === undefined && multipart === undefined ? 'GET' : 'POST');
|
|
146
|
+
let response;
|
|
147
|
+
try {
|
|
148
|
+
response = await (await runtime()).requestJson({
|
|
149
|
+
module: 'ehr',
|
|
150
|
+
operation,
|
|
151
|
+
method: resolvedMethod,
|
|
152
|
+
path,
|
|
153
|
+
query: omitEmptyQueryValues(query),
|
|
154
|
+
body: multipart === undefined ? body : undefined,
|
|
155
|
+
form: multipart === undefined && form === undefined ? undefined : formBody(form ?? {}),
|
|
156
|
+
formData: multipart,
|
|
157
|
+
headers: { 'X-Requested-With': 'XMLHttpRequest', ...extraHeaders },
|
|
158
|
+
timeoutMs,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
mapRuntimeNetworkError(error);
|
|
163
|
+
}
|
|
164
|
+
if (response.status === 401 || response.status === 302) {
|
|
165
|
+
throw ehrAuthError('session_expired', 'E10 登录态已失效,请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url <域名> 完成登录', { httpStatus: response.status });
|
|
166
|
+
}
|
|
167
|
+
if (response.parseError) {
|
|
168
|
+
if (response.status < 200 || response.status >= 300) {
|
|
169
|
+
throw new EhrCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
170
|
+
code: response.status,
|
|
171
|
+
details: { status: response.status },
|
|
172
|
+
exitCode: 1,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
throw ehrNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
|
|
176
|
+
}
|
|
177
|
+
if (response.status < 200 || response.status >= 300) {
|
|
178
|
+
throw new EhrCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
179
|
+
code: response.status,
|
|
180
|
+
details: { status: response.status, message: businessMessage(response.value) },
|
|
181
|
+
exitCode: 1,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// 二次验证失败必须优先于业务成功判定:
|
|
185
|
+
// 这类响应 HTTP 200 且 status 仍为 true,只靠 isBusinessSuccess 会被判成成功,
|
|
186
|
+
// 从而把认证失败静默吞成 data:null。
|
|
187
|
+
const secondAuthFailure = detectSecondAuthFailure(response.value);
|
|
188
|
+
if (secondAuthFailure) {
|
|
189
|
+
throw new EhrCliError('api', secondAuthFailure.subtype, secondAuthFailure.message, {
|
|
190
|
+
code: businessCode(response.value),
|
|
191
|
+
details: { code: businessCode(response.value), msg: businessMessage(response.value) },
|
|
192
|
+
exitCode: 1,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (!isBusinessSuccess(response.value)) {
|
|
196
|
+
throw new EhrCliError('api', 'business_error', businessMessage(response.value), {
|
|
197
|
+
code: businessCode(response.value),
|
|
198
|
+
details: { code: businessCode(response.value), message: businessMessage(response.value) },
|
|
199
|
+
exitCode: 1,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return response.value;
|
|
203
|
+
}
|
|
204
|
+
async function buildCardSign() {
|
|
205
|
+
const session = await getSession();
|
|
206
|
+
if (!session.userId || !session.eteamsId || !session.tenantKey) {
|
|
207
|
+
throw ehrAuthError('card_sign_unavailable', '无法构造打卡凭证:缺少 empId、ETEAMSID 或 tenantKey,请先重新登录');
|
|
208
|
+
}
|
|
209
|
+
const raw = `wea${'web'}${session.userId}${session.eteamsId}${session.tenantKey.toLowerCase()}`;
|
|
210
|
+
return `${createHash('md5').update(raw).digest('hex')}ver`;
|
|
211
|
+
}
|
|
212
|
+
return { request, getSession, buildCardSign };
|
|
213
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
|
|
3
|
+
import { createEhrContinuationSigner } from './continuation.js';
|
|
4
|
+
import { createEhrHost } from './host.js';
|
|
5
|
+
import { ehrManifest } from './manifest.js';
|
|
6
|
+
import { executeEhrOperation } from './operations.js';
|
|
7
|
+
import { ehrValidationError } from './errors.js';
|
|
8
|
+
function asOptions(value) {
|
|
9
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
10
|
+
}
|
|
11
|
+
async function readStdin() {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
for await (const chunk of process.stdin) {
|
|
14
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
15
|
+
}
|
|
16
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Windows PowerShell 的管道与 Set-Content -Encoding utf8 会在内容前写入 UTF-8 BOM,
|
|
20
|
+
* 且可能重复写入多次;JSON.parse 不接受前导 BOM,必须先剥离。
|
|
21
|
+
*/
|
|
22
|
+
function stripBom(value) {
|
|
23
|
+
return value.replace(/^\uFEFF+/, '');
|
|
24
|
+
}
|
|
25
|
+
export async function inputFrom(options, extra = {}) {
|
|
26
|
+
const opts = asOptions(options);
|
|
27
|
+
let input = {};
|
|
28
|
+
if (opts.input && opts.inputJson) {
|
|
29
|
+
throw ehrValidationError('input_conflict', '不能同时传 --input 和 --input-json');
|
|
30
|
+
}
|
|
31
|
+
if (opts.inputJson) {
|
|
32
|
+
input = parseJsonInput(String(opts.inputJson), '--input-json');
|
|
33
|
+
}
|
|
34
|
+
if (opts.input) {
|
|
35
|
+
let raw;
|
|
36
|
+
try {
|
|
37
|
+
raw = stripBom(opts.input === '-' ? await readStdin() : await readFile(String(opts.input), 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw ehrValidationError('input_unreadable', `无法读取 --input:${String(opts.input)}`);
|
|
41
|
+
}
|
|
42
|
+
input = parseJsonInput(raw, '--input');
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...input,
|
|
46
|
+
...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== undefined && value !== '')),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function parseJsonInput(raw, label) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = JSON.parse(stripBom(raw));
|
|
52
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
53
|
+
throw new Error('input must be an object');
|
|
54
|
+
}
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw ehrValidationError('input_invalid', `${label} 不是合法 JSON 对象`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function successEnvelope(operation, result) {
|
|
62
|
+
return {
|
|
63
|
+
schemaVersion: 1,
|
|
64
|
+
ok: true,
|
|
65
|
+
operation,
|
|
66
|
+
// 业务数据为 undefined 时(如社保福利/调薪记录为空)仍须输出 data 键,
|
|
67
|
+
// 否则 JSON.stringify 会省略该键,导致调用方需额外判断键是否存在。
|
|
68
|
+
data: result.data === undefined ? null : result.data,
|
|
69
|
+
...(result.meta ? { meta: result.meta } : {}),
|
|
70
|
+
warnings: [],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function failureEnvelope(error) {
|
|
74
|
+
const structured = error;
|
|
75
|
+
return {
|
|
76
|
+
schemaVersion: 1,
|
|
77
|
+
ok: false,
|
|
78
|
+
...(structured?.partialData === undefined ? {} : { data: structured.partialData }),
|
|
79
|
+
error: toErrorEnvelope(error),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function executeAndPrint(ctx, operation, input) {
|
|
83
|
+
try {
|
|
84
|
+
const result = await executeEhrOperation(operation, input, {
|
|
85
|
+
ctx,
|
|
86
|
+
host: createEhrHost(ctx),
|
|
87
|
+
continuation: createEhrContinuationSigner(ctx),
|
|
88
|
+
});
|
|
89
|
+
ctx.output.write(successEnvelope(operation, result), { json: true });
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
93
|
+
process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export const ehrShortcut = {
|
|
97
|
+
name: 'ehr',
|
|
98
|
+
description: '泛微E10聚才林(人事/出勤/薪酬)CLI',
|
|
99
|
+
category: 'shortcut',
|
|
100
|
+
register({ program, action }) {
|
|
101
|
+
const ehr = program.command('ehr').description('泛微E10聚才林(人事档案/出勤管理/薪酬管理)');
|
|
102
|
+
ehr.command('schema')
|
|
103
|
+
.description('Print ehr operation manifest for agents')
|
|
104
|
+
.action(action((ctx) => {
|
|
105
|
+
ctx.output.write(ehrManifest, { json: true });
|
|
106
|
+
}));
|
|
107
|
+
ehr.command('run')
|
|
108
|
+
.description('Run an ehr operation with JSON input')
|
|
109
|
+
.argument('<operation>', 'operation name, e.g. ehr.attend.summary.get')
|
|
110
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
111
|
+
.option('--input-json <json>', 'inline JSON input object')
|
|
112
|
+
.action(action(async (ctx, operation, options) => {
|
|
113
|
+
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
114
|
+
}));
|
|
115
|
+
// ---- 高频便捷命令:出勤 ----
|
|
116
|
+
const attend = ehr.command('attend').description('Attendance commands');
|
|
117
|
+
attend.command('summary')
|
|
118
|
+
.description('出勤情况统计')
|
|
119
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
120
|
+
.option('--begin <date>', 'start date YYYY-MM-DD')
|
|
121
|
+
.option('--end <date>', 'end date YYYY-MM-DD')
|
|
122
|
+
.action(action(async (ctx, options) => {
|
|
123
|
+
const opts = asOptions(options);
|
|
124
|
+
await executeAndPrint(ctx, 'ehr.attend.summary.get', await inputFrom(options, {
|
|
125
|
+
beginDate: opts.begin,
|
|
126
|
+
endDate: opts.end,
|
|
127
|
+
}));
|
|
128
|
+
}));
|
|
129
|
+
attend.command('abnormal')
|
|
130
|
+
.description('异常考勤明细')
|
|
131
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
132
|
+
.option('--begin <date>', 'start date YYYY-MM-DD')
|
|
133
|
+
.option('--end <date>', 'end date YYYY-MM-DD')
|
|
134
|
+
.action(action(async (ctx, options) => {
|
|
135
|
+
const opts = asOptions(options);
|
|
136
|
+
await executeAndPrint(ctx, 'ehr.attend.abnormal.list', await inputFrom(options, {
|
|
137
|
+
beginDate: opts.begin,
|
|
138
|
+
endDate: opts.end,
|
|
139
|
+
}));
|
|
140
|
+
}));
|
|
141
|
+
const card = attend.command('card').description('Attendance card punch commands');
|
|
142
|
+
card.command('status')
|
|
143
|
+
.description('查询当前打卡按钮状态')
|
|
144
|
+
.action(action(async (ctx, options) => {
|
|
145
|
+
await executeAndPrint(ctx, 'ehr.attend.card.status', await inputFrom(options));
|
|
146
|
+
}));
|
|
147
|
+
card.command('check-prepare')
|
|
148
|
+
.description('准备 PC 端打卡(需 type)')
|
|
149
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
150
|
+
.option('--type <type>', 'CHECKIN / CHECKOUT / LEAVE / RETURN / CHECKIN_AND_RETURN / CHECKOUT_AND_LEAVE')
|
|
151
|
+
.action(action(async (ctx, options) => {
|
|
152
|
+
const opts = asOptions(options);
|
|
153
|
+
await executeAndPrint(ctx, 'ehr.attend.card.check.prepare', await inputFrom(options, { type: opts.type }));
|
|
154
|
+
}));
|
|
155
|
+
card.command('check-apply')
|
|
156
|
+
.description('执行 PC 端打卡(需 --yes 与 --continuation)')
|
|
157
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
158
|
+
.option('--type <type>', 'CHECKIN / CHECKOUT / LEAVE / RETURN / CHECKIN_AND_RETURN / CHECKOUT_AND_LEAVE')
|
|
159
|
+
.option('--continuation <token>', 'continuation token from check-prepare')
|
|
160
|
+
.option('--yes', 'confirm the write operation')
|
|
161
|
+
.action(action(async (ctx, options) => {
|
|
162
|
+
const opts = asOptions(options);
|
|
163
|
+
await executeAndPrint(ctx, 'ehr.attend.card.check.apply', await inputFrom(options, {
|
|
164
|
+
type: opts.type,
|
|
165
|
+
continuation: opts.continuation,
|
|
166
|
+
confirm: opts.yes === true ? true : undefined,
|
|
167
|
+
}));
|
|
168
|
+
}));
|
|
169
|
+
// ---- 高频便捷命令:薪酬 ----
|
|
170
|
+
const salary = ehr.command('salary').description('Salary commands');
|
|
171
|
+
salary.command('bills')
|
|
172
|
+
.description('我的工资单列表')
|
|
173
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
174
|
+
.option('--month <month>', 'salary month YYYY-MM')
|
|
175
|
+
.action(action(async (ctx, options) => {
|
|
176
|
+
const opts = asOptions(options);
|
|
177
|
+
await executeAndPrint(ctx, 'ehr.salary.bill.list', await inputFrom(options, {
|
|
178
|
+
salaryYearMonth: opts.month ? [opts.month] : undefined,
|
|
179
|
+
}));
|
|
180
|
+
}));
|
|
181
|
+
// ---- 高频便捷命令:人事档案 ----
|
|
182
|
+
const hr = ehr.command('hr').description('HR profile commands');
|
|
183
|
+
hr.command('contact-search')
|
|
184
|
+
.description('通讯录高级查询(在职)')
|
|
185
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
186
|
+
.option('--username <name>', 'name keyword')
|
|
187
|
+
.action(action(async (ctx, options) => {
|
|
188
|
+
const opts = asOptions(options);
|
|
189
|
+
await executeAndPrint(ctx, 'ehr.hr.contact.search', await inputFrom(options, { username: opts.username }));
|
|
190
|
+
}));
|
|
191
|
+
hr.command('contact-fields')
|
|
192
|
+
.description('通讯录字段列表')
|
|
193
|
+
.action(action(async (ctx, options) => {
|
|
194
|
+
await executeAndPrint(ctx, 'ehr.hr.contact.fields', await inputFrom(options));
|
|
195
|
+
}));
|
|
196
|
+
hr.command('ds-fields')
|
|
197
|
+
.description('数据源字段结构(需 --form-id)')
|
|
198
|
+
.option('--input <path>', 'JSON input file, or - for stdin')
|
|
199
|
+
.option('--form-id <id>', 'data source formId')
|
|
200
|
+
.action(action(async (ctx, options) => {
|
|
201
|
+
const opts = asOptions(options);
|
|
202
|
+
await executeAndPrint(ctx, 'ehr.hr.ds.fields', await inputFrom(options, { formId: opts.formId }));
|
|
203
|
+
}));
|
|
204
|
+
},
|
|
205
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ehrOperationDefinitions } from './operations/registry.js';
|
|
2
|
+
import { HR_DATA_SOURCE_IDS } from './operations/hr-ds.js';
|
|
3
|
+
/**
|
|
4
|
+
* 招聘管理模块的禁用边界(第二期写操作,随实现逐个解除)。
|
|
5
|
+
* 读操作与上下文解析第一期已实现;写操作已实现 candidate.create / interview.arrange /
|
|
6
|
+
* offer.send / entry.process / interview.feedback.edit / interview.feedback.urge
|
|
7
|
+
* (prepare->apply 全协议),仅 entry.cancel.change(撤销类,破坏性最强)暂缓。
|
|
8
|
+
*/
|
|
9
|
+
const RECRUIT_WITHHELD = [
|
|
10
|
+
'recruit.entry.cancel.change',
|
|
11
|
+
];
|
|
12
|
+
/** 移动端考勤打卡:Agent 无法获取真实定位/WiFi/设备凭证,服务端必拒,严禁伪造参数。 */
|
|
13
|
+
const MOBILE_CARD_WITHHELD = ['attend.card.sign.mobile'];
|
|
14
|
+
function buildOperations() {
|
|
15
|
+
return ehrOperationDefinitions().map((definition) => ({
|
|
16
|
+
name: definition.name,
|
|
17
|
+
resource: definition.resource,
|
|
18
|
+
summary: definition.summary,
|
|
19
|
+
...(definition.capability ? { capability: definition.capability } : {}),
|
|
20
|
+
risk: definition.risk,
|
|
21
|
+
...(definition.requiresConfirmation ? { requiresConfirmation: true } : {}),
|
|
22
|
+
inputSchema: definition.inputSchema,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
export const ehrManifest = {
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
name: 'ehr',
|
|
28
|
+
title: '泛微E10聚才林(人事/出勤/薪酬/招聘查询)',
|
|
29
|
+
version: '0.1.0',
|
|
30
|
+
host: 'e10-ehr',
|
|
31
|
+
status: 'builtin',
|
|
32
|
+
sourceSkill: 'weaver-e10-jucailin',
|
|
33
|
+
capabilities: ['salary', 'attend', 'hr', 'recruit'],
|
|
34
|
+
dataSourceIds: HR_DATA_SOURCE_IDS,
|
|
35
|
+
dataSourceGroupId: 'weaver-hr-service',
|
|
36
|
+
operations: buildOperations(),
|
|
37
|
+
withheldOperations: [
|
|
38
|
+
...RECRUIT_WITHHELD.map((name) => ({
|
|
39
|
+
name,
|
|
40
|
+
reason: '招聘撤销类写操作(取消改期入职)破坏性最强且依赖入口链路,暂缓实现;其余招聘读操作与写操作(新建人才/安排面试/发送Offer/办理入职/面试反馈编辑/催评)均已可用。不得编造或绕过。',
|
|
41
|
+
})),
|
|
42
|
+
...MOBILE_CARD_WITHHELD.map((name) => ({
|
|
43
|
+
name,
|
|
44
|
+
reason: '移动端考勤打卡依赖真实经纬度、WiFi/蓝牙、设备信息与客户端加密凭证,Agent 均无法真实获取,服务端校验必拒;严禁伪造定位、WiFi 或凭证参数。PC 端打卡请使用 ehr.attend.card.check.*。',
|
|
45
|
+
})),
|
|
46
|
+
],
|
|
47
|
+
};
|