weaver-work-cli 0.1.44 → 0.1.45

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.
Files changed (179) hide show
  1. package/README.md +9 -5
  2. package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
  3. package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
  4. package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
  5. package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
  6. package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-CE3GMWTS.js} +3 -3
  7. package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
  8. package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
  9. package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
  10. package/dist/chunks/{chunk-CWYGFU5B.js → chunk-3WBIQLMB.js} +2 -2
  11. package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
  12. package/dist/chunks/{chunk-PC7VKEB5.js → chunk-3ZMAQQ3W.js} +161 -33
  13. package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-4EXOIQDI.js} +40 -10
  14. package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
  15. package/dist/chunks/chunk-762M5XJS.js +215 -0
  16. package/dist/chunks/{chunk-GAMZLAG2.js → chunk-77YP6I52.js} +1 -1
  17. package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
  18. package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-DGMYACGJ.js} +1 -1
  19. package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
  20. package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
  21. package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
  22. package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
  23. package/dist/chunks/{chunk-QVSWRLLU.js → chunk-JWWTI63L.js} +55 -5
  24. package/dist/chunks/{chunk-FRZKBMSW.js → chunk-LGKWL4OH.js} +176 -39
  25. package/dist/chunks/{chunk-XHK4MDR5.js → chunk-LRCPNDZA.js} +38 -6
  26. package/dist/chunks/{chunk-OF4S23UB.js → chunk-LXFVWZLM.js} +4 -4
  27. package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
  28. package/dist/chunks/{chunk-N4M2DDFE.js → chunk-OAE3AZBQ.js} +11 -11
  29. package/dist/chunks/chunk-P5GQRWDC.js +60 -0
  30. package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
  31. package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-T4MWQAQB.js} +7 -5
  32. package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
  33. package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
  34. package/dist/chunks/{chunk-FAZTGX7S.js → chunk-VIMCY4DI.js} +5 -5
  35. package/dist/chunks/chunk-VRPH24IC.js +76 -0
  36. package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
  37. package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
  38. package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-IYJETSGT.js} +2 -2
  39. package/dist/chunks/continuation-GW6PRWK3.js +12 -0
  40. package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
  41. package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
  42. package/dist/chunks/{create-flow-J22BO65E.js → create-flow-7JLC7UID.js} +6 -6
  43. package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
  44. package/dist/chunks/{ehr-GSTGAIY3.js → ehr-MYRDCHZ4.js} +121 -49
  45. package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
  46. package/dist/chunks/{env-BX3VRFS7.js → env-3MBHAWBL.js} +2 -2
  47. package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
  48. package/dist/chunks/{factory-PETTFME6.js → factory-TZEVU4DU.js} +1 -1
  49. package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
  50. package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-KL3HFKRM.js} +3 -3
  51. package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
  52. package/dist/chunks/host-7NTIBSPK.js +25 -0
  53. package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
  54. package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
  55. package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
  56. package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
  57. package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
  58. package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
  59. package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
  60. package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
  61. package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-UH6HGK2I.js} +4 -4
  62. package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
  63. package/dist/chunks/{meeting-FEVPZ67S.js → meeting-C67EHQ4Z.js} +12 -12
  64. package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
  65. package/dist/chunks/operations-J7PUIVWZ.js +15 -0
  66. package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
  67. package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
  68. package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
  69. package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-AHY5QAMF.js} +450 -117
  70. package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
  71. package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
  72. package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
  73. package/dist/chunks/{registry-IM5G23LS.js → registry-XPWPGHYE.js} +10 -10
  74. package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-CNWE5WQK.js} +6 -4
  75. package/dist/chunks/{schedule-ESZIBAUO.js → schedule-YYNYBQIE.js} +4 -4
  76. package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
  77. package/dist/index.js +30 -30
  78. package/dist/internal/e10/auth/commands.js +32 -0
  79. package/dist/internal/e10/auth/error-log.js +156 -26
  80. package/dist/internal/e10/auth/xiaoe.js +176 -13
  81. package/dist/internal/e10/context.js +12 -1
  82. package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
  83. package/dist/shortcuts/archive/operations/flow-url.js +182 -22
  84. package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
  85. package/dist/shortcuts/archive/operations/prelib.js +33 -4
  86. package/dist/shortcuts/archive/operations/shared.js +52 -0
  87. package/dist/shortcuts/contract/host.js +111 -4
  88. package/dist/shortcuts/contract/index.js +19 -0
  89. package/dist/shortcuts/contract/manifest.js +125 -0
  90. package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
  91. package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
  92. package/dist/shortcuts/contract/operations/customer.js +192 -0
  93. package/dist/shortcuts/contract/operations/file-download.js +75 -0
  94. package/dist/shortcuts/contract/operations/flow.js +44 -2
  95. package/dist/shortcuts/contract/operations/form-info.js +162 -62
  96. package/dist/shortcuts/contract/operations/registry.js +8 -0
  97. package/dist/shortcuts/contract/operations/review.js +116 -1
  98. package/dist/shortcuts/contract/operations/summary.js +177 -0
  99. package/dist/shortcuts/contract/operations/upload.js +64 -4
  100. package/dist/shortcuts/contract/upload-cache.js +104 -0
  101. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +4 -2
  102. package/dist/shortcuts/ehr/operations/recruit-position.js +136 -35
  103. package/dist/shortcuts/ehr/operations/recruit-write.js +17 -18
  104. package/dist/shortcuts/ehr/operations/recruit.js +17 -5
  105. package/dist/shortcuts/hrm/operations/employee.js +29 -1
  106. package/dist/shortcuts/meeting/operations/eb/create-flow.js +182 -58
  107. package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
  108. package/dist/shortcuts/meeting/operations/eb/factory.js +58 -3
  109. package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
  110. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +47 -5
  111. package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
  112. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  113. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +86 -16
  114. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +6 -4
  115. package/dist/shortcuts/recruit-stage/operations/jd-create.js +208 -56
  116. package/dist/shortcuts/recruit-stage/operations/resume-import.js +42 -16
  117. package/dist/shortcuts/recruit-stage/shared.js +161 -18
  118. package/dist/shortcuts/workflow/index.js +2 -0
  119. package/dist/shortcuts/workflow/operations/read.js +8 -3
  120. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
  121. package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
  122. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
  123. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
  124. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
  128. package/docs/contract.md +1 -0
  129. package/docs/e10-auth.md +4 -2
  130. package/docs/todo-smart-convert/data-contract.md +7 -0
  131. package/package.json +1 -1
  132. package/skill-template/domains/jinchengda.md +2 -0
  133. package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
  134. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
  135. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
  136. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
  137. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
  138. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
  139. package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
  140. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
  141. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
  142. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
  143. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
  145. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
  146. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
  148. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
  149. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
  152. package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
  153. package/skills/weaver-e10-jucailin/references/recruit-create.md +5 -3
  154. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -2
  155. package/skills/weaver-e10-meeting/SKILL.md +57 -9
  156. package/skills/weaver-e10-recruit-stage/SKILL.md +11 -6
  157. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +10 -2
  158. package/skills/weaver-e10-recruit-stage/references/position-templates.md +3 -1
  159. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
  160. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -18
  161. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
  162. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +7 -1
  163. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
  164. package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
  165. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
  166. package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
  167. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
  168. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
  169. package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
  170. package/skills/weaver-e10-workflow/SKILL.md +19 -17
  171. package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
  172. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
  173. package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
  174. package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
  175. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
  176. package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
  177. package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
  178. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
  179. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
