weaver-work-cli 0.1.44 → 0.1.46
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 +9 -5
- package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
- package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
- package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
- package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
- package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-MCXQBD6N.js} +3 -3
- package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
- package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
- package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
- package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
- package/dist/chunks/{chunk-FAZTGX7S.js → chunk-4RWS2YYL.js} +5 -5
- package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-6AXKWFKG.js} +32 -12
- package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
- package/dist/chunks/{chunk-QVSWRLLU.js → chunk-6V5ZPKHV.js} +56 -12
- package/dist/chunks/chunk-762M5XJS.js +215 -0
- package/dist/chunks/{chunk-PC7VKEB5.js → chunk-76H3IKH6.js} +178 -37
- package/dist/chunks/{chunk-FRZKBMSW.js → chunk-AD46OMQK.js} +239 -41
- package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
- package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
- package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
- package/dist/chunks/{chunk-CWYGFU5B.js → chunk-GSZTA43P.js} +2 -2
- package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
- package/dist/chunks/{chunk-N4M2DDFE.js → chunk-IP4CWQCF.js} +11 -11
- package/dist/chunks/{chunk-GAMZLAG2.js → chunk-IRMIEDXN.js} +1 -1
- package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
- package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-JFAWZX53.js} +134 -13
- package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
- package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-OXHHJWNC.js} +1 -1
- package/dist/chunks/chunk-P5GQRWDC.js +60 -0
- package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
- package/dist/chunks/{chunk-OF4S23UB.js → chunk-PSOMGA3U.js} +4 -4
- package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
- package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
- package/dist/chunks/{chunk-XHK4MDR5.js → chunk-UFIFZ4YC.js} +48 -14
- package/dist/chunks/chunk-VRPH24IC.js +76 -0
- package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
- package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
- package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-H7EHQXYY.js} +2 -2
- package/dist/chunks/continuation-GW6PRWK3.js +12 -0
- package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
- package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
- package/dist/chunks/{create-flow-J22BO65E.js → create-flow-VRVJEOBX.js} +6 -6
- package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
- package/dist/chunks/{ehr-GSTGAIY3.js → ehr-SH2LM3NK.js} +648 -88
- package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
- package/dist/chunks/{env-BX3VRFS7.js → env-66FPSJDV.js} +2 -2
- package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
- package/dist/chunks/{factory-PETTFME6.js → factory-UH2TZBVA.js} +1 -1
- package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
- package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-CAKMMV7K.js} +3 -3
- package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
- package/dist/chunks/host-7NTIBSPK.js +25 -0
- package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
- package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
- package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
- package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
- package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
- package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
- package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
- package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
- package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-DD6ULZ3I.js} +4 -4
- package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
- package/dist/chunks/{meeting-FEVPZ67S.js → meeting-VTBFW4HI.js} +12 -12
- package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
- package/dist/chunks/operations-J7PUIVWZ.js +15 -0
- package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
- package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
- package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
- package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-CAKZTUA7.js} +1343 -178
- package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
- package/dist/chunks/{registry-IM5G23LS.js → registry-JVQBLFQ5.js} +10 -10
- package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
- package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
- package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-5U55FMXZ.js} +6 -4
- package/dist/chunks/{schedule-ESZIBAUO.js → schedule-IDETODCA.js} +4 -4
- package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
- package/dist/cmd/action.js +14 -10
- package/dist/index.js +30 -30
- package/dist/internal/e10/auth/commands.js +32 -0
- package/dist/internal/e10/auth/error-log.js +156 -26
- package/dist/internal/e10/auth/xiaoe.js +176 -13
- package/dist/internal/e10/context.js +12 -1
- package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
- package/dist/shortcuts/archive/operations/flow-url.js +182 -22
- package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
- package/dist/shortcuts/archive/operations/prelib.js +33 -4
- package/dist/shortcuts/archive/operations/shared.js +52 -0
- package/dist/shortcuts/contract/host.js +111 -4
- package/dist/shortcuts/contract/index.js +19 -0
- package/dist/shortcuts/contract/manifest.js +125 -0
- package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
- package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
- package/dist/shortcuts/contract/operations/customer.js +192 -0
- package/dist/shortcuts/contract/operations/file-download.js +75 -0
- package/dist/shortcuts/contract/operations/flow.js +44 -2
- package/dist/shortcuts/contract/operations/form-info.js +162 -62
- package/dist/shortcuts/contract/operations/registry.js +8 -0
- package/dist/shortcuts/contract/operations/review.js +116 -1
- package/dist/shortcuts/contract/operations/summary.js +177 -0
- package/dist/shortcuts/contract/operations/upload.js +64 -4
- package/dist/shortcuts/contract/upload-cache.js +104 -0
- package/dist/shortcuts/ehr/host.js +2 -2
- package/dist/shortcuts/ehr/index.js +14 -3
- package/dist/shortcuts/ehr/manifest.js +5 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +44 -12
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +146 -43
- package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +154 -36
- package/dist/shortcuts/ehr/operations/recruit.js +196 -12
- package/dist/shortcuts/ehr/operations/registry.js +4 -0
- package/dist/shortcuts/ehr/operations.js +24 -0
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
- package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
- package/dist/shortcuts/hrm/operations/employee.js +29 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +274 -75
- package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +63 -11
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +38 -7
- package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
- package/dist/shortcuts/meeting/operations/invitation.js +27 -4
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +356 -29
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +36 -10
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +309 -67
- package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +310 -17
- package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
- package/dist/shortcuts/recruit-stage/shared.js +221 -24
- package/dist/shortcuts/workflow/index.js +2 -0
- package/dist/shortcuts/workflow/operations/read.js +8 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
- package/docs/contract.md +1 -0
- package/docs/e10-auth.md +4 -2
- package/docs/todo-smart-convert/data-contract.md +7 -0
- package/package.json +1 -1
- package/skill-template/domains/jinchengda.md +2 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
- package/skills/weaver-e10-jucailin/SKILL.md +12 -3
- package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
- package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -91
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
- package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +55 -11
- package/skills/weaver-e10-meeting/SKILL.md +103 -11
- package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +19 -11
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -8
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +23 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +11 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
- package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
- package/skills/weaver-e10-workflow/SKILL.md +19 -17
- package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
|
@@ -16,7 +16,38 @@ import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from '.
|
|
|
16
16
|
const RECRUIT_APP_TAG = 'weaver-recruit-service';
|
|
17
17
|
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
18
18
|
/** 环境缓存结构版本:新增/变更解析字段(如 2026-11-04 补 candidate 应聘者列表)时 +1,旧缓存自动失效重建。 */
|
|
19
|
-
const RECRUIT_CACHE_VERSION =
|
|
19
|
+
const RECRUIT_CACHE_VERSION = 4;
|
|
20
|
+
/**
|
|
21
|
+
* 关键表单:解析不到字段列表即判定招聘上下文不可用。
|
|
22
|
+
*
|
|
23
|
+
* 2026-11-06 修复(小E 演示「读取职位表单→数据节点无法解析」的根因):
|
|
24
|
+
* 旧实现 L4 `fetchFormFields` 返回空 fmap 时**静默跳过**,随后把缺 `fields[objId]` 的
|
|
25
|
+
* 上下文照常落盘;`load()` 命中缓存又只校验 `cacheVersion`,于是坏缓存长期复用,
|
|
26
|
+
* 后续 prepare / list / prefill 全部在「职位管理缺少字段 …(ds/fields 解析不到)」处中断。
|
|
27
|
+
* 现在:关键表单字段为空即抛明确错误(不落盘),且命中缓存时校验关键字段,坏缓存自动重建。
|
|
28
|
+
*/
|
|
29
|
+
const RECRUIT_CRITICAL_FORMS = new Set(['position_manage', 'talent_pool', 'interview_plan']);
|
|
30
|
+
/** 关键表单中文名(报错用;表单自身 objName 在解析失败时取不到,不能依赖) */
|
|
31
|
+
const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
32
|
+
position_manage: '招聘职位',
|
|
33
|
+
talent_pool: '人才库',
|
|
34
|
+
interview_plan: '面试管理',
|
|
35
|
+
};
|
|
36
|
+
/** 磁盘缓存健康检查:关键表单必须解析到 objId **且**字段表非空,否则判坏必须重建。 */
|
|
37
|
+
function hasCriticalFields(cache) {
|
|
38
|
+
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
39
|
+
const objId = cache?.forms?.[logic]?.objId;
|
|
40
|
+
// 🔴 关键表单缺 objId 同样是坏缓存:说明当初 getObjsByTag 解析失败(网络抖动/权限/未装全)。
|
|
41
|
+
// 旧实现 `if (!objId) continue` 等于「没表单就不用校验字段」,把解析失败的上下文当健康缓存长期复用,
|
|
42
|
+
// 之后所有职位/人才操作都在「表单未启用」或「缺少字段」处中断——这是坏缓存的第二条产生路径。
|
|
43
|
+
if (!objId)
|
|
44
|
+
return false;
|
|
45
|
+
const fmap = cache?.fields?.[objId] || {};
|
|
46
|
+
if (!Object.keys(fmap).length)
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
20
51
|
const RECRUIT_TAGS = {
|
|
21
52
|
talent_pool: 'uf_rcrt_talent_pool',
|
|
22
53
|
interview_plan: 'uf_rcrt_interview_plan',
|
|
@@ -80,7 +111,7 @@ function cacheDirFor(baseUrl) {
|
|
|
80
111
|
return join(home, 'env-cache', 'recruit-ops', host);
|
|
81
112
|
}
|
|
82
113
|
/** 内联展示字段解析:门户字段三种形态(数组/对象/字符串 JSON),同 recruit-detail.mjs namesOf */
|
|
83
|
-
function namesOf(field) {
|
|
114
|
+
export function namesOf(field) {
|
|
84
115
|
if (!field)
|
|
85
116
|
return null;
|
|
86
117
|
let arr;
|
|
@@ -142,22 +173,34 @@ async function fetchFormFields(host, appId, objId) {
|
|
|
142
173
|
const fieldId = String(field?.id || '');
|
|
143
174
|
if (dataKey && fieldId)
|
|
144
175
|
fmap[dataKey] = fieldId;
|
|
145
|
-
|
|
176
|
+
// 🔴 选项映射只针对「值固定」的选择类字段(单选 Select / 开关 Switch)。
|
|
177
|
+
// 关联浏览字段(本环境实测 type=String,如职位 education / job_category / position_nature /
|
|
178
|
+
// work_location、面试 digital_id)config.options 为空,值来自另一张表的记录 id,跨环境必变;
|
|
179
|
+
// 级联 Cascader 同理。**一律不进缓存**,走运行时 browser/字典解析,禁止写死或固化。
|
|
180
|
+
const selectLike = field?.type === 'Select' || field?.type === 'Switch';
|
|
181
|
+
if (selectLike && fieldId && Array.isArray(config.options) && config.options.length) {
|
|
146
182
|
const map = {};
|
|
147
183
|
for (const option of config.options) {
|
|
148
184
|
if (!option || typeof option !== 'object')
|
|
149
185
|
continue;
|
|
150
186
|
const name = option.name;
|
|
151
|
-
|
|
187
|
+
// 🔴 可写值(写进 saveFormData 的 optionId)= value / valueKey,**不是** selectionId。
|
|
188
|
+
// 实测(2026-11-06,www.e-cology.com.cn,均为 Select 字段):两者绝大多数相同,个别选项不同,例:
|
|
189
|
+
// 面试方式「AI面试」selectionId=1274947951008702504(写不进去,后端静默丢弃),
|
|
190
|
+
// valueKey=841052191228968964(正确,与 ds/options 一致);
|
|
191
|
+
// 人才最高学历「博士」selectionId=1073374587183710218,valueKey=0(正确,与 ds/options 一致)。
|
|
192
|
+
// 优先级:value → valueKey → extra.valueKey/value → selectionId/id(旧环境兜底)。
|
|
193
|
+
const scalar = (v) => (typeof v === 'string' || typeof v === 'number') && String(v) !== '' ? String(v) : '';
|
|
194
|
+
let selectionId = scalar(option.value) || scalar(option.valueKey);
|
|
152
195
|
if (!selectionId && typeof option.extra === 'string') {
|
|
153
196
|
try {
|
|
154
197
|
const extra = JSON.parse(option.extra);
|
|
155
|
-
selectionId = extra.
|
|
198
|
+
selectionId = scalar(extra.valueKey) || scalar(extra.value);
|
|
156
199
|
}
|
|
157
200
|
catch { /* 坏 extra 回退 */ }
|
|
158
201
|
}
|
|
159
202
|
if (!selectionId)
|
|
160
|
-
selectionId = option.
|
|
203
|
+
selectionId = scalar(option.selectionId) || scalar(option.id);
|
|
161
204
|
if (selectionId && name)
|
|
162
205
|
map[String(selectionId)] = name;
|
|
163
206
|
}
|
|
@@ -187,6 +230,13 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
187
230
|
if (!tenantKey && entry?.tenantKey)
|
|
188
231
|
tenantKey = String(entry.tenantKey);
|
|
189
232
|
}
|
|
233
|
+
// L2.5:关键表单必须解析到 objId。缺一个就说明 tag/权限/安装有问题,
|
|
234
|
+
// 与「字段表为空」同等对待——立即报错且**不落盘**,避免把解析失败的上下文写进缓存。
|
|
235
|
+
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
236
|
+
if (forms[logic]?.objId)
|
|
237
|
+
continue;
|
|
238
|
+
throw new RecruitContextError('recruit_form_unresolved', `当前环境未解析到「${RECRUIT_CRITICAL_FORM_LABELS[logic] || logic}」表单(getObjsByTag 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限后重试。`);
|
|
239
|
+
}
|
|
190
240
|
// L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
|
|
191
241
|
const menuResponse = (await host.request({
|
|
192
242
|
path: '/api/cusapp/app/allMenus',
|
|
@@ -219,11 +269,15 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
219
269
|
const resolvedForms = Object.entries(forms).filter(([, v]) => v.objId);
|
|
220
270
|
await Promise.all(resolvedForms.map(async ([logic, entry]) => {
|
|
221
271
|
const { fmap, omap } = await fetchFormFields(host, appId, entry.objId);
|
|
272
|
+
// 🔴 关键表单字段解析失败必须报错,且不能让缺字段的上下文落盘(见文件头修复说明)。
|
|
273
|
+
// 非关键表单(辅助配置表等)允许为空,保持旧行为,避免误伤部分环境。
|
|
274
|
+
if (!Object.keys(fmap).length && RECRUIT_CRITICAL_FORMS.has(logic)) {
|
|
275
|
+
throw new RecruitContextError('recruit_context_missing', `当前环境未解析到「${entry.objName || logic}」表单的字段列表(ds/fields 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限,或删除环境缓存后重试。`);
|
|
276
|
+
}
|
|
222
277
|
if (Object.keys(fmap).length)
|
|
223
278
|
fields[entry.objId] = fmap;
|
|
224
279
|
if (Object.keys(omap).length)
|
|
225
280
|
fieldOptions[entry.objId] = omap;
|
|
226
|
-
void logic;
|
|
227
281
|
}));
|
|
228
282
|
// L5:数据字典表全量映射(字典引用类字段如渠道的 optionId 来源)
|
|
229
283
|
const dictByName = {};
|
|
@@ -389,7 +443,8 @@ export function createRecruitContextLoader() {
|
|
|
389
443
|
}
|
|
390
444
|
}
|
|
391
445
|
catch { /* 缓存读取失败回退闸门链路 */ }
|
|
392
|
-
|
|
446
|
+
// 命中缓存前必须校验关键表单字段;版本对但字段表为空的坏缓存不复用,继续走闸门重建。
|
|
447
|
+
if (diskCache && diskCache.cacheVersion === RECRUIT_CACHE_VERSION && hasCriticalFields(diskCache)) {
|
|
393
448
|
memo.set(memoKey, diskCache);
|
|
394
449
|
return diskCache;
|
|
395
450
|
}
|
|
@@ -418,7 +473,13 @@ export function createRecruitContextLoader() {
|
|
|
418
473
|
...resolved,
|
|
419
474
|
}, null, 2), 'utf8');
|
|
420
475
|
}
|
|
421
|
-
catch {
|
|
476
|
+
catch (error) {
|
|
477
|
+
// 落盘失败不阻塞本次调用,但必须可诊断:落盘坏了会让每次调用都全量重解析(慢),
|
|
478
|
+
// 一旦解析偶发失败就会表现成「字段解析不到」。用 WEAVER_CLI_DEBUG_CACHE=1 打开。
|
|
479
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
480
|
+
console.error('[recruit-context] 缓存落盘失败:', error instanceof Error ? error.message : String(error));
|
|
481
|
+
}
|
|
482
|
+
}
|
|
422
483
|
memo.set(memoKey, resolved);
|
|
423
484
|
return resolved;
|
|
424
485
|
}
|
|
@@ -629,7 +690,7 @@ const candidateList = {
|
|
|
629
690
|
resource: 'recruit',
|
|
630
691
|
method: 'candidate.list',
|
|
631
692
|
action: 'ehr.recruit.candidate.list',
|
|
632
|
-
summary: '查询招聘业务列表(demand 招聘需求 / position 招聘职位 / entry 入职管理 / offer
|
|
693
|
+
summary: '查询招聘业务列表(demand 招聘需求 / position 招聘职位 / entry 入职管理 / offer 录用管理 / interview 面试管理 / candidate 应聘者),displayData 显示层零翻译输出',
|
|
633
694
|
capability: 'recruit',
|
|
634
695
|
risk: READ,
|
|
635
696
|
inputSchema: schemaOf({
|
|
@@ -699,8 +760,23 @@ const candidateList = {
|
|
|
699
760
|
}
|
|
700
761
|
return cleaned;
|
|
701
762
|
});
|
|
763
|
+
// 🔴 行内 id 语义(2026-11-07 实测,必须随数据一起给出,否则 Agent 会去找不存在的字段或拿人名当 id):
|
|
764
|
+
// · 所有类型:`form_data_id` 是**这一行记录本身**的 id(职位/面试/应聘…),卡片链接与后续写操作都用它;
|
|
765
|
+
// · type=position:列表**不返回 position_id**——实测后端字段就没有这一项,行里只有 form_data_id,
|
|
766
|
+
// 要「职位 id」一律用 form_data_id(对应职位卡片 /card/0/<职位objId>/<form_data_id>);
|
|
767
|
+
// · type=interview:`talent_id` / `position_manage_id` 放的是**人名**(displayData 已翻译),不是 id。
|
|
768
|
+
const idNote = type === 'position'
|
|
769
|
+
? '本列表不返回 position_id(后端接口无此字段);职位 id 请用每行的 form_data_id,'
|
|
770
|
+
+ '或改用 type=candidate 列表(那里有真实 position_id 与 talent_id)。'
|
|
771
|
+
: type === 'interview'
|
|
772
|
+
? '本列表的 talent_id / position_manage_id 是人名不是 id;要人才 id 请用 candidate.search 按手机号或姓名取。'
|
|
773
|
+
: type === 'candidate'
|
|
774
|
+
? '本列表的 form_data_id 是「应聘批次(candidateManage)」id,position_id / talent_id 是真实 id,可直接用于卡片与写操作。'
|
|
775
|
+
: undefined;
|
|
702
776
|
return ehrSuccess('ehr.recruit.candidate.list', {
|
|
703
|
-
type, total, totalExact, ...(totalNote ? { totalNote } : {}),
|
|
777
|
+
type, total, totalExact, ...(totalNote ? { totalNote } : {}),
|
|
778
|
+
...(idNote ? { idNote } : {}),
|
|
779
|
+
current: body.current, pageSize: body.pageSize, rows: outRows,
|
|
704
780
|
});
|
|
705
781
|
},
|
|
706
782
|
};
|
|
@@ -900,17 +976,78 @@ const candidateCard = {
|
|
|
900
976
|
const v = randHex6();
|
|
901
977
|
const query = `talentId=${id}&batchId=${batchId}&v=${v}&randomkey_${rk2}=${rk2}`;
|
|
902
978
|
const cardBody = { talentId: id, batchId, current: 1, pageSize: 100 };
|
|
903
|
-
|
|
979
|
+
// D7(2026-11-07 补):人才表单全量字段。
|
|
980
|
+
// `getCandidateCardBaseInfo` 只返回 9 个基础键(姓名/手机/邮箱/渠道/状态/时间/黑名单/附件数),
|
|
981
|
+
// 学历、工作年限、期望薪资、所在城市、教育/工作/项目经历全都读不到。
|
|
982
|
+
// 真正的全量通道是 EB OpenAPI `dataset/v2/getDataById`:
|
|
983
|
+
// objId = 人才表单(cache.forms.talent_pool.objId)
|
|
984
|
+
// mainTable.id = talentId
|
|
985
|
+
// isReturnDetail = 'y' 才会连三张明细表一起返回
|
|
986
|
+
const talentObjId = cache.forms.talent_pool?.objId;
|
|
987
|
+
const [base, other, interview, remark, talentForm] = await Promise.all([
|
|
904
988
|
env.host.request({ path: `/api/recruit/candidate/getCandidateCardBaseInfo?${query}`, headers: extra }),
|
|
905
989
|
env.host.request({ path: `/api/recruit/candidate/getCandidateCardOtherInfo?${query}`, headers: extra }),
|
|
906
990
|
env.host.request({ path: '/api/recruit/candidate/getCandidateCardInterviewInfo', body: cardBody, headers: extra }),
|
|
907
991
|
env.host.request({ path: '/api/recruit/candidate/getCandidateCardRemark', body: cardBody, headers: extra }),
|
|
992
|
+
talentObjId
|
|
993
|
+
? env.host.request({
|
|
994
|
+
path: '/api/ebuilder/form/dataset/v2/getDataById',
|
|
995
|
+
method: 'POST',
|
|
996
|
+
// EB OpenAPI 族的成功标识在 `data.datajson.status`,顶层无 code/status,
|
|
997
|
+
// 走通用业务判定会被误判成失败,故跳过判定(HTTP/解析/会话保护仍然生效)。
|
|
998
|
+
skipBusinessCheck: true,
|
|
999
|
+
body: {
|
|
1000
|
+
datajson: {
|
|
1001
|
+
header: { objId: talentObjId },
|
|
1002
|
+
mainTable: { id },
|
|
1003
|
+
operationinfo: { isReturnDetail: 'y', fieldNoFindIgnore: 'false' },
|
|
1004
|
+
},
|
|
1005
|
+
},
|
|
1006
|
+
headers: extra,
|
|
1007
|
+
})
|
|
1008
|
+
: Promise.resolve(null),
|
|
908
1009
|
]);
|
|
909
1010
|
const statusMap = cache.options?.recruit_status || {};
|
|
910
1011
|
const talent = base?.data?.talent || {};
|
|
911
1012
|
const currentBatch = other?.data?.currentCandidateBatch || {};
|
|
912
1013
|
const interviewList = interview?.data?.list || [];
|
|
913
1014
|
const remarkList = remark?.data?.list || [];
|
|
1015
|
+
// 解析人才表单全量字段。EB 返回的字段值是 { fieldValue | fieldOptionName | fieldOptionId, fieldType, ... }
|
|
1016
|
+
// 的包裹对象;选择类字段没有 fieldValue,只能取 fieldOptionName。空字段(未填)不会出现在返回里。
|
|
1017
|
+
const formRow = talentForm?.data?.datajson?.datas?.[0] || null;
|
|
1018
|
+
// 统一取值:跳过空串,取第一个有效值。
|
|
1019
|
+
// 实测 Cascader(所在地)返回 [{ fieldOptionId:"北京市", fieldOptionName:"" }],
|
|
1020
|
+
// 数组形态同样会被空字段名截住,必须逐个 candidate 判空。
|
|
1021
|
+
const pick = (holder) => {
|
|
1022
|
+
if (holder === undefined || holder === null)
|
|
1023
|
+
return null;
|
|
1024
|
+
for (const candidate of [holder.fieldValue, holder.fieldOptionName, holder.fieldOptionId]) {
|
|
1025
|
+
if (candidate !== undefined && candidate !== null && String(candidate).trim() !== '') {
|
|
1026
|
+
return candidate;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
return null;
|
|
1030
|
+
};
|
|
1031
|
+
const cell = (obj, key) => {
|
|
1032
|
+
const v = obj?.[key];
|
|
1033
|
+
if (v === undefined || v === null)
|
|
1034
|
+
return null;
|
|
1035
|
+
if (Array.isArray(v))
|
|
1036
|
+
return v.length ? pick(v[0]) : null;
|
|
1037
|
+
if (typeof v === 'object')
|
|
1038
|
+
return pick(v);
|
|
1039
|
+
return v;
|
|
1040
|
+
};
|
|
1041
|
+
const mainTable = formRow?.mainTable || {};
|
|
1042
|
+
// 明细表按「是否含某个标志字段」识别种类,不依赖 detail1/detail2 编号
|
|
1043
|
+
// (编号由 dataset/v1/getTableMapping 决定,换表单会变,硬编码编号必错)。
|
|
1044
|
+
const detailGroups = Object.entries(formRow || {})
|
|
1045
|
+
.filter(([key]) => /^detail\d+$/.test(key))
|
|
1046
|
+
.map(([, rows]) => (Array.isArray(rows) ? rows : []));
|
|
1047
|
+
const rowsWith = (probeKey) => detailGroups.find((rows) => rows.some((row) => row?.[probeKey] !== undefined)) || [];
|
|
1048
|
+
const workRows = rowsWith('co_name');
|
|
1049
|
+
const eduRows = rowsWith('school');
|
|
1050
|
+
const projectRows = rowsWith('pj_name');
|
|
914
1051
|
const baseUrl = (await env.host.getSession()).baseUrl.replace(/\/+$/, '');
|
|
915
1052
|
return ehrSuccess('ehr.recruit.candidate.card', {
|
|
916
1053
|
talentId: id,
|
|
@@ -921,10 +1058,22 @@ const candidateCard = {
|
|
|
921
1058
|
baseInfo: {
|
|
922
1059
|
name: talent?.hrm?.name,
|
|
923
1060
|
mobile: talent?.telephone,
|
|
1061
|
+
email: talent?.email || null,
|
|
924
1062
|
channel: talent?.channel,
|
|
925
1063
|
status: statusMap[base?.data?.recruitStatus] || base?.data?.recruitStatus || null,
|
|
926
1064
|
createTime: talent?.createTime,
|
|
1065
|
+
updateTime: talent?.updateTime || null,
|
|
1066
|
+
// 🔴 isBlacklist 后端给的是**字典 optionId**(实测 840803130362052609),不是布尔值;
|
|
1067
|
+
// 该字典名未在 env 缓存里暴露,硬翻会猜错语义,故只保留原始 id 并标明它是 optionId,
|
|
1068
|
+
// 需要「是否拉黑」的业务判断时请到页面确认,不要把长 id 当成 true。
|
|
1069
|
+
isBlacklistOptionId: talent?.isBlacklist || null,
|
|
1070
|
+
resumeFileCount: Array.isArray(talent?.originalResume) ? talent.originalResume.length : 0,
|
|
927
1071
|
},
|
|
1072
|
+
// 🔴 两处 channel 来源不同(2026-11-07 实测,属正常不是 bug):
|
|
1073
|
+
// baseInfo.channel = talent.channel,人才档案里的「简历来源渠道」;
|
|
1074
|
+
// position.channel = currentBatch.channel,本应聘批次走的渠道(如内部遴选)。
|
|
1075
|
+
// 同一人才可有多批次,这两者天然可能不一致,不要当成数据错误去"修正"。
|
|
1076
|
+
channelNote: 'baseInfo.channel 是人才档案的简历来源渠道;position.channel 是当前应聘批次的渠道,两者来源不同、可能不一致。',
|
|
928
1077
|
position: {
|
|
929
1078
|
position: currentBatch?.position?.name,
|
|
930
1079
|
stage: currentBatch?.currentStageName,
|
|
@@ -959,6 +1108,41 @@ const candidateCard = {
|
|
|
959
1108
|
creator: item?.creator?.username || item?.creator?.name || null,
|
|
960
1109
|
content: item?.remark,
|
|
961
1110
|
})),
|
|
1111
|
+
// 人才档案全量(D7 补齐,2026-11-07)。此前 baseInfo 只有 9 个基础键,简历里的学历/年限/薪资都读不到。
|
|
1112
|
+
profile: {
|
|
1113
|
+
highestDegree: cell(mainTable, 'highest_degree'),
|
|
1114
|
+
workYears: cell(mainTable, 'work_exp'),
|
|
1115
|
+
expectSalary: cell(mainTable, 'expect_salary'),
|
|
1116
|
+
currentSalary: cell(mainTable, 'current_salary'),
|
|
1117
|
+
expectIndustry: cell(mainTable, 'expect_industry'),
|
|
1118
|
+
locationArea: cell(mainTable, 'location_area'),
|
|
1119
|
+
college: cell(mainTable, 'college') ?? cell(mainTable, 'hd_college'),
|
|
1120
|
+
major: cell(mainTable, 'major') ?? cell(mainTable, 'hd_major'),
|
|
1121
|
+
graduateDate: cell(mainTable, 'graduate_date'),
|
|
1122
|
+
},
|
|
1123
|
+
workExperiences: workRows.map((row) => ({
|
|
1124
|
+
company: cell(row, 'co_name'),
|
|
1125
|
+
position: cell(row, 'work_position'),
|
|
1126
|
+
start: cell(row, 'start_end_date_0'),
|
|
1127
|
+
end: cell(row, 'start_end_date_1'),
|
|
1128
|
+
})),
|
|
1129
|
+
educations: eduRows.map((row) => ({
|
|
1130
|
+
school: cell(row, 'school'),
|
|
1131
|
+
degree: cell(row, 'edu_education'),
|
|
1132
|
+
major: cell(row, 'edu_major'),
|
|
1133
|
+
start: cell(row, 'study_date_0'),
|
|
1134
|
+
end: cell(row, 'study_date_1'),
|
|
1135
|
+
})),
|
|
1136
|
+
projects: projectRows.map((row) => ({
|
|
1137
|
+
name: cell(row, 'pj_name'),
|
|
1138
|
+
introduction: cell(row, 'pj_introduction'),
|
|
1139
|
+
start: cell(row, 'pj_date_0'),
|
|
1140
|
+
end: cell(row, 'pj_date_1'),
|
|
1141
|
+
})),
|
|
1142
|
+
// 空值不是读取失败:E9 迁移的老人才(如测试人 100005840000020214)只迁了 18 个基础字段,
|
|
1143
|
+
// 教育/工作/项目经历本来就没有数据;新建人才(千里聆解析)通常是三张明细齐全。
|
|
1144
|
+
profileNote: 'profile 与 workExperiences/educations/projects 来自人才表单全量读取;'
|
|
1145
|
+
+ '字段为空表示该人才档案里没录这项(常见于早期 E9 迁移数据),不是读取失败。',
|
|
962
1146
|
});
|
|
963
1147
|
},
|
|
964
1148
|
};
|
|
@@ -9,6 +9,8 @@ import { recruitWriteOperations } from './recruit-write.js';
|
|
|
9
9
|
import { recruitStatsOperations } from './recruit-stats.js';
|
|
10
10
|
import { recruitPositionOperations } from './recruit-position.js';
|
|
11
11
|
import { recruitCandidateImportOperations } from './recruit-candidate-import.js';
|
|
12
|
+
import { recruitTagOperations } from './recruit-tag.js';
|
|
13
|
+
import { recruitInterviewOverviewOperations } from './recruit-interview-overview.js';
|
|
12
14
|
import { salaryOperations } from './salary.js';
|
|
13
15
|
function buildRegistry() {
|
|
14
16
|
const registry = new Map();
|
|
@@ -24,6 +26,8 @@ function buildRegistry() {
|
|
|
24
26
|
...recruitStatsOperations,
|
|
25
27
|
...recruitPositionOperations,
|
|
26
28
|
...recruitCandidateImportOperations,
|
|
29
|
+
...recruitTagOperations,
|
|
30
|
+
...recruitInterviewOverviewOperations,
|
|
27
31
|
];
|
|
28
32
|
for (const definition of definitions) {
|
|
29
33
|
if (registry.has(definition.name)) {
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { getEhrOperation } from './operations/registry.js';
|
|
2
2
|
import { assertNoForbiddenKeys, asObject } from './operations/shared.js';
|
|
3
|
+
import { ehrValidationError } from './errors.js';
|
|
3
4
|
import { createRecruitContextLoader } from './operations/recruit.js';
|
|
5
|
+
/**
|
|
6
|
+
* 拒绝未声明的参数(2026-11-07 新增)。
|
|
7
|
+
*
|
|
8
|
+
* 背景:`schemaOf` 只声明 `additionalProperties:false`,运行时不校验 —— 实测
|
|
9
|
+
* `ehr.recruit.candidate.search` 传 `keyword`(真名是 `name`/`mobile`)**不报错**,
|
|
10
|
+
* 而是把查询条件整个丢掉、返回最近 10 条无关数据,Agent 会误以为查到了。
|
|
11
|
+
* 这类「参数名写错被静默忽略」最难排查,故在入口直接拒绝,并把支持列表回给调用方。
|
|
12
|
+
*
|
|
13
|
+
* 只校验未知键,不校验 required(required 缺失由各 handler 抛更具体的业务错误)。
|
|
14
|
+
*/
|
|
15
|
+
function assertKnownArguments(definition, input) {
|
|
16
|
+
const schema = definition.inputSchema;
|
|
17
|
+
if (!schema || schema.additionalProperties !== false)
|
|
18
|
+
return;
|
|
19
|
+
const props = (schema.properties || {});
|
|
20
|
+
const known = Object.keys(props);
|
|
21
|
+
const unknown = Object.keys(input).filter((key) => !known.includes(key));
|
|
22
|
+
if (unknown.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
throw ehrValidationError('unknown_argument', `未知参数:${unknown.join('、')}。本操作支持的参数:${known.length ? known.join('、') : '(无)'}。`
|
|
25
|
+
+ '参数名写错会被静默忽略并返回看似正常的结果,请按上面的参数名重传。');
|
|
26
|
+
}
|
|
4
27
|
export async function executeEhrOperation(operation, rawInput, context) {
|
|
5
28
|
const definition = getEhrOperation(operation);
|
|
6
29
|
const input = asObject(rawInput);
|
|
7
30
|
assertNoForbiddenKeys(input);
|
|
31
|
+
assertKnownArguments(definition, input);
|
|
8
32
|
const host = {
|
|
9
33
|
request(request) {
|
|
10
34
|
return context.host.request({
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量任务的暂存清单(2026-11-06)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用 continuation 直接携带:
|
|
5
|
+
* 批量简历导入的每一项都带 `structured`(整份简历 JSON),几十份时 token 会膨胀到几十万字符,
|
|
6
|
+
* Agent 传参不现实。这里把清单落到本机 `~/.weaver-work-cli/batch/`,token 只带文件路径 + 指纹;
|
|
7
|
+
* apply 时重算指纹,不一致即拒绝(防止清单被中途改写)。
|
|
8
|
+
*
|
|
9
|
+
* 安全:
|
|
10
|
+
* - 目录 0700、文件 0600;
|
|
11
|
+
* - 只允许读 batch 目录内的文件(防越权读任意路径);
|
|
12
|
+
* - 24 小时以上的旧清单在下次写入时清理。
|
|
13
|
+
*/
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
15
|
+
import { chmodSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { homedir } from 'node:os';
|
|
17
|
+
import { join, resolve, sep } from 'node:path';
|
|
18
|
+
import { rsValidationError } from './errors.js';
|
|
19
|
+
function batchDir() {
|
|
20
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
|
|
21
|
+
const dir = join(home, 'batch');
|
|
22
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
function digest(value) {
|
|
26
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
27
|
+
}
|
|
28
|
+
function cleanup(dir) {
|
|
29
|
+
try {
|
|
30
|
+
const now = Date.now();
|
|
31
|
+
for (const f of readdirSync(dir)) {
|
|
32
|
+
if (!f.endsWith('.json'))
|
|
33
|
+
continue;
|
|
34
|
+
const p = join(dir, f);
|
|
35
|
+
try {
|
|
36
|
+
if (now - statSync(p).mtimeMs > 24 * 3600 * 1000)
|
|
37
|
+
unlinkSync(p);
|
|
38
|
+
}
|
|
39
|
+
catch { /* 单文件清理失败忽略 */ }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch { /* 目录不可读忽略 */ }
|
|
43
|
+
}
|
|
44
|
+
/** 落盘批量清单,返回文件路径与内容指纹。 */
|
|
45
|
+
export function saveBatchItems(kind, items) {
|
|
46
|
+
const dir = batchDir();
|
|
47
|
+
cleanup(dir);
|
|
48
|
+
const fingerprint = digest(items);
|
|
49
|
+
const file = join(dir, `${kind}-${fingerprint.slice(0, 16)}.json`);
|
|
50
|
+
writeFileSync(file, JSON.stringify(items), { mode: 0o600 });
|
|
51
|
+
try {
|
|
52
|
+
chmodSync(file, 0o600);
|
|
53
|
+
}
|
|
54
|
+
catch { /* Windows 上可能不支持 */ }
|
|
55
|
+
return { file, fingerprint };
|
|
56
|
+
}
|
|
57
|
+
/** 读取并校验批量清单(路径必须在 batch 目录内,内容指纹必须与 token 一致)。 */
|
|
58
|
+
export function loadBatchItems(file, expectedFingerprint) {
|
|
59
|
+
const dir = resolve(batchDir());
|
|
60
|
+
const target = resolve(String(file || ''));
|
|
61
|
+
if (!target.startsWith(dir + sep)) {
|
|
62
|
+
throw rsValidationError('batch_file_invalid', '批量清单路径非法(必须位于 CLI 的 batch 目录内)');
|
|
63
|
+
}
|
|
64
|
+
let items;
|
|
65
|
+
try {
|
|
66
|
+
items = JSON.parse(readFileSync(target, 'utf8'));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw rsValidationError('batch_file_missing', '批量清单已失效(文件被移动或删除),请重新 prepare');
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(items)) {
|
|
72
|
+
throw rsValidationError('batch_file_invalid', '批量清单格式不正确,请重新 prepare');
|
|
73
|
+
}
|
|
74
|
+
if (digest(items) !== String(expectedFingerprint || '')) {
|
|
75
|
+
throw rsValidationError('batch_file_tampered', '批量清单与确认时不一致(文件被修改),已拒绝执行,请重新 prepare');
|
|
76
|
+
}
|
|
77
|
+
return items;
|
|
78
|
+
}
|