weaver-work-cli 0.1.47 → 0.1.48

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 (181) hide show
  1. package/dist/chunks/{archive-oa-BBDP7AKJ.js → archive-oa-EDJDU3V4.js} +454 -5
  2. package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-4KSNBPRO.js} +3 -3
  3. package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
  4. package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
  5. package/dist/chunks/{chunk-76H3IKH6.js → chunk-5B5JXTY2.js} +35 -35
  6. package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
  7. package/dist/chunks/{chunk-4RWS2YYL.js → chunk-BCACE6VV.js} +2 -2
  8. package/dist/chunks/{chunk-AD46OMQK.js → chunk-EFOUMXIX.js} +119 -44
  9. package/dist/chunks/{chunk-IRMIEDXN.js → chunk-FEP6ELMR.js} +1 -1
  10. package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
  11. package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
  12. package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-NK74RE5F.js} +2 -2
  13. package/dist/chunks/{chunk-GSZTA43P.js → chunk-OCYRVZGN.js} +2 -2
  14. package/dist/chunks/{chunk-OXHHJWNC.js → chunk-PSPOFLSU.js} +1 -1
  15. package/dist/chunks/{chunk-6AXKWFKG.js → chunk-R2HHLJNN.js} +4 -4
  16. package/dist/chunks/{chunk-PSOMGA3U.js → chunk-SVFG6EMV.js} +35 -6
  17. package/dist/chunks/{chunk-IP4CWQCF.js → chunk-WMSAWAWZ.js} +8 -8
  18. package/dist/chunks/{conflict-H7EHQXYY.js → conflict-APGSD5E7.js} +2 -2
  19. package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
  20. package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-5TXFOC7X.js} +6 -6
  21. package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
  22. package/dist/chunks/{env-66FPSJDV.js → env-B6GKA2J3.js} +2 -2
  23. package/dist/chunks/{factory-UH2TZBVA.js → factory-MFCKLUT6.js} +1 -1
  24. package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-YE7WIBFO.js} +3 -3
  25. package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
  26. package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
  27. package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
  28. package/dist/chunks/{meeting-VTBFW4HI.js → meeting-RYZV2JTQ.js} +10 -10
  29. package/dist/chunks/{reception-5WITA44R.js → reception-VL6TKVAW.js} +480 -26
  30. package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-ERZD3ZNB.js} +52 -16
  31. package/dist/chunks/{registry-JVQBLFQ5.js → registry-22O6UG4I.js} +10 -10
  32. package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
  33. package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
  34. package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-IMZPJMYB.js} +4 -4
  35. package/dist/chunks/{schedule-IDETODCA.js → schedule-SPPAHER2.js} +4 -4
  36. package/dist/chunks/{workflow-BSYT5TGL.js → workflow-WVEFJ6KC.js} +2 -2
  37. package/dist/core/refs.js +19 -2
  38. package/dist/index.js +14 -14
  39. package/dist/shortcuts/archive-oa/constants.js +42 -0
  40. package/dist/shortcuts/archive-oa/host.js +2 -2
  41. package/dist/shortcuts/archive-oa/index.js +38 -0
  42. package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
  43. package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
  44. package/dist/shortcuts/archive-oa/operations/registry.js +5 -3
  45. package/dist/shortcuts/contract/index.js +9 -1
  46. package/dist/shortcuts/contract/manifest.js +14 -2
  47. package/dist/shortcuts/contract/operations/card.js +231 -0
  48. package/dist/shortcuts/contract/operations/registry.js +2 -0
  49. package/dist/shortcuts/contract/operations/review.js +16 -5
  50. package/dist/shortcuts/contract/operations/summary.js +25 -17
  51. package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
  52. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +17 -8
  53. package/dist/shortcuts/ehr/recruit-stage/shared.js +33 -8
  54. package/dist/shortcuts/im/index.js +128 -0
  55. package/dist/shortcuts/im/operations/session.js +6 -0
  56. package/dist/shortcuts/invoice/host.js +0 -3
  57. package/dist/shortcuts/invoice/manifest.js +0 -1
  58. package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
  59. package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
  60. package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
  61. package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
  62. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
  63. package/dist/shortcuts/reception/host.js +33 -1
  64. package/dist/shortcuts/reception/index.js +19 -0
  65. package/dist/shortcuts/reception/manifest.js +53 -1
  66. package/dist/shortcuts/reception/operations/ask.js +18 -0
  67. package/dist/shortcuts/reception/operations/compose.js +113 -3
  68. package/dist/shortcuts/reception/operations/leads.js +245 -0
  69. package/dist/shortcuts/reception/operations/markdown.js +22 -0
  70. package/dist/shortcuts/reception/operations/registry.js +2 -0
  71. package/dist/shortcuts/reception/operations/render.js +36 -3
  72. package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
  73. package/dist/shortcuts/reception/operations/restaurant.js +251 -0
  74. package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
  75. package/dist/shortcuts/reception/operations/schedule.js +7 -1
  76. package/dist/shortcuts/reception/upload.js +22 -6
  77. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +17 -8
  78. package/dist/shortcuts/recruit-stage/shared.js +42 -14
  79. package/docs/archive-oa.md +4 -2
  80. package/package.json +1 -1
  81. package/skill-template/domains/archive-oa.md +2 -1
  82. package/skill-template/master-skill-template.md +1 -0
  83. package/skill-template/skill-template.md +1 -0
  84. package/skills/weaver-e10-archive-oa/SKILL.md +33 -6
  85. package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
  86. package/skills/weaver-e10-archive-oa/references/contract-search.md +32 -0
  87. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
  88. package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
  89. package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
  90. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +22 -0
  91. package/skills/weaver-e10-calendar/SKILL.md +1 -1
  92. package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
  93. package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
  94. package/skills/weaver-e10-cowork/SKILL.md +9 -6
  95. package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
  96. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
  97. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
  98. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
  99. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  100. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
  101. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  102. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  103. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
  104. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
  105. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
  106. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
  107. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
  108. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  109. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  110. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
  111. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
  112. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  113. package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
  114. package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
  115. package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
  116. package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
  117. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
  118. package/skills/weaver-e10-jucailin/SKILL.md +7 -4
  119. package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
  120. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
  121. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
  122. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
  123. package/skills/weaver-e10-mail/SKILL.md +17 -4
  124. package/skills/weaver-e10-meeting/SKILL.md +94 -409
  125. package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
  126. package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
  127. package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
  128. package/skills/weaver-e10-reception-flow/SKILL.md +62 -18
  129. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
  130. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
  131. package/skills/weaver-e10-reception-flow/scripts/render.py +81 -2
  132. package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
  133. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +58 -8
  134. package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
  135. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
  136. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
  137. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
  138. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
  139. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
  140. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
  141. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
  142. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
  143. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
  144. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
  145. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +127 -0
  146. package/skills/weaver-e10-shijingran/SKILL.md +6 -2
  147. package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
  148. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  149. package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
  150. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
  151. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  152. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
  153. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
  154. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
  155. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
  156. package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
  157. package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
  158. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
  159. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
  160. package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-I5ZIX4WO.js} +3 -3
  161. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
  162. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
  163. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
  164. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
  165. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
  166. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
  167. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
  168. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
  169. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
  170. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
  171. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
  172. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
  173. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
  174. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
  175. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
  176. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
  177. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
  178. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
  179. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
  180. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
  181. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