@@ -13,6 +13,9 @@
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';
16
19
  import { rsFail } from './errors.js';
17
20
  export function randHex32() {
18
21
  return randomUUID().replace(/-/g, '');
@@ -87,6 +90,26 @@ export async function getFormButtons(host, objId, layoutId) {
87
90
  }
88
91
  return actions;
89
92
  }
93
+ export async function probeCreatePermission(host, objId) {
94
+ try {
95
+ const r = await host.request({
96
+ path: '/api/ebuilder/form/data/getFormButtons',
97
+ body: { layoutType: 'formLayout', objId, dataId: '', formDataId: '', type: '1',
98
+ fromRecycle: false, otherOperator: '', objectAppId: '', browser: 'Chrome', isTamper: '0' },
99
+ });
100
+ const d = r?.data;
101
+ const btns = Array.isArray(d) ? d : (d?.buttons || []);
102
+ // 接口没返回按钮:无法判定(可能是配置差异/权限接口不可用),保守放行不阻断
103
+ if (!Array.isArray(btns) || !btns.length)
104
+ return 'unknown';
105
+ const hasSave = btns.some((b) => String(b?.buttonKey || '').toLowerCase().includes('save')
106
+ || String(b?.name || '').includes('保存'));
107
+ return hasSave ? 'ok' : 'denied';
108
+ }
109
+ catch {
110
+ return 'unknown';
111
+ }
112
+ }
90
113
  // 取「保存」按钮下的**已启用**动作链(按 showOrder 升序)——页面点「保存」时依次执行的就是这一串。
