weaver-work-cli 0.1.65 → 0.1.67
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/dist/chunks/{attachment-content-QUM27QNB.js → attachment-content-7SDA6WER.js} +3 -3
- package/dist/chunks/{chunk-IJDZ7VDC.js → chunk-33ANTJWB.js} +2 -2
- package/dist/chunks/{chunk-LRK7YND4.js → chunk-4PYLZORW.js} +7 -7
- package/dist/chunks/{chunk-SHX7XBYR.js → chunk-4WCVRDC5.js} +83 -33
- package/dist/chunks/{chunk-ZV3TYANI.js → chunk-6ZOSVKMT.js} +1 -1
- package/dist/chunks/{chunk-NZLFKBEM.js → chunk-DTJZOAO6.js} +6 -6
- package/dist/chunks/{chunk-F4ME3CGS.js → chunk-JU5OPHSY.js} +2 -2
- package/dist/chunks/{chunk-CUY64WP4.js → chunk-KS6LXSCA.js} +38 -38
- package/dist/chunks/{chunk-IT3SB7RV.js → chunk-LNWFHNVK.js} +2448 -318
- package/dist/chunks/{chunk-QT7GGCSY.js → chunk-MRYKV5HN.js} +32 -32
- package/dist/chunks/{chunk-K7QKQRSL.js → chunk-NP3ZZFGI.js} +24 -24
- package/dist/chunks/{chunk-E3OQSNF5.js → chunk-R6GGDZ2C.js} +1 -1
- package/dist/chunks/{chunk-6AW5LW4T.js → chunk-RU7ZZQQQ.js} +4 -4
- package/dist/chunks/{chunk-D6SWOUUP.js → chunk-TXXO4TJT.js} +2 -2
- package/dist/chunks/{chunk-JDZOYHAL.js → chunk-XARLZK6C.js} +1 -1
- package/dist/chunks/{conflict-76ZUL3E7.js → conflict-DYCSX7CN.js} +2 -2
- package/dist/chunks/{contract-INMS7SYQ.js → contract-N5WNHKHI.js} +94 -30
- package/dist/chunks/{create-flow-7WGKLRHH.js → create-flow-PABAGCK2.js} +6 -6
- package/dist/chunks/{entry-mode-3UMMMK6Z.js → entry-mode-C2WPJQJM.js} +3 -3
- package/dist/chunks/{env-7EGXNZR2.js → env-SEEXUXZF.js} +2 -2
- package/dist/chunks/{factory-BDERKTYX.js → factory-WNLDOLJZ.js} +1 -1
- package/dist/chunks/{group-chat-4E7EZMTJ.js → group-chat-DOS4XWUN.js} +3 -3
- package/dist/chunks/{invoice-MOGNB6HN.js → invoice-SMODTN2D.js} +7 -2
- package/dist/chunks/{lazy-dispatch-4WOIL3ZQ.js → lazy-dispatch-K25LTKQY.js} +2 -2
- package/dist/chunks/{meeting-2FMYZXG5.js → meeting-2IWXP5IL.js} +11 -11
- package/dist/chunks/{minute-doc-3DHMYMBE.js → minute-doc-N4OR5OLP.js} +2 -2
- package/dist/chunks/{registry-6UGQO35C.js → registry-ABKBGGGK.js} +2 -2
- package/dist/chunks/{registry-XXFMYPBM.js → registry-XOUVCSV4.js} +11 -11
- package/dist/chunks/{room-recommend-7LD2OHL5.js → room-recommend-TWIEVY44.js} +4 -4
- package/dist/chunks/{schedule-ZAYMZKTQ.js → schedule-XZ4UUX4E.js} +4 -4
- package/dist/chunks/{smart-extract-FOBSVNYW.js → smart-extract-DEBLJPCQ.js} +11 -11
- package/dist/chunks/{workflow-NYJJIT3D.js → workflow-D7LBN5MZ.js} +2 -2
- package/dist/cmd/refs/index.js +24 -23
- package/dist/core/output.js +134 -41
- package/dist/index.js +8 -8
- package/dist/shortcuts/contract/manifest.js +11 -4
- package/dist/shortcuts/contract/operations/first-screen.js +41 -19
- package/dist/shortcuts/contract/operations/flow.js +2 -0
- package/dist/shortcuts/contract/operations/ledger.js +58 -8
- package/dist/shortcuts/contract/operations/quote-recognize.js +31 -9
- package/dist/shortcuts/contract/operations/quote-submit.js +4 -1
- package/dist/shortcuts/contract/operations/upload.js +21 -1
- package/dist/shortcuts/contract/upload-cache.js +2 -2
- package/dist/shortcuts/invoice/manifest.js +1 -1
- package/dist/shortcuts/invoice/operations/get.js +2 -0
- package/dist/shortcuts/invoice/operations/shared.js +2 -0
- package/dist/shortcuts/invoice/projection.js +4 -1
- package/dist/shortcuts/smart-extract/operations/fill.js +14 -14
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/index.js +2 -2
- package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +1735 -0
- package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +562 -0
- package/dist/shortcuts/workflow/operations/deepRead.js +447 -0
- package/dist/shortcuts/workflow/operations/form.js +28 -4
- package/dist/shortcuts/workflow/operations/read.js +18 -4
- package/dist/shortcuts/workflow/operations/registry.js +4 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +9 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +3 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +5 -0
- package/docs/agent-io-channel-design.md +21 -10
- package/docs/invoice.md +2 -0
- package/docs/smart-extract.md +1 -1
- package/docs/todo-smart-convert/data-contract.md +1 -1
- package/package.json +1 -1
- package/scripts/package-skill.mjs +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +67 -31
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +7 -7
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +9 -9
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +11 -11
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -15
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +51 -28
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +20 -9
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +18 -18
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +9 -9
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +42 -30
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +8 -8
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +1 -1
- package/skills/weaver-e10-shared/references/json-output-contract.md +4 -3
- package/skills/weaver-e10-smart-extract/SKILL.md +1 -1
- package/skills/weaver-e10-workflow/SKILL.md +15 -3
- package/skills/weaver-e10-workflow/aiDeepRead/config.json +151 -0
- package/skills/weaver-e10-workflow/aiDeepRead/templates//345/215/225/345/215/241/347/211/207-demo.html +64 -0
- package/skills/weaver-e10-workflow/aiDeepRead/templates//346/261/207/346/200/273/345/256/241/346/211/271-demo.html +310 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +4 -2
- package/skills/weaver-e10-workflow/references/workflow-deep-read.md +201 -0
- package/skills/weaver-e10-workflow/tools/ai-deep-read.cjs +80 -0
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +80 -6
- package/skills/weaver-e10-yepiaotong/SKILL.md +30 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +1 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +16 -2
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +44 -9
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +16 -2
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +61 -2
|
@@ -545,6 +545,45 @@ function normalizeRoutePerson(raw) {
|
|
|
545
545
|
}
|
|
546
546
|
return out.length ? out : null;
|
|
547
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* 人员/团队条件「只给了姓名、或 id 不合法」时,给出**先解析人员 ID** 的可执行动作。
|
|
550
|
+
*
|
|
551
|
+
* 事故(2026-11-23 用户反馈):用户说「查一下吴洋洋的业绩」,模型**直接开卡且没带人员筛选**,
|
|
552
|
+
* 理由是「台账卡片只接受人员 ID,我这边没有可靠的人员 ID 来源,所以把条件留给页面」。
|
|
553
|
+
* 真实原因是 **skill 从没提过 CLI 早就有 `im.person.resolve`**(实测 `{name:"吴洋洋"}` →
|
|
554
|
+
* `uid = 732851919151005700`,正是台账要的那个 ID)——模型只知道「必须传 ID、不能猜」,
|
|
555
|
+
* 于是把用户明确给的条件**静默降级**成「交给页面」,用户拿到的是一张全量卡。
|
|
556
|
+
*
|
|
557
|
+
* 因此这里不静默:把「缺 ID」变成一条带 `requiredAction` / `command` / `forbiddenClaims` 的显式结论,
|
|
558
|
+
* 并在调用方**扣住卡片**——逼出「先解析 ID 再出卡」。
|
|
559
|
+
*/
|
|
560
|
+
function buildPersonLookup(conditions, unsupported) {
|
|
561
|
+
const field = ['person', 'team'].find((name) => unsupported.includes(name));
|
|
562
|
+
if (!field)
|
|
563
|
+
return null;
|
|
564
|
+
const raw = conditions[field];
|
|
565
|
+
const keyword = isRecord(raw)
|
|
566
|
+
? String(raw.name ?? '').trim()
|
|
567
|
+
: String(raw ?? '').trim();
|
|
568
|
+
return {
|
|
569
|
+
field,
|
|
570
|
+
keyword,
|
|
571
|
+
reason: '台账人员字段与卡片人员筛选键**都要求人员 ID**:传姓名不会报错,但会被静默忽略、'
|
|
572
|
+
+ '返回全量(实测 直销业绩 like 姓名 → 451,275 条 = 全量),用户会误以为看到的就是这个人的数据,'
|
|
573
|
+
+ '比"查不到"更危险。而 CLI **本来就能按姓名解析**,不存在"没有 ID 来源"。',
|
|
574
|
+
requiredAction: `先解析「${keyword}」的人员 ID,再用 conditions.${field}={"id":"<uid>","name":"${keyword}"} 重跑本命令`
|
|
575
|
+
+ '(拿到 ID 后本命令会直接把卡片一起返回)。',
|
|
576
|
+
command: `weaver-work-cli --json im run im.person.resolve --input <含 {"name":"${keyword}"} 的 json>`,
|
|
577
|
+
altCommand: `weaver-work-cli --json hrm run hrm.employee.query --input <含 {"username":"${keyword}","full":true} 的 json>`,
|
|
578
|
+
idSource: '人员 ID 取 im.person.resolve 的 `uid`(= hrm.employee.query 的 `id`);'
|
|
579
|
+
+ '**不是** `userid`、也**不是** `cid`(这两个是别的值,填错等于没筛选)。',
|
|
580
|
+
forbiddenClaims: [
|
|
581
|
+
'不要说「我这边没有可靠的人员 ID 来源」——先跑上面的命令',
|
|
582
|
+
'不要把人员条件丢给页面筛选后直接开卡——那会出来一张全量数据的卡',
|
|
583
|
+
'不要凭姓名猜一个 ID 填进去',
|
|
584
|
+
],
|
|
585
|
+
};
|
|
586
|
+
}
|
|
548
587
|
/**
|
|
549
588
|
* 台账入口路由判定(本地,零接口)。
|
|
550
589
|
*
|
|
@@ -723,6 +762,11 @@ export const contractLedgerRouteOperation = {
|
|
|
723
762
|
route = 'card';
|
|
724
763
|
reasons.push('未命中统计信号,按看台账处理;落不了的条件留给页面筛选');
|
|
725
764
|
}
|
|
765
|
+
// ── 人员/团队条件用不了时**不静默降级**(2026-11-23 事故,见 buildPersonLookup 注释)
|
|
766
|
+
const personLookup = buildPersonLookup(conditions, unsupported);
|
|
767
|
+
if (personLookup) {
|
|
768
|
+
reasons.push(`人员条件缺人员 ID(只拿到「${personLookup.keyword}」):必须先用 im.person.resolve 解析,不得开无筛选的卡`);
|
|
769
|
+
}
|
|
726
770
|
const prefillKeys = Object.keys(prefill);
|
|
727
771
|
// comParamsJson 是**字符串**入参:提示里必须给双层序列化后的字符串字面量。
|
|
728
772
|
// 事故(2026-11-20):这里原本只 JSON.stringify 一次,渲染出 `comParamsJson={"xsjl":[…]}`,
|
|
@@ -733,10 +777,11 @@ export const contractLedgerRouteOperation = {
|
|
|
733
777
|
// ── route=card 时**顺带把卡片也生成好**(2026-11-20,省 1 轮)
|
|
734
778
|
// 卡片构造是纯本地计算(`contract.ledger.card` 不访问业务接口),进程内调用即可。
|
|
735
779
|
// 失败**绝不影响路由结论**:路由是判定,卡片是产物;产物失败降级回 nextCommand 提示。
|
|
780
|
+
// ⛔ 但**人员条件缺 ID 时故意不建卡**:否则模型会照旧把这张"没有筛选"的卡发出去。
|
|
736
781
|
let card = null;
|
|
737
782
|
let cardSelfCheck = null;
|
|
738
783
|
let cardError = null;
|
|
739
|
-
if (route === 'card') {
|
|
784
|
+
if (route === 'card' && !personLookup) {
|
|
740
785
|
try {
|
|
741
786
|
const built = await contractLedgerCardOperation.execute({ menu, comParamsJson: JSON.stringify(prefill) }, context);
|
|
742
787
|
card = built?.data?.card ?? null;
|
|
@@ -746,12 +791,14 @@ export const contractLedgerRouteOperation = {
|
|
|
746
791
|
cardError = error instanceof Error ? error.message : String(error);
|
|
747
792
|
}
|
|
748
793
|
}
|
|
749
|
-
const nextCommand =
|
|
750
|
-
?
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
794
|
+
const nextCommand = personLookup
|
|
795
|
+
? `${personLookup.command}(拿到 uid 后重跑本命令:conditions.${personLookup.field}={"id":"<uid>","name":"${personLookup.keyword}"})`
|
|
796
|
+
: route === 'card'
|
|
797
|
+
? (card
|
|
798
|
+
? '(卡片已随本响应返回:顶层 data.card 直接作为 <browsertool> 输出,无需再调 contract.ledger.card)'
|
|
799
|
+
: 'weaver-work-cli --json contract run contract.ledger.card --input <args.json>'
|
|
800
|
+
+ `(menu=${menu}${prefillHint})`)
|
|
801
|
+
: 'contract.ledger.metrics 取口径 → contract.performance.list.query 取数 → contract.ledger.aggregate 汇总';
|
|
755
802
|
return {
|
|
756
803
|
status: 'COMPLETE',
|
|
757
804
|
data: {
|
|
@@ -769,10 +816,13 @@ export const contractLedgerRouteOperation = {
|
|
|
769
816
|
card,
|
|
770
817
|
cardSelfCheck,
|
|
771
818
|
...(cardError ? { cardError } : {}),
|
|
819
|
+
...(personLookup ? { personLookup } : {}),
|
|
772
820
|
conditions,
|
|
773
821
|
note: 'route=card 时禁止先进取数链路;只有统计信号或显式 intent 才走 ledger-query。'
|
|
774
822
|
+ '「业绩」二字、年月、「某个人的 / 某个团队的」都不是统计信号。本 operation 不访问业务接口。'
|
|
775
|
-
+ 'route=card 时顶层已带构建好的 data.card(本地零接口),直接用;data.card 为 null 时才按 nextCommand 自建。'
|
|
823
|
+
+ 'route=card 时顶层已带构建好的 data.card(本地零接口),直接用;data.card 为 null 时才按 nextCommand 自建。'
|
|
824
|
+
+ '⚠️ 出现 personLookup 时:**先按它的 command 解析人员 ID 再重跑本命令**,'
|
|
825
|
+
+ '此时 card 故意为 null——不要绕开它去自建一张没有人员筛选的卡。',
|
|
776
826
|
},
|
|
777
827
|
};
|
|
778
828
|
},
|
|
@@ -91,11 +91,22 @@ function normalizeSections(input) {
|
|
|
91
91
|
}
|
|
92
92
|
return out;
|
|
93
93
|
}
|
|
94
|
-
/**
|
|
95
|
-
|
|
94
|
+
/**
|
|
95
|
+
* 合同背景说明:客户 + 标的 + 费用构成概览,全部取自报价单。
|
|
96
|
+
*
|
|
97
|
+
* ⛔ 不得写死产品名(2026-11-23 修正):此处原本固定写「采购**合同管理系统**软件产品及实施服务」,
|
|
98
|
+
* 而报价单的真实标的是「协同办公系统(e-cology)」这类——**背景说明写错产品**会进正式合同字段。
|
|
99
|
+
* 现在优先用真实合同标题/标的,拿不到时才用中性表述。
|
|
100
|
+
*/
|
|
101
|
+
function buildBackground(customer, sections, totalAmount, contractTitle = '') {
|
|
96
102
|
const parts = sections.slice(0, 8).map((section) => `${section.name} ${moneyText(section.amount)} 元`);
|
|
97
103
|
const detail = parts.length ? `费用构成:${parts.join('、')}。` : '';
|
|
98
|
-
|
|
104
|
+
// 从合同标题里取「标的」:去掉客户全称前缀与结尾的「(购买)合同」,
|
|
105
|
+
// 否则会写出「采购西安泽达…有限公司协同办公系统…购买合同」这种把合同名当产品的句子。
|
|
106
|
+
const raw = contractTitle.replace(/\.docx$/iu, '').trim();
|
|
107
|
+
const withoutCustomer = raw.includes(customer) ? raw.split(customer).join('').trim() : raw;
|
|
108
|
+
const subject = withoutCustomer.replace(/(?:购买)?合同$/u, '').trim() || '软件产品及实施服务';
|
|
109
|
+
return `${customer}采购${subject},${detail}合同总金额 ${moneyText(totalAmount)} 元。`;
|
|
99
110
|
}
|
|
100
111
|
/**
|
|
101
112
|
* 报价单 → 表单要素(按流程字段表分派)。
|
|
@@ -154,11 +165,25 @@ export function buildQuoteFieldResults(args) {
|
|
|
154
165
|
}
|
|
155
166
|
/** 通用文件名黑名单:这些名字不是「合同名称」,落到系统里无法辨识。 */
|
|
156
167
|
const GENERIC_FILE_STEMS = new Set(['合同', '合同文件', '未命名', 'document', 'new', '模板', 'temp', 'output']);
|
|
168
|
+
/**
|
|
169
|
+
* §5.2 合同名称命名规则(用户明确指定)的**代码兜底**:
|
|
170
|
+
* `{客户全称}协同办公系统(e-cology)软件产品及实施服务购买合同`。
|
|
171
|
+
*
|
|
172
|
+
* 只在**拿不到真实标题**时使用(正常链路模型会把 plan 里的 title 槽填成真实标题,
|
|
173
|
+
* 并通过 `contractTitle` 传进来)。⛔ 2026-11-23 修正:此前这里写死的是
|
|
174
|
+
* `…合同管理系统软件产品及实施服务购买合同`,与实际标的(协同办公系统(e-cology))
|
|
175
|
+
* 不符,导致返回的 `expectedFileName` 教人把名字改错。
|
|
176
|
+
*/
|
|
177
|
+
export function defaultContractTitle(customer) {
|
|
178
|
+
return `${customer || '客户'}协同办公系统(e-cology)软件产品及实施服务购买合同`;
|
|
179
|
+
}
|
|
157
180
|
/**
|
|
158
181
|
* 合同文件名归一:`{合同名称}.docx`。
|
|
159
182
|
*
|
|
160
183
|
* 2026-11-19 实测事故:编排层把回填产物写成 `合同.docx`,`flow.launch` 直接沿用本地文件名,
|
|
161
184
|
* 系统附件列表里只剩一个「合同.docx」,无法辨识客户与类型。
|
|
185
|
+
* ⚠️ 2026-11-23 补充:本函数算出的名字必须**一路传到上传**(`flow.launch.fileName` /
|
|
186
|
+
* `quotescreen.submit.fileName`);只写进字段值是不够的——附件名取自 multipart filename。
|
|
162
187
|
*/
|
|
163
188
|
export function normalizeContractFileName(contractTitle, fallbackCustomer = '') {
|
|
164
189
|
const raw = String(contractTitle ?? '').replace(/\.docx$/iu, '');
|
|
@@ -167,9 +192,7 @@ export function normalizeContractFileName(contractTitle, fallbackCustomer = '')
|
|
|
167
192
|
.replace(/\s+/gu, ' ')
|
|
168
193
|
.trim();
|
|
169
194
|
const isGeneric = !cleaned || GENERIC_FILE_STEMS.has(cleaned.toLowerCase());
|
|
170
|
-
const stem = isGeneric
|
|
171
|
-
? `${fallbackCustomer || '客户'}合同管理系统软件产品及实施服务购买合同`
|
|
172
|
-
: cleaned;
|
|
195
|
+
const stem = isGeneric ? defaultContractTitle(fallbackCustomer) : cleaned;
|
|
173
196
|
return `${stem}.docx`;
|
|
174
197
|
}
|
|
175
198
|
export const contractQuoteRecognizeOperations = [
|
|
@@ -250,12 +273,11 @@ export const contractQuoteRecognizeOperations = [
|
|
|
250
273
|
if (totalAmount <= 0) {
|
|
251
274
|
throw contractValidationError('total_amount_required', `totalAmount 必须是大于 0 的纯数值(报价单最终优惠报价),收到「${amountCheck.raw}」`, { raw: amountCheck.raw });
|
|
252
275
|
}
|
|
253
|
-
const contractTitle = str(input.contractTitle)
|
|
254
|
-
|| `${customer}合同管理系统软件产品及实施服务购买合同`;
|
|
276
|
+
const contractTitle = str(input.contractTitle) || defaultContractTitle(customer);
|
|
255
277
|
const fileName = normalizeContractFileName(str(input.contractFileName) || contractTitle, customer);
|
|
256
278
|
// ── 费用分节与背景
|
|
257
279
|
const sections = normalizeSections(input.sections);
|
|
258
|
-
const background = str(input.background) || buildBackground(customer, sections, totalAmount);
|
|
280
|
+
const background = str(input.background) || buildBackground(customer, sections, totalAmount, contractTitle);
|
|
259
281
|
const ourCompanyName = str(input.ourCompany) || DEFAULT_OUR_COMPANY;
|
|
260
282
|
// verified 默认 true:上游必须在 slots.fill 的 validate.ok === true 之后才调用本 operation。
|
|
261
283
|
// 传 false 时全部 origin 置空,宁可「合同原文」列空,也不给出失真出处。
|
|
@@ -174,7 +174,10 @@ export const contractQuoteSubmitOperations = [
|
|
|
174
174
|
verified: input.verified === undefined ? true : input.verified === true,
|
|
175
175
|
};
|
|
176
176
|
const [launched, assembled] = await Promise.all([
|
|
177
|
-
|
|
177
|
+
// ⛔ 必须把规范文件名一起传下去(2026-11-23 修复):E10 附件名恒等于上传时的 multipart 文件名,
|
|
178
|
+
// 而它原先取自本地 basename——模型把产物写成 `合同.docx`,系统附件列表里就是「合同.docx」,
|
|
179
|
+
// 与表单里的合同名称字段、以及返回的 expectedFileName 都对不上。
|
|
180
|
+
callOperation('contract.flow.launch', { flow, path: contractPath, fileName }, context),
|
|
178
181
|
callOperation('contract.quotescreen.recognize', recognizeInput, context),
|
|
179
182
|
]);
|
|
180
183
|
steps.push('flow.launch+quotescreen.recognize(parallel)');
|
|
@@ -7,6 +7,24 @@ import { ensurePrewarmed } from '../prewarm.js';
|
|
|
7
7
|
const MAX_FILE_BYTES = 200 * 1024 * 1024;
|
|
8
8
|
const DEFAULT_UPLOAD_TIMEOUT_MS = 120_000;
|
|
9
9
|
const DOC_EXTENSIONS = new Set(['.doc', '.docx']);
|
|
10
|
+
const MAX_UPLOAD_NAME_CHARS = 200;
|
|
11
|
+
/**
|
|
12
|
+
* 解析本次上传真正使用的文件名:优先用调用方给的规范名,否则回落本地 basename。
|
|
13
|
+
*
|
|
14
|
+
* 传入值一律按**纯文件名**处理(剥掉路径分隔符与各平台非法字符);清洗后为空则回落本地名,
|
|
15
|
+
* 保证永远不会上传一个空名字或带路径的名字。
|
|
16
|
+
*/
|
|
17
|
+
export function resolveUploadName(absolutePath, override) {
|
|
18
|
+
const local = basename(absolutePath);
|
|
19
|
+
const raw = typeof override === 'string' ? override.trim() : '';
|
|
20
|
+
if (!raw)
|
|
21
|
+
return local;
|
|
22
|
+
const tail = basename(raw.replace(/\\/gu, '/'));
|
|
23
|
+
const cleaned = tail.replace(/[\\/:*?"<>|\r\n\t]/gu, '').trim();
|
|
24
|
+
if (!cleaned)
|
|
25
|
+
return local;
|
|
26
|
+
return cleaned.length > MAX_UPLOAD_NAME_CHARS ? cleaned.slice(0, MAX_UPLOAD_NAME_CHARS) : cleaned;
|
|
27
|
+
}
|
|
10
28
|
function text(value) {
|
|
11
29
|
if (typeof value === 'string' && value.trim())
|
|
12
30
|
return value;
|
|
@@ -39,7 +57,7 @@ export async function uploadFile(host, options) {
|
|
|
39
57
|
if (info.size > MAX_FILE_BYTES) {
|
|
40
58
|
throw contractValidationError('file_too_large', `文件超过 ${MAX_FILE_BYTES / 1024 / 1024}MB 上限:${options.path}`);
|
|
41
59
|
}
|
|
42
|
-
const name =
|
|
60
|
+
const name = resolveUploadName(absolutePath, options.fileName);
|
|
43
61
|
const buffer = await readFile(absolutePath);
|
|
44
62
|
const md5 = createHash('md5').update(buffer).digest('hex');
|
|
45
63
|
const modified = String(Math.trunc(info.mtimeMs));
|
|
@@ -55,6 +73,8 @@ export async function uploadFile(host, options) {
|
|
|
55
73
|
module: options.module,
|
|
56
74
|
baseUrl: session.baseUrl,
|
|
57
75
|
userId: session.userId ?? '',
|
|
76
|
+
// 文件名进指纹:同一份内容以不同名字上传不能复用(附件名在上传那一刻就固定了)
|
|
77
|
+
name,
|
|
58
78
|
});
|
|
59
79
|
const hit = await lookupUpload(reuseKey);
|
|
60
80
|
if (hit) {
|
|
@@ -26,10 +26,10 @@ function ttlMs() {
|
|
|
26
26
|
export function isCacheEnabled() {
|
|
27
27
|
return ttlMs() > 0;
|
|
28
28
|
}
|
|
29
|
-
/** 指纹键:内容哈希 + module + 环境 +
|
|
29
|
+
/** 指纹键:内容哈希 + module + 环境 + 用户 + **目标文件名**,任一不同都不复用。 */
|
|
30
30
|
export function fingerprintKey(input) {
|
|
31
31
|
return createHash('sha256')
|
|
32
|
-
.update(`${input.sha256}|${input.module}|${input.baseUrl}|${input.userId}`)
|
|
32
|
+
.update(`${input.sha256}|${input.module}|${input.baseUrl}|${input.userId}|${input.name ?? ''}`)
|
|
33
33
|
.digest('hex');
|
|
34
34
|
}
|
|
35
35
|
export function sha256Of(buffer) {
|
|
@@ -120,7 +120,7 @@ const invoicePartySchema = objectSchema({
|
|
|
120
120
|
tcode: { type: 'string' },
|
|
121
121
|
}, [], true);
|
|
122
122
|
const invoiceInfoSchema = objectSchema({
|
|
123
|
-
id: { type: 'string' },
|
|
123
|
+
id: { type: 'string', description: '发票业务 ID;列表和详情返回时与 fid 保持一致。' },
|
|
124
124
|
fid: { type: 'string' },
|
|
125
125
|
code: { type: 'string' },
|
|
126
126
|
number: { type: 'string' },
|
|
@@ -6,6 +6,8 @@ export class InvoiceGetOperation {
|
|
|
6
6
|
const result = await getDetail(input, host);
|
|
7
7
|
const infos = Array.isArray(result?.infos) ? result.infos : [];
|
|
8
8
|
for (const item of infos) {
|
|
9
|
+
if (item?.info?.fid !== undefined)
|
|
10
|
+
item.info.id = item.info.fid;
|
|
9
11
|
const fid = item?.info?.fid ?? item?.info?.id;
|
|
10
12
|
if (fid)
|
|
11
13
|
item.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
|
|
@@ -560,6 +560,8 @@ export async function listInvoices(input, host, flag) {
|
|
|
560
560
|
const result = await host.invoiceRequest({ path: '/api/inc/sync', method: 'POST', body });
|
|
561
561
|
const items = (result.infos || []).filter((item) => !isRedReversedInvoice(invoiceRecordOf(item))).map((item) => {
|
|
562
562
|
const record = invoiceRecordOf(item);
|
|
563
|
+
if (record.fid !== undefined)
|
|
564
|
+
record.id = record.fid;
|
|
563
565
|
const fid = record.fid ?? record.id;
|
|
564
566
|
if (fid)
|
|
565
567
|
record.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
|
|
@@ -11,6 +11,7 @@ export const OUTPUT_VIEWS = ['full', 'summary', 'detail'];
|
|
|
11
11
|
* `EXT_INFO_FIELDS` 来自票面 `ext`(费用说明、城市、备注、起止地等)。
|
|
12
12
|
*/
|
|
13
13
|
export const SUMMARY_ITEM_FIELDS = [
|
|
14
|
+
'id',
|
|
14
15
|
'fid',
|
|
15
16
|
'number',
|
|
16
17
|
'code',
|
|
@@ -55,8 +56,10 @@ export function summarizeInvoiceItem(raw) {
|
|
|
55
56
|
const payer = asRecord(comm.payer);
|
|
56
57
|
const modify = asRecord(item.modify_info);
|
|
57
58
|
const reimList = Array.isArray(asRecord(item.oreim).list_reim) ? asRecord(item.oreim).list_reim : [];
|
|
59
|
+
const fid = text(item.fid ?? item.id);
|
|
58
60
|
const summary = {
|
|
59
|
-
|
|
61
|
+
id: fid,
|
|
62
|
+
fid,
|
|
60
63
|
number: text(item.number),
|
|
61
64
|
code: text(item.code),
|
|
62
65
|
typeName: text(pro.cname),
|
|
@@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
2
2
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, extname } from 'node:path';
|
|
4
4
|
import { inflateRawSync } from 'node:zlib';
|
|
5
|
-
import {
|
|
5
|
+
import { defaultResultThresholdChars } from '../../../core/output.js';
|
|
6
6
|
import { DATA_SOURCE, MAX_ATTACHMENTS, MAX_ATTACHMENT_BYTES, MAX_REQUEST_ID_LENGTH, PATHS, TEXT_PREVIEW_CHARS, sessionPath, } from '../constants.js';
|
|
7
7
|
import { smartExtractBusinessError, smartExtractPartialError, smartExtractValidationError, SmartExtractCliError, } from '../errors.js';
|
|
8
8
|
import { record } from '../host.js';
|
|
@@ -21,10 +21,10 @@ function shortId(prefix) {
|
|
|
21
21
|
}
|
|
22
22
|
/** stdout 预算里留给附件正文的比例,其余归结构、规则、envelope 与 warnings。 */
|
|
23
23
|
const INLINE_BUDGET_RATIO = 0.95;
|
|
24
|
-
/** envelope 与 warnings
|
|
25
|
-
const
|
|
26
|
-
/**
|
|
27
|
-
const
|
|
24
|
+
/** envelope 与 warnings 的固定余量(字符)。 */
|
|
25
|
+
const ENVELOPE_RESERVE_CHARS = 400;
|
|
26
|
+
/** 单个附件至少能内联这么多字符才内联,否则整份落文件——把正文切一半没有意义。 */
|
|
27
|
+
const MIN_INLINE_CHARS_PER_ATTACHMENT = 800;
|
|
28
28
|
/** fill 的回执提示:只写「拿到这份结果后怎么抽、怎么存」。 */
|
|
29
29
|
function fillNextHint(sessionFile) {
|
|
30
30
|
return '按 fields 抽取,origin 用「附件ID#原文片段」,只填有值的字段。'
|
|
@@ -279,25 +279,25 @@ const fill = {
|
|
|
279
279
|
resultContract: RESULT_CONTRACT,
|
|
280
280
|
next: fillNextHint(sessionFile),
|
|
281
281
|
};
|
|
282
|
-
// 正文内联额度 = stdout
|
|
282
|
+
// 正文内联额度 = stdout 预算(字符)− 结构/规则/固定说明的实际字符。
|
|
283
283
|
// 简单表单额度富余,整份合同一次进上下文;只有真装不下才落文件让模型读一次。
|
|
284
|
-
const
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
const
|
|
288
|
-
const inlineAllowed =
|
|
284
|
+
const inlineBudgetChars = Math.floor(defaultResultThresholdChars() * INLINE_BUDGET_RATIO)
|
|
285
|
+
- JSON.stringify({ ...basePayload, attachments: [] }).length
|
|
286
|
+
- ENVELOPE_RESERVE_CHARS;
|
|
287
|
+
const perAttachmentChars = Math.floor(inlineBudgetChars / Math.max(1, downloaded.items.length));
|
|
288
|
+
const inlineAllowed = perAttachmentChars > MIN_INLINE_CHARS_PER_ATTACHMENT;
|
|
289
289
|
const extractedItems = await Promise.all(downloaded.items.map(async (item) => ({
|
|
290
290
|
item,
|
|
291
291
|
...(await extractText(item)),
|
|
292
292
|
})));
|
|
293
|
-
const
|
|
293
|
+
const totalTextChars = extractedItems.reduce((sum, entry) => sum + (entry.text ?? '').length, 0);
|
|
294
294
|
// 全部正文一次装得下就全内联;装不下才按附件均分额度,装不进的那份落文件。
|
|
295
|
-
const allInline =
|
|
295
|
+
const allInline = totalTextChars <= inlineBudgetChars;
|
|
296
296
|
const attachments = await Promise.all(extractedItems.map(async ({ item, text: extractedText, chars }) => {
|
|
297
297
|
const text = extractedText ?? '';
|
|
298
298
|
const oversized = allInline
|
|
299
299
|
? false
|
|
300
|
-
: !inlineAllowed ||
|
|
300
|
+
: !inlineAllowed || text.length > perAttachmentChars;
|
|
301
301
|
let textFile;
|
|
302
302
|
if (oversized && item.path) {
|
|
303
303
|
textFile = `${item.path}.txt`;
|
|
@@ -42,6 +42,8 @@ export const WORKFLOW_ENDPOINTS = {
|
|
|
42
42
|
/** 待办总数 / 列表 */
|
|
43
43
|
TODO_TOTAL: '/api/workflow/list/total/getTodoListTotal',
|
|
44
44
|
TODO_LIST: '/api/workflow/list/data/getTodoListData',
|
|
45
|
+
/** 列表行批量校验(2026-11-23 aiDeepRead 行过滤用:checkBatchOptRes[].canCheck) */
|
|
46
|
+
LIST_AUGMENT_BASE: '/api/workflow/list/augment/getListBaseAugment',
|
|
45
47
|
/** 待办分类树:流程大类/父类型下的工作流名称与归属类型。 */
|
|
46
48
|
TODO_TREE: '/api/workflow/list/tree/getTodoListTree',
|
|
47
49
|
/** 待办分组计数(按工作流/参与节点/参与身份三元组) */
|
|
@@ -122,8 +122,8 @@ async function executeAndPrint(ctx, operation, input) {
|
|
|
122
122
|
/**
|
|
123
123
|
* 目录里的 `fields` 只取 `inputSchema.properties` 的键名,供 agent 判断「这个字段存不存在」。
|
|
124
124
|
*
|
|
125
|
-
* ★ 2026-10-28:整份 manifest 实测 65,748 B,超过 stdout 预算(`
|
|
126
|
-
* =
|
|
125
|
+
* ★ 2026-10-28:整份 manifest 实测 65,748 B,超过 stdout 预算(`defaultResultThresholdChars()`
|
|
126
|
+
* = 28,000 字符)后,公共输出层按 `COMPACT_TIERS` 第一档把 `operations` 截到 10 条 —— 26 个 operation 里
|
|
127
127
|
* 排在后面的(`createRequest` 之后,含 `workflow.todoSmartConvert`)在 stdout 上完全不可见,
|
|
128
128
|
* 且没有任何「还有 16 条」的提示。此处改为默认编目形态(约 15 KB,26 条全可见),
|
|
129
129
|
* 完整 inputSchema 用 `--operation` 单取,整份完整 manifest 用 `--full`。
|