@@ -0,0 +1,271 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { MY_BORROW_ARCHIVE_OPEN_PATH, MY_BORROW_CONTRACT, MY_BORROW_EXPIRE_MAX, MY_BORROW_FLOW_VIEW_PATH, } from '../constants.js';
3
+ import { archiveOaValidationError } from '../errors.js';
4
+ import { READ, SCHEMA_PAGE_NO, SCHEMA_SEARCH_FIELDS, archiveOaSuccess, schemaOf, } from './types.js';
5
+ import { positiveInt, unwrapData } from './shared.js';
6
+ const GET_DATA_PATH = '/api/ebuilder/form/eblist/getData';
7
+ const GET_COUNT_PATH = '/api/ebuilder/form/eblist/getCount';
8
+ /** 默认页大小;界面同样用 10。 */
9
+ const DEFAULT_PAGE_SIZE = 10;
10
+ const MAX_PAGE_SIZE = 50;
11
+ /** 可筛选字段别名 → 组件元数据。别名面向用户,组件 ID + 字段名面向接口。 */
12
+ function filterableFields(profile) {
13
+ return {
14
+ customer: { id: profile.fields.customer, name: 'qyf', kind: 'text' },
15
+ contractNo: { id: profile.fields.contractNo, name: 'hth', kind: 'text' },
16
+ expireDate: { id: profile.fields.expireDate, name: 'sqjsrq', kind: 'date' },
17
+ };
18
+ }
19
+ function today() {
20
+ const now = new Date();
21
+ const pad = (value) => String(value).padStart(2, '0');
22
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
23
+ }
24
+ function randomHex(byteLength = 16) {
25
+ return randomBytes(byteLength).toString('hex');
26
+ }
27
+ function assertDateText(value, field) {
28
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(value)) {
29
+ throw archiveOaValidationError('date_invalid', `${field} 必须是 YYYY-MM-DD`);
30
+ }
31
+ return value;
32
+ }
33
+ /** 组装一条 eBuilder 高级筛选条件。 */
34
+ function buildCondition(profile, field, funcType, value) {
35
+ const isDate = field.kind === 'date';
36
+ return {
37
+ conditionType: 'and',
38
+ dataType: 'field',
39
+ id: randomHex(),
40
+ conditionComId: `${profile.compId}_advance_EXCLUDECACHE`,
41
+ filterFields: [
42
+ {
43
+ compId: profile.compId,
44
+ compType: isDate ? 'DateComponent' : 'Text',
45
+ dataset: {
46
+ isPhysical: true,
47
+ relationDataset: {
48
+ groupId: '690514401801175040',
49
+ id: '1173842415229292544',
50
+ type: 'ETEAMS',
51
+ },
52
+ ebuilderDataConfig: { dataSetup: {}, datasetType: 'sql', type: 'FORM' },
53
+ detailTable: false,
54
+ groupId: 'weaver-ebuilder-form-service',
55
+ usage: 'all',
56
+ appId: profile.pageAppId,
57
+ id: profile.objId,
58
+ text: '我借阅的合同档案',
59
+ type: 'LOGIC',
60
+ objType: 'vform',
61
+ },
62
+ fieldName: field.name,
63
+ ...(isDate ? { formatType: '4' } : {}),
64
+ id: field.id,
65
+ objId: profile.objId,
66
+ type: isDate ? 'Date' : 'String',
67
+ text: field.name,
68
+ },
69
+ ],
70
+ funcType,
71
+ value,
72
+ customSelect: null,
73
+ };
74
+ }
75
+ /** 把用户条件(别名 + like/between)转换成接口条件;`expireDate` 走 between。 */
76
+ function parseConditions(profile, fields, defaultCondition) {
77
+ const aliases = filterableFields(profile);
78
+ const conditions = [];
79
+ let expireRange = null;
80
+ if (fields !== undefined && fields !== null) {
81
+ if (!Array.isArray(fields)) {
82
+ throw archiveOaValidationError('search_fields_invalid', 'fields 必须是数组');
83
+ }
84
+ for (const [index, raw] of fields.entries()) {
85
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
86
+ throw archiveOaValidationError('search_fields_invalid', `fields[${index}] 必须是对象`);
87
+ }
88
+ const item = raw;
89
+ const name = String(item.field ?? '').trim();
90
+ const meta = aliases[name];
91
+ if (!meta) {
92
+ throw archiveOaValidationError('search_field_unknown', `fields[${index}].field 只支持 ${Object.keys(aliases).join(' / ')}`);
93
+ }
94
+ if (item.value === undefined || item.value === null || item.value === '') {
95
+ throw archiveOaValidationError('search_value_required', `fields[${index}].value 必填`);
96
+ }
97
+ if (meta.kind === 'date') {
98
+ if (Array.isArray(item.value) || typeof item.value === 'object') {
99
+ const range = Array.isArray(item.value)
100
+ ? { min: String(item.value[0] ?? ''), max: String(item.value[1] ?? '') }
101
+ : { min: String(item.value.min ?? ''), max: String(item.value.max ?? '') };
102
+ const min = assertDateText(range.min, `fields[${index}].value.min`);
103
+ const max = assertDateText(range.max, `fields[${index}].value.max`);
104
+ conditions.push({ field: meta, funcType: 'between', value: `${min},${max}` });
105
+ if (name === 'expireDate')
106
+ expireRange = { min, max };
107
+ continue;
108
+ }
109
+ const text = assertDateText(String(item.value).trim(), `fields[${index}].value`);
110
+ conditions.push({ field: meta, funcType: 'between', value: `${text},${text}` });
111
+ if (name === 'expireDate')
112
+ expireRange = { min: text, max: text };
113
+ continue;
114
+ }
115
+ if (typeof item.value !== 'string') {
116
+ throw archiveOaValidationError('search_value_invalid', `fields[${index}].value 必须是字符串`);
117
+ }
118
+ conditions.push({ field: meta, funcType: 'like', value: item.value.trim() });
119
+ }
120
+ }
121
+ if (defaultCondition && !expireRange) {
122
+ const min = today();
123
+ conditions.push({
124
+ field: { id: profile.fields.expireDate, name: 'sqjsrq', kind: 'date' },
125
+ funcType: 'between',
126
+ value: `${min},${MY_BORROW_EXPIRE_MAX}`,
127
+ });
128
+ expireRange = { min, max: MY_BORROW_EXPIRE_MAX };
129
+ }
130
+ return { conditions, expireRange: expireRange ?? { min: '', max: '' } };
131
+ }
132
+ function buildFormData(profile, values) {
133
+ const form = new FormData();
134
+ for (const [key, value] of Object.entries(values))
135
+ form.append(key, value);
136
+ return form;
137
+ }
138
+ const PAGE_FILTER = JSON.stringify({ filter: {}, filterIsNull: true, esbFilter: [] });
139
+ /** 电子档案 ID 判定:空、`0`、`-1` 视为没有电子档案文件。 */
140
+ export function hasArchiveFile(raw) {
141
+ const text = String(raw ?? '').trim();
142
+ if (!text)
143
+ return false;
144
+ if (text === '0' || text === '-1')
145
+ return false;
146
+ if (text.toLowerCase() === 'null' || text.toLowerCase() === 'undefined')
147
+ return false;
148
+ if (text === '0_0')
149
+ return false;
150
+ return true;
151
+ }
152
+ function applicantName(value) {
153
+ if (Array.isArray(value)) {
154
+ return value
155
+ .map((item) => (item && typeof item === 'object' ? String(item.name ?? '') : ''))
156
+ .filter((name) => name.length > 0)
157
+ .join('、');
158
+ }
159
+ return typeof value === 'string' ? value : '';
160
+ }
161
+ export const myBorrowListOperation = {
162
+ name: 'archive-oa.my-borrow.list',
163
+ resource: 'my-borrow',
164
+ method: 'list',
165
+ action: 'archive-oa.my-borrow.list',
166
+ summary: '查询「我借阅的合同档案」台账(eBuilder 列表),默认只看未过期',
167
+ capability: 'my-borrow',
168
+ risk: READ,
169
+ inputSchema: schemaOf({
170
+ pageNo: { ...SCHEMA_PAGE_NO, description: '页码,从 1 开始,缺省 1' },
171
+ pageSize: {
172
+ type: 'integer',
173
+ minimum: 1,
174
+ maximum: MAX_PAGE_SIZE,
175
+ description: `每页条数,缺省 ${DEFAULT_PAGE_SIZE},最多 ${MAX_PAGE_SIZE}`,
176
+ },
177
+ includeExpired: {
178
+ type: 'boolean',
179
+ description: '为 true 时去掉「授权到期日期」时间条件,返回全部(含已过期);缺省 false',
180
+ },
181
+ fields: {
182
+ ...SCHEMA_SEARCH_FIELDS,
183
+ description: '附加筛选:field 支持 customer(签约方 qyf,like)/ contractNo(合同号 hth,like)/ expireDate(授权到期日期 sqjsrq,between)',
184
+ },
185
+ }, { description: '查询我借阅的合同档案' }),
186
+ handler: async (args, env) => {
187
+ const profile = MY_BORROW_CONTRACT;
188
+ const pageNo = positiveInt(args.pageNo, 'pageNo', 1);
189
+ const pageSize = positiveInt(args.pageSize, 'pageSize', DEFAULT_PAGE_SIZE);
190
+ if (pageSize > MAX_PAGE_SIZE) {
191
+ throw archiveOaValidationError('number_invalid', `pageSize 最多 ${MAX_PAGE_SIZE}`);
192
+ }
193
+ const includeExpired = args.includeExpired === true;
194
+ const { conditions, expireRange } = parseConditions(profile, args.fields, !includeExpired);
195
+ const filter = conditions.map((condition) => buildCondition(profile, condition.field, condition.funcType, condition.value));
196
+ const tableuid = randomHex();
197
+ const session = await env.host.getSession();
198
+ const dataResponse = await env.host.request({
199
+ method: 'POST',
200
+ path: GET_DATA_PATH,
201
+ operation: 'archive-oa.my-borrow.list',
202
+ formData: buildFormData(profile, {
203
+ filter: JSON.stringify(filter),
204
+ fieldFilter: '{}',
205
+ pageFilter: PAGE_FILTER,
206
+ pageAppId: profile.pageAppId,
207
+ compId: profile.compId,
208
+ pageId: profile.pageId,
209
+ pageNo: String(pageNo),
210
+ pageSize: String(pageSize),
211
+ tableuid,
212
+ refPluginPackageId: profile.refPluginPackageId,
213
+ }),
214
+ });
215
+ const data = (unwrapData(dataResponse) ?? {});
216
+ const list = Array.isArray(data.list) ? data.list : [];
217
+ const baseUrl = session.baseUrl.replace(/\/+$/u, '');
218
+ const rows = list.map((row, index) => {
219
+ const archiveId = String(row[profile.fields.archiveId] ?? '').trim();
220
+ const available = hasArchiveFile(archiveId);
221
+ const requestId = String(row[profile.fields.requestId] ?? '').trim();
222
+ return {
223
+ index: index + 1,
224
+ applyDate: String(row[profile.fields.applyDate] ?? ''),
225
+ requestId,
226
+ flowUrl: requestId
227
+ ? `${baseUrl}${MY_BORROW_FLOW_VIEW_PATH}/${encodeURIComponent(requestId)}`
228
+ : '',
229
+ customer: String(row[profile.fields.customer] ?? ''),
230
+ contractNo: String(row[profile.fields.contractNo] ?? ''),
231
+ archiveId,
232
+ hasArchive: available,
233
+ archiveUrl: available
234
+ ? `${baseUrl}${MY_BORROW_ARCHIVE_OPEN_PATH}?appId=${profile.archiveAppId}&archiveId=${encodeURIComponent(archiveId)}`
235
+ : '',
236
+ expireDate: String(row[profile.fields.expireDate] ?? ''),
237
+ applicant: applicantName(row[profile.fields.applicant]),
238
+ };
239
+ });
240
+ let total;
241
+ try {
242
+ const countResponse = await env.host.request({
243
+ method: 'POST',
244
+ path: GET_COUNT_PATH,
245
+ operation: 'archive-oa.my-borrow.list',
246
+ query: { passid: profile.objId },
247
+ formData: buildFormData(profile, {
248
+ tableuid,
249
+ pageId: profile.pageId,
250
+ compId: profile.compId,
251
+ refPluginPackageId: profile.refPluginPackageId,
252
+ }),
253
+ });
254
+ const countData = (unwrapData(countResponse) ?? {});
255
+ const parsed = Number(countData.total);
256
+ if (Number.isFinite(parsed))
257
+ total = parsed;
258
+ }
259
+ catch {
260
+ /** 总数只是辅助信息,失败时不影响列表结果。 */
261
+ }
262
+ return archiveOaSuccess('archive-oa.my-borrow.list', { rows }, {
263
+ source: profile.source,
264
+ pageNo,
265
+ pageSize,
266
+ total,
267
+ includeExpired,
268
+ expireRange: includeExpired ? undefined : expireRange,
269
+ });
270
+ },
271
+ };
@@ -1,18 +1,20 @@
1
- import { QYS_BORROW_CAR, QYS_ESB_ADD, WEAVER_BORROW_CAR, WEAVER_ESB_ADD } from '../constants.js';
1
+ import { QYS_BORROW_CAR, QYS_ESB_ADD, QYS_ESB_REMOVE, WEAVER_BORROW_CAR, WEAVER_ESB_ADD, WEAVER_ESB_REMOVE, } from '../constants.js';
2
2
  import { archiveOaValidationError } from '../errors.js';
