weaver-work-cli 0.1.63 → 0.1.64

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 (148) hide show
  1. package/dist/chunks/{archive-BLDYBZDX.js → archive-WUZKAEZ6.js} +2 -2
  2. package/dist/chunks/{archive-oa-3GJ3TWXR.js → archive-oa-PN46RTI2.js} +2 -2
  3. package/dist/chunks/{asset-AFXJN4CK.js → asset-ZPC5VWZM.js} +2 -2
  4. package/dist/chunks/{asset-idle-VUJXWGWJ.js → asset-idle-DHGP3NYY.js} +2 -2
  5. package/dist/chunks/{attachment-content-VMJA7NSQ.js → attachment-content-JQDW3BIB.js} +3 -3
  6. package/dist/chunks/{blog-EREB35VU.js → blog-JC47AIXK.js} +2 -2
  7. package/dist/chunks/{caizhilian-ATM2JO5S.js → caizhilian-IKIHM77A.js} +4 -4
  8. package/dist/chunks/{calendar-E26ZIH7S.js → calendar-GZTSJ57Y.js} +2 -2
  9. package/dist/chunks/{chunk-OMAGCLUE.js → chunk-26FCCU5O.js} +2 -2
  10. package/dist/chunks/{chunk-BY3WDJO5.js → chunk-3PCXBG4H.js} +1 -1
  11. package/dist/chunks/{chunk-EOZHSNND.js → chunk-3W5NMGDS.js} +2 -2
  12. package/dist/chunks/{chunk-TNFIUZ4H.js → chunk-4AFWOGOV.js} +1 -1
  13. package/dist/chunks/{chunk-QAMIIFP6.js → chunk-5QQKLR6H.js} +11 -11
  14. package/dist/chunks/{chunk-C5PIGPGX.js → chunk-6T5X6YWX.js} +2 -2
  15. package/dist/chunks/{chunk-WPBZQVLS.js → chunk-AFZTMYGC.js} +1 -1
  16. package/dist/chunks/{chunk-IGICM3WJ.js → chunk-AGSO3PIK.js} +2 -2
  17. package/dist/chunks/{chunk-6VCQLZXE.js → chunk-FDBAFANU.js} +1 -0
  18. package/dist/chunks/{chunk-RV2JAA5I.js → chunk-FJUOUSV3.js} +1 -1
  19. package/dist/chunks/{chunk-6G2JARDK.js → chunk-HLT6B26P.js} +1 -1
  20. package/dist/chunks/{chunk-THMBDCRA.js → chunk-HWA2A25Y.js} +2 -2
  21. package/dist/chunks/{chunk-SHBDXEUE.js → chunk-I3MOFD6Q.js} +4 -4
  22. package/dist/chunks/{chunk-5CY37VLS.js → chunk-INVYKG4I.js} +45 -43
  23. package/dist/chunks/{chunk-QZYKZ7MQ.js → chunk-K7QKQRSL.js} +155 -57
  24. package/dist/chunks/{chunk-HEJPVXD3.js → chunk-KDFEHDIB.js} +4 -4
  25. package/dist/chunks/{chunk-I4C2KR2G.js → chunk-KYDXWYFB.js} +1 -1
  26. package/dist/chunks/{chunk-RR45ELVE.js → chunk-Q6D6PSMH.js} +2 -2
  27. package/dist/chunks/{chunk-G3ZM57PD.js → chunk-RMOH2GMF.js} +2 -2
  28. package/dist/chunks/{chunk-LOVAIGM2.js → chunk-SCMHG23G.js} +50 -50
  29. package/dist/chunks/{chunk-GQK6WLOS.js → chunk-VLY5RTVO.js} +2 -2
  30. package/dist/chunks/{chunk-SDPC7BG2.js → chunk-WSHIOSGM.js} +2 -2
  31. package/dist/chunks/{chunk-4OB22YKE.js → chunk-XHSEK2VM.js} +6 -6
  32. package/dist/chunks/{chunk-GOBNIGWS.js → chunk-YTFNMQO4.js} +1 -1
  33. package/dist/chunks/{conflict-AMNTM3FV.js → conflict-UUC7AFUI.js} +2 -2
  34. package/dist/chunks/{contract-PLO2V2NO.js → contract-INMS7SYQ.js} +846 -199
  35. package/dist/chunks/{cowork-FZAXE6FO.js → cowork-34CBYVQP.js} +2 -2
  36. package/dist/chunks/{create-flow-2DAUN7HU.js → create-flow-YOR4QTAJ.js} +8 -6
  37. package/dist/chunks/{data-7NXMWET4.js → data-QKWI5325.js} +13 -2
  38. package/dist/chunks/{ebuilder-form-DEYHX6M7.js → ebuilder-form-ZONRROK4.js} +3 -3
  39. package/dist/chunks/{ehr-QQH2DYYA.js → ehr-2CONM7R6.js} +2 -2
  40. package/dist/chunks/{entry-mode-2JTVEKMP.js → entry-mode-S2ENJ6GZ.js} +3 -3
  41. package/dist/chunks/{env-2JZMXC6I.js → env-ZSAXU5PJ.js} +2 -2
  42. package/dist/chunks/{esb-I5ZFHJUK.js → esb-FQASCY2H.js} +4 -4
  43. package/dist/chunks/{factory-XIATYHU6.js → factory-N76QQA53.js} +1 -1
  44. package/dist/chunks/{fna-3V2TL6B2.js → fna-FCLVIWAS.js} +2 -2
  45. package/dist/chunks/{group-chat-CVYUZCOQ.js → group-chat-UM665WDZ.js} +3 -3
  46. package/dist/chunks/{host-CBONEAZS.js → host-2ED2KC4X.js} +3 -3
  47. package/dist/chunks/{host-4DP7C7YQ.js → host-2UYZEY2V.js} +3 -3
  48. package/dist/chunks/{host-4KQCAEWA.js → host-46NYKDQP.js} +3 -3
  49. package/dist/chunks/{host-BD7NAM33.js → host-7IPZKIM4.js} +3 -3
  50. package/dist/chunks/{host-L37QVNIV.js → host-P7G22WNM.js} +3 -3
  51. package/dist/chunks/{host-4X2F3JPQ.js → host-XLCBLNJD.js} +3 -3
  52. package/dist/chunks/{hrm-OL3IKN7C.js → hrm-XKL27NX2.js} +3 -3
  53. package/dist/chunks/{im-YXQWUF3R.js → im-NDYIMASG.js} +3 -3
  54. package/dist/chunks/{invoice-4WY32PR2.js → invoice-MOGNB6HN.js} +3 -3
  55. package/dist/chunks/{jiuchuanhui-L6SHLONH.js → jiuchuanhui-3T5X7SB7.js} +2 -2
  56. package/dist/chunks/{lazy-dispatch-OYE6QV24.js → lazy-dispatch-4WOIL3ZQ.js} +4 -4
  57. package/dist/chunks/{mail-PZV2KNRU.js → mail-P7VMUKQW.js} +2 -2
  58. package/dist/chunks/{meeting-6SOBCC6N.js → meeting-MMTYDHXA.js} +13 -13
  59. package/dist/chunks/{minute-doc-KSJSJNOH.js → minute-doc-LCSBWGJ3.js} +4 -4
  60. package/dist/chunks/{okr-B76FW5M2.js → okr-VZXRQGS4.js} +2 -2
  61. package/dist/chunks/{operations-YOMEGFLV.js → operations-MI2BSKZX.js} +4 -4
  62. package/dist/chunks/{performance-4VBKUPFO.js → performance-OPEQNW7Y.js} +870 -15
  63. package/dist/chunks/{plan-HBNZRQTI.js → plan-TJAS4N5X.js} +2 -2
  64. package/dist/chunks/{project-IV6FWK74.js → project-CYBGU6K6.js} +2 -2
  65. package/dist/chunks/{reception-BR5YURT6.js → reception-3FT2F66K.js} +2 -2
  66. package/dist/chunks/{recruit-stage-4HQ6OGXT.js → recruit-stage-WPGB5BDJ.js} +2 -2
  67. package/dist/chunks/{registry-JFQEFC7E.js → registry-BAWCWV4D.js} +2 -2
  68. package/dist/chunks/{registry-7LICMV5J.js → registry-FNI5E76J.js} +12 -12
  69. package/dist/chunks/{registry-MZJQX65Q.js → registry-QRMXRSCT.js} +4 -4
  70. package/dist/chunks/{room-recommend-43GLLE7Y.js → room-recommend-I7QQRHEL.js} +4 -4
  71. package/dist/chunks/{schedule-ZQ42BEW6.js → schedule-3P7EWGNZ.js} +4 -4
  72. package/dist/chunks/{smart-extract-QKAEAZGM.js → smart-extract-FOBSVNYW.js} +2 -2
  73. package/dist/chunks/{workflow-6HV7H5PC.js → workflow-U2KKTVQY.js} +4 -4
  74. package/dist/index.js +33 -33
  75. package/dist/internal/e10/auth/commands.js +182 -43
  76. package/dist/shortcuts/contract/error-actions.js +112 -0
  77. package/dist/shortcuts/contract/errors.js +9 -1
  78. package/dist/shortcuts/contract/manifest.js +18 -7
  79. package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
  80. package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
  81. package/dist/shortcuts/contract/operations/elements-build.js +82 -56
  82. package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
  83. package/dist/shortcuts/contract/operations/ledger-card.js +25 -2
  84. package/dist/shortcuts/contract/operations/ledger.js +33 -5
  85. package/dist/shortcuts/contract/operations/money.js +90 -0
  86. package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
  87. package/dist/shortcuts/contract/operations/quote-recognize.js +54 -17
  88. package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
  89. package/dist/shortcuts/contract/operations/quote-submit.js +20 -3
  90. package/dist/shortcuts/contract/operations/quote.js +66 -12
  91. package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
  92. package/dist/shortcuts/contract/operations/triage.js +55 -9
  93. package/dist/shortcuts/data/operations/shared.js +14 -1
  94. package/dist/shortcuts/meeting/operations/eb/create-flow.js +25 -11
  95. package/dist/shortcuts/performance/flow-utils.js +363 -0
  96. package/dist/shortcuts/performance/manifest.js +2 -2
  97. package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
  98. package/dist/shortcuts/performance/operations/flow-list.js +213 -0
  99. package/dist/shortcuts/performance/operations/flow-score.js +241 -0
  100. package/dist/shortcuts/performance/operations/registry.js +6 -0
  101. package/docs/e10-auth.md +27 -2
  102. package/package.json +1 -1
  103. package/skills/weaver-e10-jinchengda/SKILL.md +87 -39
  104. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +29 -29
  105. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +2 -2
  106. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
  107. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +29 -7
  108. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +3 -3
  109. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +5 -5
  110. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
  111. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +22 -25
  112. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -314
  113. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +6 -5
  114. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +19 -11
  115. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +3 -3
  116. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +43 -25
  117. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +103 -212
  118. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +7 -7
  119. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +7 -6
  120. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +34 -21
  121. package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +6 -6
  122. package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +3 -3
  123. package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +6 -6
  124. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +22 -22
  125. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +21 -19
  126. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +6 -5
  127. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +132 -95
  128. package/skills/weaver-e10-jinchengda/references/contract-request-status.md +1 -1
  129. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
  130. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  131. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
  132. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +1 -1
  133. package/skills/weaver-e10-jinchengda/references/orchestration.md +5 -5
  134. package/skills/weaver-e10-meeting/SKILL.md +8 -7
  135. package/skills/weaver-e10-meeting/references/create-commands.md +2 -2
  136. package/skills/weaver-e10-meeting/references/create-flow.md +6 -6
  137. package/skills/weaver-e10-meeting/references/create-guardrails.md +10 -10
  138. package/skills/weaver-e10-meeting/references/invitation.md +1 -1
  139. package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
  140. package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
  141. package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
  142. package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
  143. package/skills/weaver-e10-performance/SKILL.md +45 -5
  144. package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
  145. package/skills/weaver-e10-performance/references/flow-api.md +128 -0
  146. package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
  147. package/skills/weaver-e10-yimiaoban/SKILL.md +8 -5
  148. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
