weaver-work-cli 0.1.76 → 0.1.78
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 +3 -1
- package/dist/chunks/{attachment-content-24RL44SE.js → attachment-content-TFOC3Y3X.js} +3 -3
- package/dist/chunks/{chunk-FEZK536Z.js → chunk-4PBN7NJY.js} +353 -43
- package/dist/chunks/{chunk-SQFKBWTR.js → chunk-5VQ7JHV4.js} +132 -47
- package/dist/chunks/{chunk-KJA7CRES.js → chunk-7SQN5IZR.js} +1 -1
- package/dist/chunks/{chunk-MS7MKBGJ.js → chunk-BP7BONZO.js} +664 -75
- package/dist/chunks/{chunk-L5SCNJKX.js → chunk-DACQKJ6O.js} +1 -1
- package/dist/chunks/{chunk-T7HVQ2WP.js → chunk-E2EY3DMS.js} +2 -2
- package/dist/chunks/{chunk-WJQJ7YEX.js → chunk-FAC4IFGQ.js} +2 -2
- package/dist/chunks/{minute-doc-4BA2R5EA.js → chunk-IBTGXLOT.js} +99 -16
- package/dist/chunks/{chunk-OJ4JPD25.js → chunk-LQLIXBJF.js} +6 -8
- package/dist/chunks/{chunk-H6N6U2D6.js → chunk-SWFTWNWL.js} +7 -7
- package/dist/chunks/{chunk-SU6IJD6D.js → chunk-TD5IOEGN.js} +1 -1
- package/dist/chunks/{chunk-Q7RXCK2Y.js → chunk-USYFVIUR.js} +22 -7
- package/dist/chunks/{chunk-WHI6YAUE.js → chunk-UZ2E3VNI.js} +1 -1
- package/dist/chunks/{chunk-AZC53XSQ.js → chunk-VNEU7OUN.js} +1 -1
- package/dist/chunks/{chunk-5QUTQHXF.js → chunk-WNFDR5PC.js} +198 -80
- package/dist/chunks/{chunk-NZQRW4KL.js → chunk-Z44YFIN6.js} +2 -2
- package/dist/chunks/{chunk-R4PN3OFK.js → chunk-ZOTXXGUM.js} +7 -7
- package/dist/chunks/{cli-DFLV57LO.js → cli-WA7FOQKC.js} +10 -10
- package/dist/chunks/{conflict-72Q6DM4I.js → conflict-D4GVAURN.js} +2 -2
- package/dist/chunks/{contract-IRNRQ5FY.js → contract-GW7US3UF.js} +4399 -3547
- package/dist/chunks/{create-flow-UGTDI7SP.js → create-flow-ERDGW3FZ.js} +10 -6
- package/dist/chunks/{ehr-PHIBBUIG.js → ehr-P6T7OAAV.js} +1 -1
- package/dist/chunks/{entry-mode-5WOXFE67.js → entry-mode-SQU5WTX6.js} +3 -3
- package/dist/chunks/{env-H4ALHESA.js → env-DASBNSEM.js} +2 -2
- package/dist/chunks/{factory-COX6AVK7.js → factory-A3NAKZAA.js} +1 -1
- package/dist/chunks/{group-chat-ZIWQQO4G.js → group-chat-7SEAVAJR.js} +3 -3
- package/dist/chunks/{lazy-dispatch-MZ3EZYDL.js → lazy-dispatch-ZDKLS5MR.js} +3 -3
- package/dist/chunks/{meeting-XE6CTXYA.js → meeting-7AEQGBAT.js} +18 -12
- package/dist/chunks/minute-doc-REI6RUE4.js +20 -0
- package/dist/chunks/{project-XREEXFU2.js → project-6PRGBLO2.js} +38 -14
- package/dist/chunks/{recruit-stage-TSQWOGQD.js → recruit-stage-TLZJUFHD.js} +543 -463
- package/dist/chunks/{registry-F4YFZLOD.js → registry-KQ4TNUWO.js} +1 -1
- package/dist/chunks/{registry-7UDUWYB5.js → registry-UVTI323K.js} +12 -11
- package/dist/chunks/{room-recommend-FO3HLPNB.js → room-recommend-ELEJUYBN.js} +4 -4
- package/dist/chunks/{schedule-DHNNOHVS.js → schedule-XBKY7VEA.js} +4 -4
- package/dist/chunks/{update-AV5VOXGY.js → update-77ZUIYSG.js} +2 -2
- package/dist/chunks/{workflow-MAGCHWYZ.js → workflow-SYCBS5XD.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/internal/update/service.js +9 -8
- package/dist/shortcuts/contract/data/collection-ledger-html.js +109 -33
- package/dist/shortcuts/contract/data/collection-node-catalog.js +26 -2
- package/dist/shortcuts/contract/data/report-renderers.js +75 -31
- package/dist/shortcuts/contract/data/report-spec.js +17 -3
- package/dist/shortcuts/contract/manifest.js +20 -3
- package/dist/shortcuts/contract/operations/bizreview-report.js +23 -2
- package/dist/shortcuts/contract/operations/collection-node.js +116 -1
- package/dist/shortcuts/contract/operations/compare-report.js +27 -5
- package/dist/shortcuts/contract/operations/credit-page.js +11 -2
- package/dist/shortcuts/contract/operations/docx-slots.js +27 -2
- package/dist/shortcuts/contract/operations/draft-submit.js +9 -6
- package/dist/shortcuts/contract/operations/elements-build.js +162 -30
- package/dist/shortcuts/contract/operations/elements-spec.js +50 -0
- package/dist/shortcuts/contract/operations/generated-submit.js +35 -0
- package/dist/shortcuts/contract/operations/ledger-card.js +32 -2
- package/dist/shortcuts/contract/operations/ledger-stat.js +17 -5
- package/dist/shortcuts/contract/operations/ledger.js +88 -16
- package/dist/shortcuts/contract/operations/metrics.js +16 -3
- package/dist/shortcuts/contract/operations/ops-draft.js +359 -27
- package/dist/shortcuts/contract/operations/page.js +23 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +91 -13
- package/dist/shortcuts/contract/operations/quote-submit.js +16 -0
- package/dist/shortcuts/contract/operations/review-report.js +11 -3
- package/dist/shortcuts/contract/operations/save-recognize.js +62 -1
- package/dist/shortcuts/contract/operations/triage.js +18 -3
- package/dist/shortcuts/contract/operations/viewlink.js +17 -1
- package/dist/shortcuts/ehr/operations/recruit.js +255 -90
- package/dist/shortcuts/meeting/confirm-gate.js +42 -0
- package/dist/shortcuts/meeting/continuation.js +6 -2
- package/dist/shortcuts/meeting/minute-doc.js +119 -12
- package/dist/shortcuts/meeting/operations/attachment.js +19 -0
- package/dist/shortcuts/meeting/operations/compose-outcome.js +24 -2
- package/dist/shortcuts/meeting/operations/eb/conflict.js +2 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +162 -19
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +22 -3
- package/dist/shortcuts/meeting/operations/group-share.js +268 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +58 -1
- package/dist/shortcuts/meeting/operations/minute-export.js +295 -0
- package/dist/shortcuts/meeting/operations/registry.js +4 -0
- package/dist/shortcuts/project/operations/read.js +40 -15
- package/dist/shortcuts/recruit-stage/context.js +16 -81
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +89 -53
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +15 -5
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +46 -108
- package/dist/shortcuts/recruit-stage/operations/list.js +203 -74
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -85
- package/dist/shortcuts/recruit-stage/operations/search.js +113 -53
- package/dist/shortcuts/recruit-stage/shared.js +153 -4
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +11 -0
- package/dist/shortcuts/workflow/operations/read.js +24 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +2 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +28 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.node.js +198 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subordinate.js +70 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +15 -5
- package/docs/project.md +1 -1
- package/package.json +1 -1
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +64 -28
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +26 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +9 -8
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +47 -52
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +7 -1
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +44 -1
- package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +8 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +33 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +17 -3
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +18 -10
- package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +77 -37
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +7 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +55 -12
- package/skills/weaver-e10-jinchengda/references/contract-review-todo.md +102 -0
- package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +1 -17
- package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +11 -8
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +2 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +6 -6
- package/skills/weaver-e10-meeting/SKILL.md +203 -80
- package/skills/weaver-e10-meeting/references/create-quickstart.md +98 -0
- package/skills/weaver-e10-meeting/references/delivery-checklist.md +34 -0
- package/skills/weaver-e10-meeting/references/error-codes.md +44 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +56 -3
- package/skills/weaver-e10-meeting/references/room-recommend.md +2 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +61 -58
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +28 -25
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +20 -14
- package/skills/weaver-e10-recruit-stage/lib/recruit-attach-probe.mjs +127 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +71 -25
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +39 -7
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +2 -2
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +8 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +29 -31
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +4 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +6 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +10 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +2 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +1 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +10 -28
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +1 -1
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +2 -2
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +1 -1
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +14 -10
- package/skills/weaver-e10-shijingran/SKILL.md +2 -2
- package/skills/weaver-e10-shijingran/references/operations.md +5 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-workflow/SKILL.md +13 -9
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +33 -8
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +19 -14
- package/skills/weaver-e10-workflow/references/workflow-create.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +4 -2
- package/skills/weaver-e10-workflow/references/workflow-view.md +3 -3
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +132 -42
- package/templates/meeting/minute.docx +0 -0
- package/skills/weaver-e10-yepiaotong.zip +0 -0
|
@@ -14,13 +14,54 @@ function esc(text) {
|
|
|
14
14
|
.replace(/"/g, '"');
|
|
15
15
|
}
|
|
16
16
|
function para(text, options = {}) {
|
|
17
|
+
const spacing = [];
|
|
18
|
+
if (options.before !== undefined)
|
|
19
|
+
spacing.push(`w:before="${options.before}"`);
|
|
20
|
+
if (options.after !== undefined)
|
|
21
|
+
spacing.push(`w:after="${options.after}"`);
|
|
22
|
+
if (options.line !== undefined)
|
|
23
|
+
spacing.push(`w:line="${options.line}"`, 'w:lineRule="auto"');
|
|
17
24
|
const props = [
|
|
25
|
+
spacing.length > 0 ? `<w:spacing ${spacing.join(' ')}/>` : '',
|
|
18
26
|
options.bold ? '<w:b/>' : '',
|
|
19
27
|
options.size ? `<w:sz w:val="${options.size}"/><w:szCs w:val="${options.size}"/>` : '',
|
|
20
28
|
options.align ? `<w:jc w:val="${options.align}"/>` : '',
|
|
21
29
|
].join('');
|
|
22
30
|
return `<w:p><w:pPr>${props}</w:pPr><w:r><w:t xml:space="preserve">${esc(text)}</w:t></w:r></w:p>`;
|
|
23
31
|
}
|
|
32
|
+
/** 把 `| a | b |` 切成单元格文本(去掉首尾竖线与空单元格)。 */
|
|
33
|
+
function splitRow(line) {
|
|
34
|
+
return line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((cell) => cell.trim());
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* markdown 表格 → Word 表格。
|
|
38
|
+
* 以前整表按段落输出,打开就是一堆竖线(看着像 md),纪要文件里不可读。
|
|
39
|
+
*/
|
|
40
|
+
function table(rows, cellSize = 20) {
|
|
41
|
+
const cols = Math.max(...rows.map((row) => row.length), 1);
|
|
42
|
+
const totalWidth = 9026;
|
|
43
|
+
const cellWidth = Math.floor(totalWidth / cols);
|
|
44
|
+
const border = '<w:tblBorders>'
|
|
45
|
+
+ ['top', 'left', 'bottom', 'right', 'insideH', 'insideV']
|
|
46
|
+
.map((side) => `<w:${side} w:val="single" w:sz="4" w:space="0" w:color="000000"/>`)
|
|
47
|
+
.join('')
|
|
48
|
+
+ '</w:tblBorders>';
|
|
49
|
+
const body = rows.map((row, rowIndex) => {
|
|
50
|
+
const cells = Array.from({ length: cols }, (_, colIndex) => {
|
|
51
|
+
const text = row[colIndex] ?? '';
|
|
52
|
+
const isHeader = rowIndex === 0;
|
|
53
|
+
return '<w:tc><w:tcPr>'
|
|
54
|
+
+ `<w:tcW w:w="${cellWidth}" w:type="dxa"/>`
|
|
55
|
+
+ '<w:vAlign w:val="center"/>'
|
|
56
|
+
+ '</w:tcPr>'
|
|
57
|
+
+ para(text, { bold: isHeader, size: cellSize })
|
|
58
|
+
+ '</w:tc>';
|
|
59
|
+
}).join('');
|
|
60
|
+
return `<w:tr>${cells}</w:tr>`;
|
|
61
|
+
}).join('');
|
|
62
|
+
return `<w:tbl><w:tblPr><w:tblW w:w="${totalWidth}" w:type="dxa"/>${border}</w:tblPr>${body}</w:tbl>`
|
|
63
|
+
+ para('', { size: cellSize + 1 });
|
|
64
|
+
}
|
|
24
65
|
const CONTENT_TYPES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
25
66
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
26
67
|
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
@@ -31,31 +72,60 @@ const RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
|
31
72
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
32
73
|
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
33
74
|
</Relationships>`;
|
|
34
|
-
|
|
75
|
+
const DEFAULT_BODY_SIZES = { body: 21, heading: 28, cell: 20 };
|
|
76
|
+
/**
|
|
77
|
+
* 把 markdown 正文渲染成 Word 段落/表格 XML。
|
|
78
|
+
* 字号可传:模板渲染(templates/meeting/minute.docx,正文 22 / 标题 32)与旧的最小包(21 / 28)共用同一段逻辑。
|
|
79
|
+
*/
|
|
80
|
+
export function buildBodyParagraphsXml(content, sizes = DEFAULT_BODY_SIZES) {
|
|
35
81
|
const body = [];
|
|
36
|
-
|
|
37
|
-
for (
|
|
38
|
-
|
|
39
|
-
body.push(para(line, { size: 21 }));
|
|
40
|
-
}
|
|
41
|
-
body.push(para('', { size: 21 }));
|
|
42
|
-
for (const raw of String(input.content ?? '').split(/\r?\n/)) {
|
|
43
|
-
const line = raw.replace(/\s+$/, '');
|
|
82
|
+
const lines = String(content ?? '').split(/\r?\n/);
|
|
83
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
84
|
+
const line = lines[i].replace(/\s+$/, '');
|
|
44
85
|
if (line.trim() === '') {
|
|
45
|
-
body.push(para('', { size:
|
|
86
|
+
body.push(para('', { size: sizes.body, after: 0 }));
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// markdown 表格:| a | b | 紧跟 |---|---| 才算,整块渲染成 Word 表格
|
|
90
|
+
const isRow = /^\s*\|.*\|\s*$/.test(line);
|
|
91
|
+
const isSep = /^\s*\|[\s:|-]+\|\s*$/.test(lines[i + 1] ?? '');
|
|
92
|
+
if (isRow && isSep) {
|
|
93
|
+
const rows = [splitRow(line)];
|
|
94
|
+
i += 1;
|
|
95
|
+
while (i + 1 < lines.length && /^\s*\|.*\|\s*$/.test(lines[i + 1])) {
|
|
96
|
+
i += 1;
|
|
97
|
+
rows.push(splitRow(lines[i]));
|
|
98
|
+
}
|
|
99
|
+
body.push(table(rows, sizes.cell));
|
|
46
100
|
continue;
|
|
47
101
|
}
|
|
48
102
|
const heading = line.match(/^#{1,4}\s+(.*)$/);
|
|
49
103
|
if (heading) {
|
|
50
|
-
|
|
104
|
+
// 标题给段前距,正文给段后距 + 1.5 倍行距:不给间距时整篇挤成一坨(用户反馈"文件很丑")
|
|
105
|
+
body.push(para(heading[1], { bold: true, size: sizes.heading, before: 240, after: 120, line: 300 }));
|
|
51
106
|
continue;
|
|
52
107
|
}
|
|
53
|
-
body.push(para(line.replace(/^[-*]\s+/, '· '), { size:
|
|
108
|
+
body.push(para(line.replace(/^[-*]\s+/, '· '), { size: sizes.body, after: 80, line: 360 }));
|
|
109
|
+
}
|
|
110
|
+
return body.join('');
|
|
111
|
+
}
|
|
112
|
+
export function buildMinuteDocumentXml(input) {
|
|
113
|
+
const body = [];
|
|
114
|
+
body.push(para(input.title, { bold: true, size: 36, align: 'center' }));
|
|
115
|
+
for (const line of input.meta) {
|
|
116
|
+
if (String(line).trim() !== '')
|
|
117
|
+
body.push(para(line, { size: 21 }));
|
|
54
118
|
}
|
|
119
|
+
body.push(para('', { size: 21 }));
|
|
120
|
+
body.push(buildBodyParagraphsXml(String(input.content ?? '')));
|
|
55
121
|
const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
56
122
|
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
57
123
|
<w:body>${body.join('')}<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/></w:sectPr></w:body>
|
|
58
124
|
</w:document>`;
|
|
125
|
+
return documentXml;
|
|
126
|
+
}
|
|
127
|
+
export function buildMinuteDocx(input) {
|
|
128
|
+
const documentXml = buildMinuteDocumentXml(input);
|
|
59
129
|
const entries = [
|
|
60
130
|
{ name: '[Content_Types].xml', data: Buffer.from(CONTENT_TYPES, 'utf8') },
|
|
61
131
|
{ name: '_rels/.rels', data: Buffer.from(RELS, 'utf8') },
|
|
@@ -67,6 +137,43 @@ export function buildMinuteDocx(input) {
|
|
|
67
137
|
* 生成 docx → 上传 → 回写纪要的 doc_file / mt_minutes → 回读校验。
|
|
68
138
|
* create / writeContent / fromGroupChat 三条路径共用,避免再漏某一条。
|
|
69
139
|
*/
|
|
140
|
+
/** 租户级「保存解析并生成文档」动作流 id(服务端生成标准纪要文档,回写 mt_minutes)。 */
|
|
141
|
+
const FLOW_GENERATE_DOCUMENT = '1F638AE31BC746C28A1D9DCF26D91037';
|
|
142
|
+
/**
|
|
143
|
+
* 走 ESB 生成标准纪要文档(与群聊链路同一条动作流)。
|
|
144
|
+
* 成功返回 docId;失败返回 error,由调用方决定是否回退本地 docx。
|
|
145
|
+
*/
|
|
146
|
+
export async function generateMinuteDocViaEsb(env, input) {
|
|
147
|
+
const id = String(input.id ?? '').trim();
|
|
148
|
+
const content = String(input.content ?? '').trim();
|
|
149
|
+
if (!id)
|
|
150
|
+
return { docId: '', error: 'missing_minute_id' };
|
|
151
|
+
if (!content)
|
|
152
|
+
return { docId: '', error: 'empty_content' };
|
|
153
|
+
try {
|
|
154
|
+
const session = await env.host.getSession();
|
|
155
|
+
const employeeId = String(session?.userId ?? '').trim();
|
|
156
|
+
if (!employeeId)
|
|
157
|
+
return { docId: '', error: 'no_employee_id' };
|
|
158
|
+
const flowId = String(input.flowId ?? '').trim() || FLOW_GENERATE_DOCUMENT;
|
|
159
|
+
const { createEsbHost } = await import('../esb/host.js');
|
|
160
|
+
const { createEsbContinuationSigner } = await import('../esb/continuation.js');
|
|
161
|
+
const { getEsbOperation } = await import('../esb/operations/registry.js');
|
|
162
|
+
const esbEnv = {
|
|
163
|
+
ctx: env.ctx,
|
|
164
|
+
host: createEsbHost(env.ctx),
|
|
165
|
+
continuation: createEsbContinuationSigner(env.ctx),
|
|
166
|
+
};
|
|
167
|
+
const target = /^\d+$/.test(flowId) ? { esbFlowId: flowId } : { uniqueIndent: flowId };
|
|
168
|
+
const prepared = await getEsbOperation('esb.trigger.prepare').handler({ employeeId, ...target, customParams: { mainTable: { parse_content: content, mt_minute_id: id } } }, esbEnv);
|
|
169
|
+
const applied = await getEsbOperation('esb.trigger.apply').handler({ continuation: prepared?.data?.continuation, confirm: true }, esbEnv);
|
|
170
|
+
const docId = String(applied?.data?.actionData?.responseData?.customData?.mainTable?.wdID ?? '').trim();
|
|
171
|
+
return docId ? { docId } : { docId: '', error: 'esb_returned_no_wdid' };
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
return { docId: '', error: String(error?.message ?? error).slice(0, 160) };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
70
177
|
/** 文件名净化:Windows 非法字符(尤其时间里的冒号)会让上传预检直接失败。 */
|
|
71
178
|
export function safeDocxName(subject) {
|
|
72
179
|
return String(subject ?? '')
|
|
@@ -24,6 +24,7 @@ import { createReadStream } from 'node:fs';
|
|
|
24
24
|
import { readFile, stat } from 'node:fs/promises';
|
|
25
25
|
import { extname, resolve } from 'node:path';
|
|
26
26
|
import { meetingValidationError } from '../errors.js';
|
|
27
|
+
import { requireDestructiveConfirm } from '../confirm-gate.js';
|
|
27
28
|
import { meetingSuccess, SCHEMA_ID } from './types.js';
|
|
28
29
|
import { listMeetingAttachments } from './attachment-content.js';
|
|
29
30
|
/** 超过这个大小就别读了 —— `readFile` 会把整个文件压进内存。 */
|
|
@@ -338,6 +339,11 @@ const meetingAttachmentAttach = {
|
|
|
338
339
|
items: { type: 'string' },
|
|
339
340
|
description: '可选:显式指定“现有附件 id”。不传时 CLI 自己读,通常不需要填',
|
|
340
341
|
},
|
|
342
|
+
confirm: {
|
|
343
|
+
type: 'boolean',
|
|
344
|
+
description: '只有 mode="replace" 且会议已有附件时才需要:不传会被拒绝(confirm_required),'
|
|
345
|
+
+ '因为那会覆盖整份附件列表。append 天然不需要',
|
|
346
|
+
},
|
|
341
347
|
},
|
|
342
348
|
required: ['id'],
|
|
343
349
|
},
|
|
@@ -380,6 +386,19 @@ const meetingAttachmentAttach = {
|
|
|
380
386
|
if (mode === 'append' && existingIds.length === 0) {
|
|
381
387
|
existingIds.push(...beforeIds);
|
|
382
388
|
}
|
|
389
|
+
// replace 会把 mt_accessorys 整份换成本次这一个文件 —— 已有附件时必须先确认,
|
|
390
|
+
// 否则"补传一个附件"被写成 replace 就是一次性清空别人的附件(不可逆)。
|
|
391
|
+
if (mode === 'replace' && beforeIds.length > 0) {
|
|
392
|
+
requireDestructiveConfirm({
|
|
393
|
+
confirm: args.confirm,
|
|
394
|
+
destructive: true,
|
|
395
|
+
action: '用本次文件覆盖会议附件列表',
|
|
396
|
+
details: [
|
|
397
|
+
`现有附件 ${beforeIds.length} 个${beforeIds.length > 0 ? `:${beforeIds.slice(0, 5).join('、')}${beforeIds.length > 5 ? ' 等' : ''}` : ''}`,
|
|
398
|
+
`覆盖后这份列表里只剩本次这 1 个文件`,
|
|
399
|
+
],
|
|
400
|
+
});
|
|
401
|
+
}
|
|
383
402
|
const { getMeetingOperation } = await import('./registry.js');
|
|
384
403
|
const list = getMeetingOperation('meeting.eb.meeting.list');
|
|
385
404
|
// 1) 需要的话先上传(带 refId 绑定到该会议)
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { meetingSuccess } from './types.js';
|
|
9
9
|
import { meetingValidationError } from '../errors.js';
|
|
10
|
+
import { requireDestructiveConfirm } from '../confirm-gate.js';
|
|
10
11
|
import { meetingUrlMap } from './eb/meeting-link.js';
|
|
11
12
|
const composeOutcome = {
|
|
12
13
|
name: 'meeting.outcome.compose',
|
|
@@ -21,7 +22,11 @@ const composeOutcome = {
|
|
|
21
22
|
type: 'object',
|
|
22
23
|
additionalProperties: false,
|
|
23
24
|
properties: {
|
|
24
|
-
confirm: {
|
|
25
|
+
confirm: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
description: '可省略:首次写入(同名纪要不存在)不需要;**要覆盖已存在的同名纪要时必须显式传 true**,'
|
|
28
|
+
+ '否则被拒绝(confirm_required)并给出"现有多少字 → 替换成多少字"。传 false 直接阻止写入',
|
|
29
|
+
},
|
|
25
30
|
mt_id: { type: 'string', description: '会议 id;与 mt_name/date 二选一' },
|
|
26
31
|
mt_name: { type: 'string', description: '会议名称关键词(可省略 mt_id,CLI 自动解析)' },
|
|
27
32
|
date: { type: 'string', description: '会议日期 yyyy-MM-dd,配合 mt_name/date 解析用' },
|
|
@@ -98,7 +103,24 @@ const composeOutcome = {
|
|
|
98
103
|
let minuteId = '';
|
|
99
104
|
let minuteDoc = null;
|
|
100
105
|
if (existing?.id) {
|
|
101
|
-
|
|
106
|
+
// 同名纪要已存在 ⇒ 这次是**覆盖更新**(不是新增):先确认,再写。
|
|
107
|
+
requireDestructiveConfirm({
|
|
108
|
+
confirm: args.confirm,
|
|
109
|
+
destructive: true,
|
|
110
|
+
action: `覆盖已存在的同名纪要「${subject}」`,
|
|
111
|
+
details: [
|
|
112
|
+
`已有纪要 id ${String(existing.id)}(标题「${String(existing.mt_minutes_subject ?? subject)}」)`,
|
|
113
|
+
`原文:现有 ${String(existing.minutes_content ?? '').length} 字 → 将替换为 ${String(args.minutes_content ?? '').length} 字`,
|
|
114
|
+
'同时会重新生成纪要文档并回写「纪要文件」',
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
const written = await getMeetingOperation('meeting.minute.writeContent').handler({
|
|
118
|
+
id: String(existing.id),
|
|
119
|
+
mt_id: mtId,
|
|
120
|
+
minutes_content: String(args.minutes_content ?? ''),
|
|
121
|
+
with_doc: true,
|
|
122
|
+
confirm: true,
|
|
123
|
+
}, env);
|
|
102
124
|
minuteId = String(existing.id);
|
|
103
125
|
minuteDoc = (written?.data?.minuteDoc ?? null);
|
|
104
126
|
for (const w of (written?.warnings ?? []))
|
|
@@ -539,7 +539,8 @@ const ebConflictRoom = {
|
|
|
539
539
|
resource: 'eb',
|
|
540
540
|
method: 'meeting.eb.conflict.room',
|
|
541
541
|
action: 'meeting.eb.conflict.room',
|
|
542
|
-
summary: 'EB 版会议室冲突检测(query_roomusage_list 查该会议室时段内占用):按应用设置 room_conflict_chk/room_conflict 给出 verdict'
|
|
542
|
+
summary: 'EB 版会议室冲突检测(query_roomusage_list 查该会议室时段内占用):按应用设置 room_conflict_chk/room_conflict 给出 verdict。'
|
|
543
|
+
+ '只用于「只问不建」;用户要建会请直接 create.flow.prepare —— 它内部判冲突,被占会自动换房并给出替代房',
|
|
543
544
|
capability: 'eb.conflict',
|
|
544
545
|
risk: 'read',
|
|
545
546
|
inputSchema: {
|
|
@@ -1061,6 +1061,35 @@ export async function fixedFlowIdsForEnv(env) {
|
|
|
1061
1061
|
* 只有一个有权限 → 直接发起(不弹窗);都没有权限 → 报"没有发起权限"。
|
|
1062
1062
|
* 只有显式 `flowChoice: 'auto'`(或 `WEAVER_MEETING_FLOW_CHOICE=auto`)才自动取第一个。
|
|
1063
1063
|
*/
|
|
1064
|
+
/**
|
|
1065
|
+
* workflow 层已经算好的耗时,原样透传(**不新增测量**,只是不再丢弃)。
|
|
1066
|
+
* 键名:durationMs→workflowMs、authMs→authMs、apiSlowest 字符串原样带。
|
|
1067
|
+
*/
|
|
1068
|
+
function workflowTimingsOf(data) {
|
|
1069
|
+
const out = {};
|
|
1070
|
+
for (const [from, to] of [['durationMs', 'workflowMs'], ['authMs', 'authMs']]) {
|
|
1071
|
+
const value = Number(data?.[from]);
|
|
1072
|
+
if (Number.isFinite(value) && value >= 0)
|
|
1073
|
+
out[to] = Math.round(value);
|
|
1074
|
+
}
|
|
1075
|
+
const slowest = data?.apiSlowest;
|
|
1076
|
+
if (typeof slowest === 'string' && slowest !== '')
|
|
1077
|
+
out.apiSlowest = slowest;
|
|
1078
|
+
return out;
|
|
1079
|
+
}
|
|
1080
|
+
/** 每个接口各自多久(workflow 层按 span 汇总好的)。 */
|
|
1081
|
+
function workflowApiDurations(data) {
|
|
1082
|
+
const raw = data?.apiDurations;
|
|
1083
|
+
if (!raw || typeof raw !== 'object')
|
|
1084
|
+
return null;
|
|
1085
|
+
const out = {};
|
|
1086
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
1087
|
+
const num = Number(value);
|
|
1088
|
+
if (Number.isFinite(num))
|
|
1089
|
+
out[key] = Math.round(num);
|
|
1090
|
+
}
|
|
1091
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
1092
|
+
}
|
|
1064
1093
|
export function shouldAutoPickFlow(args) {
|
|
1065
1094
|
if (args.flowChoice === 'auto')
|
|
1066
1095
|
return true;
|
|
@@ -1268,6 +1297,39 @@ export function decideEntryMode(input) {
|
|
|
1268
1297
|
return { mode: declared, reason: 'token' };
|
|
1269
1298
|
return { mode: '', reason: 'unverified' };
|
|
1270
1299
|
}
|
|
1300
|
+
/**
|
|
1301
|
+
* 是否已经"问都不用问"就能往下走(免入口询问)。
|
|
1302
|
+
*
|
|
1303
|
+
* 判据只有两条:**时间**(具体时刻,或时段+日期)和**地点**。
|
|
1304
|
+
* ⛔ 参会人**不参与**判定:
|
|
1305
|
+
* - 「没点名就不传 `hrm_members`,CLI 自动填当前登录人」是明文允许的输入;
|
|
1306
|
+
* - 拿它当阻断条件,会让「就我一个人参加」「我们两个去」这类会永远判不齐,
|
|
1307
|
+
* 白弹一次入口询问(一次调用实测 +8.5s,什么都没查)。
|
|
1308
|
+
* ⛔ 地点仍然要:它决定会不会撞占用/换房,没给地点时问一次入口是合理的。
|
|
1309
|
+
*/
|
|
1310
|
+
export function decideAutoDirect(args) {
|
|
1311
|
+
const beginRaw = String(args.begin_datetime ?? '').trim();
|
|
1312
|
+
const timeReady = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(beginRaw)
|
|
1313
|
+
|| (String(args.time_slot ?? '').trim() !== ''
|
|
1314
|
+
&& (String(args.dateFrom ?? '').trim() !== '' || /^\d{4}-\d{2}-\d{2}/.test(beginRaw)));
|
|
1315
|
+
const placeReady = String(args.address ?? args.customize_address ?? '').trim() !== ''
|
|
1316
|
+
|| args.allowNoRoom === true;
|
|
1317
|
+
return timeReady && placeReady;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* 时间**完全没给**:既没有时刻、也没有时段、也没有日期。
|
|
1321
|
+
*
|
|
1322
|
+
* 这种输入不能弹"直发 / 推荐"入口,也不能拿去推荐会议室 —— 只能先问时间。
|
|
1323
|
+
* (实测:缺时间时走推荐链路会返回 `room_unavailable`,用户看到的是"没推荐出可用会议室",
|
|
1324
|
+
* 而真实原因是他还没说什么时候开。)
|
|
1325
|
+
*/
|
|
1326
|
+
export function isTimeMissing(args) {
|
|
1327
|
+
const begin = String(args.begin_datetime ?? args.beginDatetime ?? '').trim();
|
|
1328
|
+
const hasClock = /\d{1,2}:\d{2}/.test(begin);
|
|
1329
|
+
const hasSlot = /(上午|下午|晚上|早上)/u.test(begin) || String(args.time_slot ?? '').trim() !== '';
|
|
1330
|
+
const hasDate = /\d{4}-\d{2}-\d{2}/.test(begin) || String(args.dateFrom ?? '').trim() !== '';
|
|
1331
|
+
return !hasClock && !hasSlot && !hasDate;
|
|
1332
|
+
}
|
|
1271
1333
|
const ebMeetingCreateFlowPrepare = {
|
|
1272
1334
|
name: 'meeting.eb.meeting.create.flow.prepare',
|
|
1273
1335
|
resource: 'eb',
|
|
@@ -1355,6 +1417,13 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
1355
1417
|
+ '不传 = 未确认:即使传了 address,CLI 也会把"你指定的这间"和推荐候选一起列出来让用户点选。'
|
|
1356
1418
|
+ '⛔ 不要自己从 room.list / room.recommend 里挑一间塞进 address —— 那是替用户拍板',
|
|
1357
1419
|
},
|
|
1420
|
+
roomStrategy: {
|
|
1421
|
+
type: 'string',
|
|
1422
|
+
enum: ['auto', 'ask'],
|
|
1423
|
+
description: '指定的会议室被占用时怎么办。auto(默认)= 自动改用首选空闲房并继续出确认卡,'
|
|
1424
|
+
+ '回复里说明换了哪间;ask = 返回候选让用户点选。'
|
|
1425
|
+
+ '只有用户明确表达"就要这间 / 必须是 317"时才传 ask',
|
|
1426
|
+
},
|
|
1358
1427
|
extraFields: {
|
|
1359
1428
|
type: 'object',
|
|
1360
1429
|
description: '按**流程表单里的字段名**填额外字段,形如 {"参会客户": "xx公司", "联系方式": "138xxxx"}'
|
|
@@ -1441,20 +1510,18 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
1441
1510
|
const { getMeetingOperation } = await import('../registry.js');
|
|
1442
1511
|
return getMeetingOperation('meeting.eb.meeting.create.formLink').handler(args, env);
|
|
1443
1512
|
}
|
|
1444
|
-
//
|
|
1445
|
-
|
|
1446
|
-
const
|
|
1447
|
-
|| (String(args.time_slot ?? '').trim() !== ''
|
|
1448
|
-
&& (String(args.dateFrom ?? '').trim() !== '' || /^\d{4}-\d{2}-\d{2}/.test(beginRaw)));
|
|
1449
|
-
const placeReady = String(args.address ?? args.customize_address ?? '').trim() !== '';
|
|
1450
|
-
const peopleReady = String(args.hrm_members ?? '').trim() !== '';
|
|
1451
|
-
const autoDirect = timeReady && placeReady && peopleReady;
|
|
1513
|
+
// 时间 + 地点已齐 ⇒ 直接往下走(判冲突/推荐/换房),不再问入口。
|
|
1514
|
+
// ⛔ 不要在这里再要求 `hrm_members`:没点名时 CLI 自动填当前登录人,是合法输入。
|
|
1515
|
+
const autoDirect = decideAutoDirect(args);
|
|
1452
1516
|
if (autoDirect) {
|
|
1453
1517
|
args = { ...args, skipPreflight: true };
|
|
1454
1518
|
skipPreflight = true;
|
|
1455
1519
|
}
|
|
1456
1520
|
// 入口确认:没有 entryMode、没有会话标记、也不是直接发起 → 必须先让用户选一次。
|
|
1457
|
-
|
|
1521
|
+
// ⛔ 但时间都没定(既没时刻、也没时段、也没日期)时**不要**弹入口:
|
|
1522
|
+
// 那个选择对用户毫无意义,而且会一路走到 room_unavailable(把"缺时间"错报成"没房间")。
|
|
1523
|
+
// 让流程继续往下,由后面的时间闸门给时段候选。
|
|
1524
|
+
if (!entryResolved && args.skipPreflight !== true && !isTimeMissing(args)) {
|
|
1458
1525
|
const { createEntryToken } = await import('./entry-mode.js');
|
|
1459
1526
|
const tokenDirect = await createEntryToken(env, 'direct_form');
|
|
1460
1527
|
const tokenAssist = await createEntryToken(env, 'assist');
|
|
@@ -1676,7 +1743,9 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
1676
1743
|
if (Number.isFinite(startMs))
|
|
1677
1744
|
endText = formatMinute(new Date(startMs + duration * 60000));
|
|
1678
1745
|
}
|
|
1679
|
-
|
|
1746
|
+
// ⛔ 这里不再要求 `!skipPreflight`:直发(skipPreflight)但**时间根本没给**时,
|
|
1747
|
+
// 往下走只会得到 room_unavailable("没推荐出可用的空闲会议室"),把缺时间错报成没房间。
|
|
1748
|
+
if (!beginHasTime || !timeConfirmed) {
|
|
1680
1749
|
const day = /^\d{4}-\d{2}-\d{2}/.test(beginText)
|
|
1681
1750
|
? beginText.slice(0, 10)
|
|
1682
1751
|
: (String(args.dateFrom ?? '').trim().slice(0, 10) || tomorrowIso());
|
|
@@ -1960,8 +2029,15 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
1960
2029
|
}).catch(noteFailure('参会人**日程空闲**检测'))
|
|
1961
2030
|
: Promise.resolve(null);
|
|
1962
2031
|
const enrichStarted = Date.now();
|
|
1963
|
-
|
|
1964
|
-
|
|
2032
|
+
// ⚡ 流程解析只读配置/缓存,不依赖房间与人员的检测结果 → 提前算出来,
|
|
2033
|
+
// 顺带把「表单载入(createForm)」塞进并行组:原本是四路检测**全部结束之后**才串行载表单,
|
|
2034
|
+
// 实测表单载入 1~4s(缓存 miss 时更久),藏进检测窗口里等于白赚。
|
|
2035
|
+
const resolvedEarly = await resolveWorkflowId(env, args).catch(() => null);
|
|
2036
|
+
const formPreloadTask = resolvedEarly?.workflowId
|
|
2037
|
+
? loadCreateForm(env, resolvedEarly.workflowId).catch(() => null)
|
|
2038
|
+
: Promise.resolve(null);
|
|
2039
|
+
const [roomRec, memberConflict, free, roomConflict, preloadedForm] = await Promise.all([
|
|
2040
|
+
roomTask, conflictTask, availabilityTask, roomConflictTask, formPreloadTask,
|
|
1965
2041
|
]);
|
|
1966
2042
|
mark('enrichMs', enrichStarted);
|
|
1967
2043
|
timings.parallelMs = Date.now() - startedAt;
|
|
@@ -2068,16 +2144,51 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2068
2144
|
});
|
|
2069
2145
|
}
|
|
2070
2146
|
// 只有"用户已确认这间房"时才按占用拦截;未确认的只是候选,交给下面的选房分支处理。
|
|
2071
|
-
//
|
|
2072
|
-
|
|
2147
|
+
// 指定房被占的默认处置:自动改用首选空闲房并继续出确认卡(回复里说明换了哪间),
|
|
2148
|
+
// 不再让用户对着 R1/R2/R3 手打一遍;只有用户明说"就要这间"(roomStrategy=ask)或没有替代房时才拦。
|
|
2149
|
+
const roomStrategyAsk = String(args.roomStrategy ?? '').trim() === 'ask';
|
|
2150
|
+
let roomSwitchNotice = '';
|
|
2151
|
+
/** 自动换房后的**可点候选**:R1 = 已改用的那间,R2 起 = 其它空闲房。
|
|
2152
|
+
* ⛔ 不给结构化候选项时,模型会自己把 `decisions.roomOptions` 抄成文字列表("可选:A / B / C"),
|
|
2153
|
+
* 用户只能手打房间名 —— 明明有数据,却退化成打字。
|
|
2154
|
+
*/
|
|
2155
|
+
let roomSwapOptions;
|
|
2156
|
+
if (addressInput && roomConfirmed && roomConflictData?.hasConflict === true
|
|
2157
|
+
&& roomOptions.length > 0 && !roomStrategyAsk) {
|
|
2073
2158
|
const fallback = roomOptions[0].value ?? {};
|
|
2074
2159
|
const from = { id: resolvedAddressId, name: addressDisplay };
|
|
2075
2160
|
resolvedAddressId = String(fallback.id ?? '');
|
|
2076
2161
|
addressDisplay = String(fallback.name ?? addressDisplay);
|
|
2077
2162
|
addressInput = resolvedAddressId;
|
|
2078
|
-
decisions.roomAutoSwitched = {
|
|
2163
|
+
decisions.roomAutoSwitched = {
|
|
2164
|
+
reason: '你指定的会议室该时段被占用,已改用首选空闲房',
|
|
2165
|
+
from,
|
|
2166
|
+
to: { id: resolvedAddressId, name: addressDisplay },
|
|
2167
|
+
};
|
|
2168
|
+
roomSwitchNotice = `${from.name} 在 ${beginText}~${endText} 已被占用,本次已改用「${addressDisplay}」;`
|
|
2169
|
+
+ '要换别的房间或改时间,直接在表单里改,或告诉我房间名';
|
|
2170
|
+
const others = roomOptions
|
|
2171
|
+
.filter((item) => String(item.value?.id ?? '') !== resolvedAddressId)
|
|
2172
|
+
.slice(0, 3);
|
|
2173
|
+
// 选项文案是给**最终用户**看的,不是给模型看的:
|
|
2174
|
+
// ⛔ label 只放房间名(+容纳人数),不要写「已自动改用 / 推荐」这类系统口径 —— 用户看不懂;
|
|
2175
|
+
// 为什么换、为什么选它,全写在 reason 里(照抄推荐理由:常用次数 + 容量 + 该时段空闲)。
|
|
2176
|
+
const picked = roomOptions[0];
|
|
2177
|
+
const pickedLabel = String(picked?.label ?? addressDisplay).replace(/\s*·\s*推荐\s*$/, '').trim();
|
|
2178
|
+
const pickedReason = String(picked?.reason ?? '').trim();
|
|
2179
|
+
roomSwapOptions = [
|
|
2180
|
+
{
|
|
2181
|
+
key: 'R1',
|
|
2182
|
+
label: pickedLabel || addressDisplay,
|
|
2183
|
+
reason: `${from.name} 该时段已被占用,已自动改用这间`
|
|
2184
|
+
+ (pickedReason ? `;${pickedReason}` : ''),
|
|
2185
|
+
value: { id: resolvedAddressId, name: addressDisplay, roomConfirmed: true, applyDirect: true },
|
|
2186
|
+
},
|
|
2187
|
+
...others.map((item, index) => ({ ...item, key: `R${index + 2}` })),
|
|
2188
|
+
];
|
|
2079
2189
|
}
|
|
2080
|
-
if (addressInput && roomConfirmed && roomConflictData?.hasConflict === true
|
|
2190
|
+
if (addressInput && roomConfirmed && roomConflictData?.hasConflict === true
|
|
2191
|
+
&& (roomStrategyAsk || roomOptions.length === 0)) {
|
|
2081
2192
|
const busy = Array.isArray(roomConflictData.conflicts) ? roomConflictData.conflicts : [];
|
|
2082
2193
|
decisions.roomConflict = {
|
|
2083
2194
|
address: resolvedAddressId,
|
|
@@ -2246,7 +2357,7 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2246
2357
|
// 理由:流程只是承载体,用户先要确定"这会到底开不开、什么时候开、在哪开、谁参加",
|
|
2247
2358
|
// 到这一步都定了,最后再让他挑"用哪条流程走审批"。所以时间/房间闸门都在上面,
|
|
2248
2359
|
// 到这里四要素已经齐了(时间带 timeConfirmed、地点带 roomConfirmed),只剩流程没定。
|
|
2249
|
-
const resolved = await resolveWorkflowId(env, args);
|
|
2360
|
+
const resolved = resolvedEarly ?? await resolveWorkflowId(env, args);
|
|
2250
2361
|
// 地点还原成**人看得懂的名字**(address 入参可能是 id):用户看确认摘要不能是一串数字。
|
|
2251
2362
|
// 名称/名称(id) 传进来时用解析出来的真实房间名,别再回显用户那串原文。
|
|
2252
2363
|
const confirmedAddressId = resolvedAddressId;
|
|
@@ -2269,6 +2380,8 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2269
2380
|
: '应用设置配置'));
|
|
2270
2381
|
let probes = [];
|
|
2271
2382
|
let loadedForms = new Map();
|
|
2383
|
+
if (preloadedForm && resolvedEarly?.workflowId)
|
|
2384
|
+
loadedForms.set(resolvedEarly.workflowId, preloadedForm);
|
|
2272
2385
|
// 固化自用场景:多个流程都能发起时自动取优先级最高的,不再打断用户去选(2026-10-30 要求)。
|
|
2273
2386
|
const autoPick = shouldAutoPickFlow(args);
|
|
2274
2387
|
if (!workflowId && candidates.length > 1) {
|
|
@@ -2413,7 +2526,11 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2413
2526
|
throw meetingValidationError('flow_context_missing', '建会流程表单没有返回 continuation,无法继续提交');
|
|
2414
2527
|
}
|
|
2415
2528
|
// 参会人冲突 / 空闲时段已在选房之前处理完(见上方 conflictBrief)。
|
|
2416
|
-
|
|
2529
|
+
// 把 mark() 记的分段耗时(enrichMs / formLoadMs / flowProbeMs…)一并交出去:
|
|
2530
|
+
// 只看一个总毫秒数没法判断"慢在哪",用户也没法自证是不是环境问题。
|
|
2531
|
+
const markMs = Object.fromEntries(Object.entries((env.__meetingTimings ?? {}))
|
|
2532
|
+
.filter(([key, value]) => /Ms$/.test(key) && typeof value === 'number'));
|
|
2533
|
+
decisions.timings = { ...timings, ...markMs };
|
|
2417
2534
|
// 参会客户:选了客户就自动算「应到客户数」,不让用户再手填一遍(填了以用户的为准)。
|
|
2418
2535
|
const crmMemberCount = (() => {
|
|
2419
2536
|
if (args.crm_member_count !== undefined && args.crm_member_count !== '')
|
|
@@ -2817,6 +2934,18 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2817
2934
|
return meetingSuccess('meeting.eb.meeting.create.flow.prepare', {
|
|
2818
2935
|
status: 'AWAITING_CONFIRMATION',
|
|
2819
2936
|
...(entryResolved ? { entryResolved } : {}),
|
|
2937
|
+
// 指定房被占、已自动换房时给一句人话说明:模型必须把它带进回复,不许静默换房
|
|
2938
|
+
...(roomSwitchNotice ? { roomSwitchNotice } : {}),
|
|
2939
|
+
// 换房后的候选房必须是可以点的:模型要问就渲染成选项控件,⛔ 不许抄成文字列表让用户打字
|
|
2940
|
+
...(roomSwapOptions
|
|
2941
|
+
? {
|
|
2942
|
+
options: roomSwapOptions,
|
|
2943
|
+
ui: { component: 'choice', multiple: false, recommendedKey: 'R1' },
|
|
2944
|
+
roomSwapHint: '要问用户就用选项控件渲染 options,⛔ 不许写成"可选:A/B/C"这种文字列表;'
|
|
2945
|
+
+ 'R1 是已自动改用的房(点它直接用 continuationId 提交,不必重新预检),'
|
|
2946
|
+
+ 'R2 起是其它空闲房(选中后用该 value.id 当 address 重新 prepare)',
|
|
2947
|
+
}
|
|
2948
|
+
: {}),
|
|
2820
2949
|
preview: {
|
|
2821
2950
|
workflowId,
|
|
2822
2951
|
workflowCandidates: candidates,
|
|
@@ -2845,6 +2974,10 @@ const ebMeetingCreateFlowPrepare = {
|
|
|
2845
2974
|
},
|
|
2846
2975
|
continuation,
|
|
2847
2976
|
continuationId: await saveContinuationAlias(continuation, CONTINUATION_TTL_MS).catch(() => null),
|
|
2977
|
+
// 长 token 有 4KB,模型转述时会被截断/改写(实测出现过 fingerprint 被改成 "x" 导致验签失败)。
|
|
2978
|
+
// 这里把"该用哪个"写成一句话,避免模型自己挑。
|
|
2979
|
+
submitHint: '提交 apply 时传 continuationId(8 位)即可,不要手抄 continuation 长串;'
|
|
2980
|
+
+ '长串被截断或改写会报 continuation_invalid',
|
|
2848
2981
|
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
2849
2982
|
}, warnings.length > 0 ? { warnings } : {});
|
|
2850
2983
|
},
|
|
@@ -3122,7 +3255,17 @@ const ebMeetingCreateFlowApply = {
|
|
|
3122
3255
|
message: String(submittedData.message ?? ''),
|
|
3123
3256
|
invitation: browserInvitation,
|
|
3124
3257
|
...(groupChat ? { groupChat } : {}),
|
|
3125
|
-
|
|
3258
|
+
// ⛔ 这里以前只报 submitMs(拼 URL 的 13ms),把 workflow 层**已经算好**的
|
|
3259
|
+
// `durationMs / authMs / apiDurations / apiSlowest` 全丢了 —— 于是用户看到"7 秒"、
|
|
3260
|
+
// timings 里只有 13ms,谁也说不清剩下的时间花在哪(2026-11-30 用户质问)。
|
|
3261
|
+
// 这些字段 workflow 本来就产出(见 workflow/index.ts 的 printWorkflowResult 注释),
|
|
3262
|
+
// 这里只是别再把它们扔掉,方便直接对着日志看分段。
|
|
3263
|
+
timings: {
|
|
3264
|
+
submitMs: Date.now() - submitStartedAt,
|
|
3265
|
+
invitationMs: pre.ms,
|
|
3266
|
+
...workflowTimingsOf(submittedData),
|
|
3267
|
+
},
|
|
3268
|
+
...(workflowApiDurations(submittedData) ? { apiDurations: workflowApiDurations(submittedData) } : {}),
|
|
3126
3269
|
}, {
|
|
3127
3270
|
warnings: [
|
|
3128
3271
|
'当前是小e 环境:本次**没有向服务端写入**,建会流程改由浏览器页面完成填单(见 finalMarkdown)。'
|
|
@@ -250,8 +250,17 @@ export async function recommendRooms(env, input) {
|
|
|
250
250
|
const candidates = [];
|
|
251
251
|
/** 描述/名称命中「接待」定位的房间 id:带客户时作为硬筛选池,而不是加分项。 */
|
|
252
252
|
const purposeHitIds = new Set();
|
|
253
|
+
/** 台账里到底有没有接待类房间(**不论忙闲**)。用来区分两种"候选池空了":
|
|
254
|
+
* ① 根本没有接待房 → 只能退回普通房;② 有接待房但都被占/被楼层设备筛掉 → 必须拦住,不许退回普通房。 */
|
|
255
|
+
let receptionSeen = false;
|
|
253
256
|
for (const room of usable) {
|
|
254
257
|
const isBusy = busy.ids.has(room.id);
|
|
258
|
+
if (requirement.hasCustomer === true && !receptionSeen) {
|
|
259
|
+
const hostName = room.name.match(/(接待|招待|贵宾|商务|vip)/iu);
|
|
260
|
+
const hostDesc = String(room.roomDesc ?? '').trim().match(/(接待|招待|贵宾|商务|vip)/iu);
|
|
261
|
+
if (hostName || hostDesc)
|
|
262
|
+
receptionSeen = true;
|
|
263
|
+
}
|
|
255
264
|
if (isBusy) {
|
|
256
265
|
busyCount += 1;
|
|
257
266
|
if (!input.includeBusy)
|
|
@@ -343,10 +352,20 @@ export async function recommendRooms(env, input) {
|
|
|
343
352
|
}
|
|
344
353
|
// 定位优先(带客户场景):只要库里有「接待」定位的房间,就只在这些房间里排序。
|
|
345
354
|
// 常规/容量分再高也不能顶掉定位,否则会把客户安排到普通茶室。
|
|
346
|
-
|
|
355
|
+
let receptionBlocked = false;
|
|
356
|
+
if (requirement.hasCustomer === true && receptionSeen) {
|
|
347
357
|
const preferred = candidates.filter((candidate) => purposeHitIds.has(candidate.id));
|
|
348
|
-
if (preferred.length > 0)
|
|
358
|
+
if (preferred.length > 0) {
|
|
349
359
|
candidates.splice(0, candidates.length, ...preferred);
|
|
360
|
+
}
|
|
361
|
+
else if (candidates.length > 0) {
|
|
362
|
+
// 有接待房,但当前筛选范围(楼层 / 设备 / 容量 / 占用)里一间都进不来。
|
|
363
|
+
// ⛔ 不许静默退回普通房:客户会被排进普通会议室,而用户完全看不出"接待类"这条规则没生效。
|
|
364
|
+
candidates.length = 0;
|
|
365
|
+
receptionBlocked = true;
|
|
366
|
+
warnings.push('本次带客户,但当前条件下没有可用的接待类会议室(楼层 / 设备 / 人数 / 占用任一维度把它筛没了);'
|
|
367
|
+
+ '已停止推荐,请换楼层、去掉设备要求,或改会议时间');
|
|
368
|
+
}
|
|
350
369
|
}
|
|
351
370
|
candidates.sort((left, right) => {
|
|
352
371
|
if (right.score !== left.score)
|
|
@@ -361,7 +380,7 @@ export async function recommendRooms(env, input) {
|
|
|
361
380
|
// ⛔ 候选为空且数据来自缓存 → 缓存可能已过时(刚导入会议室、房间刚解封、容量刚改),
|
|
362
381
|
// 静默用旧缓存回答会让用户得出"系统里没有会议室/只有一间"的错误结论(2026-10-30 真机事故)。
|
|
363
382
|
// 这里自动强制重拉一次再算;只有重拉后仍为空才如实报告。不递归:refreshRooms=true 时直接跳过。
|
|
364
|
-
if (candidates.length === 0 && roomData.fromCache && input.refreshRooms !== true) {
|
|
383
|
+
if (candidates.length === 0 && roomData.fromCache && input.refreshRooms !== true && !receptionBlocked) {
|
|
365
384
|
const retried = await recommendRooms(env, { ...input, refreshRooms: true, refreshFrequent: true });
|
|
366
385
|
return {
|
|
367
386
|
...retried,
|