3
3
  import { createBorrowCarOperations } from './borrow-car.js';
4
4
  import { createBorrowStartUrlOperation } from './borrow-url.js';
5
5
  import { qysContractListOperation, weaverContractFieldsOperation, weaverContractListOperation, } from './contract.js';
6
6
  import { archiveLocateOperation } from './locate.js';
7
+ import { myBorrowListOperation } from './my-borrow-contract.js';
7
8
  function buildRegistry() {
8
9
  const registry = new Map();
9
10
  const definitions = [
10
11
  archiveLocateOperation,
12
+ myBorrowListOperation,
11
13
  weaverContractFieldsOperation,
12
14
  weaverContractListOperation,
13
15
  qysContractListOperation,
14
- ...createBorrowCarOperations(WEAVER_BORROW_CAR, WEAVER_ESB_ADD),
15
- ...createBorrowCarOperations(QYS_BORROW_CAR, QYS_ESB_ADD),
16
+ ...createBorrowCarOperations(WEAVER_BORROW_CAR, WEAVER_ESB_ADD, WEAVER_ESB_REMOVE),
17
+ ...createBorrowCarOperations(QYS_BORROW_CAR, QYS_ESB_ADD, QYS_ESB_REMOVE),
16
18
  createBorrowStartUrlOperation(WEAVER_BORROW_CAR),
17
19
  createBorrowStartUrlOperation(QYS_BORROW_CAR),
18
20
  ];
@@ -360,7 +360,7 @@ export const contractShortcut = {
360
360
  ]);
