weaver-work-cli 0.1.70 → 0.1.73
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-VUTREF3P.js → archive-THZV4ND4.js} +22 -5
- package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-PQ23OLEV.js} +17 -5
- package/dist/chunks/{asset-45U6TY7I.js → asset-RGPROZYH.js} +22 -5
- package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-Z2PDX7NA.js} +15 -5
- package/dist/chunks/{attachment-content-DMU7KNZ7.js → attachment-content-R3RPVOYE.js} +3 -3
- package/dist/chunks/{blog-5AML4WMG.js → blog-7U3QZPIF.js} +25 -5
- package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-3AB42GCV.js} +22 -8
- package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-KINM64E4.js} +15 -5
- package/dist/chunks/{chunk-EHH363SP.js → chunk-2CHGUYMG.js} +4 -4
- package/dist/chunks/{chunk-GWM5TLIK.js → chunk-2XED2FKY.js} +34 -34
- package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
- package/dist/chunks/{chunk-QYDSTYGG.js → chunk-4BXR6CNB.js} +3 -3
- package/dist/chunks/{chunk-KDOJW5LH.js → chunk-4I26YMBY.js} +1 -1
- package/dist/chunks/{chunk-X6PMJQGO.js → chunk-4YXAK6OA.js} +19 -8
- package/dist/chunks/{chunk-HG6INLH6.js → chunk-54ST55IJ.js} +28 -7
- package/dist/chunks/{chunk-DSBV4GRK.js → chunk-6HT73VOI.js} +3 -3
- package/dist/chunks/{chunk-4W6BSNIL.js → chunk-7QFVXP2X.js} +6 -6
- package/dist/chunks/{chunk-I5XB4MZT.js → chunk-AMAPQVBT.js} +95 -65
- package/dist/chunks/{chunk-L2A3COWV.js → chunk-BWYVS62Z.js} +4 -4
- package/dist/chunks/{chunk-UPVAQJKS.js → chunk-DRUND2PJ.js} +130 -79
- package/dist/chunks/{chunk-LJE7RZNC.js → chunk-F4HM25K4.js} +1 -1
- package/dist/chunks/{chunk-T24EBWAZ.js → chunk-GAMGDNTF.js} +48 -21
- package/dist/chunks/{chunk-H2NRTGZR.js → chunk-GWJLAF6B.js} +3 -3
- package/dist/chunks/{chunk-XIBMZEDB.js → chunk-IBSJJGXL.js} +2 -2
- package/dist/chunks/{chunk-VZUH3LKI.js → chunk-ICP53R52.js} +167 -157
- package/dist/chunks/{chunk-LRKKKO5A.js → chunk-IU6UB2TD.js} +3 -4
- package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
- package/dist/chunks/{chunk-727VKJQK.js → chunk-JMJBPP4B.js} +2 -2
- package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-L7TYG5SN.js} +3 -3
- package/dist/chunks/{chunk-HAORST2G.js → chunk-LLCMOZ5L.js} +11 -11
- package/dist/chunks/{chunk-U3OO3IZF.js → chunk-NUP4RYZK.js} +20 -7
- package/dist/chunks/{chunk-IVCOZCAW.js → chunk-PAFOLIYQ.js} +1 -1
- package/dist/chunks/{chunk-LSVA7QA6.js → chunk-R3MK2RBN.js} +3 -1
- package/dist/chunks/{chunk-GFOFUH6O.js → chunk-TV46Q4NY.js} +52 -51
- package/dist/chunks/chunk-WM33BSIL.js +136 -0
- package/dist/chunks/{chunk-7CINV2BU.js → chunk-XZBYRYWX.js} +2 -2
- package/dist/chunks/{chunk-E7VWE2XI.js → chunk-ZWLWXHJC.js} +3 -3
- package/dist/chunks/{conflict-YW5BULJ3.js → conflict-VPAR7E6F.js} +2 -2
- package/dist/chunks/{contract-3PMHUASH.js → contract-DDXAO2DZ.js} +48 -5
- package/dist/chunks/{cowork-FZBTTBYX.js → cowork-34QCHMDD.js} +37 -8
- package/dist/chunks/{create-flow-5OBS3B3V.js → create-flow-52PU2OBI.js} +6 -6
- package/dist/chunks/{data-2YZ6A6TL.js → data-CLQ62QGD.js} +99 -184
- package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-W5R7Q22S.js} +17 -7
- package/dist/chunks/{ehr-MNPR4TE5.js → ehr-LCNAVMK5.js} +67 -17
- package/dist/chunks/{entry-mode-L65OWPFM.js → entry-mode-6Z3ZV3DE.js} +3 -3
- package/dist/chunks/{env-XW7LYIME.js → env-RDKWAARB.js} +2 -2
- package/dist/chunks/{esb-GSB5QCEX.js → esb-ANKPUU65.js} +17 -7
- package/dist/chunks/{factory-MHFZZAGH.js → factory-434B7RAT.js} +1 -1
- package/dist/chunks/{fna-XBSNUS2V.js → fna-AKBSG5HI.js} +15 -5
- package/dist/chunks/{group-chat-EEOLO5NM.js → group-chat-PROTW22R.js} +3 -3
- package/dist/chunks/{host-NVDG3NC6.js → host-5R2SNFWD.js} +4 -4
- package/dist/chunks/{host-2UMNXX5H.js → host-7FJW4E7R.js} +4 -4
- package/dist/chunks/{host-XVWBOSEN.js → host-CGXUFQO4.js} +4 -4
- package/dist/chunks/{host-R7BP3CTI.js → host-PDJAKCT7.js} +6 -4
- package/dist/chunks/{host-SYPCA63D.js → host-WO4L5G5I.js} +4 -4
- package/dist/chunks/{host-BD44ASOD.js → host-XIYG4F4B.js} +4 -4
- package/dist/chunks/{hrm-FZUDJAND.js → hrm-WGODDTEH.js} +15 -6
- package/dist/chunks/{im-F5NENPD7.js → im-YKTKAJU3.js} +16 -6
- package/dist/chunks/{invoice-DS6FLU55.js → invoice-PVYCCCVM.js} +27 -6
- package/dist/chunks/{jiuchuanhui-JCBUR563.js → jiuchuanhui-RKOQW7BY.js} +19 -6
- package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-DW45AFQ5.js} +6 -6
- package/dist/chunks/{mail-ZEOSANEJ.js → mail-BNB5S4NW.js} +116 -97
- package/dist/chunks/{meeting-PCD5EPBF.js → meeting-O2KDJH66.js} +29 -16
- package/dist/chunks/{minute-doc-WTZJVCHG.js → minute-doc-JUCG56GY.js} +4 -4
- package/dist/chunks/{okr-OZUMTMCL.js → okr-LWFGWOE7.js} +15 -5
- package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
- package/dist/chunks/{operations-UTUWFJTX.js → operations-532PN5OB.js} +5 -5
- package/dist/chunks/{performance-SMVTPK6T.js → performance-7W5COCFU.js} +92 -7
- package/dist/chunks/{plan-C2NENH42.js → plan-ZVY3IYTL.js} +15 -5
- package/dist/chunks/{project-FAJ2P3UR.js → project-SA62B7MH.js} +18 -5
- package/dist/chunks/{reception-NH6MJFPR.js → reception-NGIONPQ3.js} +128 -49
- package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-WOSN6MGP.js} +1264 -197
- package/dist/chunks/{registry-FTPUUHWC.js → registry-N7P3W2RD.js} +5 -5
- package/dist/chunks/{registry-3B3OAJYX.js → registry-R72GWXOG.js} +4 -4
- package/dist/chunks/{registry-ZQ7OONCB.js → registry-RIQ67ZT7.js} +12 -12
- package/dist/chunks/{room-recommend-73NBN3RU.js → room-recommend-KCGIVUFR.js} +4 -4
- package/dist/chunks/{schedule-SDBOBBUQ.js → schedule-6UP27HQ4.js} +4 -4
- package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-DDOQSPRB.js} +19 -6
- package/dist/chunks/{workflow-OWHWLAOX.js → workflow-V5ALD6QZ.js} +22 -8
- package/dist/cmd/auth/index.js +23 -0
- package/dist/cmd/e10/index.js +2 -1
- package/dist/cmd/index.js +2 -0
- package/dist/core/manifest-view.js +207 -0
- package/dist/core/output.js +42 -8
- package/dist/index.js +35 -35
- package/dist/internal/e10/auth/crypto.js +18 -8
- package/dist/internal/e10/auth/error-log.js +1 -2
- package/dist/internal/e10/auth/messages.js +2 -3
- package/dist/internal/e10/auth/xiaoe.js +1 -1
- package/dist/internal/e10/tls-policy.js +61 -13
- package/dist/shortcuts/archive/index.js +11 -2
- package/dist/shortcuts/archive/operations/download.js +1 -0
- package/dist/shortcuts/archive/operations/flow-url.js +3 -0
- package/dist/shortcuts/archive/operations/prelib.js +2 -0
- package/dist/shortcuts/archive/operations/upload.js +1 -0
- package/dist/shortcuts/archive-oa/index.js +11 -2
- package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
- package/dist/shortcuts/asset/index.js +11 -2
- package/dist/shortcuts/asset/manifest.js +7 -0
- package/dist/shortcuts/asset-idle/index.js +11 -2
- package/dist/shortcuts/blog/index.js +11 -2
- package/dist/shortcuts/blog/manifest.js +10 -0
- package/dist/shortcuts/caizhilian/host.js +20 -4
- package/dist/shortcuts/caizhilian/index.js +12 -2
- package/dist/shortcuts/caizhilian/manifest.js +4 -25
- package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
- package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
- package/dist/shortcuts/calendar/index.js +11 -2
- package/dist/shortcuts/contract/index.js +11 -2
- package/dist/shortcuts/contract/manifest.js +32 -0
- package/dist/shortcuts/contract/operations/write.js +3 -0
- package/dist/shortcuts/cowork/index.js +21 -5
- package/dist/shortcuts/cowork/manifest.js +3 -0
- package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
- package/dist/shortcuts/cowork/operations/item-write.js +3 -0
- package/dist/shortcuts/cowork/operations/member-write.js +2 -0
- package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
- package/dist/shortcuts/cowork/operations/review-write.js +1 -0
- package/dist/shortcuts/data/errors.js +16 -29
- package/dist/shortcuts/data/host.js +16 -7
- package/dist/shortcuts/data/index.js +12 -41
- package/dist/shortcuts/data/manifest.js +5 -44
- package/dist/shortcuts/data/operations/attend.js +2 -2
- package/dist/shortcuts/data/operations/conf.js +0 -88
- package/dist/shortcuts/data/operations/ds.js +4 -4
- package/dist/shortcuts/data/operations/index.js +1 -5
- package/dist/shortcuts/data/operations/module.js +40 -14
- package/dist/shortcuts/data/operations/query.js +2 -2
- package/dist/shortcuts/ebuilder-form/index.js +11 -2
- package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
- package/dist/shortcuts/ehr/index.js +11 -2
- package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
- package/dist/shortcuts/ehr/operations/recruit-position.js +4 -3
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +3 -3
- package/dist/shortcuts/ehr/operations/recruit.js +206 -82
- package/dist/shortcuts/ehr/operations/shared.js +31 -0
- package/dist/shortcuts/esb/index.js +11 -2
- package/dist/shortcuts/esb/manifest.js +2 -0
- package/dist/shortcuts/fna/index.js +11 -2
- package/dist/shortcuts/hrm/index.js +11 -1
- package/dist/shortcuts/im/index.js +11 -2
- package/dist/shortcuts/invoice/index.js +11 -2
- package/dist/shortcuts/invoice/manifest.js +8 -0
- package/dist/shortcuts/jiuchuanhui/index.js +15 -1
- package/dist/shortcuts/jiuchuanhui/manifest.js +2 -0
- package/dist/shortcuts/mail/errors.js +14 -0
- package/dist/shortcuts/mail/index.js +23 -6
- package/dist/shortcuts/mail/manifest.js +11 -4
- package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
- package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
- package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
- package/dist/shortcuts/mail/operations/mail-read.js +7 -25
- package/dist/shortcuts/mail/operations/mail-send.js +12 -12
- package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
- package/dist/shortcuts/mail/operations/mail-template.js +10 -10
- package/dist/shortcuts/meeting/index.js +11 -2
- package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
- package/dist/shortcuts/okr/index.js +11 -2
- package/dist/shortcuts/performance/index.js +62 -3
- package/dist/shortcuts/performance/scheme-validate.js +7 -0
- package/dist/shortcuts/performance/shared.js +40 -2
- package/dist/shortcuts/plan/index.js +11 -2
- package/dist/shortcuts/project/index.js +11 -2
- package/dist/shortcuts/project/operations/write.js +3 -0
- package/dist/shortcuts/reception/constants.js +22 -0
- package/dist/shortcuts/reception/index.js +15 -2
- package/dist/shortcuts/reception/manifest.js +17 -3
- package/dist/shortcuts/reception/operations/ask.js +3 -0
- package/dist/shortcuts/reception/operations/doc.js +24 -11
- package/dist/shortcuts/reception/operations/docrender.js +18 -1
- package/dist/shortcuts/reception/operations/render-assets.js +93 -22
- package/dist/shortcuts/recruit-stage/context.js +12 -6
- package/dist/shortcuts/recruit-stage/index.js +22 -3
- package/dist/shortcuts/recruit-stage/manifest.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +19 -10
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +487 -38
- package/dist/shortcuts/recruit-stage/operations/list.js +72 -1
- package/dist/shortcuts/recruit-stage/operations/profile.js +194 -0
- package/dist/shortcuts/recruit-stage/operations/registry.js +20 -2
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +258 -63
- package/dist/shortcuts/recruit-stage/operations/search.js +226 -27
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +122 -0
- package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
- package/dist/shortcuts/recruit-stage/shared.js +158 -4
- package/dist/shortcuts/smart-extract/index.js +11 -2
- package/dist/shortcuts/smart-extract/manifest.js +1 -0
- package/dist/shortcuts/smart-extract/operations/save.js +2 -0
- package/dist/shortcuts/workflow/index.js +21 -1
- package/dist/shortcuts/workflow/operations/form.js +36 -2
- package/dist/shortcuts/workflow/operations/read.js +2 -2
- package/dist/shortcuts/workflow/operations/write.js +1 -1
- package/docs/caizhilian.md +1 -1
- package/docs/contract.md +1 -0
- package/docs/data.md +22 -22
- package/docs/e10-auth.md +41 -33
- package/docs/ehr.md +2 -0
- package/docs/reception.md +4 -3
- package/package.json +1 -1
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/scripts/pysite/sitecustomize.py +41 -0
- package/skill-template/domains/data.md +4 -4
- package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
- package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
- package/skills/weaver-e10-cowork/SKILL.md +3 -1
- package/skills/weaver-e10-data/SKILL.md +12 -16
- package/skills/weaver-e10-data/references/config-center.md +6 -7
- package/skills/weaver-e10-data/references/datasource.md +1 -1
- package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -4
- package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +18 -8
- package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
- package/skills/weaver-e10-jucailin/SKILL.md +7 -3
- package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
- package/skills/weaver-e10-mail/SKILL.md +4 -1
- package/skills/weaver-e10-mail/references/mail-read.md +4 -2
- package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-performance/SKILL.md +8 -6
- package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
- package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +557 -75
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +67 -44
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +279 -0
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +198 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +697 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +507 -0
- package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +19 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +19 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +15 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +37 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +64 -28
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +43 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +41 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +25 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +51 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +63 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +58 -33
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +5 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +11 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +106 -0
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +325 -0
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +265 -0
- package/skills/weaver-e10-shared/SKILL.md +22 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
- package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
|
@@ -4,6 +4,7 @@ import { ehrConfirmationError, ehrValidationError } from '../errors.js';
|
|
|
4
4
|
import { WRITE, SCHEMA_ID, ehrSuccess, schemaOf, } from './types.js';
|
|
5
5
|
import { buildListBody, fetchListRows, } from './recruit.js';
|
|
6
6
|
import { getDsOptions, getFormDataRecord, resolvePersonId, saveFormData, toSubmitDetails, } from './recruit-write.js';
|
|
7
|
+
import { toMenuList } from './shared.js';
|
|
7
8
|
/**
|
|
8
9
|
* 职位 JD 建职位(口述 → JD 文本 → 建到招聘职位列表)。
|
|
9
10
|
*
|
|
@@ -129,13 +130,13 @@ async function findWorkPlaceMenu(env, cache) {
|
|
|
129
130
|
}));
|
|
130
131
|
const flat = [];
|
|
131
132
|
(function walk(nodes) {
|
|
132
|
-
for (const n of nodes
|
|
133
|
+
for (const n of toMenuList(nodes)) {
|
|
133
134
|
if (n && typeof n === 'object') {
|
|
134
135
|
flat.push(n);
|
|
135
|
-
walk(n.children
|
|
136
|
+
walk(n.children ?? n.childs);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
|
-
})(
|
|
139
|
+
})(r?.data);
|
|
139
140
|
return pick(flat);
|
|
140
141
|
}
|
|
141
142
|
catch {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 招聘写通道短缓存:只用于「跨进程仍然成立、且短时间不会变」的解析结果
|
|
3
|
-
* (人员姓名→userId、ds/options
|
|
4
|
-
*
|
|
3
|
+
* (人员姓名→userId、当前登录人 personId、ds/options 枚举、公共标签列表)。
|
|
4
|
+
* CLI 每次调用都是新进程,进程内 memo 无效,所以这里落盘(TTL 到期自动失效)。
|
|
5
|
+
* `E10_RS_NO_SHORT_CACHE=1` 可整体关闭。
|
|
5
6
|
*
|
|
7
|
+
* 合规口径(2026-11-28 用户裁定):person / self-person 缓存只含
|
|
8
|
+
* 「姓名 → 内部人员 id(+ 是否等于 session.userId)」,不含密码、票据、手机号、身份证,
|
|
9
|
+
* 判定不违规,保留落盘(TTL 15min / 7 天)。若将来缓存内容扩展到敏感字段,必须重新评估。
|
|
6
10
|
* 不动任何业务判定:缓存只保存「解析成功的结果」,读不到/过期就重新请求。
|
|
7
11
|
*/
|
|
8
12
|
import { createHash } from 'node:crypto';
|
|
@@ -242,9 +242,9 @@ export async function resolvePersonId(host, _fieldId, keyword) {
|
|
|
242
242
|
const kw = String(keyword || '').trim();
|
|
243
243
|
if (!kw)
|
|
244
244
|
return null;
|
|
245
|
+
// 2026-11-28 用户裁定:缓存只含「姓名→内部人员 id」,无密码/票据/手机号,不违规 → 恢复 15min 短缓存。
|
|
246
|
+
// 命中多人仍抛 person_ambiguous(cachedShort 只在 loader 正常返回时写,异常不落盘)。
|
|
245
247
|
const session = await host.getSession();
|
|
246
|
-
// 人员解析短缓存(15 min):写通道最高频的一笔(默认面试官=当前登录人,实测 0.61 s/次)。
|
|
247
|
-
// 只缓存「解析结果」(userId 或 null),命中多人仍抛歧义、绝不缓存。
|
|
248
248
|
return cachedShort('person', session.baseUrl, kw, 15 * 60 * 1000, () => lookupPersonId(host, kw));
|
|
249
249
|
}
|
|
250
250
|
async function lookupPersonId(host, kw) {
|
|
@@ -296,7 +296,7 @@ async function lookupPersonId(host, kw) {
|
|
|
296
296
|
* - 相等 → 后续同环境同姓名直接返回 session.userId(**零请求**);
|
|
297
297
|
* - 不相等 → 后续直接用实证得到的 personId(也不再检索);
|
|
298
298
|
* - 姓名变了(换账号/换人)→ 重新实证一次。
|
|
299
|
-
* 只缓存「实证结果」,不缓存任何猜测值。
|
|
299
|
+
* 只缓存「实证结果」,不缓存任何猜测值。2026-11-28 用户裁定该缓存内容不违规、恢复使用。
|
|
300
300
|
*/
|
|
301
301
|
async function resolveSelfPersonId(host, selfName) {
|
|
302
302
|
const name = String(selfName || '').trim();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync,
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { ehrValidationError } from '../errors.js';
|
|
6
6
|
import { READ, SCHEMA_ID, ehrSuccess, schemaOf, } from './types.js';
|
|
7
|
-
import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
7
|
+
import { compact, normalizePaged, toMenuList, toNumber, toPageQuery, toPositiveInt } from './shared.js';
|
|
8
|
+
import { isXiaoECloudRuntime } from '../../../internal/e10/auth/xiaoe.js';
|
|
8
9
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
9
10
|
// 五层运行时解析(迁移自 ehr 技能 _init_env_cache.mjs,真机验证过)
|
|
10
11
|
// getAppIds -> getObjsByTag -> allMenus -> ds/fields -> ds/options
|
|
@@ -14,9 +15,41 @@ import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from '.
|
|
|
14
15
|
// 设同一 E10_SKILL_CACHE_DIR 即可共享缓存)。菜单名跨版本不同,解析不到必须报错,禁止臆造。
|
|
15
16
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
16
17
|
const RECRUIT_APP_TAG = 'weaver-recruit-service';
|
|
18
|
+
/**
|
|
19
|
+
* 自用系统租户标识(2026-11-28 用户指定,租户 key 唯一)。
|
|
20
|
+
*
|
|
21
|
+
* 判「是否自用环境」原有两条依据,都不够稳:
|
|
22
|
+
* · selfUse:来自业务配置表 config_key=-9999,配置表读不到/无权限时恒为 '0';
|
|
23
|
+
* · 域名:同一套自用环境可能有多个入口(www.e-cology.com.cn / 内网 IP / 带端口),
|
|
24
|
+
* 域名不匹配就漏判,但底层数据其实是同一套。
|
|
25
|
+
* tenantKey 是平台级唯一标识,与入口地址、菜单权限、配置表都无关,作为主判据最可靠。
|
|
26
|
+
* 这里只列自用租户;匹配不到仍按原逻辑判断,不影响其他环境。
|
|
27
|
+
*/
|
|
28
|
+
export const SELF_TENANT_KEYS = new Set(['t7akvdnf84']);
|
|
29
|
+
/** 是否自用租户:tenantKey 唯一命中即认定 */
|
|
30
|
+
export function isSelfTenant(tenantKey) {
|
|
31
|
+
const key = String(tenantKey || '').trim();
|
|
32
|
+
return !!key && SELF_TENANT_KEYS.has(key);
|
|
33
|
+
}
|
|
17
34
|
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
18
|
-
/**
|
|
19
|
-
|
|
35
|
+
/**
|
|
36
|
+
* 环境缓存结构版本:新增/变更解析字段时 +1,旧缓存自动失效重建。
|
|
37
|
+
*
|
|
38
|
+
* v5(2026-11-28 缓存治理):① 新增 savedAt/degraded 字段;② 命中规则改为
|
|
39
|
+
* 「先闸门取 appId → 精确读 <appId>.json」,旧遍历命中废除;③ 新增 12h TTL。
|
|
40
|
+
* 升版后所有旧缓存(含另一台机器上「菜单失败→字典空」固化的 v4 缓存)自动作废,
|
|
41
|
+
* 无需用户手工删除。
|
|
42
|
+
*/
|
|
43
|
+
export const RECRUIT_CACHE_VERSION = 5;
|
|
44
|
+
/**
|
|
45
|
+
* 磁盘缓存 TTL(2026-11-28 新增)。
|
|
46
|
+
*
|
|
47
|
+
* 旧实现磁盘缓存**永不过期**(实测 19.6 天前的缓存仍在用),菜单改名/字段调整/
|
|
48
|
+
* 字典更新不会被感知,只能手工 cacheVersion+1。快照虽有 12h TTL + 双探针,
|
|
49
|
+
* 但它只在主缓存 miss 后才走——主缓存命中即 return,快照的时效保护被完全短路。
|
|
50
|
+
* 现在主缓存与快照统一 12h:过期 → 快照双探针 → 全量重建,配置漂移最多 12h 自愈。
|
|
51
|
+
*/
|
|
52
|
+
const RECRUIT_CACHE_TTL_MS = 12 * 60 * 60 * 1000;
|
|
20
53
|
/**
|
|
21
54
|
* 关键表单:解析不到字段列表即判定招聘上下文不可用。
|
|
22
55
|
*
|
|
@@ -33,7 +66,15 @@ const RECRUIT_CRITICAL_FORM_LABELS = {
|
|
|
33
66
|
talent_pool: '人才库',
|
|
34
67
|
interview_plan: '面试管理',
|
|
35
68
|
};
|
|
36
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* 磁盘缓存健康检查(2026-11-28 缓存治理后共三条,任一不满足即判坏必须重建):
|
|
71
|
+
* ① 关键表单必须解析到 objId 且字段表非空(原有,11-06 修复);
|
|
72
|
+
* ② degraded 非空 → 本次解析有可选依赖失败(菜单/字典/枚举),上下文残缺;
|
|
73
|
+
* ③(2026-11-28 修订)**已移除**「关键业务列表必须解析到」这一条:菜单接口失败已由
|
|
74
|
+
* degraded 承担;「菜单正常但租户改名/缺项」属环境配置问题,判坏只会让该环境
|
|
75
|
+
* 每次都全量解析(永久慢 2.4 s)而列表功能照样报错,不落盘无收益。
|
|
76
|
+
* 这类环境由 12 h TTL 兜底:配置修正后最迟 12 h 自动重建。
|
|
77
|
+
*/
|
|
37
78
|
function hasCriticalFields(cache) {
|
|
38
79
|
for (const logic of RECRUIT_CRITICAL_FORMS) {
|
|
39
80
|
const objId = cache?.forms?.[logic]?.objId;
|
|
@@ -46,6 +87,13 @@ function hasCriticalFields(cache) {
|
|
|
46
87
|
if (!Object.keys(fmap).length)
|
|
47
88
|
return false;
|
|
48
89
|
}
|
|
90
|
+
// ② 降级标记:非空 = 残缺上下文,绝不复用(防御旧版本/外部写入的 degraded 缓存)
|
|
91
|
+
if (Array.isArray(cache?.degraded) && cache.degraded.length)
|
|
92
|
+
return false;
|
|
93
|
+
// ③(2026-11-28 修订,采纳小E 复审意见):不再强制 candidate/position listId。
|
|
94
|
+
// 「菜单接口失败」已由 degraded 承担;「菜单正常但租户菜单改名/缺项」属环境配置问题,
|
|
95
|
+
// 判坏只会让该环境每次全量解析(永久慢 2.4s)而列表功能照样报错,不落盘无收益。
|
|
96
|
+
// 落盘后由 12h TTL 兜底:环境配置修正后最多 12h 自动重建。
|
|
49
97
|
return true;
|
|
50
98
|
}
|
|
51
99
|
const RECRUIT_TAGS = {
|
|
@@ -131,6 +179,8 @@ function snapshotPathFor(baseUrl) {
|
|
|
131
179
|
return join(cacheDirFor(baseUrl), '..', '_recruit-stage', `context-snapshot-${host}.json`);
|
|
132
180
|
}
|
|
133
181
|
function readContextSnapshot(baseUrl) {
|
|
182
|
+
if (isXiaoECloudRuntime())
|
|
183
|
+
return null; /* 云端容器不持久,读快照无意义 */
|
|
134
184
|
try {
|
|
135
185
|
const raw = JSON.parse(readFileSync(snapshotPathFor(baseUrl), 'utf8'));
|
|
136
186
|
if (!raw?.at || raw.cacheVersion !== RECRUIT_CACHE_VERSION)
|
|
@@ -146,6 +196,11 @@ function readContextSnapshot(baseUrl) {
|
|
|
146
196
|
}
|
|
147
197
|
}
|
|
148
198
|
function writeContextSnapshot(baseUrl, appId, resolved) {
|
|
199
|
+
// 与 persistContextCache 同口径:残缺上下文不写快照(否则快照文件成为永不过期的残缺源)
|
|
200
|
+
if (Array.isArray(resolved?.degraded) && resolved.degraded.length)
|
|
201
|
+
return;
|
|
202
|
+
if (isXiaoECloudRuntime())
|
|
203
|
+
return; /* 云端容器不持久,写快照无意义 */
|
|
149
204
|
try {
|
|
150
205
|
const path = snapshotPathFor(baseUrl);
|
|
151
206
|
mkdirSync(join(path, '..'), { recursive: true });
|
|
@@ -256,6 +311,8 @@ async function fetchFormFields(host, appId, objId) {
|
|
|
256
311
|
}
|
|
257
312
|
/** 五层解析主流程(磁盘缓存缺失时执行;每层失败必须报错,禁止臆造) */
|
|
258
313
|
async function resolveRecruitEnv(host, appId) {
|
|
314
|
+
// 解析降级标记:可选依赖(菜单/字典/枚举)失败时留痕,残缺上下文不落盘不命中(见 hasCriticalFields)
|
|
315
|
+
const degraded = [];
|
|
259
316
|
// L2:tag 解析各表单 objId/formId(顺带 tenantKey)
|
|
260
317
|
// 🔴 2026-11-18 提速:14 个 tag 由串行改并发(原实现逐个 await,冷启动白等 13 个 RTT)。
|
|
261
318
|
// 保持原语义:① 任一请求失败仍向上抛(Promise.all 不吞异常,与原串行一致);
|
|
@@ -285,22 +342,46 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
285
342
|
continue;
|
|
286
343
|
throw new RecruitContextError('recruit_form_unresolved', `当前环境未解析到「${RECRUIT_CRITICAL_FORM_LABELS[logic] || logic}」表单(getObjsByTag 返回空),已中止且未写入缓存;请确认招聘应用已安装、账号对该表单有权限后重试。`);
|
|
287
344
|
}
|
|
345
|
+
// 🔴 2026-11-28:字典表(uf_rcrt_dictionary)是简历来源等字典引用字段的唯一取值源,
|
|
346
|
+
// 解析不到时字典必空——与「字典拉取失败」同性质,必须留痕,否则残缺 dict 落盘固化,
|
|
347
|
+
// 简历录入永远拦在「缺手动录入」。业务配置表(biz_config)有 page/list 兜底,不强制。
|
|
348
|
+
if (!forms.dictionary?.objId)
|
|
349
|
+
degraded.push('dict');
|
|
288
350
|
// L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
351
|
+
// 🔴 菜单是「可选依赖」:只用于定位列表/页面入口,页面地址另有固定路由兜底。
|
|
352
|
+
// 接口失败或返回结构不可控(数组 / 包装对象 / 空对象 / 缺字段)都必须降级为空菜单继续,
|
|
353
|
+
// 不得阻断上下文解析——否则一旦失败整份上下文就不会落缓存,换机器后会陷入
|
|
354
|
+
// 「每次冷启动都在同一处失败、且永远不再生成缓存」的死循环。
|
|
355
|
+
//
|
|
356
|
+
// 🔴 2026-11-28 缓存治理:降级必须**留痕**(degraded 标记)。只降级不留痕的话,
|
|
357
|
+
// 「菜单失败 → 数据字典菜单找不到 → 字典整段跳过 → 残缺上下文被判健康落盘」,
|
|
358
|
+
// 之后每次录入都在「简历来源缺手动录入」处被拦(2026-11-28 另一台电脑的事故现场)。
|
|
359
|
+
// 有 degraded 标记的解析结果不落盘、不命中(见 hasCriticalFields),下次自动重建。
|
|
293
360
|
const flat = [];
|
|
294
361
|
const walk = (nodes) => {
|
|
295
|
-
for (const node of nodes
|
|
362
|
+
for (const node of toMenuList(nodes)) {
|
|
296
363
|
if (node && typeof node === 'object') {
|
|
297
364
|
flat.push(node);
|
|
298
|
-
walk(node.children
|
|
365
|
+
walk(node.children ?? node.childs);
|
|
299
366
|
}
|
|
300
367
|
}
|
|
301
368
|
};
|
|
302
|
-
|
|
303
|
-
|
|
369
|
+
let menuFailed = false;
|
|
370
|
+
try {
|
|
371
|
+
const menuResponse = (await host.request({
|
|
372
|
+
path: '/api/cusapp/app/allMenus',
|
|
373
|
+
query: { isFront: 1, appId, terminalType: 'PC' },
|
|
374
|
+
}));
|
|
375
|
+
// 只传 data:由 toMenuList 自行识别 cusAppMenus 包装;不要再 `|| menuData` 把整个对象塞进遍历
|
|
376
|
+
walk(menuResponse?.data);
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
menuFailed = true; /* 菜单不可用:降级为空菜单,后续解析与业务链路照常继续 */
|
|
380
|
+
}
|
|
381
|
+
// 接口成功但展开后 0 节点同样按失败处理:招聘应用不可能没有菜单,
|
|
382
|
+
// 0 节点说明返回结构异常或权限不足,字典/列表解析必残缺。
|
|
383
|
+
if (menuFailed || !flat.length)
|
|
384
|
+
degraded.push('menus');
|
|
304
385
|
const searchMenus = [];
|
|
305
386
|
const pages = [];
|
|
306
387
|
for (const node of flat) {
|
|
@@ -328,49 +409,60 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
328
409
|
fieldOptions[entry.objId] = omap;
|
|
329
410
|
}));
|
|
330
411
|
// L5:数据字典表全量映射(字典引用类字段如渠道的 optionId 来源)
|
|
412
|
+
// 🔴 2026-11-28:字典是简历录入「固定来源(手动录入)」的唯一取值通道,
|
|
413
|
+
// 拉取失败必须降级留痕(degraded)——否则残缺 dict 落盘固化后,录入永远被拦。
|
|
331
414
|
const dictByName = {};
|
|
332
415
|
const dictRaw = [];
|
|
333
416
|
const dictMenu = searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null;
|
|
334
417
|
const dictObjId = forms.dictionary?.objId || '';
|
|
335
418
|
if (dictObjId && dictMenu) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
(
|
|
364
|
-
|
|
419
|
+
try {
|
|
420
|
+
const size = 500;
|
|
421
|
+
// 🔴 2026-11-18 提速:批内并发、批间串行(原 for(;;) 逐页 await,N 页线性叠加)。
|
|
422
|
+
// 保留原语义:遇到不满页即判定末页并停止;字典条目按页序消费,dictByName 首次命中顺序不变。
|
|
423
|
+
const CONCURRENCY = 6;
|
|
424
|
+
const fetchDictPage = (pageNo) => host.request({
|
|
425
|
+
path: `/api/ebuilder/form/list/getListDatas?passid=${dictObjId}&cid=${dictObjId}`,
|
|
426
|
+
body: {
|
|
427
|
+
current: pageNo, pageSize: size, tableuid: randHex32(),
|
|
428
|
+
listId: dictMenu.listId,
|
|
429
|
+
searchParamData: { searchType: '3', type: 'and' },
|
|
430
|
+
terminal: 'PC', browser: 'Chrome', requiredMatch: 1, mapResult: 1,
|
|
431
|
+
recheckQuery: 1, isFollow: 0, isShareToMe: 0, filterCondition: {},
|
|
432
|
+
cusMenuId: dictMenu.cusMenuId, urlPageTitle: '数据字典', menuName: '数据字典',
|
|
433
|
+
},
|
|
434
|
+
headers: { ebBusinessId: dictMenu.listId },
|
|
435
|
+
});
|
|
436
|
+
let pageNo = 1;
|
|
437
|
+
let reachedEnd = false;
|
|
438
|
+
while (!reachedEnd) {
|
|
439
|
+
const batchPages = Array.from({ length: CONCURRENCY }, (_, i) => pageNo + i);
|
|
440
|
+
const responses = await Promise.all(batchPages.map((p) => fetchDictPage(p)));
|
|
441
|
+
for (const response of responses) {
|
|
442
|
+
const rows = response?.data?.data || [];
|
|
443
|
+
for (const row of rows) {
|
|
444
|
+
const name = row.selection_name;
|
|
445
|
+
const optionId = row.form_data_id;
|
|
446
|
+
if (name && optionId) {
|
|
447
|
+
(dictByName[String(name)] ||= []).push(String(optionId));
|
|
448
|
+
dictRaw.push({ selection_name: String(name), option_id: String(optionId), dict_type: row.dict_type, browser_key: row.browser_key });
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (rows.length < size) {
|
|
452
|
+
reachedEnd = true;
|
|
453
|
+
break;
|
|
365
454
|
}
|
|
366
455
|
}
|
|
367
|
-
|
|
368
|
-
reachedEnd = true;
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
456
|
+
pageNo += CONCURRENCY;
|
|
371
457
|
}
|
|
372
|
-
pageNo += CONCURRENCY;
|
|
373
458
|
}
|
|
459
|
+
catch {
|
|
460
|
+
degraded.push('dict'); /* 字典拉取失败:留痕降级,残缺 dict 不落盘 */
|
|
461
|
+
}
|
|
462
|
+
// 菜单在、表单在、但一条字典都没拉到:要么接口静默失败,要么字典表真没配。
|
|
463
|
+
// 两种都按残缺处理——环境配好后下次重建即恢复。
|
|
464
|
+
if (!Object.keys(dictByName).length)
|
|
465
|
+
degraded.push('dict');
|
|
374
466
|
}
|
|
375
467
|
// 人才卡片页面 id(L1 业务配置表 config_key=28 前台可查;L2 page/list 兜底,失败不阻塞)+ 泛微自用标记
|
|
376
468
|
let ebdDetailPageId = '';
|
|
@@ -431,6 +523,11 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
431
523
|
}
|
|
432
524
|
catch { /* 配置表权限不足不阻塞,保持空 */ }
|
|
433
525
|
}
|
|
526
|
+
// 🔴 自用租户兜底(2026-11-28):tenantKey 命中自用租户即认定,不再依赖业务配置表。
|
|
527
|
+
// 业务配置表要经菜单+表单权限才能读,任一环节缺失 selfUse 就恒为 '0',
|
|
528
|
+
// 导致下游(人才卡片链接、简历导入、面试反馈)漏拼 &recruitType=useSelf 而取错数据。
|
|
529
|
+
if (isSelfTenant(tenantKey))
|
|
530
|
+
selfUse = '1';
|
|
434
531
|
if (!ebdDetailPageId) {
|
|
435
532
|
try {
|
|
436
533
|
const response = (await host.request({
|
|
@@ -447,22 +544,28 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
447
544
|
catch { /* 后台权限不足不阻塞,保持空 */ }
|
|
448
545
|
}
|
|
449
546
|
// ds/options 兼容通道(人才库 recruit_status/channel;字典引用类返回空则跳过)
|
|
547
|
+
// 🔴 2026-11-28:拉取失败从「炸整链」改为降级留痕——枚举失败不该让上下文解析整体失败。
|
|
450
548
|
const options = {};
|
|
451
549
|
for (const [dataKey, logic] of [['recruit_status', 'talent_pool'], ['channel', 'talent_pool']]) {
|
|
452
550
|
const entry = forms[logic] || { objId: '', formId: '', objName: '' };
|
|
453
551
|
const fieldId = (fields[entry.objId] || {})[dataKey] || '';
|
|
454
552
|
if (fieldId && entry.objId) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
553
|
+
try {
|
|
554
|
+
const response = (await host.request({
|
|
555
|
+
path: '/api/ebuilder/common/ds/options',
|
|
556
|
+
query: { fieldName: fieldId, objId: entry.objId, sourceType: 'FORM', groupId: appId },
|
|
557
|
+
}));
|
|
558
|
+
if (Array.isArray(response?.data)) {
|
|
559
|
+
options[dataKey] = {};
|
|
560
|
+
for (const option of response.data) {
|
|
561
|
+
if (option?.id)
|
|
562
|
+
options[dataKey][String(option.id)] = option.name;
|
|
563
|
+
}
|
|
464
564
|
}
|
|
465
565
|
}
|
|
566
|
+
catch {
|
|
567
|
+
degraded.push(`options:${dataKey}`); /* 枚举拉取失败:留痕降级 */
|
|
568
|
+
}
|
|
466
569
|
}
|
|
467
570
|
}
|
|
468
571
|
const lists = {
|
|
@@ -481,6 +584,7 @@ async function resolveRecruitEnv(host, appId) {
|
|
|
481
584
|
return {
|
|
482
585
|
appId,
|
|
483
586
|
tenantKey,
|
|
587
|
+
degraded,
|
|
484
588
|
forms,
|
|
485
589
|
lists,
|
|
486
590
|
fields,
|
|
@@ -497,32 +601,20 @@ export function createRecruitContextLoader() {
|
|
|
497
601
|
const session = await host.getSession();
|
|
498
602
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
499
603
|
const memoKey = baseUrl;
|
|
500
|
-
//
|
|
501
|
-
//
|
|
604
|
+
// 进程内 memo:同一进程多次 load 直接复用(CLI 单次调用通常只跑一个 operation,
|
|
605
|
+
// memo 主要惠及单次调用内的多次 load 与测试场景)。
|
|
502
606
|
let cached = memo.get(memoKey);
|
|
503
607
|
if (cached)
|
|
504
608
|
return cached;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
appId = files[0].replace(/\.json$/, '');
|
|
515
|
-
diskCache = JSON.parse(readFileSync(join(dir, files[0]), 'utf8'));
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
catch { /* 缓存读取失败回退闸门链路 */ }
|
|
520
|
-
// 命中缓存前必须校验关键表单字段;版本对但字段表为空的坏缓存不复用,继续走闸门重建。
|
|
521
|
-
if (diskCache && diskCache.cacheVersion === RECRUIT_CACHE_VERSION && hasCriticalFields(diskCache)) {
|
|
522
|
-
memo.set(memoKey, diskCache);
|
|
523
|
-
return diskCache;
|
|
524
|
-
}
|
|
525
|
-
// 安装闸门:getAppIds(tag) 取 appId(空=未安装招聘服务,必须明确报错)
|
|
609
|
+
// 🔴 2026-11-28 缓存治理:网页端/沙箱(XIAOE_CLIENT_TYPE=cloud/web/browser)容器不持久,
|
|
610
|
+
// 写盘永不命中、只读盘还会抛错——一律跳过磁盘缓存,只留进程内 memo。
|
|
611
|
+
// 每次全量解析 ~2.4s(11-28 实测口径),属设计内成本;不要为它加预热调用(prewarm 已证伪无收益)。
|
|
612
|
+
const cloudRuntime = isXiaoECloudRuntime();
|
|
613
|
+
// 安装闸门前置(2026-11-28 改序):先 getAppIds 拿到「当前环境的正确 appId」,
|
|
614
|
+
// 再按 appId 精确读 <appId>.json。旧实现「先遍历目录命中、闸门在命中之后」有结构性缺陷:
|
|
615
|
+
// 命中时根本不知道当前 appId,只能靠「目录内恰好 1 个 json」间接保证;多份缓存
|
|
616
|
+
// (换 appId / 重装 / 另一套工具写入)时会随机命中错误的 appId。前置闸门只多花
|
|
617
|
+
// 1 个 RTT(相对全量解析 46 个请求可忽略),换来归属确定性。
|
|
526
618
|
const gate = (await host.request({
|
|
527
619
|
path: '/api/bs/ebuilder/app/tags/getAppIds',
|
|
528
620
|
query: { tag: RECRUIT_APP_TAG },
|
|
@@ -531,8 +623,25 @@ export function createRecruitContextLoader() {
|
|
|
531
623
|
if (!Array.isArray(appIds) || !appIds.length) {
|
|
532
624
|
throw new RecruitContextError('recruit_service_not_installed', '当前租户未安装招聘服务(weaver-recruit-service),无法使用招聘能力。请先在 E10 应用市场安装「招聘」应用。');
|
|
533
625
|
}
|
|
534
|
-
appId = String(appIds[0]);
|
|
535
|
-
//
|
|
626
|
+
const appId = String(appIds[0]);
|
|
627
|
+
// 磁盘缓存:按 appId 精确读(不再遍历目录)。命中条件 = 版本一致 + 通过健康检查 + 未过 TTL。
|
|
628
|
+
// 残缺/过期/降版文件留在盘上作诊断证据,重建成功后被同名覆盖。
|
|
629
|
+
if (!cloudRuntime) {
|
|
630
|
+
try {
|
|
631
|
+
const file = join(cacheDirFor(baseUrl), `${appId}.json`);
|
|
632
|
+
if (existsSync(file)) {
|
|
633
|
+
const candidate = JSON.parse(readFileSync(file, 'utf8'));
|
|
634
|
+
const savedAt = Number(candidate?.savedAt || 0);
|
|
635
|
+
const fresh = savedAt > 0 && (Date.now() - savedAt) <= RECRUIT_CACHE_TTL_MS;
|
|
636
|
+
if (candidate && candidate.cacheVersion === RECRUIT_CACHE_VERSION && fresh && hasCriticalFields(candidate)) {
|
|
637
|
+
memo.set(memoKey, candidate);
|
|
638
|
+
return candidate;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
catch { /* 缓存读取失败回退快照/全量链路 */ }
|
|
643
|
+
}
|
|
644
|
+
// 冷启动快照试用:闸门已确认 appId,再用 1 个 tag 探针确认「表单 objId 未变」,
|
|
536
645
|
// 两条都过就采用快照(省掉 allMenus / 13 份字段表 / 字典分页 / 选项 ≈ 2 s)。
|
|
537
646
|
const snapshot = readContextSnapshot(baseUrl);
|
|
538
647
|
if (snapshot && snapshot.appId === appId && !process.env.E10_RS_NO_CTX_SNAPSHOT) {
|
|
@@ -567,6 +676,19 @@ export function createRecruitContextLoader() {
|
|
|
567
676
|
}
|
|
568
677
|
/** 写环境上下文磁盘缓存(结构同 ehr 技能 v5);失败不阻塞,可经 WEAVER_CLI_DEBUG_CACHE=1 诊断。 */
|
|
569
678
|
function persistContextCache(baseUrl, appId, cache) {
|
|
679
|
+
// 🔴 2026-11-28:残缺上下文(degraded 非空)绝不落盘——「菜单失败→字典空」的残缺缓存
|
|
680
|
+
// 一旦固化,录入会在「简历来源缺手动录入」处永远被拦(2026-11-28 另一台电脑事故)。
|
|
681
|
+
// 快照采纳路径(load 内 tagStillMatches)不会带 degraded:快照写入时若 resolved 残缺,
|
|
682
|
+
// resolveRecruitEnv 的返回值本身带标记,此处同样拦截。
|
|
683
|
+
if (Array.isArray(cache?.degraded) && cache.degraded.length) {
|
|
684
|
+
if (process.env.WEAVER_CLI_DEBUG_CACHE) {
|
|
685
|
+
console.error('[recruit-context] 解析存在降级(', cache.degraded.join(','), '),本次不落盘,下次调用将全量重建');
|
|
686
|
+
}
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
// 🔴 2026-11-28:网页端/沙箱容器不持久,写盘永不命中还可能只读失败——直接跳过。
|
|
690
|
+
if (isXiaoECloudRuntime())
|
|
691
|
+
return;
|
|
570
692
|
try {
|
|
571
693
|
const dir = cacheDirFor(baseUrl);
|
|
572
694
|
mkdirSync(dir, { recursive: true });
|
|
@@ -576,8 +698,10 @@ function persistContextCache(baseUrl, appId, cache) {
|
|
|
576
698
|
note: 'recruit-ops 环境参数缓存(weaver-work-cli 运行时解析产物,不含认证字段)',
|
|
577
699
|
},
|
|
578
700
|
envKey: `${dir.split(/[\\/]/).pop()}|${appId}`,
|
|
579
|
-
cacheVersion: RECRUIT_CACHE_VERSION,
|
|
580
701
|
...cache,
|
|
702
|
+
cacheVersion: RECRUIT_CACHE_VERSION,
|
|
703
|
+
// 🔴 savedAt 必须在 ...cache 之后:防止调用方携带旧 savedAt 把新写入标成过期
|
|
704
|
+
savedAt: Date.now(),
|
|
581
705
|
}, null, 2), 'utf8');
|
|
582
706
|
}
|
|
583
707
|
catch (error) {
|
|
@@ -7,6 +7,37 @@ export function asObject(value) {
|
|
|
7
7
|
}
|
|
8
8
|
return value;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* 菜单接口返回结构归一化。
|
|
12
|
+
*
|
|
13
|
+
* /api/cusapp/app/allMenus 的 data 形态在不同环境/版本间不一致:可能是数组,
|
|
14
|
+
* 也可能是 { cusAppMenus: [...] } 的包装对象,甚至是空对象或缺字段。
|
|
15
|
+
* 这里把「结构不可控」统一收敛为「拿到数组」,实在取不到就返回空数组。
|
|
16
|
+
*
|
|
17
|
+
* 🔴 原则:结构异常等价于「没拿到菜单」,绝不能抛出异常。
|
|
18
|
+
* 菜单只用于定位列表/页面入口,属于可选依赖(页面地址有固定路由兜底),
|
|
19
|
+
* 取不到应由调用方降级继续,而不是阻断整条上下文解析。
|
|
20
|
+
*
|
|
21
|
+
* 🔴 顶层只识别「容器语义」的键(cusAppMenus/menus/allMenus/data/list)。
|
|
22
|
+
* children/childs 是「节点 → 子节点」的递归键,由调用方 walk 时显式传入;
|
|
23
|
+
* 若也列入顶层键,单个菜单节点对象会被误当容器、返回其子集并漏掉节点自身。
|
|
24
|
+
*
|
|
25
|
+
* 🔴 `allMenus` 这一支与 ecode 页面层(`app/resolve.js` 的 listMenus)对齐:
|
|
26
|
+
* 页面侧认 cusAppMenus / menus / allMenus 三种容器,CLI 少认一个就会出现
|
|
27
|
+
* 「页面能定位台账、CLI 判菜单为空(degraded=menus、lists 全空)」的环境差异。
|
|
28
|
+
*/
|
|
29
|
+
export function toMenuList(value) {
|
|
30
|
+
if (Array.isArray(value))
|
|
31
|
+
return value;
|
|
32
|
+
if (value && typeof value === 'object') {
|
|
33
|
+
const obj = value;
|
|
34
|
+
for (const key of ['cusAppMenus', 'menus', 'allMenus', 'data', 'list']) {
|
|
35
|
+
if (Array.isArray(obj[key]))
|
|
36
|
+
return obj[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
10
41
|
export function assertNoForbiddenKeys(input) {
|
|
11
42
|
for (const key of Object.keys(input)) {
|
|
12
43
|
if (FORBIDDEN_KEYS.has(key)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
|
|
3
3
|
import { reportPlatformError } from '../../core/error-codes.js';
|
|
4
|
+
import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
|
|
4
5
|
import { createEsbContinuationSigner } from './continuation.js';
|
|
5
6
|
import { createEsbHost } from './host.js';
|
|
6
7
|
import { esbManifest } from './manifest.js';
|
|
@@ -99,8 +100,16 @@ export const esbShortcut = {
|
|
|
99
100
|
const esb = program.command('esb').description('泛微E10 ESB 中心自定义触发动作流(取入参模板 / 确认后触发)');
|
|
100
101
|
esb.command('schema')
|
|
101
102
|
.description('Print esb operation manifest for agents')
|
|
102
|
-
.
|
|
103
|
-
|
|
103
|
+
.option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
|
|
104
|
+
.option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
|
|
105
|
+
.option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
|
|
106
|
+
.action(action((ctx, options) => {
|
|
107
|
+
const schema = schemaOptionsOf(options);
|
|
108
|
+
ctx.output.write(manifestView(esbManifest, schema), {
|
|
109
|
+
json: true,
|
|
110
|
+
// 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
|
|
111
|
+
...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
|
|
112
|
+
});
|
|
104
113
|
}));
|
|
105
114
|
esb.command('run')
|
|
106
115
|
.description('Run an esb operation with JSON input')
|
|
@@ -43,6 +43,7 @@ export const esbOperations = [
|
|
|
43
43
|
name: 'esb.trigger.prepare',
|
|
44
44
|
summary: '触发前的只读回查与请求体组装,签发 apply 所需的 continuation(不产生业务副作用)',
|
|
45
45
|
risk: 'read-before-write',
|
|
46
|
+
requiresConfirmation: true,
|
|
46
47
|
inputSchema: {
|
|
47
48
|
type: 'object',
|
|
48
49
|
additionalProperties: false,
|
|
@@ -55,6 +56,7 @@ export const esbOperations = [
|
|
|
55
56
|
name: 'esb.trigger.apply',
|
|
56
57
|
summary: '按 continuation 执行动作流触发(高风险写操作,可能产生业务副作用)',
|
|
57
58
|
risk: 'high-risk-write',
|
|
59
|
+
requiresConfirmation: true,
|
|
58
60
|
inputSchema: {
|
|
59
61
|
type: 'object',
|
|
60
62
|
additionalProperties: false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
|
|
3
3
|
import { reportPlatformError } from '../../core/error-codes.js';
|
|
4
|
+
import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
|
|
4
5
|
import { createFnaContinuationSigner } from './continuation.js';
|
|
5
6
|
import { createFnaHost } from './host.js';
|
|
6
7
|
import { fnaManifest } from './manifest.js';
|
|
@@ -98,8 +99,16 @@ export const fnaShortcut = {
|
|
|
98
99
|
const fna = program.command('fna').description('泛微E10齐业成费控中心(预算查询/费用中心/借款管理/发票核销)');
|
|
99
100
|
fna.command('schema')
|
|
100
101
|
.description('Print fna operation manifest for agents')
|
|
101
|
-
.
|
|
102
|
-
|
|
102
|
+
.option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
|
|
103
|
+
.option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
|
|
104
|
+
.option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
|
|
105
|
+
.action(action((ctx, options) => {
|
|
106
|
+
const schema = schemaOptionsOf(options);
|
|
107
|
+
ctx.output.write(manifestView(fnaManifest, schema), {
|
|
108
|
+
json: true,
|
|
109
|
+
// 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
|
|
110
|
+
...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
|
|
111
|
+
});
|
|
103
112
|
}));
|
|
104
113
|
fna.command('run')
|
|
105
114
|
.description('Run an fna operation with JSON input')
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
|
|
3
3
|
import { reportPlatformError } from '../../core/error-codes.js';
|
|
4
|
+
import { manifestView } from '../../core/manifest-view.js';
|
|
4
5
|
import { createHrmHost } from './host.js';
|
|
5
6
|
import { hrmManifest } from './manifest.js';
|
|
6
7
|
import { executeHrmOperation } from './operations.js';
|
|
@@ -143,9 +144,18 @@ export const hrmShortcut = {
|
|
|
143
144
|
const hrm = program.command('hrm').description('泛微E10组织管理(员工查询/组织架构/岗位查询)');
|
|
144
145
|
hrm.command('schema')
|
|
145
146
|
.description('Print hrm operation manifest for agents')
|
|
147
|
+
// `--list` 是本模块的默认行为(默认就输出精简索引),保留声明只为跨域统一。
|
|
148
|
+
.option('--list', '只列操作索引(name/summary/参数名/必填项),与默认输出一致,全量不截断')
|
|
149
|
+
.option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
|
|
146
150
|
.option('--full', 'print full manifest with complete inputSchema')
|
|
147
151
|
.action(action((ctx, options) => {
|
|
148
|
-
|
|
152
|
+
const opts = asOptions(options);
|
|
153
|
+
const requested = String(opts.operation ?? '').trim();
|
|
154
|
+
if (requested) {
|
|
155
|
+
ctx.output.write(manifestView(hrmManifest, { operation: requested }), { json: true });
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (opts.full === true) {
|
|
149
159
|
ctx.output.write(hrmManifest, { json: true });
|
|
150
160
|
return;
|
|
151
161
|
}
|