91
114
  // 跨环境自适应:按钮 id / 动作 id / 动作数量 / 名称均运行时解析,不写死。
92
115
  // enable=0 的动作页面不会执行(实测:人才表单 7 条动作里 3 条为禁用态),一律排除。
@@ -336,17 +359,135 @@ export async function resolvePersonId(host, fieldId, keyword) {
336
359
  const list = r?.data?.data || r?.data || [];
337
360
  return list[0]?.id || list[0]?.value || null;
338
361
  }
339
- // ds/options 运行时解析枚举(面试方式/轮次/状态等):name → optionId
340
- export async function getDsOptions(host, objId, fieldId, groupId) {
341
- const r = await host.request({
342
- path: '/api/ebuilder/common/ds/options?fieldName=' + fieldId + '&objId=' + objId + '&sourceType=FORM&groupId=' + groupId,
343
- method: 'GET',
344
- });
345
- const list = r?.data || [];
346
- const map = {};
347
- for (const x of list)
348
- map[x.name] = x.id;
349
- return map;
362
+ /**
363
+ * ds/options 是单选枚举的**权威真源**(后端 ebselect 枚举常量)。
364
+ * 🔴 缓存方案 A(2026-11-06 用户定稿):写路径一律回源,不读磁盘 field_options 缓存——
365
+ * 今天的事故就是缓存里的 optionId 写错后长期固化、后端静默丢弃仍返回 success。
366
+ * 只在**进程内** memo:一条命令里同一字段多次解析只发一次请求;跨进程不落盘,错误无法固化。
367
+ * prepare 可通过 dsOptionsSnapshot() 把结果放进 continuation,apply 用 restoreDsOptions() 复用,避免重复请求。
368
+ */
369
+ const dsOptionsMemo = new Map();
370
+ export function restoreDsOptions(snapshot) {
371
+ for (const [key, value] of Object.entries(snapshot || {})) {
372
+ if (value && typeof value === 'object' && Object.keys(value).length) {
373
+ dsOptionsMemo.set(key, Promise.resolve(value));
374
+ }
375
+ }
376
+ }
377
+ export async function dsOptionsSnapshot() {
378
+ const out = {};
379
+ await Promise.all([...dsOptionsMemo.entries()].map(async ([key, task]) => {
380
+ try {
381
+ const value = await task;
382
+ if (value && Object.keys(value).length)
383
+ out[key] = value;
384
+ }
385
+ catch { /* 失败项不进快照,apply 时重新回源 */ }
386
+ }));
387
+ return out;
388
+ }
389
+ /** 从待提交 dataDetails 提取关键字段期望值(供落库回查比对)。expected='*' 表示只要求非空。 */
390
+ export function expectedFields(details, fields, keys, nonEmptyOnly = [], optionalKeys = []) {
391
+ const out = [];
392
+ for (const k of keys) {
393
+ const fid = fields[k];
394
+ if (!fid)
395
+ continue;
396
+ const d = (details || []).find((x) => String(x?.formField?.id) === String(fid));
397
+ if (!d)
398
+ continue;
399
+ const value = String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? '');
400
+ const optional = optionalKeys.includes(k);
401
+ if (nonEmptyOnly.includes(k))
402
+ out.push({ fieldId: String(fid), label: k, expected: '*', optional });
403
+ else if (value)
404
+ out.push({ fieldId: String(fid), label: k, expected: value, optional });
405
+ }
406
+ return out;
407
+ }
408
+ /**
409
+ * 落库回查(缓存方案 A 第三层门禁):saveFormData 返回 success 不代表字段真的写进去——
410
+ * 后端对不认识的 optionId 会**静默丢弃仍返回成功**(2026-11-06 面试方式为空事故的根因)。
411
+ * 写完立即用 getFormDataAndLayout 读回真实值,逐字段比对;不一致交调用方报 partial + 点名。
412
+ */
413
+ export async function verifySubmitted(opts) {
414
+ const { host, formId, objId, dataId, expected } = opts;
415
+ if (!expected.length)
416
+ return { checked: 0, mismatches: [] };
417
+ let details = [];
418
+ try {
419
+ const r = await host.request({
420
+ path: '/api/ebuilder/form/form/core/getFormDataAndLayout?formId=' + encodeURIComponent(formId) + '&dataId=' + encodeURIComponent(dataId),
421
+ method: 'POST',
422
+ body: {
423
+ terminalType: 'PC', dataId, formId, module: 'ebuilderform', newLayout: true,
424
+ cacheUid: '', layoutMultiId: '', dataCrossLayout: false, permissionId: '',
425
+ allReadOnly: false, initialDatas: [], dynamicData: false, cost: false,
426
+ customParam: { objId },
427
+ },
428
+ });
429
+ details = r?.data?.formData?.dataDetails || [];
430
+ }
431
+ catch (e) {
432
+ return { checked: 0, mismatches: [], unavailable: e?.message || '回查接口不可用' };
433
+ }
434
+ const byId = new Map();
435
+ for (const d of details) {
436
+ const fid = String(d?.fieldId || d?.formField?.id || '');
437
+ if (fid)
438
+ byId.set(fid, d);
439
+ }
440
+ const mismatches = [];
441
+ for (const e of expected) {
442
+ const d = byId.get(e.fieldId);
443
+ if (!d && e.optional)
444
+ continue;
445
+ const actual = d
446
+ ? String((d.dataOptions || [])[0]?.optionId ?? d.content ?? d.dataText?.content ?? d.value ?? '')
447
+ : '';
448
+ const bad = e.expected === '*' ? !actual : actual !== e.expected;
449
+ if (bad)
450
+ mismatches.push({ label: e.label, expected: e.expected === '*' ? '(非空)' : e.expected, actual: actual || '(空)' });
451
+ }
452
+ return { checked: expected.length, mismatches };
453
+ }
454
+ /** 回查/校验失败时清空进程内枚举 memo,并标记磁盘环境缓存失效(下次自动重建)。 */
455
+ export function invalidateEnvCache(baseUrl, appId) {
456
+ dsOptionsMemo.clear();
457
+ if (!baseUrl || !appId)
458
+ return;
459
+ try {
460
+ const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/+$/, '').replace(/:/g, '_');
461
+ const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolvePath(homedir(), '.weaver-work-cli');
462
+ const root = process.env.E10_SKILL_CACHE_DIR || join(home, 'env-cache', 'recruit-ops');
463
+ unlinkSync(join(root, host, appId + '.json'));
464
+ }
465
+ catch { /* 缓存文件不存在/只读盘:不影响主流程 */ }
466
+ }
467
+ export async function getDsOptions(host, objId, fieldId, groupId = '') {
468
+ const key = objId + ':' + fieldId;
469
+ const hit = dsOptionsMemo.get(key);
470
+ if (hit)
471
+ return hit;
472
+ const task = (async () => {
473
+ const r = await host.request({
474
+ path: '/api/ebuilder/common/ds/options?fieldName=' + fieldId + '&objId=' + objId + '&sourceType=FORM'
475
+ + (groupId ? '&groupId=' + groupId : ''),
476
+ method: 'GET',
477
+ });
478
+ const list = r?.data || [];
479
+ const map = {};
480
+ for (const x of list)
481
+ if (x?.name && x?.id)
482
+ map[String(x.name)] = String(x.id);
483
+ // 空结果不缓存:字典引用类字段可能临时返回空,下次应能重新回源
484
+ if (!Object.keys(map).length)
485
+ dsOptionsMemo.delete(key);
486
+ return map;
487
+ })();
488
+ dsOptionsMemo.set(key, task);
489
+ task.catch(() => { dsOptionsMemo.delete(key); });
490
+ return task;
350
491
  }