@@ -8,7 +8,9 @@
8
8
  * 内置成常量表后,模型只需跑一条命令,不再生成任何 ID。
9
9
  *
10
10
  * 维护红线:
11
+ * - **选项类字段传选项 ID**(2026-11-20 回退:此前一度改成传显示名,已撤销);
11
12
  * - 选项 ID 未经实测校核的 Select 字段一律不登记,宁缺勿猜;
13
+ * - 选项表**按流程各登记一份**,禁止跨流程复用(同义语义在各流程的 ID 不同);
12
14
  * - 复选框选项 ID 各流程**互不相同**,禁止互抄;
13
15
  * - 不登记附件字段到 recognizeResult(附件只走流程组件 customParams)。
14
16
  */
@@ -34,9 +36,14 @@ export const NEW_CUSTOMER = {
34
36
  receiver: '1269716066559755079#合同收件人',
35
37
  mobile: '1269716066559755081#收件人移动电话',
36
38
  designatedDate: '1269716066559755286#指定签署日期',
39
+ invoiceConfirm: '1269716066559755005#是否触发开票立项确认',
37
40
  },
38
41
  subFormId: '1269716066559754943',
39
42
  subFormName: '专项购买信息',
43
+ // ⚠️ 2026-11-20 回退:**选项值传选项 ID,不传显示名**(此前一度改成传显示名,已撤销)。
44
+ // 「必须传显示名」的口径作废;ID 逐条对照 references/contract-field-extract-new-customer.md §2。
45
+ // ⛔ 仍成立的两条:① 选项 ID 未经实测校核的 Select 字段一律不登记(宁缺勿猜);
46
+ // ② 同一语义在不同流程的选项表**各自登记、禁止跨流程复用**(各流程 ID 不同)。
40
47
  options: {
41
48
  buyMode: { 直签: '0', 通过伙伴签署: '1' },
42
49
  ourCompany: {
@@ -58,6 +65,8 @@ export const NEW_CUSTOMER = {
58
65
  单方电子签署: '3',
59
66
  双方电子签署泛微契约锁平台双方电子签: '4',
60
67
  无需用印: '5',
68
+ // 第 7 项(2026-11-20 由 contract.workflow.field.options 实测补登)
69
+ 客户用自己的电子签平台先发起的电子签: '1269716066559755755',
61
70
  },
62
71
  signDate: {
63
72
  是: '0',
@@ -67,8 +76,11 @@ export const NEW_CUSTOMER = {
67
76
  暂不填写: '4',
68
77
  },
69
78
  signWay: { 我方先盖章: '0', 客户方先盖章: '1', 等待确认: '2' },
79
+ // 2026-11-20 用户定稿保留:开票立项确认**默认「触发」**(触发=0 / 不触发=1),不从合同文本推断。
80
+ invoiceConfirm: { 触发: '0', 不触发: '1' },
70
81
  },
71
- defaults: { signForm: '2', signDate: '2', signWay: '0' },
82
+ // 默认值同样是**选项 ID**(纸质签署=2、默认合同办理当天=2、我方先盖章=0、开票立项触发=0)
83
+ defaults: { signForm: '2', signDate: '2', signWay: '0', invoiceConfirm: '0' },
72
84
  };
73
85
  /**
74
86
  * 契约锁流程(workflowId 100003460000002066)字段表。
@@ -93,7 +105,6 @@ export const QIYUESUO = {
93
105
  },
94
106
  selects: {
95
107
  buyMode: '100003720000025514#购买方式',
96
- ourCompany: '100003720000053778#签约公司(发票开具专用)',
97
108
  signForm: '100003720000026071#签约形式',
98
109
  signDateType: '1024078670684487911#合同签署日期',
99
110
  signWay: '100003720000025491#合同签订方式',
@@ -104,6 +115,42 @@ export const QIYUESUO = {
104
115
  finalUser: '100003720000025524#客户名称(最终用户)',
105
116
  partner: '100003720000025582#伙伴公司名称',
106
117
  },
118
+ // 契约锁的选项表(2026-11-20 用户确认 + `contract.workflow.field.options` 接口实测补全):
119
+ // ⛔ 与其它流程同名但**值不同**(如签约形式:契约锁 双方电子签署=0 / 防伪打印签署=1 / 纸质签署=2),禁止跨流程复用。
120
+ // ⚠️「签约公司(发票开具专用)」`…053778` 用户确认**本流程没有这个字段、不需要抽**,已从 selects 移除。
121
+ options: {
122
+ buyMode: { 直签: '0', 通过伙伴签署: '1' },
123
+ signForm: { 双方电子签署: '0', 防伪打印签署: '1', 纸质签署: '2' },
124
+ signDateType: { 默认合同办理当天: '0', 指定签署日期: '1', 暂不填写: '2' },
125
+ signWay: { 我方先盖章: '0', 客户方先盖章: '1', 等待确认: '2' },
126
+ isXinChuang: { 是: '1', 否: '2' },
127
+ // 契约锁三项抽取项(references/contract-field-extract-other-flows.md §2.1.1)
128
+ implParty: { 是: '0', 否: '1', 泛微: '2', 亘岩: '3', 无: '4', QBU: '5' },
129
+ relatedProduct: {
130
+ 云平台: '0',
131
+ 开放平台: '1',
132
+ 私有云: '2',
133
+ 单体章: '3',
134
+ '云平台-第三方': '4',
135
+ 云平台第三方: '4',
136
+ 混合云: '5',
137
+ '私有云-第三方': '6',
138
+ 私有云第三方: '6',
139
+ 可信身份数字系统: '7',
140
+ },
141
+ contractType: {
142
+ 'e-cology购买': '0',
143
+ ecology购买: '0',
144
+ 'e-weaver购买': '1',
145
+ eweaver购买: '1',
146
+ 'e-office购买': '2',
147
+ eoffice购买: '2',
148
+ 新签: '3',
149
+ 续签: '4',
150
+ 常规: '5',
151
+ 增值: '6',
152
+ },
153
+ },
107
154
  };
108
155
  /**
109
156
  * 常规二次销售流程(workflowId 1283761687634100307)字段表。
@@ -137,6 +184,51 @@ export const RESALE = {
137
184
  fieldKey: 'purchase',
138
185
  options: { 维护: '0', 用户数: '1', 第三方软硬件: '2', 契约锁: '3', 实施开发: '4' },
139
186
  },
187
+ // 选项表:2026-11-20 由 `contract.workflow.field.options` 对本流程各字段**逐个实测**取得。
188
+ // ⚠️ 本流程的「签约形式 / 合同签署日期 / 合同签订方式 / 签约公司 / 购买方式」的 ID 与新客户**恰好相同**,
189
+ // 但这是实测结果,不是"通用表"——各流程仍各登记一份,禁止互相引用(2026-11-20 用户规则)。
190
+ options: {
191
+ buyMode: { 直签: '0', 通过伙伴签署: '1' },
192
+ ourCompany: {
193
+ 泛微网络: '0',
194
+ 泛微网络科技: '0',
195
+ 泛微网络科技股份有限公司: '0',
196
+ 泛微软件: '1',
197
+ 上海泛微软件: '1',
198
+ 上海泛微软件有限公司: '1',
199
+ 泛微新加坡: '2',
200
+ 成都泛微: '3',
201
+ 泛微马来西亚: '4',
202
+ 泛微印尼: '5',
203
+ 浙江泛微: '6',
204
+ },
205
+ signForm: {
206
+ 双方电子签署客户电子签平台双方电子签: '0',
207
+ 双方电子签署: '0',
208
+ 防伪打印签署: '1',
209
+ 纸质签署: '2',
210
+ 单方电子签署泛微电子签后上传PDF到流程: '3',
211
+ 单方电子签署: '3',
212
+ 双方电子签署泛微契约锁平台双方电子签: '4',
213
+ 无需用印: '5',
214
+ },
215
+ signDateType: {
216
+ 是: '0',
217
+ 否: '1',
218
+ 默认合同办理当天: '2',
219
+ 指定签署日期: '3',
220
+ 暂不填写: '4',
221
+ },
222
+ signWay: { 我方先盖章: '0', 客户方先盖章: '1', 等待确认: '2' },
223
+ contractType: {
224
+ 'e-cology购买': '0',
225
+ ecology购买: '0',
226
+ 'e-weaver购买': '1',
227
+ eweaver购买: '1',
228
+ 'e-office购买': '2',
229
+ eoffice购买: '2',
230
+ },
231
+ },
140
232
  };
141
233
  /**
142
234
  * 老客户增值流程(workflowId 1283761429944369334)字段表。
@@ -166,7 +258,7 @@ export const UPSALE = {
166
258
  finalUser: '100003720000001287#客户名称(最终用户)',
167
259
  partner: '1291612552921137531#伙伴名称(文本备份)',
168
260
  },
169
- // 合同购买内容选项 ID 与常规二次销售不同,禁止互抄
261
+ // 合同购买内容选项 ID **与常规二次销售不同**,禁止互抄(多选按选项 ID 逗号拼接)
170
262
  checkbox: {
171
263
  fieldKey: 'purchase',
172
264
  options: {
@@ -178,6 +270,51 @@ export const UPSALE = {
178
270
  重新部署: '5',
179
271
  },
180
272
  },
273
+ // 选项表:2026-11-20 由 `contract.workflow.field.options` 对本流程各字段**逐个实测**取得。
274
+ // ⚠️ 本流程「合同类型」比常规二次销售**多一项** `其他增值服务购买=3`——禁止跨流程复用。
275
+ options: {
276
+ buyMode: { 直签: '0', 通过伙伴签署: '1' },
277
+ ourCompany: {
278
+ 泛微网络: '0',
279
+ 泛微网络科技: '0',
280
+ 泛微网络科技股份有限公司: '0',
281
+ 泛微软件: '1',
282
+ 上海泛微软件: '1',
283
+ 上海泛微软件有限公司: '1',
284
+ 泛微新加坡: '2',
285
+ 成都泛微: '3',
286
+ 泛微马来西亚: '4',
287
+ 泛微印尼: '5',
288
+ 浙江泛微: '6',
289
+ },
290
+ signForm: {
291
+ 双方电子签署客户电子签平台双方电子签: '0',
292
+ 双方电子签署: '0',
293
+ 防伪打印签署: '1',
294
+ 纸质签署: '2',
295
+ 单方电子签署泛微电子签后上传PDF到流程: '3',
296
+ 单方电子签署: '3',
297
+ 双方电子签署泛微契约锁平台双方电子签: '4',
298
+ 无需用印: '5',
299
+ },
300
+ signDateType: {
301
+ 是: '0',
302
+ 否: '1',
303
+ 默认合同办理当天: '2',
304
+ 指定签署日期: '3',
305
+ 暂不填写: '4',
306
+ },
307
+ signWay: { 我方先盖章: '0', 客户方先盖章: '1', 等待确认: '2' },
308
+ contractType: {
309
+ 'e-cology购买': '0',
310
+ ecology购买: '0',
311
+ 'e-weaver购买': '1',
312
+ eweaver购买: '1',
313
+ 'e-office购买': '2',
314
+ eoffice购买: '2',
315
+ 其他增值服务购买: '3',
316
+ },
317
+ },
181
318
  };
182
319
  export const BUILTIN = {
183
320
  新客户: NEW_CUSTOMER,
@@ -257,9 +257,32 @@ async function resolveOrigin(raw, context) {
257
257
  }
258
258
  return cleanOrigin(normalized);
259
259
  }
260
+ /**
261
+ * 读取 `comParamsJson` 入参文本——**只接受 JSON 字符串**(2026-11-20 定稿)。
262
+ *
263
+ * 事故:此前两个解析函数都写 `typeof rawJson === 'string' && rawJson.trim() ? rawJson : ''`,
264
+ * 于是入参传对象 / 数组时被当成「没传」,条件被**静默丢弃**,接口还返回 `ok=true`、
265
+ * `filters` 为空——卡片打开后没有任何筛选,且全程没有任何报错,排查成本极高。
266
+ * 现在非字符串一律报 `com_params_invalid`,绝不静默置空;要传结构化条件请先 `JSON.stringify`。
267
+ */
268
+ function requireComParamsJsonText(rawJson) {
269
+ if (rawJson === null || rawJson === undefined || rawJson === '')
270
+ return '';
271
+ if (typeof rawJson === 'string')
272
+ return rawJson.trim();
273
+ if (Array.isArray(rawJson)) {
274
+ throw contractValidationError('com_params_invalid', `comParamsJson 必须是 JSON 字符串,收到数组 ${pyReprText(rawJson)};`
275
+ + '请先 JSON.stringify 成字符串再传(按 key=value 传请改用 comParamPairs)。');
276
+ }
277
+ if (typeof rawJson === 'object') {
278
+ throw contractValidationError('com_params_invalid', `comParamsJson 必须是 JSON 字符串,收到对象 ${pyStr(rawJson)};`
279
+ + '请先 JSON.stringify 成字符串再传,直接传对象会被丢弃筛选条件。');
280
+ }
281
+ throw contractValidationError('com_params_invalid', `comParamsJson 必须是 JSON 字符串,收到 ${pyReprText(rawJson)}。`);
282
+ }
260
283
  function parseComParams(pairs, rawJson) {
261
284
  const pairList = Array.isArray(pairs) ? pairs : [];
262
- const jsonText = typeof rawJson === 'string' && rawJson.trim() ? rawJson : '';
285
+ const jsonText = requireComParamsJsonText(rawJson);
263
286
  if (pairList.length && jsonText) {
264
287
  throw contractValidationError('com_params_conflict', 'comParamPairs 与 comParamsJson 只能二选一');
265
288
  }
@@ -349,7 +372,7 @@ function buildCard(pageId, origin, title, callId, comParams) {
349
372
  function parseLedgerFilters(pairs, rawJson, viewKey) {
350
373
  const allowed = LEDGER_FILTER_KINDS[viewKey] ?? {};
351
374
  const pairList = Array.isArray(pairs) ? pairs : [];
352
- const jsonText = typeof rawJson === 'string' && rawJson.trim() ? rawJson : '';
375
+ const jsonText = requireComParamsJsonText(rawJson);
353
376
  if (pairList.length && jsonText) {
354
377
  throw contractValidationError('com_params_conflict', 'comParamPairs 与 comParamsJson 只能二选一');
355
378
  }
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { basename, join } from 'node:path';
4
4
  import { contractValidationError } from '../errors.js';
5
- import { ALIASES, LEDGER_VIEW_KEYS, MENU_PAGES } from './ledger-card.js';
5
+ import { ALIASES, LEDGER_VIEW_KEYS, MENU_PAGES, contractLedgerCardOperation } from './ledger-card.js';
6
6
  /**
7
7
  * 台账数据处理的本地 operation(2026-11-13 从 scripts/ledger_aggregate.py 与
8
8
  * scripts/ledger_guard.py 迁移,遵守「能力下沉 CLI」规范)。
@@ -574,7 +574,7 @@ export const contractLedgerRouteOperation = {
574
574
  },
575
575
  },
576
576
  },
577
- async execute(input) {
577
+ async execute(input, context) {
578
578
  const query = typeof input.query === 'string' ? input.query : '';
579
579
  const intent = typeof input.intent === 'string' ? input.intent.trim().toLowerCase() : '';
580
580
  const conditions = isRecord(input.conditions) ? input.conditions : {};
@@ -724,9 +724,33 @@ export const contractLedgerRouteOperation = {
724
724
  reasons.push('未命中统计信号,按看台账处理;落不了的条件留给页面筛选');
725
725
  }
726
726
  const prefillKeys = Object.keys(prefill);
727
+ // comParamsJson 是**字符串**入参:提示里必须给双层序列化后的字符串字面量。
728
+ // 事故(2026-11-20):这里原本只 JSON.stringify 一次,渲染出 `comParamsJson={"xsjl":[…]}`,
729
+ // 模型照抄成对象形态;而卡片接口对非字符串入参是静默丢弃条件、不报错,条件就没了。
730
+ const prefillHint = prefillKeys.length
731
+ ? `,comParamsJson=${JSON.stringify(JSON.stringify(prefill))}`
732
+ : '';
733
+ // ── route=card 时**顺带把卡片也生成好**(2026-11-20,省 1 轮)
734
+ // 卡片构造是纯本地计算(`contract.ledger.card` 不访问业务接口),进程内调用即可。
735
+ // 失败**绝不影响路由结论**:路由是判定,卡片是产物;产物失败降级回 nextCommand 提示。
736
+ let card = null;
737
+ let cardSelfCheck = null;
738
+ let cardError = null;
739
+ if (route === 'card') {
740
+ try {
741
+ const built = await contractLedgerCardOperation.execute({ menu, comParamsJson: JSON.stringify(prefill) }, context);
742
+ card = built?.data?.card ?? null;
743
+ cardSelfCheck = built?.data?.selfCheck ?? null;
744
+ }
745
+ catch (error) {
746
+ cardError = error instanceof Error ? error.message : String(error);
747
+ }
748
+ }
727
749
  const nextCommand = route === 'card'
728
- ? 'weaver-work-cli --json contract run contract.ledger.card --input <args.json>'
729
- + `(menu=${menu}${prefillKeys.length ? `,comParamsJson=${JSON.stringify(prefill)}` : ''})`
750
+ ? (card
751
+ ? '(卡片已随本响应返回:顶层 data.card 直接作为 <browsertool> 输出,无需再调 contract.ledger.card)'
752
+ : 'weaver-work-cli --json contract run contract.ledger.card --input <args.json>'
753
+ + `(menu=${menu}${prefillHint})`)
730
754
  : 'contract.ledger.metrics 取口径 → contract.performance.list.query 取数 → contract.ledger.aggregate 汇总';
731
755
  return {
732
756
  status: 'COMPLETE',
@@ -742,9 +766,13 @@ export const contractLedgerRouteOperation = {
742
766
  matchedSignals,
743
767
  reasons,
744
768
  nextCommand,
769
+ card,
770
+ cardSelfCheck,
771
+ ...(cardError ? { cardError } : {}),
745
772
  conditions,
746
773
  note: 'route=card 时禁止先进取数链路;只有统计信号或显式 intent 才走 ledger-query。'
747
- + '「业绩」二字、年月、「某个人的 / 某个团队的」都不是统计信号。本 operation 不访问业务接口。',
774
+ + '「业绩」二字、年月、「某个人的 / 某个团队的」都不是统计信号。本 operation 不访问业务接口。'
775
+ + 'route=card 时顶层已带构建好的 data.card(本地零接口),直接用;data.card 为 null 时才按 nextCommand 自建。',
748
776
  },
749
777
  };
750
778
  },
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 金额取值守卫(2026-11-20 P0)。
3
+ *
4
+ * ## 为什么单独一层
5
+ *
6
+ * 平台在**文档内容进入模型上下文前**把金额脱敏成占位符(`[[MONEY_*]]`,或形状保持的
7
+ * `¥144,000.00` 之类展示文本),还原只发生在**渲染回模型/用户**这一步。而模型把字符串
8
+ * 写进本地进程的参数、再由本地进程写入文件或提交接口时,**没有任何还原环节介入**:
9
+ *
10
+ * - `Number('¥809,166.76')` → `NaN`,参数校验必然失败,模型容易把它误读成「数据缺失」;
11
+ * - 占位符被当成「值」写进 docx 时,回读一致、必填覆盖等校验全部通过,产出的是**残次品**
12
+ * (2026-11-20 实测:付款表 4 行被写成占位符文本)。
13
+ *
14
+ * 因此金额只有两种合法形态:**纯数值**,或**能唯一归一成纯数值的字符串**。
15
+ * 占位符与展示文本一律**拒收**,并用专用错误码告知正确动作,而不是报「缺少参数」。
16
+ */
17
+ /**
18
+ * 脱敏占位符形态:
19
+ * - `[[MONEY_1]]` / `[[MONEY_ABC]]` —— 文档里出现过的显式占位符;
20
+ * - `MONEY_1` —— 占位符被正文拼接或二次加工后的裸片段。
21
+ */
22
+ const PLACEHOLDER_TOKEN = /\[\[\s*MONEY[^\]]*\]\]|MONEY_[A-Za-z0-9]*/u;
23
+ /**
24
+ * 是否带**货币符号**(`¥` `¥` `$` `$`)。
25
+ *
26
+ * 只判符号、不判「元」:平台脱敏值与真实金额的展示形态都长成 `¥144,000.00`,
27
+ * 且 `¥` 前缀在 docx 里无法被还原;而 `144000元` 这种写法数字完整、含义唯一,
28
+ * 拒收它只会造成误伤,属于可接受输入。
29
+ */
30
+ export function hasCurrencySymbol(value) {
31
+ if (value === null || value === undefined)
32
+ return false;
33
+ return /[¥¥$$]/u.test(String(value));
34
+ }
35
+ /** 找出文本里的脱敏占位符片段;没有则返回 null。 */
36
+ export function findMoneyPlaceholder(value) {
37
+ if (value === null || value === undefined)
38
+ return null;
39
+ const match = PLACEHOLDER_TOKEN.exec(String(value));
40
+ return match ? match[0] : null;
41
+ }
42
+ /**
43
+ * 归一金额:接受纯数值,或 `¥809,166.76` / `1,234.5 元` / 全角数字这类**能唯一还原**的字符串。
44
+ *
45
+ * 明确拒绝:脱敏占位符(返回 null,由调用方用 `findMoneyPlaceholder` 给出专用错误码)、
46
+ * 空串、非数值文本、`NaN`/`Infinity`。
47
+ *
48
+ * 比裸 `Number()` 严的地方:不接受 `1e3` / `0x10` / 前后缀单位——金额只可能是十进制字面量。
49
+ */
50
+ export function coerceAmount(value) {
51
+ if (typeof value === 'number')
52
+ return Number.isFinite(value) ? value : null;
53
+ if (typeof value !== 'string')
54
+ return null;
55
+ let text = value.trim();
56
+ if (!text)
57
+ return null;
58
+ if (findMoneyPlaceholder(text))
59
+ return null;
60
+ text = text
61
+ // 全角数字 → 半角
62
+ .replace(/[\uff10-\uff19]/gu, (ch) => String(ch.charCodeAt(0) - 0xff10))
63
+ // 千分位与空白(含不换行空格)
64
+ .replace(/[,\s\u00a0]/gu, '')
65
+ // 货币符号可出现在任意位置(原 numOf 口径),尾部「元」单独去掉
66
+ .replace(/[¥¥$$]/gu, '')
67
+ .replace(/元$/u, '');
68
+ if (!/^[-+]?\d+(?:\.\d+)?$/u.test(text))
69
+ return null;
70
+ const num = Number(text);
71
+ return Number.isFinite(num) ? num : null;
72
+ }
73
+ /**
74
+ * 金额入参体检:把「形态非法」与「真的没传」分开。
75
+ *
76
+ * 调用方按 `reason` 发不同错误码——`placeholder` 的正确动作是**改传纯数值重跑**,
77
+ * 不是向用户索要数据,也不是宣告链路失败。
78
+ */
79
+ export function inspectAmount(value) {
80
+ const raw = value === null || value === undefined ? '' : String(value).trim();
81
+ const placeholder = findMoneyPlaceholder(value);
82
+ if (placeholder)
83
+ return { ok: false, value: null, reason: 'placeholder', raw, placeholder };
84
+ if (!raw)
85
+ return { ok: false, value: null, reason: 'missing', raw, placeholder: null };
86
+ const amount = coerceAmount(value);
87
+ if (amount === null)
88
+ return { ok: false, value: null, reason: 'not_numeric', raw, placeholder: null };
89
+ return { ok: true, value: amount, reason: 'ok', raw, placeholder: null };
90
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * 占位符残留扫描(2026-11-20 P0)。
3
+ *
4
+ * ## 为什么抽成公共模块
5
+ *
6
+ * 原先两处各有一份占位符清单,且**两份都漏了脱敏金额占位符**:
7
+ * - `contract.docx.verify` 的 `DEFAULT_PATTERNS`;
8
+ * - `contract.docx.slots.scan` 的 `PLACEHOLDER_PATTERNS`(并据此判定「哪些段落是待填位点」)。
9
+ *
10
+ * 后果(2026-11-20 实测):模型把 `[[MONEY_*]]` 当作「值」交给 `slots.fill` 写进 docx,
11
+ * 占位符**不在任何清单里**,于是「必填覆盖 / 回读一致 / 结构未变 / XML 良构」四项校验全过,
12
+ * 产出的是金额为占位符的残次品合同。
13
+ *
14
+ * 现在残留清单只此一份,且显式包含脱敏金额占位符:**写进文件的占位符一律是事故**。
15
+ * 注意「展示层」与「数据层」的区别:`¥144,000.00` 这类**形状保持**的展示文本无法与真实
16
+ * 金额区分,因此不靠扫描兜底,而是由 `money.ts` 在入参关口拒收。
17
+ */
18
+ /**
19
+ * 默认残留清单。除模板占位文本外,**必须**包含脱敏金额占位符——
20
+ * 它是 2026-11-20 残次品事故的直接特征串。
21
+ */
22
+ export const RESIDUE_PATTERNS = [
23
+ '[[MONEY',
24
+ 'MONEY_',
25
+ 'xxx公司',
26
+ 'XXX公司',
27
+ '***有限公司',
28
+ '***',
29
+ '年 月 日',
30
+ '年 月 日',
31
+ '【】',
32
+ '____',
33
+ '{{',
34
+ '}}',
35
+ ];
36
+ const XML_ENTITIES = [
37
+ [/&lt;/gu, '<'],
38
+ [/&gt;/gu, '>'],
39
+ [/&quot;/gu, '"'],
40
+ [/&apos;/gu, "'"],
41
+ [/&amp;/gu, '&'],
42
+ ];
43
+ export function decodeEntities(text) {
44
+ let out = text;
45
+ for (const [pattern, value] of XML_ENTITIES)
46
+ out = out.replace(pattern, value);
47
+ return out;
48
+ }
49
+ /** 去掉全部 XML 标签,保留文本(用于「整包 XML 里有没有这个串」的粗判)。 */
50
+ export function stripTags(xml) {
51
+ return decodeEntities(xml.replace(/<[^>]+>/gu, ''));
52
+ }
53
+ /** 统计子串出现次数(按字面量,不用正则,避免占位符里的特殊字符)。 */
54
+ export function countOccurrences(haystack, needle) {
55
+ if (!needle)
56
+ return 0;
57
+ let count = 0;
58
+ let index = haystack.indexOf(needle);
59
+ while (index !== -1) {
60
+ count += 1;
61
+ index = haystack.indexOf(needle, index + needle.length);
62
+ }
63
+ return count;
64
+ }
65
+ /**
66
+ * 可见文本:逐段落取 `<w:t>` 节点(等价 python-docx 的 paragraph.text / cell.text)。
67
+ * 只看用户真能看见的字,不含 `instrText` 等内部文本,避免误报。
68
+ */
69
+ export function visibleText(documentXml) {
70
+ const lines = [];
71
+ for (const chunk of documentXml.split(/<\/w:p>/u)) {
72
+ const parts = [];
73
+ for (const match of chunk.matchAll(/<w:t(?:\s[^>]*)?>([\s\S]*?)<\/w:t>/gu)) {
74
+ parts.push(decodeEntities(match[1] ?? ''));
75
+ }
76
+ if (parts.length > 0)
77
+ lines.push(parts.join(''));
78
+ }
79
+ return lines.join('\n');
80
+ }
81
+ /** 按清单统计残留;返回 `{ 占位文本: 出现次数 }`,无残留时为空对象。 */
82
+ export function scanResidue(text, patterns = RESIDUE_PATTERNS) {
83
+ const residue = {};
84
+ for (const pattern of patterns) {
85
+ const count = countOccurrences(text, pattern);
86
+ if (count > 0)
87
+ residue[pattern] = count;
88
+ }
89
+ return residue;
90
+ }
91
+ /**
92
+ * 交付物全量文本:正文按**可见文本**取(精确),页眉页脚/脚注/批注等其它 part 按去标签文本取。
93
+ *
94
+ * 用可见文本而不是 `stripTags(document.xml)`:后者会把 `instrText` 等内部字段也算进来,
95
+ * 模板里合法的域代码可能被误判成残留。
96
+ */
97
+ export function residueTextOfDocx(entries) {
98
+ const body = entries.find((entry) => entry.name === 'word/document.xml');
99
+ const others = entries
100
+ .filter((entry) => entry.name.startsWith('word/') && entry.name.endsWith('.xml') && entry.name !== 'word/document.xml')
101
+ .map((entry) => stripTags(entry.data.toString('utf8')));
102
+ const head = body ? visibleText(body.data.toString('utf8')) : '';
103
+ return [head, ...others].filter(Boolean).join('\n');
104
+ }
@@ -3,6 +3,8 @@ import { dirname, resolve } from 'node:path';
3
3
  import { contractValidationError } from '../errors.js';
4
4
  import { mapCompany, pickOption } from './elements-build.js';
5
5
  import { BUILTIN } from './elements-spec.js';
6
+ import { coerceAmount, findMoneyPlaceholder, inspectAmount } from './money.js';
7
+ import { assertQuoteRefsResolved, resolveQuoteRefs } from './quote-ref.js';
6
8
  const DEFAULT_OUR_COMPANY = '泛微网络科技股份有限公司';
7
9
  const SIGN_FORM_LABEL = '纸质签署';
8
10
  const SIGN_DATE_LABEL = '默认合同办理当天';
@@ -62,17 +64,14 @@ function str(value) {
62
64
  return String(value);
63
65
  return '';
64
66
  }
67
+ /**
68
+ * 金额归一:与 `money.ts` 同一份口径(2026-11-20 起不再各写一套)。
69
+ *
70
+ * 旧实现在这里放宽、在 `quote-submit` 用裸 `Number()`,同一个 `¥809,166.76` 一处能过、
71
+ * 一处报 `total_amount_required`——正是模型把错误读成「金额不可得」的起点。
72
+ */
65
73
  function numOf(value) {
66
- if (typeof value === 'number' && Number.isFinite(value))
67
- return value;
68
- if (typeof value === 'string') {
69
- const cleaned = value.replace(/[,\s¥¥]/gu, '');
70
- if (!cleaned)
71
- return null;
72
- const parsed = Number(cleaned);
73
- return Number.isFinite(parsed) ? parsed : null;
74
- }
75
- return null;
74
+ return coerceAmount(value);
76
75
  }
77
76
  function moneyText(value) {
78
77
  return Math.round(value).toLocaleString('en-US');
@@ -125,10 +124,12 @@ export function buildQuoteFieldResults(args) {
125
124
  return null;
126
125
  return [`${args.fileId}#${value}`];
127
126
  };
127
+ // 选项类字段的值一律是**选项 ID**(2026-11-20 回退:此前一度改传显示名,已撤销)。
128
+ // `pickOption` 按本流程的 options 表做归一化匹配,返回值即选项 ID。
128
129
  // ① 流程标题:与合同文件同名,四处一致(文件名 / 标题 / 上传名 / URL name)
129
130
  add(fieldOf('title'), args.contractTitle, '取合同名称,与合同文件同名', originOf(args.contractTitle));
130
131
  // ② 购买方式:报价单由泛微出具、客户即最终用户,不存在伙伴代签结构
131
- add(fieldOf('buyMode'), pickOption(spec.options?.buyMode ?? {}, '直签') ?? '直签', '泛微与最终用户直接签署(报价单无伙伴代签结构)', null);
132
+ add(fieldOf('buyMode'), pickOption(spec.options?.buyMode ?? {}, '直签') ?? '0', '泛微与最终用户直接签署(报价单无伙伴代签结构)', null);
132
133
  // ③ 最终用户:取报价单「客户名称」
133
134
  add(fieldOf('finalUser'), args.customer, '取报价单客户名称,客户即最终用户', originOf(args.customer));
134
135
  // ④ 合同总金额:取「最终优惠报价」,不是标准价
@@ -137,16 +138,16 @@ export function buildQuoteFieldResults(args) {
137
138
  add(fieldOf('background'), args.background, '按报价单标的与费用分节归纳', originOf(args.background));
138
139
  // ⑥ 我方签约公司:必须映射成下拉可选值,禁止直接填全称
139
140
  const companyLabel = mapCompany(args.ourCompanyName) || args.ourCompanyName || DEFAULT_OUR_COMPANY;
140
- add(fieldOf('ourCompany'), pickOption(spec.options?.ourCompany ?? {}, companyLabel) ?? companyLabel, `乙方签约主体:${args.ourCompanyName || DEFAULT_OUR_COMPANY}`, originOf(args.ourCompanyName || DEFAULT_OUR_COMPANY));
141
+ add(fieldOf('ourCompany'), pickOption(spec.options?.ourCompany ?? {}, companyLabel) ?? '', `乙方签约主体:${args.ourCompanyName || DEFAULT_OUR_COMPANY}`, originOf(args.ourCompanyName || DEFAULT_OUR_COMPANY));
141
142
  // ⑦ 签约形式:技术性默认(规则允许默认,非业务判断)
142
- add(fieldOf('signForm'), pickOption(spec.options?.signForm ?? {}, SIGN_FORM_LABEL) ?? SIGN_FORM_LABEL, '合同未约定电子签,按纸质签署(技术性默认值)', null);
143
+ add(fieldOf('signForm'), pickOption(spec.options?.signForm ?? {}, SIGN_FORM_LABEL) ?? spec.defaults?.signForm ?? '', '合同未约定电子签,按纸质签署(技术性默认值)', null);
143
144
  // ⑧ 合同签署日期:技术性默认「默认合同办理当天」
144
145
  // 新客户字段键是 signDate,其余三个流程是 signDateType,择一写入
145
146
  const signDateField = fieldOf('signDate') || fieldOf('signDateType');
146
- add(signDateField, pickOption(spec.options?.signDate ?? {}, SIGN_DATE_LABEL) ?? SIGN_DATE_LABEL, '未约定固定签署日,按默认合同办理当天(技术性默认值)', null);
147
+ add(signDateField, pickOption(spec.options?.signDate ?? {}, SIGN_DATE_LABEL) ?? spec.defaults?.signDate ?? '', '未约定固定签署日,按默认合同办理当天(技术性默认值)', null);
147
148
  // ⑨ 合同签订方式:技术性默认「我方先盖章」
148
- add(fieldOf('signWay'), pickOption(spec.options?.signWay ?? {}, SIGN_WAY_LABEL) ?? SIGN_WAY_LABEL, '未特别约定签署顺序,按我方先盖章(技术性默认值)', null);
149
- // ⑩ 关联流程类型:报价单链路固定「报价审批及伙伴授权书流程」
149
+ add(fieldOf('signWay'), pickOption(spec.options?.signWay ?? {}, SIGN_WAY_LABEL) ?? spec.defaults?.signWay ?? '', '未特别约定签署顺序,按我方先盖章(技术性默认值)', null);
150
+ // ⑩ 关联流程类型:报价单链路固定「报价审批及伙伴授权书流程」(传**选项 ID**:0)
150
151
  // 仅新客户与契约锁流程存在该字段;另两个流程无此字段,不硬写
151
152
  add(RELATED_FLOW_FIELD[args.flow] ?? '', RELATED_FLOW_OPTION, `报价单链路固定关联「${RELATED_FLOW_LABEL}」`, null);
152
153
  return results;
@@ -175,6 +176,14 @@ export const contractQuoteRecognizeOperations = [
175
176
  {
176
177
  name: 'contract.quotescreen.recognize',
177
178
  async execute(input) {
179
+ // 值引用解析(2026-11-20 P1):totalAmount / sections 都可以写成
180
+ // {"$quote":"<报价书解析结果.json>#totals.final_total"},由本进程读真值。
181
+ // 金额在模型侧是脱敏的,模型不可能把真值传出来;这条通道让「取值」由代码完成。
182
+ const refOutcome = resolveQuoteRefs(input);
183
+ assertQuoteRefsResolved(refOutcome, (errors) => `入参有 ${errors.length} 处 $quote 引用取不到值:`
184
+ + errors.slice(0, 5).map((item) => `${item.at}(${item.ref}:${item.reason})`).join(';')
185
+ + '。请核对文件路径与字段路径;报价书解析结果需先用 contract.quote.parse / contract.quote.normalize 的 out 参数落盘。');
186
+ input = refOutcome.value;
178
187
  const fileId = str(input.fileId);
179
188
  if (!fileId) {
180
189
  throw contractValidationError('file_id_required', '缺少 fileId(必须是 flow.launch 返回的 workflow fileId)');
@@ -209,9 +218,37 @@ export const contractQuoteRecognizeOperations = [
209
218
  throw contractValidationError('flow_not_builtin', `流程「${flow}」无内置字段表:${Object.keys(BUILTIN).join(' / ')}`);
210
219
  }
211
220
  // ── 金额与标题
221
+ // 金额形态体检:脱敏占位符与「真的没传」必须分开报——占位符的正确动作是改传纯数值重跑,
222
+ // 不是向用户索要金额、也不是宣告链路失败(2026-11-20 事故:模型把 total_amount_required
223
+ // 误读成「金额在我这边不可得」,整条链路停在上传之前)。
224
+ const amountCheck = inspectAmount(input.totalAmount);
225
+ if (amountCheck.reason === 'placeholder') {
226
+ throw contractValidationError('total_amount_placeholder', `totalAmount 是平台脱敏占位符「${amountCheck.placeholder}」。它在模型上下文里是真实金额的等价表示,`
227
+ + '但本地进程收到的是字面量、没有任何还原环节,不能当数值使用。'
228
+ + '正确动作:改传报价单解析结果里的纯数值(如 809166.76)重跑。'
229
+ + '⚠️ 这不是「金额拿不到」,不要据此向用户索要金额、也不要宣告链路失败。', { raw: amountCheck.raw, placeholder: amountCheck.placeholder });
230
+ }
231
+ // 分节金额同样不接受占位符:normalizeSections 对非数值是**静默丢弃**,
232
+ // 占位符会让费用分节凭空少一项且不报错,背景说明随之失真。
233
+ const sectionPlaceholders = [];
234
+ if (Array.isArray(input.sections)) {
235
+ input.sections.forEach((item, index) => {
236
+ if (!isRecord(item))
237
+ return;
238
+ const candidate = item.amount ?? item.total ?? item.sum;
239
+ const token = findMoneyPlaceholder(candidate);
240
+ if (token)
241
+ sectionPlaceholders.push({ index, placeholder: token, raw: String(candidate) });
242
+ });
243
+ }
244
+ if (sectionPlaceholders.length > 0) {
245
+ throw contractValidationError('sections_amount_placeholder', `sections 有 ${sectionPlaceholders.length} 项金额是脱敏占位符(第 ${sectionPlaceholders.map((item) => item.index + 1).join('、')} 项)。`
246
+ + '本地进程不会还原占位符,写进合同背景说明就会留下占位符文本。'
247
+ + '正确动作:改用报价单解析结果里的纯数值重跑,或不传 sections(背景说明退化为不含费用构成)。', { sections: sectionPlaceholders });
248
+ }
212
249
  const totalAmount = numOf(input.totalAmount) ?? 0;
213
250
  if (totalAmount <= 0) {
214
- throw contractValidationError('total_amount_required', '缺少 totalAmount(报价单最终优惠报价,须大于 0)');
251
+ throw contractValidationError('total_amount_required', `totalAmount 必须是大于 0 的纯数值(报价单最终优惠报价),收到「${amountCheck.raw}」`, { raw: amountCheck.raw });
215
252
  }
216
253
  const contractTitle = str(input.contractTitle)
217
254
  || `${customer}合同管理系统软件产品及实施服务购买合同`;