361
361
  registerCommand(review, 'export', 'Export AI review records', 'contract.review.export', [
362
362
  { flag: '--file-id <id>', description: 'contract file id', key: 'fileId' },
363
- { flag: '--sclx <types>', description: '1 risk, 2 legal, 3 proofreading', key: 'sclx' },
363
+ { flag: '--sclx <types>', description: '8 risk review (contract pre-review); 1/2/3 disabled', key: 'sclx' },
364
364
  ]);
365
365
  const flow = contract.command('flow').description('Contract flow entry commands');
366
366
  registerCommand(flow, 'page', 'Build the flow create page url', 'contract.flow.page', [
@@ -454,6 +454,14 @@ export const contractShortcut = {
454
454
  { flag: '--data <file>', description: 'summary data JSON path', key: 'data' },
455
455
  { flag: '--out <file>', description: 'output HTML path', key: 'out' },
456
456
  ]);
457
+ const card = contract.command('card').description('Contract action card rendering commands (local)');
458
+ registerCommand(card, 'render', 'Render action card JSON into xiaoeCustomPage HTML (local)', 'contract.card.render', [
459
+ { flag: '--data <file>', description: 'card data JSON path', key: 'data' },
460
+ { flag: '--out <file>', description: 'output card HTML path', key: 'out' },
461
+ { flag: '--summary <file>', description: 'optional summary data JSON path to embed', key: 'summary' },
462
+ { flag: '--browsertool <file>', description: 'optional path to write full browsertool JSON', key: 'browsertool' },
463
+ { flag: '--base-url <url>', description: 'optional E10 base url, defaults to session', key: 'baseUrl' },
464
+ ]);
457
465
  const file = contract.command('file').description('Contract file download commands (binary)');
458
466
  registerCommand(file, 'download', 'Download an E10 file to a local path', 'contract.file.download', [
459
467
  { flag: '--file-id <id>', description: 'E10 file id (template / attachment / review file)', key: 'fileId' },
@@ -443,6 +443,18 @@ const quoteContracts = [
443
443
  out: { type: 'string', minLength: 1, maxLength: 4096, description: '输出 HTML 绝对路径' },
444
444
  }, ['data', 'out']),
445
445
  },
446
+ {
447
+ name: 'contract.card.render',
448
+ risk: 'local-file-write',
449
+ fixed: { local: true, kind: 'card-render' },
450
+ inputSchema: readSchema({
451
+ data: { type: 'string', minLength: 1, maxLength: 4096, description: '卡片数据 JSON 文件路径(cards 数组 + title/width/hint)' },
452
+ out: { type: 'string', minLength: 1, maxLength: 4096, description: '输出卡片 HTML 绝对路径(即 customParams.html 内容)' },
453
+ summary: { type: 'string', minLength: 1, maxLength: 4096, description: '可选:摘要数据 JSON 路径,渲染后内嵌为 artifact 动作的内容' },
454
+ browsertool: { type: 'string', minLength: 1, maxLength: 4096, description: '可选:同时输出完整 browsertool JSON 的路径' },
455
+ baseUrl: { type: 'string', minLength: 1, maxLength: 2048, description: '可选:当前 E10 环境地址,缺省取登录会话' },
456
+ }, ['data', 'out']),
457
+ },
446
458
  {
447
459
  name: 'contract.file.download',
448
460
  risk: 'local-file-write',
@@ -1124,11 +1136,11 @@ export const contractOperations = [
1124
1136
  method: 'POST',
1125
1137
  path: '/api/ebd/contract/ai/getAiReviewRecord',
1126
1138
  aiId: '1326842382967570463',
1127
- defaults: { sclx: '1,2,3' },
1139
+ defaults: { sclx: '8' },
1128
1140
  },
1129
1141
  inputSchema: readSchema({
1130
1142
  fileId: { type: 'string', minLength: 1, maxLength: 64 },
1131
- sclx: { type: 'string', pattern: '^[1-3](,[1-3]){0,2}$' },
1143
+ sclx: { type: 'string', pattern: '^8$' },
1132
1144
  }, ['fileId']),
1133
1145
  },
1134
1146
  {
@@ -0,0 +1,231 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { basename, resolve } from 'node:path';
3
+ import { contractValidationError } from '../errors.js';
4
+ import { requireNonEmptyString } from './shared.js';
5
+ import { renderSummaryHtml } from './summary.js';
6
+ /**
7
+ * 行为卡片 HTML 渲染(本地,零依赖)。
8
+ *
9
+ * 定位:模型只产出「卡片清单 + 摘要数据」的紧凑 JSON(约 2~3 KB),
10
+ * 卡片骨架、事件绑定、ES5 脚本、browsertool 外壳全部由本 operation 生成。
11
+ *
12
+ * 为什么值得做(2026-11-09):
13
+ * 1. 手写卡片 HTML 是"点不动"的高发区(双引号截断、括号错位、漏 initialArtifactKeys)。
14
+ * 生成器固定输出,这三类错误从结构上不可能发生——这是主要收益。
15
+ * 2. 卡片从「逐张重复 HTML」改为「紧凑数组 + 循环生成」,
16
+ * 常驻体积从约 6 KB 降到约 2 KB(脚本只写一次)。
17
+ *
18
+ * 注意:browsertool 必须内联完整 HTML,所以模型回复的体积下限仍由成品 HTML 决定。
19
+ * 本 operation 靠"结构复用"降低成品体积,不承诺数量级的 token 下降。
20
+ */
21
+ const CARD_SCRIPT = `(function(){
22
+ var root=document.getElementById('__UID__');
23
+ if(!root){return;}
24
+ var st=root.querySelector('[data-status]');
25
+ function say(m){if(st){st.textContent=m;}}
26
+ function plug(){
27
+ if(window.xiaoePlugin){return window.xiaoePlugin;}
28
+ if(window.rawWindow&&window.rawWindow.xiaoePlugin){return window.rawWindow.xiaoePlugin;}
29
+ return null;
30
+ }
31
+ var wrap=document.createElement('div');
32
+ root.insertBefore(wrap,st);
33
+ var cards=[];
34
+ var cb=root.querySelector('[data-cards]');
35
+ try{cards=JSON.parse(cb?cb.value:'[]');}catch(e){cards=[];}
36
+ var ICON={send:'&#128231;',shield:'&#128737;',search:'&#128269;',doc:'&#128203;',compare:'&#128260;',calc:'&#128202;',link:'&#128279;'};
37
+ function run(c){
38
+ var a=c.action||{};
39
+ if(a.type==='sendQuestion'){
40
+ var ps=plug();
41
+ if(!ps||!ps.session||typeof ps.session.sendQuestion!=='function'){say('当前环境不支持发送会话消息');return;}
42
+ try{ps.session.sendQuestion({question:a.question||c.title||'',files:[]});say('已发送,正在处理');}
43
+ catch(e){say('发送失败,请重试');}
44
+ return;
45
+ }
46
+ var p=plug();
47
+ if(!p||!p.rightPanel||typeof p.rightPanel.open!=='function'){say('当前环境没有小e右侧面板');return;}
48
+ var cfg={};
49
+ if(a.type==='e10Sdk'){
50
+ var prm={app:a.app,compName:a.comp};
51
+ if(a.companyName){prm.companyName=a.companyName;}
52
+ if(a.customParams){prm.customParams=a.customParams;}
53
+ cfg.type='e10Sdk';
54
+ cfg.width=a.width||1300;
55
+ cfg.contentProps={src:a.src,sdkOptions:{compName:'ui.CorsComponent',routerType:'MemoryRouter',routerProps:{initialEntries:a.entries},params:prm}};
56
+ }else if(a.type==='artifact'){
57
+ var sb=root.querySelector('[data-summary]');
58
+ var h=sb?sb.value:'';
59
+ if(!h){say('摘要内容为空');return;}
60
+ cfg.type='artifact';
61
+ cfg.width=a.width||760;
62
+ cfg.contentProps={initialArtifactKeys:['summary-1'],artifacts:[{id:'summary-1',name:'合同摘要.html',fileType:'html',raw:{html:h}}]};
63
+ }else{say('不支持的动作类型');return;}
64
+ try{p.rightPanel.open(cfg);say('已打开');}catch(e){say('面板打开失败,请检查右侧面板');}
65
+ }
66
+ for(var i=0;i<cards.length;i++){
67
+ (function(c){
68
+ var b=document.createElement('button');
69
+ b.type='button';
70
+ b.setAttribute('data-act',c.id||('act'+i));
71
+ b.style.cssText='width:100%;box-sizing:border-box;text-align:left;font-family:inherit;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e3e6eb;border-radius:10px;padding:16px;margin-bottom:12px;cursor:pointer';
72
+ var ic=document.createElement('span');
73
+ ic.style.cssText='flex:0 0 auto;width:44px;height:44px;border-radius:10px;background:#eef4ff;display:flex;align-items:center;justify-content:center;font-size:20px';
74
+ ic.innerHTML=ICON[c.icon]||ICON.doc;
75
+ var tx=document.createElement('span');
76
+ tx.style.cssText='min-width:0';
77
+ var t1=document.createElement('span');
78
+ t1.style.cssText='display:block;margin-bottom:6px;font-size:15px;font-weight:700;color:#1f2329';
79
+ t1.textContent=c.title||'';
80
+ if(c.recommended){
81
+ var bd=document.createElement('span');
82
+ bd.style.cssText='font-size:11px;color:#fff;background:#1a56b8;border-radius:999px;padding:2px 10px;margin-left:8px';
83
+ bd.textContent='推荐';
84
+ t1.appendChild(bd);
85
+ }
86
+ var t2=document.createElement('span');
87
+ t2.style.cssText='display:block;font-size:13px;color:#5c6570;line-height:1.5';
88
+ t2.textContent=c.desc||'';
89
+ tx.appendChild(t1);tx.appendChild(t2);
90
+ b.appendChild(ic);b.appendChild(tx);
91
+ b.addEventListener('click',function(){run(c);});
92
+ b.addEventListener('mouseenter',function(){b.style.borderColor='#1a56b8';});
93
+ b.addEventListener('mouseleave',function(){b.style.borderColor='#e3e6eb';});
94
+ wrap.appendChild(b);
95
+ })(cards[i]);
96
+ }
97
+ say('共 '+cards.length+' 个可执行操作');
98
+ })();`;
99
+ function escAttr(value) {
100
+ return String(value ?? '')
101
+ .replace(/&/gu, '&amp;')
102
+ .replace(/</gu, '&lt;')
103
+ .replace(/>/gu, '&gt;')
104
+ .replace(/'/gu, '&#39;');
105
+ }
106
+ /** textarea 是 raw text:先把 & 转义,再把双引号转成实体,读 .value 时浏览器会还原。 */
107
+ function textareaRaw(value) {
108
+ return value
109
+ .replace(/&/gu, '&amp;')
110
+ .replace(/"/gu, '&quot;')
111
+ .replace(/<\/textarea/giu, '&lt;/textarea');
112
+ }
113
+ function makeUid() {
114
+ const now = new Date();
115
+ const pad = (value) => String(value).padStart(2, '0');
116
+ const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`
117
+ + `${pad(now.getHours())}${pad(now.getMinutes())}`;
118
+ const rand = Math.random().toString(36).slice(2, 6);
119
+ return `card-${stamp}-${rand}`;
120
+ }
121
+ function readJsonObject(path, label) {
122
+ let raw;
123
+ try {
124
+ raw = readFileSync(path, 'utf8').replace(/^\uFEFF/u, '');
125
+ }
126
+ catch (error) {
127
+ const message = error instanceof Error ? error.message : String(error);
128
+ throw contractValidationError('data_unreadable', `无法读取${label} JSON:${message}`);
129
+ }
130
+ let parsed;
131
+ try {
132
+ parsed = JSON.parse(raw);
133
+ }
134
+ catch (error) {
135
+ const message = error instanceof Error ? error.message : String(error);
136
+ throw contractValidationError('data_unreadable', `无法解析${label} JSON:${message}`);
137
+ }
138
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
139
+ throw contractValidationError('data_unreadable', `${label}必须是 JSON 对象`);
140
+ }
141
+ return parsed;
142
+ }
143
+ export const contractCardOperations = [
144
+ {
145
+ name: 'contract.card.render',
146
+ async execute(input, context) {
147
+ const dataPath = resolve(requireNonEmptyString(input.data, 'data', 4096).trim());
148
+ const outPath = resolve(requireNonEmptyString(input.out, 'out', 4096).trim());
149
+ const data = readJsonObject(dataPath, '卡片数据');
150
+ const cards = Array.isArray(data.cards) ? data.cards : [];
151
+ if (cards.length === 0) {
152
+ throw contractValidationError('cards_required', '卡片数据必须包含非空的 cards 数组');
153
+ }
154
+ let summaryHtml = '';
155
+ if (input.summary) {
156
+ const summaryPath = resolve(requireNonEmptyString(input.summary, 'summary', 4096).trim());
157
+ summaryHtml = renderSummaryHtml(readJsonObject(summaryPath, '摘要数据'));
158
+ }
159
+ let baseUrl = input.baseUrl ? requireNonEmptyString(input.baseUrl, 'baseUrl', 2048).trim() : '';
160
+ if (!baseUrl) {
161
+ const session = await context.host.getSession();
162
+ baseUrl = String(session?.baseUrl ?? '').trim();
163
+ }
164
+ baseUrl = baseUrl.replace(/\/+$/u, '');
165
+ if (!baseUrl) {
166
+ throw contractValidationError('base_url_missing', '无法确定当前 E10 环境地址,请显式传入 baseUrl');
167
+ }
168
+ const uid = typeof data.id === 'string' && data.id.trim() ? data.id.trim() : makeUid();
169
+ const hint = typeof data.hint === 'string' ? data.hint.trim() : '';
170
+ const title = typeof data.title === 'string' && data.title.trim() ? data.title.trim() : '可执行操作';
171
+ const width = typeof data.width === 'number' && data.width > 0 ? data.width : 1300;
172
+ const cardsJson = JSON.stringify(cards);
173
+ const script = CARD_SCRIPT.replace(/__UID__/gu, uid);
174
+ const parts = [];
175
+ parts.push(`<section id='${escAttr(uid)}' style='padding:4px 2px;font-family:Microsoft YaHei,PingFang SC,sans-serif'>`);
176
+ if (hint) {
177
+ parts.push(`<div style='background:#eef4ff;border:1px solid #d6e4ff;border-radius:8px;padding:10px 12px;margin-bottom:12px;font-size:12.5px;color:#1d39c4;line-height:1.6'>${escAttr(hint)}</div>`);
178
+ }
179
+ parts.push(`<p data-status aria-live='polite' style='margin:8px 0 0;color:#b45309;font-size:12px;line-height:1.6'></p>`);
180
+ parts.push(`<textarea data-cards style='display:none'>${textareaRaw(cardsJson)}</textarea>`);
181
+ if (summaryHtml) {
182
+ parts.push(`<textarea data-summary style='display:none'>${textareaRaw(summaryHtml)}</textarea>`);
183
+ }
184
+ parts.push(`</section><script>${script}</script>`);
185
+ const html = parts.join('');
186
+ writeFileSync(outPath, html, 'utf8');
187
+ const bytes = Buffer.byteLength(html, 'utf8');
188
+ let browsertoolPath = '';
189
+ if (input.browsertool) {
190
+ browsertoolPath = resolve(requireNonEmptyString(input.browsertool, 'browsertool', 4096).trim());
191
+ const browsertool = {
192
+ version: 1,
193
+ callId: typeof data.callId === 'string' && data.callId.trim() ? data.callId.trim() : `${uid}-01`,
194
+ toolId: 'fill_form',
195
+ arguments: {
196
+ type: 'e10',
197
+ title,
198
+ src: `${baseUrl}/sp/contract/xiaoe-custom-page`,
199
+ width,
200
+ sdkRenderType: 'inline',
201
+ sdkOptions: {
202
+ compName: 'ui.CorsComponent',
203
+ routerType: 'MemoryRouter',
204
+ routerProps_pc: { initialEntries: ['/sp/contract/xiaoe-custom-page'] },
205
+ params_pc: {
206
+ app: '@weapp/contract',
207
+ compName: 'xiaoeCustomPage',
208
+ customParams: { html },
209
+ },
210
+ },
211
+ },
212
+ };
213
+ writeFileSync(browsertoolPath, JSON.stringify(browsertool), 'utf8');
214
+ }
215
+ return {
216
+ status: 'COMPLETE',
217
+ data: {
218
+ output: outPath,
219
+ fileName: basename(outPath),
220
+ fileSize: bytes,
221
+ uid,
222
+ cardCount: cards.length,
223
+ cardIds: cards.map((card) => String(card?.id ?? '')),
224
+ summaryEmbedded: Boolean(summaryHtml),
225
+ browsertool: browsertoolPath || undefined,
226
+ note: 'HTML 与 browsertool JSON 均由 CLI 生成;模型不要再手写卡片 HTML',
227
+ },
228
+ };
229
+ },
230
+ },
231
+ ];
@@ -4,6 +4,7 @@ import { contractAssistantOperations } from './assistant.js';
4
4
  import { contractClauseInsertOperations } from './clause-insert.js';
5
5
  import { contractClauseLibraryOperations } from './clause-library.js';
6
6
  import { contractClauseReferenceOperations } from './clause-reference.js';
7
+ import { contractCardOperations } from './card.js';
7
8
  import { contractCompareOperations } from './compare.js';
8
9
  import { contractCreditPageOperations } from './credit-page.js';
9
10
  import { contractCustomerOperations } from './customer.js';
@@ -38,6 +39,7 @@ function buildRegistry() {
38
39
  ...contractAssistantOperations,
39
40
  ...contractPerformanceOperations,
40
41
  ...contractSummaryOperations,
42
+ ...contractCardOperations,
41
43
  ...contractQuoteOperations,
42
44
  ];
43
45
  for (const handler of handlers) {
@@ -15,7 +15,13 @@ const PREWARM_PATH = '/api/ebd/contract/ai/saveInternalRecord';
15
15
  const PREWARM_TIMEOUT_MS = 30_000;
16
16
  const PREWARM_ERROR = 'prewarm_error';
17
17
  const MAX_FILES = 10;
18
- const SCLX_PATTERN = /^[1-3](?:,[1-3]){0,2}$/u;
18
+ /** 合同预审固定只走风险审查,sclx 取值为 8(2026-11-09 用户确认)。 */
19
+ export const CONTRACT_REVIEW_SCLX = '8';
20
+ /**
21
+ * 旧分类取值:`1`=内控、`2`=法审、`3`=纠错。
22
+ * 代码保留备查,但对应触发入口已全部屏蔽,不再作为 sclx 的合法取值。
23
+ */
24
+ export const LEGACY_SCLX_PATTERN = /^[1-3](?:,[1-3]){0,2}$/u;
19
25
  /**
20
26
  * 触发预审预热。
21
27
  *
@@ -51,9 +57,9 @@ async function prewarmAll(host, fileIds) {
51
57
  }
52
58
  function normalizeSclx(value) {
53
59
  if (value === undefined || value === null || value === '')
54
- return '1,2,3';
55
- if (typeof value !== 'string' || !SCLX_PATTERN.test(value)) {
56
- throw contractValidationError('sclx_invalid', 'sclx 只能是 "1"、"2"、"3" 或它们的逗号组合(如 "1,2,3")');
60
+ return CONTRACT_REVIEW_SCLX;
61
+ if (typeof value !== 'string' || value !== CONTRACT_REVIEW_SCLX) {
62
+ throw contractValidationError('sclx_invalid', `合同预审只走风险审查,sclx 固定为 "${CONTRACT_REVIEW_SCLX}";内控/法审/纠错(1/2/3)入口已屏蔽`);
57
63
  }
58
64
  return value;
59
65
  }
@@ -175,10 +181,15 @@ export const contractReviewOperations = [
175
181
  async execute(input, { host }) {
176
182
  const fileId = requireNonEmptyString(input.fileId, 'fileId', 64);
177
183
  const sclx = normalizeSclx(input.sclx);
184
+ // 请求体与前端实际调用保持一致:flowId + sclx + fileId。
185
+ // 注意:不要带 ai_id —— 带上会导致服务端返回空记录(2026-11-09 实测)。
186
+ const flowId = (input.flowId === undefined || input.flowId === null || input.flowId === '')
187
+ ? AI_REVIEW_PREWARM_FLOW_ID
188
+ : requireNonEmptyString(input.flowId, 'flowId', 64);
178
189
  const value = await host.contractRequest({
179
190
  method: 'POST',
180
191
  path: '/api/ebd/contract/ai/getAiReviewRecord',
181
- body: { sclx, fileId, ai_id: AI_REVIEW_ASSISTANT_ID },
192
+ body: { flowId, sclx, fileId },
182
193
  timeoutMs: 120_000,
183
194
  });
184
195
  const records = collectRecords(value);