351
492
  // 环境缓存 field_options({optionId: 名称})反转成 getDsOptions 同款 {名称: optionId};未覆盖返回 null 由调用方回源
352
493
  export function cachedDsMap(cache, objId, fieldKey) {
@@ -596,13 +737,15 @@ export function buildCardUrl(baseUrl, objId, dataId) {
596
737
  return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/card/0/' + objId + '/' + dataId;
597
738
  }
598
739
  /**
599
- * 「列表 + 滑出该记录卡片」组合地址(2026-10-21 实测可用,简化版无需
600
- * EbdfListToCardKey/targetConditionId——它们是页面会话态/已存条件 id,运行时组不出来也不需要):
601
- * {base}/sp/ebdfpage/list/{listId}/card/0/{objId}/{dataId}/{listId}?id={dataId}&openSource=field&openSourceId={dataId}&openSourceAppId={appId}
740
+ * 「只打开列表」URL:{base}/sp/ebdfpage/list/{listId}(2026-11-06 用户定稿)。
741
+ *
742
+ * 旧形态 .../list/{listId}/card/0/{objId}/{dataId}/... 会在打开列表的**同时滑出记录详情单页**,
743
+ * 与「详情单页单独给、列表只打开列表」的产物约定冲突,已停用。
744
+ * 记录详情由 buildCardUrl 单独产出,两个链接相互独立。
745
+ * listId 取自环境缓存 lists.<type>.listId(allMenus 自动发现,SEARCH 型 pageId=listId),跨环境不写死。
602
746
  */
603
- export function buildListLocateUrl(baseUrl, appId, listId, objId, dataId) {
604
- if (!baseUrl || !listId || !objId || !dataId)
747
+ export function buildListUrl(baseUrl, listId) {
748
+ if (!baseUrl || !listId)
605
749
  return null;
606
- const base = String(baseUrl).replace(/\/+$/, '');
607
- return `${base}/sp/ebdfpage/list/${listId}/card/0/${objId}/${dataId}/${listId}?id=${dataId}&openSource=field&openSourceId=${dataId}&openSourceAppId=${appId}`;
750
+ return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/list/' + listId;
608
751
  }
@@ -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
- const SORT_OPTIONS = {
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
- /** 四个时间窗参数的取值说明(原文照抄 V11.3 argparse help,参数名适配为 schema 字段名) */
297
- const TIME_DESCRIPTIONS = {
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
- if (priority.rules !== undefined) {
130
- const KNOWN_PRIORITY_RULES = ['overdue', 'levelFallback'];
131
- if (!Array.isArray(priority.rules) || priority.rules.length === 0
132
- || priority.rules.some((r) => !KNOWN_PRIORITY_RULES.includes(String(r)))) {
133
- errors.push(`generalRules.priorityGroup.rules 只支持 ${KNOWN_PRIORITY_RULES.join('、')}`);
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)