weaver-work-cli 0.1.39 → 0.1.42
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 +4 -2
- package/dist/chunks/{archive-ENZYBBME.js → archive-J4I6MCKF.js} +2 -2
- package/dist/chunks/{archive-oa-YWLEC5V4.js → archive-oa-BRZKKTO4.js} +2 -2
- package/dist/chunks/{asset-OOV6DWPA.js → asset-L7D4FAOZ.js} +2 -2
- package/dist/chunks/{asset-idle-RE632MY5.js → asset-idle-DADLLV75.js} +2 -2
- package/dist/chunks/{attachment-content-RWN2FCLL.js → attachment-content-K4C7VLWQ.js} +3 -3
- package/dist/chunks/{blog-PEPOJAL7.js → blog-BVGQ7NZL.js} +2 -2
- package/dist/chunks/{caizhilian-WYIQDVPJ.js → caizhilian-SAADNFD6.js} +2 -2
- package/dist/chunks/{calendar-CIARBAOX.js → calendar-Q7NQY5Z2.js} +61 -23
- package/dist/chunks/{chunk-F2EQXUEE.js → chunk-3KTFS4IA.js} +397 -159
- package/dist/chunks/{chunk-G2JSIUWF.js → chunk-4PD5NWAX.js} +89 -0
- package/dist/chunks/{chunk-HJYVHXUQ.js → chunk-4RAE6JXP.js} +1 -1
- package/dist/chunks/{chunk-CQHGNCK2.js → chunk-72CKAUAG.js} +41 -8
- package/dist/chunks/{chunk-K3RUEEOL.js → chunk-APVFJUQH.js} +2 -2
- package/dist/chunks/{chunk-BJGXMFGD.js → chunk-BBKDXQEC.js} +2 -2
- package/dist/chunks/chunk-BIPYLLVS.js +501 -0
- package/dist/chunks/{chunk-GVPJZXJ2.js → chunk-EKWAQSLU.js} +92 -50
- package/dist/chunks/{chunk-XXJOSZTQ.js → chunk-FOAA27U5.js} +381 -57
- package/dist/chunks/{chunk-I2HB737U.js → chunk-G4UR6NXN.js} +2 -2
- package/dist/chunks/{chunk-YS5DPN4T.js → chunk-GEWYMQME.js} +1 -1
- package/dist/chunks/{chunk-P2DAISYW.js → chunk-GHXCDPTM.js} +1 -1
- package/dist/chunks/{chunk-L4N7B7ZD.js → chunk-IZ7S7QUS.js} +4 -4
- package/dist/chunks/{chunk-NLK2RZKG.js → chunk-JPRO6ER2.js} +122 -2214
- package/dist/chunks/{chunk-36DIFZAH.js → chunk-LADPYOWC.js} +2 -2
- package/dist/chunks/chunk-LDZQPUIA.js +1238 -0
- package/dist/chunks/chunk-NKZRQXST.js +2546 -0
- package/dist/chunks/{chunk-EINRJHQ3.js → chunk-QKNKR4RH.js} +3 -3
- package/dist/chunks/{chunk-T7JDJJ7H.js → chunk-R4CHUSKC.js} +126 -19
- package/dist/chunks/{chunk-EZGFHJFW.js → chunk-SA6VBIHY.js} +88 -15
- package/dist/chunks/{chunk-ZXRNHZTE.js → chunk-TTPJJJC4.js} +2 -2
- package/dist/chunks/{chunk-KTCB5R5H.js → chunk-W7BEHOSR.js} +2 -2
- package/dist/chunks/{chunk-MUQUHKPG.js → chunk-YRSZQUD2.js} +2 -2
- package/dist/chunks/{conflict-DRMDOL56.js → conflict-F2OMZRTO.js} +2 -2
- package/dist/chunks/{contract-73MERZWN.js → contract-5BETHRSG.js} +2 -2
- package/dist/chunks/{cowork-HNGBPD7A.js → cowork-3MN6EQQO.js} +27 -10
- package/dist/chunks/create-flow-5FQNNMVO.js +55 -0
- package/dist/chunks/{ebuilder-form-OY6DVNRK.js → ebuilder-form-SBHOYBUD.js} +3 -3
- package/dist/chunks/{ehr-RAQNEQO7.js → ehr-KMOJULKG.js} +432 -1234
- package/dist/chunks/env-LB7NBL2O.js +19 -0
- package/dist/chunks/{esb-6XV7C7YV.js → esb-W2PJCFCX.js} +4 -4
- package/dist/chunks/factory-6ZFQXQ46.js +30 -0
- package/dist/chunks/{fna-XTSRB7G7.js → fna-ZQPCUV4R.js} +2 -2
- package/dist/chunks/group-chat-2HHAJN46.js +20 -0
- package/dist/chunks/{host-YMBXWFWX.js → host-4CBHGOHT.js} +3 -3
- package/dist/chunks/{host-A7J6GDUP.js → host-ATKVNZAT.js} +3 -3
- package/dist/chunks/{host-3F5UM5GN.js → host-BQH22NTQ.js} +3 -3
- package/dist/chunks/{host-YAQAPYNP.js → host-X2CSLFM6.js} +3 -3
- package/dist/chunks/{host-VGPVP7YF.js → host-YTODKMSL.js} +3 -3
- package/dist/chunks/{hrm-TLHKC545.js → hrm-FFM4UJFS.js} +4 -4
- package/dist/chunks/{im-YOUCFMUK.js → im-VEHKDQPB.js} +8 -8
- package/dist/chunks/{invoice-WNBS2B4C.js → invoice-LVIKSIIF.js} +3 -3
- package/dist/chunks/{jiuchuanhui-XABWS5RN.js → jiuchuanhui-X6DINO5P.js} +2 -2
- package/dist/chunks/{lazy-dispatch-NLZ5UQQI.js → lazy-dispatch-KSWTN5L6.js} +4 -4
- package/dist/chunks/{mail-LRYMBFNL.js → mail-VDKRGUD3.js} +9 -4
- package/dist/chunks/{meeting-ESXL6MFI.js → meeting-CLC6HP3Z.js} +12 -10
- package/dist/chunks/{okr-EOV65SSF.js → okr-CHG4OO3U.js} +2 -2
- package/dist/chunks/{plan-YFPVKW6Y.js → plan-XWR75667.js} +2 -2
- package/dist/chunks/{project-MDVZUYQW.js → project-5BXOOKMG.js} +40 -23
- package/dist/chunks/recruit-stage-DGMFNNDE.js +4507 -0
- package/dist/chunks/{registry-VT5Y2HLA.js → registry-7FFOXIAW.js} +4 -4
- package/dist/chunks/{registry-QCLZEDAP.js → registry-BKBZPBAJ.js} +10 -8
- package/dist/chunks/{registry-YX4CSEMD.js → registry-RHMW6ANW.js} +2 -2
- package/dist/chunks/{registry-NYPYMZXG.js → registry-Z43434VG.js} +1 -1
- package/dist/chunks/{room-recommend-L3MWH4JW.js → room-recommend-62H7ZQQ6.js} +4 -4
- package/dist/chunks/{schedule-UASAVDVD.js → schedule-FNXKH3DQ.js} +4 -4
- package/dist/chunks/{workflow-KDGIUCNW.js → workflow-ADHKCAJK.js} +4 -4
- package/dist/index.js +33 -28
- package/dist/internal/e10/auth/commands.js +110 -56
- package/dist/internal/e10/auth/messages.js +6 -0
- package/dist/internal/e10/auth/session.js +28 -1
- package/dist/internal/e10/auth/xiaoe.js +315 -48
- package/dist/internal/e10/auth-recovery.js +36 -5
- package/dist/internal/e10/client.js +13 -0
- package/dist/internal/e10/context.js +61 -9
- package/dist/internal/e10/index.js +1 -1
- package/dist/internal/e10/network-error.js +93 -0
- package/dist/internal/e10/request-runtime.js +15 -0
- package/dist/shortcuts/calendar/operations/read.js +31 -22
- package/dist/shortcuts/calendar/operations/write.js +45 -1
- package/dist/shortcuts/cowork/operations/discuss-write.js +5 -1
- package/dist/shortcuts/cowork/operations/item-write.js +5 -3
- package/dist/shortcuts/cowork/operations/member-write.js +3 -1
- package/dist/shortcuts/cowork/operations/permission-write.js +5 -1
- package/dist/shortcuts/cowork/operations/shared.js +7 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +43 -1
- package/dist/shortcuts/ehr/operations/hr-contact.js +7 -4
- package/dist/shortcuts/ehr/operations/hr-report.js +13 -7
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +134 -59
- package/dist/shortcuts/ehr/operations/recruit-write.js +262 -17
- package/dist/shortcuts/ehr/operations/recruit.js +10 -4
- package/dist/shortcuts/ehr/operations/shared.js +47 -0
- package/dist/shortcuts/hrm/operations/org.js +118 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/operations/mail-send.js +8 -2
- package/dist/shortcuts/meeting/operations/eb/catalog.js +9 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +461 -127
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
- package/dist/shortcuts/meeting/operations/eb/factory.js +33 -0
- package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +605 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +96 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +44 -6
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
- package/dist/shortcuts/project/operations/read.js +6 -25
- package/dist/shortcuts/project/operations/shared.js +22 -0
- package/dist/shortcuts/project/operations/write.js +28 -2
- package/dist/shortcuts/recruit-stage/context.js +119 -0
- package/dist/shortcuts/recruit-stage/continuation.js +73 -0
- package/dist/shortcuts/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/recruit-stage/host.js +109 -0
- package/dist/shortcuts/recruit-stage/index.js +115 -0
- package/dist/shortcuts/recruit-stage/manifest.js +29 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +722 -0
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +269 -0
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +630 -0
- package/dist/shortcuts/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/recruit-stage/operations/registry.js +38 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +1198 -0
- package/dist/shortcuts/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/recruit-stage/operations/types.js +25 -0
- package/dist/shortcuts/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/recruit-stage/shared.js +608 -0
- package/dist/shortcuts/workflow/operations/form.js +21 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +52 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +19 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +17 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +14 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +78 -10
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +3 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +17 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +16 -40
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +52 -15
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.pipeline.js +16 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +151 -63
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subGroup.js +56 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +53 -16
- package/docs/e10-auth.md +22 -1
- package/docs/operation-manual.md +8 -0
- package/package.json +1 -1
- package/scripts/install-skill-to-xiaoe.mjs +105 -0
- package/scripts/mcp-meeting.mjs +234 -0
- package/scripts/package-skill.mjs +4 -2
- package/skill-template/business-info.json +24 -0
- package/skill-template/domains/recruit-stage.md +29 -0
- package/skills/weaver-e10-calendar/SKILL.md +2 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +54 -0
- package/skills/weaver-e10-cowork/SKILL.md +1 -1
- package/skills/weaver-e10-cowork/references/cowork-write.md +3 -1
- package/skills/weaver-e10-jucailin/SKILL.md +1 -1
- package/skills/weaver-e10-jucailin/references/attend-write.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-contact.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-report.md +8 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -3
- package/skills/weaver-e10-mail/SKILL.md +1 -1
- package/skills/weaver-e10-mail/references/mail-send.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +119 -26
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +226 -0
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +119 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +188 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +322 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +127 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +65 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +63 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +73 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +56 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +148 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +59 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +438 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-shared/SKILL.md +2 -2
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-shijingran/SKILL.md +3 -2
- package/skills/weaver-e10-shijingran/references/operations.md +3 -1
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-shijingran/references/write-operations.md +2 -0
- package/skills/weaver-e10-workflow/SKILL.md +7 -1
- package/skills/weaver-e10-workflow/aigroup/default.json +23 -9
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +37 -21
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +135 -43
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -10
- package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +6 -3
|
@@ -96,6 +96,47 @@ export function validateRuleFile(raw) {
|
|
|
96
96
|
errors.push('rules 必须是数组');
|
|
97
97
|
return errors;
|
|
98
98
|
}
|
|
99
|
+
// generalRules(2026-11-03):可选区块,只做宽松类型校验;未知键忽略(向后兼容预留扩展)。
|
|
100
|
+
if (file.generalRules !== undefined) {
|
|
101
|
+
if (!file.generalRules || typeof file.generalRules !== 'object' || Array.isArray(file.generalRules)) {
|
|
102
|
+
errors.push('generalRules 必须是对象');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const identity = file.generalRules.identityFilter;
|
|
106
|
+
if (identity !== undefined) {
|
|
107
|
+
if (!identity || typeof identity !== 'object' || Array.isArray(identity)) {
|
|
108
|
+
errors.push('generalRules.identityFilter 必须是对象');
|
|
109
|
+
}
|
|
110
|
+
else if (identity.defaultIsremarks !== undefined
|
|
111
|
+
&& !/^\d+(,\d+)*$/.test(String(identity.defaultIsremarks).trim())) {
|
|
112
|
+
errors.push('generalRules.identityFilter.defaultIsremarks 必须是「数字逗号拼接」格式,如 0,1,2');
|
|
113
|
+
}
|
|
114
|
+
if (identity?.excludedCodes !== undefined
|
|
115
|
+
&& (!Array.isArray(identity.excludedCodes)
|
|
116
|
+
|| identity.excludedCodes.some((c) => !/^\d+$/.test(String(c))))) {
|
|
117
|
+
errors.push('generalRules.identityFilter.excludedCodes 必须是数字码数组');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const priority = file.generalRules.priorityGroup;
|
|
121
|
+
if (priority !== undefined) {
|
|
122
|
+
if (!priority || typeof priority !== 'object' || Array.isArray(priority)) {
|
|
123
|
+
errors.push('generalRules.priorityGroup 必须是对象');
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
if (priority.title !== undefined && (typeof priority.title !== 'string' || !priority.title.trim())) {
|
|
127
|
+
errors.push('generalRules.priorityGroup.title 必须是非空字符串');
|
|
128
|
+
}
|
|
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('、')}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
99
140
|
const defaultsExclude = validateExcludeFields(file.defaults?.excludeOriginFormDataFields, 'defaults.excludeOriginFormDataFields');
|
|
100
141
|
if (defaultsExclude)
|
|
101
142
|
errors.push(defaultsExclude);
|
|
@@ -253,7 +294,13 @@ export function loadRules(options = {}) {
|
|
|
253
294
|
}
|
|
254
295
|
}
|
|
255
296
|
return {
|
|
256
|
-
file: {
|
|
297
|
+
file: {
|
|
298
|
+
schemaVersion: base.file.schemaVersion,
|
|
299
|
+
defaults: { ...FALLBACK_DEFAULTS, ...base.file.defaults },
|
|
300
|
+
rules,
|
|
301
|
+
// 通用规则区(2026-11-03):仅取 default.json 的定义;用户意图文件不参与通用规则
|
|
302
|
+
...(base.file.generalRules ? { generalRules: base.file.generalRules } : {}),
|
|
303
|
+
},
|
|
257
304
|
warnings,
|
|
258
305
|
dir,
|
|
259
306
|
};
|
|
@@ -472,6 +519,10 @@ export function activeRuleFor(workflowName) {
|
|
|
472
519
|
return null;
|
|
473
520
|
return resolveRule(activeRules(), name)?.rule ?? null;
|
|
474
521
|
}
|
|
522
|
+
/** 通用规则区(2026-11-03):未配置返回 null,消费方按内置默认兜底。 */
|
|
523
|
+
export function generalRules() {
|
|
524
|
+
return activeRules().generalRules ?? null;
|
|
525
|
+
}
|
|
475
526
|
/** 清空进程内缓存(单测用)。 */
|
|
476
527
|
export function resetActiveRules() {
|
|
477
528
|
activeFile = null;
|
|
@@ -89,14 +89,16 @@ export function pickInternalMessageContentField(fields) {
|
|
|
89
89
|
*
|
|
90
90
|
* `留言内容` 为空 ⇒ 返回空数组:这是「表单没有业务内容」,不是「只有发起人」。
|
|
91
91
|
*/
|
|
92
|
-
export function pickInternalMessageFieldPairs(fields, basicInfo = {}
|
|
92
|
+
export function pickInternalMessageFieldPairs(fields, basicInfo = {},
|
|
93
|
+
/** 兜底发起人(2026-11-03:汇总链路已不再保留 basic,改由列表行的 createrName 传入) */
|
|
94
|
+
fallbackCreatorName) {
|
|
93
95
|
const content = pickInternalMessageContentField(fields);
|
|
94
96
|
const contentValue = String(content?.value ?? '').trim();
|
|
95
97
|
if (!contentValue)
|
|
96
98
|
return [];
|
|
97
99
|
const name = normalizeDetailFieldName(content?.fieldName) || INTERNAL_MESSAGE_CONTENT_LABEL;
|
|
98
100
|
const pairs = [{ fieldName: name, value: contentValue }];
|
|
99
|
-
const creatorName = String(basicInfo.creatorName ?? '').trim();
|
|
101
|
+
const creatorName = String(basicInfo.creatorName ?? fallbackCreatorName ?? '').trim();
|
|
100
102
|
if (creatorName)
|
|
101
103
|
pairs.push({ fieldName: INTERNAL_MESSAGE_INITIATOR_LABEL, value: creatorName });
|
|
102
104
|
const createdAt = String(basicInfo.createdAt ?? '').trim();
|
|
@@ -123,19 +123,24 @@ export function promptTagOf(prompt) {
|
|
|
123
123
|
return String(prompt ?? '').trim();
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* 缓存条目是否与当前口径/素材匹配。
|
|
127
127
|
*
|
|
128
|
-
*
|
|
129
|
-
* - `pk
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
128
|
+
* **失效条件:由 `requestSummaryPrompt`(default.json / 用户意图)调整触发**——
|
|
129
|
+
* - `pk`:**严格比对**(2026-11-04 修正)。调用方只要传了 pk,条目缺 pk 或 pk 不等 ⇒ 一律失效重写。
|
|
130
|
+
* 旧口径(`entry.pk !== undefined` 才比对)等于「改 requestSummaryPrompt 对老条目永远不生效」:
|
|
131
|
+
* 条目是用旧口径写的,缺 pk 只能说明「口径未知」,不能证明「口径没变」。
|
|
132
|
+
* 空口径(`pk === ''`)会照常落库,因此「改空 / 改回非空」同样能触发失效,且空口径组不会抖动。
|
|
133
|
+
* - `maxChars`:双方都存在时才比对,且调用方只在用户**显式**传字数时才传入
|
|
134
|
+
* (`summary.ts` 的 `explicitMaxCharsFor`)——规则/默认字数变化不作废历史摘要;
|
|
135
|
+
* 用户显式要求「10 字以内」时仍会重写(2026-10-22 实测踩坑的保护保留);
|
|
136
|
+
* - `dv`:详情素材特征值仍比对——素材升级 / 排除清单调整后旧摘要缺信息(如安全工单缺行号),
|
|
137
|
+
* 不能继续命中;条目缺 dv = 旧条目,兼容命中(素材侧无法核验,属另一条口径,未随本次收紧)。
|
|
134
138
|
*/
|
|
135
139
|
function entryMatches(entry, maxChars, pk, dv) {
|
|
136
|
-
|
|
140
|
+
// 调用方不传 pk(undefined)= 不做口径判定(保持对旧调用点的兼容);传了就必须逐字符相等。
|
|
141
|
+
if (pk !== undefined && entry.pk !== pk)
|
|
137
142
|
return false;
|
|
138
|
-
if (
|
|
143
|
+
if (maxChars !== undefined && entry.maxChars !== undefined && entry.maxChars !== maxChars)
|
|
139
144
|
return false;
|
|
140
145
|
if (entry.dv !== undefined && entry.dv !== dv)
|
|
141
146
|
return false;
|
|
@@ -150,7 +155,9 @@ function normalizeSummaryEntry(raw) {
|
|
|
150
155
|
if (typeof entry.cachedAt !== 'number' || !Number.isFinite(entry.cachedAt))
|
|
151
156
|
return null;
|
|
152
157
|
const maxChars = typeof entry.maxChars === "number" && Number.isFinite(entry.maxChars) ? entry.maxChars : undefined;
|
|
153
|
-
|
|
158
|
+
// 空串是有效口径(该组本来就没配 requestSummaryPrompt):保留下来,
|
|
159
|
+
// 否则「空口径条目」会被当成「缺 pk 的旧条目」,收紧后每次都 miss。
|
|
160
|
+
const pk = typeof entry.pk === 'string' ? entry.pk : undefined;
|
|
154
161
|
const dv = typeof entry.dv === 'string' && entry.dv !== '' ? entry.dv : undefined;
|
|
155
162
|
return {
|
|
156
163
|
summary: entry.summary,
|
|
@@ -235,7 +242,8 @@ export async function openSummaryCache(ctx) {
|
|
|
235
242
|
summary: text,
|
|
236
243
|
cachedAt: Date.now(),
|
|
237
244
|
...(maxChars === undefined ? {} : { maxChars }),
|
|
238
|
-
|
|
245
|
+
// 空串同样落库(见 entryMatches 注释):空口径与「缺 pk」必须能区分开。
|
|
246
|
+
...(pk === undefined ? {} : { pk }),
|
|
239
247
|
...(dv === undefined || dv === '' ? {} : { dv }),
|
|
240
248
|
});
|
|
241
249
|
dirty = true;
|
|
@@ -5,7 +5,7 @@ import { cacheRoots, readCacheFile, writeCacheFile, SUMMARY_CACHE_PRUNE_INTERVAL
|
|
|
5
5
|
* 规则(用户 2026-10-26 定稿;条目格式 2026-10-30 升 v2):
|
|
6
6
|
* - 键:`requestId__lastFeedBackDateTime`(与该条待办的业务时间绑定——流程一动就换键);
|
|
7
7
|
* - 有效期:7 天,与摘要缓存一致;读的时候逻辑过期,超过清理间隔(3 天)时物理剔除;
|
|
8
|
-
* - **条目带格式版本 `v`**:
|
|
8
|
+
* - **条目带格式版本 `v`**:v4(2026-11-03)起素材 = 排除清单过滤后的 formData **+ 仅 workflowName**;
|
|
9
9
|
* 旧格式条目(无 `v`)读取时视为无效,被新条目逐步覆盖;排除清单变化靠 `excludeTag` 失效;
|
|
10
10
|
* - 详情为空的条目**也写**(`fields: []`),否则这类条目每次都要重拉;
|
|
11
11
|
* - 缓存文件缺失 ⇒ 视为从未缓存过,正常走接口。
|
|
@@ -18,29 +18,28 @@ export const DETAIL_CACHE_TTL_MS = SUMMARY_CACHE_TTL_MS;
|
|
|
18
18
|
/** 与摘要缓存一致:清理间隔 3 天。 */
|
|
19
19
|
export const DETAIL_CACHE_PRUNE_INTERVAL_MS = SUMMARY_CACHE_PRUNE_INTERVAL_MS;
|
|
20
20
|
/**
|
|
21
|
-
* 缓存条目格式版本。
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
21
|
+
* 缓存条目格式版本。
|
|
22
|
+
* - v2(2026-10-30):素材 = 排除清单过滤后的 formData + 全量 basicInfo,新增 `excludeTag`;
|
|
23
|
+
* - v3(2026-11-01):basicInfo 剔除 `requestTitle` / `flowName`;
|
|
24
|
+
* - **v4(2026-11-03,用户定)**:基础信息**只留 `workflowName`**,其余 basic 字段(creatorName /
|
|
25
|
+
* createdAt / currentNode / flowStatus / requestLevel …)既不入缓存也不入素材;
|
|
26
|
+
* `dv` 相应改为**只对 fields 哈希**。v3 及更早条目读取时视为无效、自动重拉。
|
|
26
27
|
*/
|
|
27
|
-
export const DETAIL_CACHE_ENTRY_VERSION =
|
|
28
|
+
export const DETAIL_CACHE_ENTRY_VERSION = 4;
|
|
28
29
|
export function detailCacheKey(requestId, lastFeedBackDateTime) {
|
|
29
30
|
const stamp = String(lastFeedBackDateTime ?? '').trim();
|
|
30
31
|
return `${requestId}__${stamp}`;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* 详情素材特征值 `dv`(2026-11-01 根治「素材升级后旧摘要继续命中」):对**清洗后的 fields**
|
|
35
|
+
* 做稳定序列化 + djb2 哈希。任何素材变化——详情管线升级、`excludeOriginFormDataFields` 调整、
|
|
36
|
+
* 字段增减——都会让它改变;摘要缓存条目的 `dv` 与之比对即可自动失效重写。
|
|
37
|
+
* (v4 起 basic 只剩 workflowName 且不进素材,故不再参与哈希。)
|
|
36
38
|
*/
|
|
37
39
|
export function detailMaterialTagOf(entry) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const material = JSON.stringify([
|
|
41
|
-
basicKeys.map((key) => [key, basic[key]]),
|
|
42
|
-
(entry.fields ?? []).map((field) => [field.fieldName, field.value]),
|
|
43
|
-
]);
|
|
40
|
+
// v4 起 basic 只剩 workflowName 且不进素材 ⇒ dv 只对**清洗后的 fields** 哈希;
|
|
41
|
+
// workflowName 的变化不影响摘要内容,故不参与(改由 pk 侧的口径与分组处理)。
|
|
42
|
+
const material = JSON.stringify((entry.fields ?? []).map((field) => [field.fieldName, field.value]));
|
|
44
43
|
let hash = 5381;
|
|
45
44
|
for (let i = 0; i < material.length; i += 1)
|
|
46
45
|
hash = ((hash << 5) + hash + material.charCodeAt(i)) >>> 0;
|
|
@@ -57,13 +56,7 @@ function normalizeEntry(raw) {
|
|
|
57
56
|
return null;
|
|
58
57
|
if (typeof value.excludeTag !== 'string')
|
|
59
58
|
return null;
|
|
60
|
-
const
|
|
61
|
-
if (value.basicInfo && typeof value.basicInfo === 'object') {
|
|
62
|
-
for (const [key, item] of Object.entries(value.basicInfo)) {
|
|
63
|
-
if (typeof item === 'string')
|
|
64
|
-
basicInfo[key] = item;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
59
|
+
const workflowName = typeof value.workflowName === 'string' ? value.workflowName : '';
|
|
67
60
|
const fields = Array.isArray(value.fields)
|
|
68
61
|
? value.fields
|
|
69
62
|
.filter((item) => Boolean(item) && typeof item.fieldName === 'string'
|
|
@@ -73,7 +66,7 @@ function normalizeEntry(raw) {
|
|
|
73
66
|
const metrics = value.metrics && typeof value.metrics === 'object' ? value.metrics : {};
|
|
74
67
|
return {
|
|
75
68
|
v: DETAIL_CACHE_ENTRY_VERSION,
|
|
76
|
-
|
|
69
|
+
workflowName,
|
|
77
70
|
fields,
|
|
78
71
|
metrics,
|
|
79
72
|
excludeTag: value.excludeTag,
|
|
@@ -110,6 +110,12 @@ function isRetryable(error) {
|
|
|
110
110
|
return true;
|
|
111
111
|
return structured?.retryable === true && structured?.type !== 'authentication';
|
|
112
112
|
}
|
|
113
|
+
/** 列表行上的发起人(**只用于内部留言的「发起人」行**,basic 已丢弃后由它兜底)。 */
|
|
114
|
+
function userIdToCreatorName(options, requestId) {
|
|
115
|
+
const name = options.rowMeta?.get(requestId)?.createrName;
|
|
116
|
+
const text = String(name ?? '').trim();
|
|
117
|
+
return text === '' ? undefined : text;
|
|
118
|
+
}
|
|
113
119
|
/**
|
|
114
120
|
* 单条详情取数。后续切换批量接口时,保持本文件对外的批量结果契约即可。
|
|
115
121
|
*/
|
|
@@ -134,15 +140,14 @@ async function fetchOneDetail(env, requestId, userId, options) {
|
|
|
134
140
|
const normalized = normalizeDetailResponse(response);
|
|
135
141
|
const base = (normalized?.basicInfo ?? {});
|
|
136
142
|
const rawFields = Array.isArray(normalized?.formData?.fields) ? normalized.formData.fields : [];
|
|
137
|
-
// ⓪
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
const basicInfo = Object.fromEntries(Object.entries(base).filter(([key]) => key !== 'requestTitle' && key !== 'flowName'));
|
|
143
|
+
// ⓪ 基础信息**只留 workflowName**(2026-11-03 用户定):其余 basic 字段丢弃,不进缓存也不进素材。
|
|
144
|
+
// `requestTitle` / `flowName` 这类标题字段自然也在丢弃之列。
|
|
145
|
+
const workflowName = String(base.workflowName ?? '').trim();
|
|
141
146
|
// ① 分发类字段(`主送` …)**无条件丢弃**:值是几十个部门的收件人清单,对摘要零信息量,
|
|
142
147
|
// 还会撑大喂给模型的上下文。必须在排除清单之前丢(技术卫生,用户不可在 JSON 里恢复)。
|
|
143
148
|
const usableFields = dropDistributionDetailFields(rawFields);
|
|
144
149
|
// ② 内部留言类:只保留 留言内容 / 发起人 / 发起时间(其余是分发元数据,见 `detailFieldRules.ts`)。
|
|
145
|
-
const internalMessage = isInternalMessageDetail(
|
|
150
|
+
const internalMessage = isInternalMessageDetail(workflowName, usableFields.map((field) => field?.fieldName));
|
|
146
151
|
// ③ 字段值只清洗(实体解码 / 富文本残留 / 压缩空白),不在这一步截断。
|
|
147
152
|
const cleanedFields = usableFields.map((field) => ({
|
|
148
153
|
...field,
|
|
@@ -150,10 +155,10 @@ async function fetchOneDetail(env, requestId, userId, options) {
|
|
|
150
155
|
}));
|
|
151
156
|
// ④ 规则排除清单(aigroup JSON `excludeOriginFormDataFields`):按 fieldName 精确匹配剔除,
|
|
152
157
|
// 两侧都过 `normalizeDetailFieldName`,防【】包裹 / 空白等排版差异绕过精确匹配。
|
|
153
|
-
const excludeFields = excludeFieldsFor(
|
|
158
|
+
const excludeFields = excludeFieldsFor(workflowName);
|
|
154
159
|
const excludeSet = new Set(excludeFields.map((name) => normalizeDetailFieldName(name)));
|
|
155
160
|
const picked = (internalMessage
|
|
156
|
-
? pickInternalMessageFieldPairs(cleanedFields,
|
|
161
|
+
? pickInternalMessageFieldPairs(cleanedFields, {}, userIdToCreatorName(options, requestId))
|
|
157
162
|
: cleanedFields.filter((field) => !excludeSet.has(normalizeDetailFieldName(field?.fieldName))))
|
|
158
163
|
.slice(0, DETAIL_MATERIAL_FIELD_LIMIT)
|
|
159
164
|
.map((field) => ({
|
|
@@ -167,7 +172,7 @@ async function fetchOneDetail(env, requestId, userId, options) {
|
|
|
167
172
|
const metrics = extractRowMetrics(usableFields);
|
|
168
173
|
return {
|
|
169
174
|
requestId,
|
|
170
|
-
|
|
175
|
+
workflowName,
|
|
171
176
|
formFields: picked,
|
|
172
177
|
contextAvailable: picked.length > 0,
|
|
173
178
|
excludeTag: excludeTagOf(excludeFields),
|
|
@@ -240,7 +245,7 @@ export async function fetchRequestDetailsBatch(env, requestIds, options = {}) {
|
|
|
240
245
|
failures.push({ requestId, error: reason });
|
|
241
246
|
details.set(requestId, {
|
|
242
247
|
requestId,
|
|
243
|
-
|
|
248
|
+
workflowName: '',
|
|
244
249
|
formFields: [],
|
|
245
250
|
contextAvailable: false,
|
|
246
251
|
excludeTag: '',
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { activeRuleFor } from './aigroupRules.js';
|
|
1
|
+
import { activeRuleFor, generalRules } from './aigroupRules.js';
|
|
2
|
+
import { writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
2
5
|
import { WORKFLOW_ENDPOINTS } from '../../endpoints.js';
|
|
3
6
|
import { saveSearchIndex } from '../../state.js';
|
|
4
7
|
import { buildSearchQuery } from '../read.js';
|
|
@@ -19,16 +22,26 @@ export async function collectRawTodos(args, env) {
|
|
|
19
22
|
// 取数阶段只允许 getTodoListData,getTodo* 分页/统计接口一律拦掉。
|
|
20
23
|
const listEnv = guardListOnlyHost(env);
|
|
21
24
|
const searchArgs = { category };
|
|
22
|
-
for (const key of ['tabid', 'tabName', 'subCategory', 'workflow', 'creator', 'requestName', 'receiveTime', 'requestLevel']) {
|
|
25
|
+
for (const key of ['tabid', 'tabName', 'subCategory', 'isremarks', 'workflow', 'creator', 'requestName', 'receiveTime', 'requestLevel']) {
|
|
23
26
|
const value = args[key];
|
|
24
27
|
if (value !== undefined && value !== null && value !== '')
|
|
25
28
|
searchArgs[key] = value;
|
|
26
29
|
}
|
|
30
|
+
// 通用规则(2026-11-03):默认排除抄送类身份(generalRules.identityFilter.defaultIsremarks)。
|
|
31
|
+
// 用户显式传 isremarks 时不覆盖;「包含抄送 / 只要抄送」等诉求由调用方按提示词显式传 --isremarks。
|
|
32
|
+
// 注意:warnings 在下方声明,默认值注入放到声明之后(见「通用规则默认身份过滤」块)。
|
|
27
33
|
// 显式给 tabid 才走平铺路径(见 DEFAULT_TABID 注释);用户另有子分类条件时原样尊重。
|
|
28
34
|
const explicitTab = ['tabid', 'tabName', 'subCategory'].some((key) => searchArgs[key] !== undefined && String(searchArgs[key]).trim() !== '');
|
|
29
35
|
if (!explicitTab)
|
|
30
36
|
searchArgs.tabid = DEFAULT_TABID;
|
|
31
37
|
const warnings = [];
|
|
38
|
+
if (searchArgs.isremarks === undefined) {
|
|
39
|
+
const defaultIsremarks = generalRules()?.identityFilter?.defaultIsremarks?.trim();
|
|
40
|
+
if (defaultIsremarks) {
|
|
41
|
+
searchArgs.isremarks = defaultIsremarks;
|
|
42
|
+
warnings.push(`已按通用规则默认排除抄送类身份(isremarks=${defaultIsremarks});如需包含抄送,请在提示词中说明`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
32
45
|
if (cappedFrom !== undefined) {
|
|
33
46
|
// 超过上限时显式告知,避免调用方误以为已取全量。
|
|
34
47
|
warnings.push(`单次最多只能取 ${MAX_FETCH_LIMIT} 条(${MAX_FETCH_PAGES} 次请求 × ${FETCH_PAGE_SIZE} 条),`
|
|
@@ -50,6 +63,19 @@ export async function collectRawTodos(args, env) {
|
|
|
50
63
|
const listPath = LIST_ENDPOINT_BY_CATEGORY[category] ?? WORKFLOW_ENDPOINTS.TODO_LIST;
|
|
51
64
|
for (let pageNo = 1; pageNo <= plannedPages; pageNo += 1) {
|
|
52
65
|
const { query } = await buildSearchQuery(listEnv, { ...searchArgs, current: pageNo, pageSize }, 'list');
|
|
66
|
+
// 2026-11-02:isremarks(备注筛选,多个数字英文逗号拼接)只由汇总链路透传,放 params 层。
|
|
67
|
+
// 注入点故意放在 collect 内部而非共享的 buildSearchQuery,保证 workflow.search 的代码路径零改动。
|
|
68
|
+
const isremarks = String(searchArgs.isremarks ?? '').trim();
|
|
69
|
+
if (isremarks !== '') {
|
|
70
|
+
query.params = { ...(query.params || {}), isremarks };
|
|
71
|
+
}
|
|
72
|
+
// 调试留痕(环境变量开启才写):把最终发往列表接口的 body 原样落盘,便于核对拼接结果。
|
|
73
|
+
if (process.env.WEAVER_WORK_CLI_DUMP_LIST_BODY) {
|
|
74
|
+
try {
|
|
75
|
+
writeFileSync(join(tmpdir(), `weaver-list-body-page${pageNo}.json`), JSON.stringify({ path: listPath, body: query }, null, 2));
|
|
76
|
+
}
|
|
77
|
+
catch { /* 留痕失败不影响主流程 */ }
|
|
78
|
+
}
|
|
53
79
|
const response = await listEnv.host.workflowRequest({
|
|
54
80
|
method: 'POST',
|
|
55
81
|
path: listPath,
|
|
@@ -98,6 +124,46 @@ export async function collectRawTodos(args, env) {
|
|
|
98
124
|
if (pageRows.length < pageSize)
|
|
99
125
|
break;
|
|
100
126
|
}
|
|
127
|
+
// ① 详情回填(2026-11-03 用户定:取完列表**紧接着**拉流程详情)
|
|
128
|
+
// 目的:`getTodoListData.displayData` 可能没有 `workflowName`,缺了分组会整片落到 UNKNOWN_GROUP;
|
|
129
|
+
// 这里全量拉一遍详情(缓存优先,热缓存 0 请求),列表缺名时用详情 basic 的 workflowName 回填。
|
|
130
|
+
// 清洗口径照旧(分发字段 / excludeOriginFormDataFields / 200 字段 / 500 字),
|
|
131
|
+
// 但 basic 只保留 workflowName,其余字段丢弃(见 todoDetailFetcher + todoDetailCache v4)。
|
|
132
|
+
const workflowNames = new Map();
|
|
133
|
+
const createrNames = new Map();
|
|
134
|
+
for (const row of items) {
|
|
135
|
+
if (!row.requestId)
|
|
136
|
+
continue;
|
|
137
|
+
const name = String(row.workflowName ?? '').trim();
|
|
138
|
+
if (name)
|
|
139
|
+
workflowNames.set(row.requestId, name);
|
|
140
|
+
if (row.createrName)
|
|
141
|
+
createrNames.set(row.requestId, { createrName: row.createrName });
|
|
142
|
+
}
|
|
143
|
+
const detailBackfill = { requested: 0, cacheHit: 0, fetched: 0, failed: 0, nameFilled: 0 };
|
|
144
|
+
let allFacts = new Map();
|
|
145
|
+
if (items.length > 0) {
|
|
146
|
+
const detailIds = [...new Set(items.map((row) => row.requestId).filter(Boolean))];
|
|
147
|
+
const { facts, stats } = await fetchDetailFacts(env, detailIds, args, stampsOfRows(items), workflowNames, createrNames);
|
|
148
|
+
allFacts = facts;
|
|
149
|
+
detailBackfill.requested = stats.requested;
|
|
150
|
+
detailBackfill.cacheHit = stats.cacheHit;
|
|
151
|
+
detailBackfill.fetched = stats.fetched;
|
|
152
|
+
detailBackfill.failed = stats.failed;
|
|
153
|
+
for (const row of items) {
|
|
154
|
+
const fact = facts.get(row.requestId);
|
|
155
|
+
if (!fact)
|
|
156
|
+
continue;
|
|
157
|
+
if (!String(row.workflowName ?? '').trim() && fact.workflowName) {
|
|
158
|
+
row.workflowName = fact.workflowName;
|
|
159
|
+
workflowNames.set(row.requestId, fact.workflowName);
|
|
160
|
+
detailBackfill.nameFilled += 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (detailBackfill.nameFilled > 0) {
|
|
164
|
+
warnings.push(`有 ${detailBackfill.nameFilled} 条列表数据缺少工作流名称,已用流程详情数据(basic.workflowName)回填`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
101
167
|
// 刷新本地查询快照(本地写文件,不联网):批量写门禁以「最近一次查询结果」为准,
|
|
102
168
|
// 不写会让 todoSmartConvert 取到的 ID 在 workflow.batch* 那里被判成「不在快照里」。
|
|
103
169
|
await saveSearchIndex({
|
|
@@ -171,8 +237,9 @@ export async function collectRawTodos(args, env) {
|
|
|
171
237
|
// 详情是流水线中间数据,smartGroup / summaryContext 需要时现场拉取(带缓存)。
|
|
172
238
|
// 例外:**有意图时**,ai二次分组要先看到表单字段,这里就把素材准备好(见下)。
|
|
173
239
|
detailStats = {
|
|
174
|
-
deferred:
|
|
175
|
-
note: '
|
|
240
|
+
deferred: false,
|
|
241
|
+
note: '详情已在 collect 阶段全量回填(缓存优先):仅 basic.workflowName 保留,其余 basic 字段与素材无关',
|
|
242
|
+
detailBackfill,
|
|
176
243
|
summaryCached: cachedSummaryIds.size,
|
|
177
244
|
summaryCacheFile: summaryCache.file,
|
|
178
245
|
summaryCachePruned: summaryCache.pruned,
|
|
@@ -188,16 +255,17 @@ export async function collectRawTodos(args, env) {
|
|
|
188
255
|
.flatMap((group) => group.requestDatas ?? []);
|
|
189
256
|
const targetIds = [...new Set(targetRows.map((row) => row.requestId).filter(Boolean))];
|
|
190
257
|
if (targetIds.length > 0) {
|
|
191
|
-
|
|
192
|
-
for (const
|
|
193
|
-
|
|
258
|
+
// 复用 ① 已回填的 facts(不再二次取数)
|
|
259
|
+
for (const requestId of targetIds) {
|
|
260
|
+
const fact = allFacts.get(requestId);
|
|
261
|
+
if (fact && fact.fields.length > 0)
|
|
194
262
|
fieldsById.set(requestId, fact.fields);
|
|
195
263
|
}
|
|
196
264
|
detailStats.groupingMaterial = {
|
|
197
265
|
requested: targetIds.length,
|
|
198
|
-
cacheHit:
|
|
199
|
-
fetched:
|
|
200
|
-
failed:
|
|
266
|
+
cacheHit: detailBackfill.cacheHit,
|
|
267
|
+
fetched: detailBackfill.fetched,
|
|
268
|
+
failed: detailBackfill.failed,
|
|
201
269
|
withFields: fieldsById.size,
|
|
202
270
|
};
|
|
203
271
|
}
|
|
@@ -7,7 +7,7 @@ export const UNKNOWN_DATE = '未知日期';
|
|
|
7
7
|
export const DEFAULT_TOP_N = 10;
|
|
8
8
|
export const STAGE_VALUES = [
|
|
9
9
|
'auto', 'collect', 'group', 'smartGroup',
|
|
10
|
-
'summaryContext', 'summary', 'groupSummaryContext', 'groupSummary',
|
|
10
|
+
'summaryContext', 'summary', 'subGroup', 'groupSummaryContext', 'groupSummary',
|
|
11
11
|
'aggregate',
|
|
12
12
|
];
|
|
13
13
|
export function asRecord(value) {
|
|
@@ -137,6 +137,7 @@ export const ALLOWED_INPUT_KEYS = [
|
|
|
137
137
|
'aiGroupSummaries',
|
|
138
138
|
'withDetailContext',
|
|
139
139
|
'withGroupSummaryContext',
|
|
140
|
+
'withSubGroup',
|
|
140
141
|
'detailPrefetch',
|
|
141
142
|
'maxCharsPerBatch',
|
|
142
143
|
'maxItemsPerBatch',
|
|
@@ -154,6 +155,7 @@ export const ALLOWED_INPUT_KEYS = [
|
|
|
154
155
|
'tabid',
|
|
155
156
|
'tabName',
|
|
156
157
|
'subCategory',
|
|
158
|
+
'isremarks',
|
|
157
159
|
'workflow',
|
|
158
160
|
'creator',
|
|
159
161
|
'requestName',
|
|
@@ -3,17 +3,16 @@ import { readBoundedInt } from './todoSmartConvert.core.js';
|
|
|
3
3
|
import { openDetailCache, DETAIL_CACHE_ENTRY_VERSION } from './todoDetailCache.js';
|
|
4
4
|
import { excludeTagFor } from './aigroupRules.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* 把「排除清单过滤后的 formData 字段」拼成喂模型的文本。
|
|
7
7
|
*
|
|
8
|
-
* 每行一条 `fieldName:value
|
|
8
|
+
* 每行一条 `fieldName:value`;2026-11-03 起基础信息(basic)整体丢弃、只有 `workflowName` 保留在
|
|
9
|
+
* `DetailFact` 上用于分组回填,**不进素材**。
|
|
9
10
|
* 字段来源与截断口径见 `todoDetailFetcher`(排除清单 → ≤200 个字段 → 单值 ≤500 字)。
|
|
10
11
|
*/
|
|
11
12
|
export function contextOfDetail(detail) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const fieldLines = (detail.formFields ?? []).map((field) => `${field.fieldName}:${field.value}`);
|
|
16
|
-
return [...basicLines, ...fieldLines].join('\n');
|
|
13
|
+
// 2026-11-03 用户定:流程详情接口返回的 basic 基础信息直接丢弃(只留 workflowName 用于分组回填,
|
|
14
|
+
// 且不进素材)。因此素材就是清洗后的表单字段,逐行 `fieldName:value`。
|
|
15
|
+
return (detail.formFields ?? []).map((field) => `${field.fieldName}:${field.value}`).join('\n');
|
|
17
16
|
}
|
|
18
17
|
const EMPTY_DETAIL_STATS = {
|
|
19
18
|
requested: 0,
|
|
@@ -57,7 +56,11 @@ function materialFieldsOf(detail) {
|
|
|
57
56
|
*
|
|
58
57
|
* 失败不致命:返回已拿到的部分 + warning,调用方按「无详情」降级。
|
|
59
58
|
*/
|
|
60
|
-
export async function fetchDetailFacts(env, requestIds, args, stamps
|
|
59
|
+
export async function fetchDetailFacts(env, requestIds, args, stamps,
|
|
60
|
+
/** 列表行的 `requestId → workflowName`(详情回填与 excludeTag 校验用) */
|
|
61
|
+
names,
|
|
62
|
+
/** 列表行的 `requestId → createrName`(内部留言「发起人」行兜底) */
|
|
63
|
+
createrNames) {
|
|
61
64
|
const unique = [...new Set(requestIds.filter(Boolean))];
|
|
62
65
|
const facts = new Map();
|
|
63
66
|
const warnings = [];
|
|
@@ -72,15 +75,16 @@ export async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
72
75
|
const missing = [];
|
|
73
76
|
for (const requestId of unique) {
|
|
74
77
|
const hit = cache.get(requestId, stamps?.get(requestId));
|
|
75
|
-
if (!hit || hit.excludeTag !== excludeTagFor(hit.
|
|
78
|
+
if (!hit || hit.excludeTag !== excludeTagFor(hit.workflowName ?? names?.get(requestId) ?? '')) {
|
|
76
79
|
missing.push(requestId);
|
|
77
80
|
continue;
|
|
78
81
|
}
|
|
79
82
|
facts.set(requestId, {
|
|
80
|
-
context: contextOfDetail({
|
|
83
|
+
context: contextOfDetail({ formFields: hit.fields }),
|
|
81
84
|
contextAvailable: hit.fields.length > 0,
|
|
82
85
|
metrics: hit.metrics,
|
|
83
86
|
fields: hit.fields,
|
|
87
|
+
workflowName: hit.workflowName || (names?.get(requestId) ?? ''),
|
|
84
88
|
});
|
|
85
89
|
stats.cacheHit += 1;
|
|
86
90
|
}
|
|
@@ -91,6 +95,7 @@ export async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
91
95
|
const { details, stats: fetchStats } = await fetchRequestDetailsBatch(env, missing, {
|
|
92
96
|
concurrency: readBoundedInt(args.detailConcurrency, 'detailConcurrency', 10, 1, 32),
|
|
93
97
|
timeoutMs: readBoundedInt(args.detailTimeoutMs, 'detailTimeoutMs', 10_000, 1_000, 60_000),
|
|
98
|
+
...(createrNames ? { rowMeta: createrNames } : {}),
|
|
94
99
|
});
|
|
95
100
|
stats.failed = fetchStats.failed;
|
|
96
101
|
stats.concurrency = fetchStats.concurrency;
|
|
@@ -100,6 +105,7 @@ export async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
100
105
|
contextAvailable: detail.formFields.length > 0,
|
|
101
106
|
metrics: detail.metrics ?? {},
|
|
102
107
|
fields: materialFieldsOf(detail),
|
|
108
|
+
workflowName: detail.workflowName || (names?.get(requestId) ?? ''),
|
|
103
109
|
};
|
|
104
110
|
facts.set(requestId, fact);
|
|
105
111
|
stats.fetched += 1;
|
|
@@ -110,7 +116,7 @@ export async function fetchDetailFacts(env, requestIds, args, stamps) {
|
|
|
110
116
|
// 详情为空也写缓存:否则这类条目每次都要重拉
|
|
111
117
|
if (cache.set(requestId, stamps?.get(requestId), {
|
|
112
118
|
v: DETAIL_CACHE_ENTRY_VERSION,
|
|
113
|
-
|
|
119
|
+
workflowName: fact.workflowName,
|
|
114
120
|
metrics: fact.metrics,
|
|
115
121
|
fields: fact.fields,
|
|
116
122
|
excludeTag: detail.excludeTag,
|