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
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* (同构五层解析,磁盘缓存目录一致,可直接命中脚本版播种的缓存)。
|
|
14
14
|
*/
|
|
15
15
|
import { randomUUID } from 'node:crypto';
|
|
16
|
+
import { unlinkSync } from 'node:fs';
|
|
17
|
+
import { homedir } from 'node:os';
|
|
18
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
19
|
+
import { ehrValidationError } from '../ehr/errors.js';
|
|
16
20
|
import { rsFail } from './errors.js';
|
|
17
21
|
export function randHex32() {
|
|
18
22
|
return randomUUID().replace(/-/g, '');
|
|
@@ -87,6 +91,26 @@ export async function getFormButtons(host, objId, layoutId) {
|
|
|
87
91
|
}
|
|
88
92
|
return actions;
|
|
89
93
|
}
|
|
94
|
+
export async function probeCreatePermission(host, objId) {
|
|
95
|
+
try {
|
|
96
|
+
const r = await host.request({
|
|
97
|
+
path: '/api/ebuilder/form/data/getFormButtons',
|
|
98
|
+
body: { layoutType: 'formLayout', objId, dataId: '', formDataId: '', type: '1',
|
|
99
|
+
fromRecycle: false, otherOperator: '', objectAppId: '', browser: 'Chrome', isTamper: '0' },
|
|
100
|
+
});
|
|
101
|
+
const d = r?.data;
|
|
102
|
+
const btns = Array.isArray(d) ? d : (d?.buttons || []);
|
|
103
|
+
// 接口没返回按钮:无法判定(可能是配置差异/权限接口不可用),保守放行不阻断
|
|
104
|
+
if (!Array.isArray(btns) || !btns.length)
|
|
105
|
+
return 'unknown';
|
|
106
|
+
const hasSave = btns.some((b) => String(b?.buttonKey || '').toLowerCase().includes('save')
|
|
107
|
+
|| String(b?.name || '').includes('保存'));
|
|
108
|
+
return hasSave ? 'ok' : 'denied';
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return 'unknown';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
90
114
|
// 取「保存」按钮下的**已启用**动作链(按 showOrder 升序)——页面点「保存」时依次执行的就是这一串。
|
|
91
115
|
// 跨环境自适应:按钮 id / 动作 id / 动作数量 / 名称均运行时解析,不写死。
|
|
92
116
|
// enable=0 的动作页面不会执行(实测:人才表单 7 条动作里 3 条为禁用态),一律排除。
|
|
@@ -327,26 +351,197 @@ export async function resolveCurrentUser(host) {
|
|
|
327
351
|
return null;
|
|
328
352
|
}
|
|
329
353
|
}
|
|
330
|
-
// 人员名称 → userId
|
|
331
|
-
|
|
354
|
+
// 人员名称 → userId
|
|
355
|
+
/**
|
|
356
|
+
* 主通道:`POST /api/hrm/common/browser/data/resource`——真正按关键词过滤的人员搜索
|
|
357
|
+
* (2026-11-07 实测:搜「李伟」返回 4 人;搜「顾梦瑶」返回 0 条,确认它确实按关键字过滤)。
|
|
358
|
+
* 不要退回 `browser/complete/resource`:该接口无完整选择器上下文时**不按关键词过滤**,
|
|
359
|
+
* 只返回默认人员前 10 位,第一条恰好是当前登录用户。旧实现取 list[0],导致面试官一律被写成当前用户。
|
|
360
|
+
* 匹配规则:姓名完全相等且唯一 → 用它;无完全匹配时包含匹配唯一 → 用它;命中多个 → 抛 person_ambiguous;
|
|
361
|
+
* 完全没有命中返回 null,由调用方报"找不到"。**绝不静默取第一条。**
|
|
362
|
+
*/
|
|
363
|
+
export async function resolvePersonId(host, _fieldId, keyword) {
|
|
364
|
+
const kw = String(keyword || '').trim();
|
|
365
|
+
if (!kw)
|
|
366
|
+
return null;
|
|
367
|
+
const formDatas = {
|
|
368
|
+
status: [{ statusSelect: ['normal'] }],
|
|
369
|
+
subcompany: [{ subcompanyOpt: 'in' }],
|
|
370
|
+
department: [{ departmentOpt: 'in' }],
|
|
371
|
+
role: [{ roleOpt: 'in' }],
|
|
372
|
+
position: [{ positionOpt: 'in' }],
|
|
373
|
+
superior: [{ superiorOpt: 'in' }],
|
|
374
|
+
};
|
|
375
|
+
if (/@/.test(kw))
|
|
376
|
+
formDatas.email = [{ emailOpt: 'in', emailInput: kw }];
|
|
377
|
+
else if (/^\d{11}$/.test(kw))
|
|
378
|
+
formDatas.mobile = [{ mobileOpt: 'in', mobileInput: kw }];
|
|
379
|
+
else
|
|
380
|
+
formDatas.username = [{ usernameOpt: 'in', usernameInput: kw }];
|
|
332
381
|
const r = await host.request({
|
|
333
|
-
path: '/api/
|
|
334
|
-
body: {
|
|
382
|
+
path: '/api/hrm/common/browser/data/resource',
|
|
383
|
+
body: {
|
|
384
|
+
browserMultiple: true, authWecahtBook: false,
|
|
385
|
+
wxDepNeedConvertCount: 0, wxEmpNeedConvertCount: 0, wxTotalNeedConvertCount: 0,
|
|
386
|
+
...formDatas,
|
|
387
|
+
cmd: 'all', formDatas, quickSearchDatas: {}, type: 'and', current: 1, pageSize: 200,
|
|
388
|
+
containsNoneAccount: false, containsPartTimeEmployee: false, containsDls: false,
|
|
389
|
+
},
|
|
335
390
|
});
|
|
336
|
-
const
|
|
337
|
-
|
|
391
|
+
const rows = (r?.data?.data ?? [])
|
|
392
|
+
.filter((x) => x && (x.id || x.value) && x.name);
|
|
393
|
+
if (!rows.length)
|
|
394
|
+
return null;
|
|
395
|
+
const nameOf = (x) => String(x.name || '').trim();
|
|
396
|
+
const idOf = (x) => String(x.id ?? x.value ?? '');
|
|
397
|
+
const exact = rows.filter((x) => nameOf(x) === kw);
|
|
398
|
+
if (exact.length === 1)
|
|
399
|
+
return idOf(exact[0]) || null;
|
|
400
|
+
if (exact.length > 1)
|
|
401
|
+
throw ambiguousPerson(kw, exact);
|
|
402
|
+
if (rows.length === 1)
|
|
403
|
+
return idOf(rows[0]) || null;
|
|
404
|
+
throw ambiguousPerson(kw, rows);
|
|
405
|
+
}
|
|
406
|
+
/** 多人命中:把候选摆出来让用户选,禁止自动取第一条。 */
|
|
407
|
+
function ambiguousPerson(keyword, rows) {
|
|
408
|
+
const candidates = rows.slice(0, 20).map((r) => ({
|
|
409
|
+
id: String(r.id ?? r.value ?? ''),
|
|
410
|
+
name: String(r.name ?? ''),
|
|
411
|
+
department: String(r.department ?? ''),
|
|
412
|
+
position: String(r.position ?? ''),
|
|
413
|
+
}));
|
|
414
|
+
return ehrValidationError('person_ambiguous', `人员「${keyword}」命中 ${rows.length} 人,请指明具体是哪一位:${candidates.map((c) => `${c.name}${c.department ? `(${c.department})` : ''}`).join('、')}`, { candidates });
|
|
338
415
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
416
|
+
/**
|
|
417
|
+
* ds/options 是单选枚举的**权威真源**(后端 ebselect 枚举常量)。
|
|
418
|
+
* 🔴 缓存方案 A(2026-11-06 用户定稿):写路径一律回源,不读磁盘 field_options 缓存——
|
|
419
|
+
* 今天的事故就是缓存里的 optionId 写错后长期固化、后端静默丢弃仍返回 success。
|
|
420
|
+
* 只在**进程内** memo:一条命令里同一字段多次解析只发一次请求;跨进程不落盘,错误无法固化。
|
|
421
|
+
* prepare 可通过 dsOptionsSnapshot() 把结果放进 continuation,apply 用 restoreDsOptions() 复用,避免重复请求。
|
|
422
|
+
*/
|
|
423
|
+
const dsOptionsMemo = new Map();
|
|
424
|
+
export function restoreDsOptions(snapshot) {
|
|
425
|
+
for (const [key, value] of Object.entries(snapshot || {})) {
|
|
426
|
+
if (value && typeof value === 'object' && Object.keys(value).length) {
|
|
427
|
+
dsOptionsMemo.set(key, Promise.resolve(value));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
export async function dsOptionsSnapshot() {
|
|
432
|
+
const out = {};
|
|
433
|
+
await Promise.all([...dsOptionsMemo.entries()].map(async ([key, task]) => {
|
|
434
|
+
try {
|
|
435
|
+
const value = await task;
|
|
436
|
+
if (value && Object.keys(value).length)
|
|
437
|
+
out[key] = value;
|
|
438
|
+
}
|
|
439
|
+
catch { /* 失败项不进快照,apply 时重新回源 */ }
|
|
440
|
+
}));
|
|
441
|
+
return out;
|
|
442
|
+
}
|
|
443
|
+
/** 从待提交 dataDetails 提取关键字段期望值(供落库回查比对)。expected='*' 表示只要求非空。 */
|
|
444
|
+
export function expectedFields(details, fields, keys, nonEmptyOnly = [], optionalKeys = []) {
|
|
445
|
+
const out = [];
|
|
446
|
+
for (const k of keys) {
|
|
447
|
+
const fid = fields[k];
|
|
448
|
+
if (!fid)
|
|
449
|
+
continue;
|
|
450
|
+
const d = (details || []).find((x) => String(x?.formField?.id) === String(fid));
|
|
451
|
+
if (!d)
|
|
452
|
+
continue;
|
|
453
|
+
const value = String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? '');
|
|
454
|
+
const optional = optionalKeys.includes(k);
|
|
455
|
+
if (nonEmptyOnly.includes(k))
|
|
456
|
+
out.push({ fieldId: String(fid), label: k, expected: '*', optional });
|
|
457
|
+
else if (value)
|
|
458
|
+
out.push({ fieldId: String(fid), label: k, expected: value, optional });
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* 落库回查(缓存方案 A 第三层门禁):saveFormData 返回 success 不代表字段真的写进去——
|
|
464
|
+
* 后端对不认识的 optionId 会**静默丢弃仍返回成功**(2026-11-06 面试方式为空事故的根因)。
|
|
465
|
+
* 写完立即用 getFormDataAndLayout 读回真实值,逐字段比对;不一致交调用方报 partial + 点名。
|
|
466
|
+
*/
|
|
467
|
+
export async function verifySubmitted(opts) {
|
|
468
|
+
const { host, formId, objId, dataId, expected } = opts;
|
|
469
|
+
if (!expected.length)
|
|
470
|
+
return { checked: 0, mismatches: [] };
|
|
471
|
+
let details = [];
|
|
472
|
+
try {
|
|
473
|
+
const r = await host.request({
|
|
474
|
+
path: '/api/ebuilder/form/form/core/getFormDataAndLayout?formId=' + encodeURIComponent(formId) + '&dataId=' + encodeURIComponent(dataId),
|
|
475
|
+
method: 'POST',
|
|
476
|
+
body: {
|
|
477
|
+
terminalType: 'PC', dataId, formId, module: 'ebuilderform', newLayout: true,
|
|
478
|
+
cacheUid: '', layoutMultiId: '', dataCrossLayout: false, permissionId: '',
|
|
479
|
+
allReadOnly: false, initialDatas: [], dynamicData: false, cost: false,
|
|
480
|
+
customParam: { objId },
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
details = r?.data?.formData?.dataDetails || [];
|
|
484
|
+
}
|
|
485
|
+
catch (e) {
|
|
486
|
+
return { checked: 0, mismatches: [], unavailable: e?.message || '回查接口不可用' };
|
|
487
|
+
}
|
|
488
|
+
const byId = new Map();
|
|
489
|
+
for (const d of details) {
|
|
490
|
+
const fid = String(d?.fieldId || d?.formField?.id || '');
|
|
491
|
+
if (fid)
|
|
492
|
+
byId.set(fid, d);
|
|
493
|
+
}
|
|
494
|
+
const mismatches = [];
|
|
495
|
+
for (const e of expected) {
|
|
496
|
+
const d = byId.get(e.fieldId);
|
|
497
|
+
if (!d && e.optional)
|
|
498
|
+
continue;
|
|
499
|
+
const actual = d
|
|
500
|
+
? String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? '')
|
|
501
|
+
: '';
|
|
502
|
+
const bad = e.expected === '*' ? !actual : actual !== e.expected;
|
|
503
|
+
if (bad)
|
|
504
|
+
mismatches.push({ label: e.label, expected: e.expected === '*' ? '(非空)' : e.expected, actual: actual || '(空)' });
|
|
505
|
+
}
|
|
506
|
+
return { checked: expected.length, mismatches };
|
|
507
|
+
}
|
|
508
|
+
/** 回查/校验失败时清空进程内枚举 memo,并标记磁盘环境缓存失效(下次自动重建)。 */
|
|
509
|
+
export function invalidateEnvCache(baseUrl, appId) {
|
|
510
|
+
dsOptionsMemo.clear();
|
|
511
|
+
if (!baseUrl || !appId)
|
|
512
|
+
return;
|
|
513
|
+
try {
|
|
514
|
+
const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/+$/, '').replace(/:/g, '_');
|
|
515
|
+
const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir(), '.weaver-work-cli');
|
|
516
|
+
const root = process.env.E10_SKILL_CACHE_DIR || join(home, 'env-cache', 'recruit-ops');
|
|
517
|
+
unlinkSync(join(root, host, appId + '.json'));
|
|
518
|
+
}
|
|
519
|
+
catch { /* 缓存文件不存在/只读盘:不影响主流程 */ }
|
|
520
|
+
}
|
|
521
|
+
export async function getDsOptions(host, objId, fieldId, groupId = '') {
|
|
522
|
+
const key = objId + ':' + fieldId;
|
|
523
|
+
const hit = dsOptionsMemo.get(key);
|
|
524
|
+
if (hit)
|
|
525
|
+
return hit;
|
|
526
|
+
const task = (async () => {
|
|
527
|
+
const r = await host.request({
|
|
528
|
+
path: '/api/ebuilder/common/ds/options?fieldName=' + fieldId + '&objId=' + objId + '&sourceType=FORM'
|
|
529
|
+
+ (groupId ? '&groupId=' + groupId : ''),
|
|
530
|
+
method: 'GET',
|
|
531
|
+
});
|
|
532
|
+
const list = r?.data || [];
|
|
533
|
+
const map = {};
|
|
534
|
+
for (const x of list)
|
|
535
|
+
if (x?.name && x?.id)
|
|
536
|
+
map[String(x.name)] = String(x.id);
|
|
537
|
+
// 空结果不缓存:字典引用类字段可能临时返回空,下次应能重新回源
|
|
538
|
+
if (!Object.keys(map).length)
|
|
539
|
+
dsOptionsMemo.delete(key);
|
|
540
|
+
return map;
|
|
541
|
+
})();
|
|
542
|
+
dsOptionsMemo.set(key, task);
|
|
543
|
+
task.catch(() => { dsOptionsMemo.delete(key); });
|
|
544
|
+
return task;
|
|
350
545
|
}
|
|
351
546
|
// 环境缓存 field_options({optionId: 名称})反转成 getDsOptions 同款 {名称: optionId};未覆盖返回 null 由调用方回源
|
|
352
547
|
export function cachedDsMap(cache, objId, fieldKey) {
|
|
@@ -596,13 +791,15 @@ export function buildCardUrl(baseUrl, objId, dataId) {
|
|
|
596
791
|
return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/card/0/' + objId + '/' + dataId;
|
|
597
792
|
}
|
|
598
793
|
/**
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
*
|
|
794
|
+
* 「只打开列表」URL:{base}/sp/ebdfpage/list/{listId}(2026-11-06 用户定稿)。
|
|
795
|
+
*
|
|
796
|
+
* 旧形态 .../list/{listId}/card/0/{objId}/{dataId}/... 会在打开列表的**同时滑出记录详情单页**,
|
|
797
|
+
* 与「详情单页单独给、列表只打开列表」的产物约定冲突,已停用。
|
|
798
|
+
* 记录详情由 buildCardUrl 单独产出,两个链接相互独立。
|
|
799
|
+
* listId 取自环境缓存 lists.<type>.listId(allMenus 自动发现,SEARCH 型 pageId=listId),跨环境不写死。
|
|
602
800
|
*/
|
|
603
|
-
export function
|
|
604
|
-
if (!baseUrl || !listId
|
|
801
|
+
export function buildListUrl(baseUrl, listId) {
|
|
802
|
+
if (!baseUrl || !listId)
|
|
605
803
|
return null;
|
|
606
|
-
|
|
607
|
-
return `${base}/sp/ebdfpage/list/${listId}/card/0/${objId}/${dataId}/${listId}?id=${dataId}&openSource=field&openSourceId=${dataId}&openSourceAppId=${appId}`;
|
|
804
|
+
return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/list/' + listId;
|
|
608
805
|
}
|
|
@@ -222,6 +222,8 @@ export const workflowShortcut = {
|
|
|
222
222
|
userIntentExists: user.exists,
|
|
223
223
|
userIntentError: user.error,
|
|
224
224
|
defaults: loaded.file.defaults,
|
|
225
|
+
// 通用规则区(2026-11-05):只改 default.json 就能调的配置都在这里,输出出来才自检得到
|
|
226
|
+
generalRules: loaded.file.generalRules ?? null,
|
|
225
227
|
rules: loaded.file.rules,
|
|
226
228
|
userRules: user.rules,
|
|
227
229
|
warnings: loaded.warnings,
|
|
@@ -50,7 +50,9 @@ const CATEGORY_NAMES = {
|
|
|
50
50
|
};
|
|
51
51
|
// 排序:排序方式名 → 接口 orderkey(来源:Python WORKFLOW_SORT_OPTIONS,L590,穷举全量)。
|
|
52
52
|
// 仅中文键名(Python 无英文别名);sortType 必须显式 asc/desc(无默认方向),与 Python parse_sort_params 一致。
|
|
53
|
-
|
|
53
|
+
// 导出给 `workflow.todoSmartConvert` 复用:两条链路的排序键必须同源,否则「search 能排、汇总排不了」
|
|
54
|
+
// 或键名口径漂移(2026-11-06 用户要求 collect 的取数与排序完全覆盖 search)。
|
|
55
|
+
export const SORT_OPTIONS = {
|
|
54
56
|
当前节点: -45, 发起人: -15, 发起时间: -20, 所属工作流: -40, 接收时间: -25,
|
|
55
57
|
最后反馈时间: -175, 紧急程度: -55, 流程编号: -70, 流程标题: -10, 操作时间: -30, 结束时间: -35,
|
|
56
58
|
};
|
|
@@ -293,8 +295,11 @@ function parseDateRange(value) {
|
|
|
293
295
|
return null;
|
|
294
296
|
return [start, end];
|
|
295
297
|
}
|
|
296
|
-
/**
|
|
297
|
-
|
|
298
|
+
/**
|
|
299
|
+
* 四个时间窗参数的取值说明(原文照抄 V11.3 argparse help,参数名适配为 schema 字段名)。
|
|
300
|
+
* 导出给 `workflow.todoSmartConvert` 复用——两条链路的取数口径必须逐字一致,文案不能各写一份。
|
|
301
|
+
*/
|
|
302
|
+
export const TIME_DESCRIPTIONS = {
|
|
298
303
|
createTime: "发起时间条件:'开始 结束'(YYYY-MM-DD),单边用空串,如 '2026-08-01 2026-08-07' 或 ' 2026-08-07'",
|
|
299
304
|
operateTime: "操作时间条件:'开始 结束'(YYYY-MM-DD),单边用空串;待办(todo)分类下此条件会被忽略(待办=还未处理)",
|
|
300
305
|
receiveTime: "接收时间条件:'开始 结束'(YYYY-MM-DD),单边用空串,如 '2026-08-07 2026-08-07'(\"今天提交到我待办的\"→receiveTime)",
|
|
@@ -13,6 +13,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
import { stateRoot } from '../../../../core/state.js';
|
|
15
15
|
import { resolveSkillDir } from './summaryCache.js';
|
|
16
|
+
import { collectPriorityFields, parsePriorityRule, PriorityExprError, } from './priorityExpr.js';
|
|
16
17
|
export const AIGROUP_DIR_NAME = 'aigroup';
|
|
17
18
|
export const DEFAULT_RULE_FILE = 'default.json';
|
|
18
19
|
export const USER_INTENT_RULE_FILE = 'user-intents.json';
|
|
@@ -22,6 +23,20 @@ export const FOCUS_OPERATORS = [
|
|
|
22
23
|
];
|
|
23
24
|
/** `groupingPrompt` 会原样进模型上下文,限长避免把规则文件当提示词工程仓库。 */
|
|
24
25
|
const MAX_GROUPING_PROMPT_CHARS = 500;
|
|
26
|
+
/** `"userOverTime asc"` / `"requestLevel desc"` / `"receivedatetime"`(方向缺省 asc)。 */
|
|
27
|
+
const PRIORITY_SORT_PATTERN = /^([A-Za-z_][A-Za-z0-9_]*)(?:\s+(asc|desc))?$/i;
|
|
28
|
+
/** 宽松解析排序配置:不合法的项直接跳过(校验阶段已保证合法)。 */
|
|
29
|
+
export function parsePrioritySort(raw) {
|
|
30
|
+
const list = typeof raw === 'string' ? [raw] : Array.isArray(raw) ? raw : [];
|
|
31
|
+
const keys = [];
|
|
32
|
+
for (const item of list) {
|
|
33
|
+
const matched = PRIORITY_SORT_PATTERN.exec(String(item ?? '').trim());
|
|
34
|
+
if (!matched)
|
|
35
|
+
continue;
|
|
36
|
+
keys.push({ field: matched[1], dir: matched[2]?.toLowerCase() === 'desc' ? 'desc' : 'asc' });
|
|
37
|
+
}
|
|
38
|
+
return keys;
|
|
39
|
+
}
|
|
25
40
|
const EMPTY_GROUP_RULE = { focus: false };
|
|
26
41
|
export const FALLBACK_DEFAULTS = {
|
|
27
42
|
weight: 999,
|
|
@@ -126,11 +141,42 @@ export function validateRuleFile(raw) {
|
|
|
126
141
|
if (priority.title !== undefined && (typeof priority.title !== 'string' || !priority.title.trim())) {
|
|
127
142
|
errors.push('generalRules.priorityGroup.title 必须是非空字符串');
|
|
128
143
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
144
|
+
// 组内排序(2026-11-05):写成「字段名 asc|desc」的字符串数组,方向可省。
|
|
145
|
+
// 拼错的项直接报错,不做静默丢弃——否则「配了但顺序没变」只能靠人肉发现。
|
|
146
|
+
if (priority.sort !== undefined) {
|
|
147
|
+
const list = typeof priority.sort === 'string' ? [priority.sort] : priority.sort;
|
|
148
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
149
|
+
errors.push('generalRules.priorityGroup.sort 必须是非空字符串数组,如 ["userOverTime asc", "requestLevel desc"]');
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
for (const item of list) {
|
|
153
|
+
if (typeof item !== 'string' || !PRIORITY_SORT_PATTERN.test(item.trim())) {
|
|
154
|
+
errors.push(`generalRules.priorityGroup.sort 的「${String(item)}」格式不对:`
|
|
155
|
+
+ '每项写成「字段名 + 空格 + asc|desc」(方向可省,默认 asc)');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// 2026-11-05:入选口径改为一条表达式,旧的 rules / excludeIsremarks 直接报错,
|
|
161
|
+
// 不做静默忽略——否则「配了但没生效」这类问题只能靠人肉发现。
|
|
162
|
+
const legacyKeys = ['rules', 'excludeIsremarks'].filter((key) => priority[key] !== undefined);
|
|
163
|
+
if (legacyKeys.length > 0) {
|
|
164
|
+
errors.push(`generalRules.priorityGroup.${legacyKeys.join(' / ')} 已废弃(2026-11-05 起由 rule 表达式取代),请把口径写进 rule`);
|
|
165
|
+
}
|
|
166
|
+
if (priority.rule !== undefined) {
|
|
167
|
+
if (typeof priority.rule !== 'string' || !priority.rule.trim()) {
|
|
168
|
+
errors.push('generalRules.priorityGroup.rule 必须是非空字符串(不启用请删掉这个键)');
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
try {
|
|
172
|
+
parsePriorityRule(priority.rule);
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
const detail = error instanceof PriorityExprError
|
|
176
|
+
? error.message
|
|
177
|
+
: error.message;
|
|
178
|
+
errors.push(`generalRules.priorityGroup.rule 语法错误:${detail}`);
|
|
179
|
+
}
|
|
134
180
|
}
|
|
135
181
|
}
|
|
136
182
|
}
|
|
@@ -523,10 +569,51 @@ export function activeRuleFor(workflowName) {
|
|
|
523
569
|
export function generalRules() {
|
|
524
570
|
return activeRules().generalRules ?? null;
|
|
525
571
|
}
|
|
572
|
+
// 优先组表达式(2026-11-05):按「源字符串」缓存解析结果。
|
|
573
|
+
// 一次 operation 里取数阶段(要字段清单)和最后一步(要求值)各要一次,重复解析纯属浪费。
|
|
574
|
+
let priorityExprCache = null;
|
|
575
|
+
/** 优先组规则原文;没配返回 null(= 不输出优先组)。 */
|
|
576
|
+
export function priorityRuleSource() {
|
|
577
|
+
const source = generalRules()?.priorityGroup?.rule?.trim();
|
|
578
|
+
return source ? source : null;
|
|
579
|
+
}
|
|
580
|
+
/** 解析后的优先组表达式(语法已在校验阶段保证;这里失败说明规则被外部改动过)。 */
|
|
581
|
+
export function priorityRuleExpr() {
|
|
582
|
+
const source = priorityRuleSource();
|
|
583
|
+
if (!source) {
|
|
584
|
+
priorityExprCache = null;
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
if (priorityExprCache && priorityExprCache.source === source)
|
|
588
|
+
return priorityExprCache.expr;
|
|
589
|
+
const expr = parsePriorityRule(source);
|
|
590
|
+
priorityExprCache = { source, expr };
|
|
591
|
+
return expr;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* 表达式引用到的字段名(小写)。
|
|
595
|
+
*
|
|
596
|
+
* 取数阶段拿它做「按需保留原始字段」:只有规则真正用到的 displayData 字段才会跟着
|
|
597
|
+
* requestData 穿过中间阶段,其余 100+ 个字段照旧丢弃。
|
|
598
|
+
*/
|
|
599
|
+
export function priorityRuleFields() {
|
|
600
|
+
const expr = priorityRuleExpr();
|
|
601
|
+
return expr ? collectPriorityFields(expr) : new Set();
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* 优先组**组内排序**配置(2026-11-05 用户定:到期时间正序 → 紧急程度倒序 → 接收时间倒序)。
|
|
605
|
+
*
|
|
606
|
+
* 没配 `sort` 时返回空数组,由消费方(`todoSmartConvert.group.ts`)回落内置默认,
|
|
607
|
+
* 保证旧规则文件的行为不变。
|
|
608
|
+
*/
|
|
609
|
+
export function prioritySort() {
|
|
610
|
+
return parsePrioritySort(generalRules()?.priorityGroup?.sort);
|
|
611
|
+
}
|
|
526
612
|
/** 清空进程内缓存(单测用)。 */
|
|
527
613
|
export function resetActiveRules() {
|
|
528
614
|
activeFile = null;
|
|
529
615
|
activeDir = null;
|
|
616
|
+
priorityExprCache = null;
|
|
530
617
|
}
|
|
531
618
|
// ---------------------------------------------------------------------------
|
|
532
619
|
// formData 排除字段(2026-10-30 用户定稿:excludeOriginFormDataFields)
|