weaver-work-cli 0.1.50 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{attachment-content-EJYIOJPH.js → attachment-content-W3TSJC3Y.js} +3 -3
- package/dist/chunks/{chunk-BFKLQLBK.js → chunk-2J3XY4ED.js} +7 -7
- package/dist/chunks/{chunk-K67FODVC.js → chunk-6GCXWKG6.js} +1 -1
- package/dist/chunks/{chunk-WNJUGI2F.js → chunk-76PRVYH4.js} +1 -1
- package/dist/chunks/{chunk-RYFRGTUV.js → chunk-DEHJ7PMA.js} +4 -4
- package/dist/chunks/{chunk-3NCFFHB2.js → chunk-IF33CG4V.js} +1 -1
- package/dist/chunks/{chunk-YB3AJYPY.js → chunk-PE334WL3.js} +4 -4
- package/dist/chunks/{chunk-MCZG6HPM.js → chunk-QQXMHM3J.js} +2 -2
- package/dist/chunks/{chunk-7ECB22G3.js → chunk-U7ROML5E.js} +23 -23
- package/dist/chunks/{chunk-7AYQJSFY.js → chunk-WTLQGS6D.js} +2 -2
- package/dist/chunks/{chunk-6T53BSWZ.js → chunk-XPQN4E5O.js} +50 -19
- package/dist/chunks/{chunk-HARQF5IP.js → chunk-Z4G7LLDD.js} +25 -25
- package/dist/chunks/{conflict-C4UDHCWV.js → conflict-57WDJWL7.js} +2 -2
- package/dist/chunks/{contract-VUC6JOPG.js → contract-LJRAXVZU.js} +8587 -1421
- package/dist/chunks/{create-flow-6OG2LYBD.js → create-flow-3FMMZBCA.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-WP57TF2S.js → env-JYZE3BZB.js} +2 -2
- package/dist/chunks/{factory-VUXI7N5C.js → factory-66SCIKW3.js} +1 -1
- package/dist/chunks/{group-chat-UQRGXILK.js → group-chat-MNRYMLNG.js} +3 -3
- package/dist/chunks/{invoice-E7GOITEU.js → invoice-V7ZTITUO.js} +725 -205
- package/dist/chunks/{meeting-4BBLVAWM.js → meeting-IIY4UAJL.js} +10 -10
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-V4CHRQDI.js → registry-CJOVECZD.js} +1 -1
- package/dist/chunks/{registry-5CRCN2TV.js → registry-METZ2LWE.js} +10 -10
- package/dist/chunks/{room-recommend-AYR3UG7R.js → room-recommend-YFY7HTOF.js} +4 -4
- package/dist/chunks/{schedule-JZEFIXUS.js → schedule-6I63TERA.js} +4 -4
- package/dist/chunks/smart-extract-FOUYNIG3.js +2882 -0
- package/dist/chunks/{workflow-3ZAF2J5E.js → workflow-YHXFIU63.js} +1 -1
- package/dist/index.js +11 -6
- package/dist/shortcuts/contract/manifest.js +251 -0
- package/dist/shortcuts/contract/ooxml/docx-table.js +233 -0
- package/dist/shortcuts/contract/operations/card-action.js +1165 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +571 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/card.js +6 -5
- package/dist/shortcuts/contract/operations/docx-fillfromquote.js +532 -0
- package/dist/shortcuts/contract/operations/docx-verify.js +258 -0
- package/dist/shortcuts/contract/operations/elements-build.js +761 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +588 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/ledger.js +438 -0
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +104 -3
- package/dist/shortcuts/contract/operations/quote.js +131 -25
- package/dist/shortcuts/contract/operations/quotescreen.js +529 -0
- package/dist/shortcuts/contract/operations/registry.js +30 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/triage.js +1100 -0
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +200 -49
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +492 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +454 -0
- package/dist/shortcuts/workflow/operations/form.js +68 -33
- package/dist/shortcuts/workflow/operations/read.js +19 -1
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +3 -0
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +14 -1
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +16 -1
- package/skill-template/domains/qiyecheng.md +2 -0
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +223 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +47 -481
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +11 -11
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +32 -16
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +478 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +39 -61
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +18 -13
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -6
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -4
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +263 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +525 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +36 -0
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +80 -54
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +110 -14
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +19 -21
- package/skills/weaver-e10-jinchengda/references/orchestration.md +12 -12
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1 -6
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +2 -1
- package/skills/weaver-e10-qiyecheng/SKILL.md +37 -0
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +25 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +34 -27
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -42
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +180 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +106 -0
- package/skills/weaver-e10-workflow/references/workflow-create.md +6 -5
- package/skills/weaver-e10-workflow/references/workflow-edit.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +46 -33
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +12 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +91 -2
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +12 -12
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +136 -91
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +109 -23
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +0 -265
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +0 -588
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +0 -118
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
plan_actions.py — 合同动作推荐引擎(可执行实现,2026-11-09 新增)
|
|
5
|
-
|
|
6
|
-
背景:此前 `contract-action-engine.md` 只是算法文档,1~4 张卡片全靠模型每次手算,
|
|
7
|
-
实测出现「预审后只给 1 张报告卡、漏掉查看审查详情/发起流程/查资信」的偏差。
|
|
8
|
-
本脚本把注册表、requires、抑制、排序、截断固化为可执行逻辑,
|
|
9
|
-
模型只需提供上下文状态 JSON,不再自行推断卡片条数。
|
|
10
|
-
|
|
11
|
-
用法:
|
|
12
|
-
python scripts/plan_actions.py --context ctx.json
|
|
13
|
-
python scripts/plan_actions.py --context ctx.json --pretty
|
|
14
|
-
也可以传 JSON 字符串: python scripts/plan_actions.py --context-json '{"reviewed":true,...}'
|
|
15
|
-
|
|
16
|
-
上下文(全部可选,缺省为 false / null):
|
|
17
|
-
scene doc | query | config(默认 doc)
|
|
18
|
-
docType contract | quote | tender | other
|
|
19
|
-
hasFileId 已有审查用 fileId
|
|
20
|
-
flowKey 契约锁 | 新客户 | 常规二次销售 | 老客户增值 | null
|
|
21
|
-
hasCounterparty 有对方企业全称
|
|
22
|
-
summaryReady 摘要已生成
|
|
23
|
-
reviewStarted 预审已触发(已预热/审查在跑),但**尚未拿到审查结果**
|
|
24
|
-
reviewed 已拿到审查结果(只有它为真才允许导出审查报告)
|
|
25
|
-
submitted 流程已发起
|
|
26
|
-
requestId 流程实例 id
|
|
27
|
-
compared 已完成比对
|
|
28
|
-
comparePair 比对文件对
|
|
29
|
-
compareReportReady 比对报告已生成
|
|
30
|
-
generatedDocx 报价单已生成合同
|
|
31
|
-
otherVersionAvailable 会话内存在另一版本
|
|
32
|
-
lastAction 上一步刚执行的动作 id(本轮剔除)
|
|
33
|
-
|
|
34
|
-
输出:JSON(count / title / cards[]),退出码 0。FAIL 情形返回 1 并说明缺口。
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
import argparse
|
|
38
|
-
import io
|
|
39
|
-
import json
|
|
40
|
-
import sys
|
|
41
|
-
|
|
42
|
-
MAX_CARDS = 4
|
|
43
|
-
|
|
44
|
-
# ── 动作注册表 ───────────────────────────────────────────────
|
|
45
|
-
# requires : 全部为真才进候选
|
|
46
|
-
# blocked : 任一为真则退场(终态不回推 / 已完成不重复)
|
|
47
|
-
# walk : e10Sdk(系统页面已存在)/ artifact(内容已在手)/ sendQuestion(需现场加工)
|
|
48
|
-
ACTIONS = [
|
|
49
|
-
{
|
|
50
|
-
"id": "generate-contract",
|
|
51
|
-
"title": "按报价单生成合同",
|
|
52
|
-
"weight": 100,
|
|
53
|
-
"walk": "sendQuestion",
|
|
54
|
-
"desc": "用真实模板把标的与金额填成合同 docx | 缺 .docx 模板 | 3~5 步 · 确认 1 次",
|
|
55
|
-
"requires": {"docType": ["quote", "tender"]},
|
|
56
|
-
"blocked": ["generatedDocx"],
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"id": "launch-flow",
|
|
60
|
-
"title": "发起「{flowKey}」合同流程",
|
|
61
|
-
"weight": 100,
|
|
62
|
-
"walk": "e10Sdk",
|
|
63
|
-
"desc": "生成正式审批单并进入流转 | 证据齐 | 4~7 步 · 确认 2 次",
|
|
64
|
-
"requires": {"flowKey": "set", "hasFileId": True},
|
|
65
|
-
"blocked": ["submitted"],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"id": "review",
|
|
69
|
-
"title": "合同预审",
|
|
70
|
-
"weight": 92,
|
|
71
|
-
"walk": "sendQuestion",
|
|
72
|
-
"desc": "发消息让 AI 出风险条款与修改建议 | 只读,不改原文",
|
|
73
|
-
"requires": {"hasFileId": True},
|
|
74
|
-
# 已经触发过审查(reviewStarted)就不再给「合同预审」,避免重复触发
|
|
75
|
-
"blocked": ["reviewed", "reviewStarted"],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"id": "export-review",
|
|
79
|
-
"title": "导出审查报告",
|
|
80
|
-
"weight": 84,
|
|
81
|
-
"walk": "artifact",
|
|
82
|
-
"desc": "查看风险条款、问题说明与建议修改 | 只读 | 点开即看",
|
|
83
|
-
# 只有「已拿到审查结果」才允许导出;reviewStarted 但无结果时不得出现
|
|
84
|
-
"requires": {"reviewed": True},
|
|
85
|
-
"blocked": [],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"id": "view-compare",
|
|
89
|
-
"title": "查看比对详情",
|
|
90
|
-
"weight": 82,
|
|
91
|
-
"walk": "e10Sdk",
|
|
92
|
-
"desc": "左右对照看两版差异 | 只读,仅开页面",
|
|
93
|
-
"requires": {"compared": True},
|
|
94
|
-
"blocked": [],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"id": "view-review",
|
|
98
|
-
"title": "查看审查详情",
|
|
99
|
-
"weight": 80,
|
|
100
|
-
"walk": "e10Sdk",
|
|
101
|
-
"desc": "打开 AI 审查页看逐条判定与原文定位 | 只读,不改原文",
|
|
102
|
-
# 审查进行中(reviewStarted)与已出结果(reviewed)两种情况都要给:
|
|
103
|
-
# 前者是用户稍后回来看进度的唯一入口,后者可看逐条判定
|
|
104
|
-
"requires": {},
|
|
105
|
-
"any_of": [{"reviewed": True}, {"reviewStarted": True}],
|
|
106
|
-
"blocked": [],
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"id": "export-compare-report",
|
|
110
|
-
"title": "生成比对报告",
|
|
111
|
-
"weight": 78,
|
|
112
|
-
"walk": "artifact",
|
|
113
|
-
"desc": "出四指标统计与差异清单 | 只读 | 点开即看",
|
|
114
|
-
"requires": {"compared": True},
|
|
115
|
-
"blocked": [],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"id": "credit",
|
|
119
|
-
"title": "查对方资信",
|
|
120
|
-
"weight": 72,
|
|
121
|
-
"walk": "e10Sdk",
|
|
122
|
-
"desc": "看诉讼/被执行/工商变更 | 只开页面,只读",
|
|
123
|
-
"requires": {"hasCounterparty": True},
|
|
124
|
-
"blocked": [],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"id": "request-status",
|
|
128
|
-
"title": "查这份合同的审批进度",
|
|
129
|
-
"weight": 70,
|
|
130
|
-
"walk": "sendQuestion",
|
|
131
|
-
"desc": "看当前节点与审批意见 | 只读 | 1~2 步",
|
|
132
|
-
"requires": {"submitted": True, "requestId": "set"},
|
|
133
|
-
"blocked": [],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"id": "compare",
|
|
137
|
-
"title": "比对两份合同",
|
|
138
|
-
"weight": 60,
|
|
139
|
-
"walk": "e10Sdk",
|
|
140
|
-
"desc": "逐条比差异 | 需两份文件 | 2~3 步",
|
|
141
|
-
"requires": {"otherVersionAvailable": True},
|
|
142
|
-
"blocked": ["compared"],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"id": "clause-rewrite",
|
|
146
|
-
"title": "按建议改条款",
|
|
147
|
-
"weight": 56,
|
|
148
|
-
"walk": "sendQuestion",
|
|
149
|
-
"desc": "把建议条款写回合同 | 会改原文 | 需确认 2 次",
|
|
150
|
-
"requires": {"reviewed": True},
|
|
151
|
-
"blocked": [],
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"id": "summary",
|
|
155
|
-
"title": "查看合同摘要",
|
|
156
|
-
"weight": 28,
|
|
157
|
-
"walk": "artifact",
|
|
158
|
-
"desc": "要素、标的与关键条款 | 只读 | 点开即看",
|
|
159
|
-
"requires": {"summaryReady": True},
|
|
160
|
-
"blocked": [],
|
|
161
|
-
},
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
# scene ≠ doc 时的动作域(query / config 不处理合同文件)
|
|
165
|
-
QUERY_ACTIONS = [
|
|
166
|
-
{"id": "query-contracts", "title": "查我负责的合同", "weight": 100, "walk": "sendQuestion",
|
|
167
|
-
"desc": "按负责人查合同列表 | 只读", "requires": {}, "blocked": []},
|
|
168
|
-
{"id": "query-performance", "title": "查直销业绩", "weight": 90, "walk": "sendQuestion",
|
|
169
|
-
"desc": "按期间汇总直销业绩 | 只读", "requires": {}, "blocked": []},
|
|
170
|
-
{"id": "query-receipts", "title": "查合同收款", "weight": 80, "walk": "sendQuestion",
|
|
171
|
-
"desc": "按合同号查收款台账 | 只读", "requires": {}, "blocked": []},
|
|
172
|
-
{"id": "query-channel", "title": "查渠道订单", "weight": 70, "walk": "sendQuestion",
|
|
173
|
-
"desc": "按渠道查订单 | 只读", "requires": {}, "blocked": []},
|
|
174
|
-
]
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
def _ok(rule_value, ctx):
|
|
178
|
-
if rule_value is True:
|
|
179
|
-
return bool(ctx.get("hasFileId") if False else True)
|
|
180
|
-
return True
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
def _match_one(cond, ctx):
|
|
184
|
-
"""单个条件组:全部为真才通过。"""
|
|
185
|
-
for key, expect in cond.items():
|
|
186
|
-
actual = ctx.get(key)
|
|
187
|
-
if expect == "set":
|
|
188
|
-
if actual in (None, "", False):
|
|
189
|
-
return False
|
|
190
|
-
continue
|
|
191
|
-
if isinstance(expect, list):
|
|
192
|
-
if actual not in expect:
|
|
193
|
-
return False
|
|
194
|
-
continue
|
|
195
|
-
if bool(actual) != bool(expect):
|
|
196
|
-
return False
|
|
197
|
-
return True
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
def matches(action, ctx):
|
|
201
|
-
"""requires 判定:requires 全真 且 (无 any_of 或任一分支全真)。"""
|
|
202
|
-
if not _match_one(action.get("requires") or {}, ctx):
|
|
203
|
-
return False
|
|
204
|
-
any_of = action.get("any_of")
|
|
205
|
-
if any_of:
|
|
206
|
-
if not any(_match_one(c, ctx) for c in any_of):
|
|
207
|
-
return False
|
|
208
|
-
return True
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def suppressed(action, ctx):
|
|
212
|
-
"""抑制判定:终态不回推、已完成不重复、本轮刚执行的不立刻回推。"""
|
|
213
|
-
aid = action["id"]
|
|
214
|
-
for key in action.get("blocked", []):
|
|
215
|
-
if ctx.get(key):
|
|
216
|
-
return True
|
|
217
|
-
if ctx.get("lastAction") == aid:
|
|
218
|
-
return True
|
|
219
|
-
return False
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
def plan(ctx):
|
|
223
|
-
scene = ctx.get("scene") or "doc"
|
|
224
|
-
pool = QUERY_ACTIONS if scene in ("query", "config") else ACTIONS
|
|
225
|
-
|
|
226
|
-
scored = []
|
|
227
|
-
for a in pool:
|
|
228
|
-
if not matches(a, ctx):
|
|
229
|
-
continue
|
|
230
|
-
if suppressed(a, ctx):
|
|
231
|
-
continue
|
|
232
|
-
scored.append(a)
|
|
233
|
-
|
|
234
|
-
scored.sort(key=lambda x: (-x["weight"], x["id"]))
|
|
235
|
-
picked = scored[:MAX_CARDS]
|
|
236
|
-
|
|
237
|
-
cards = []
|
|
238
|
-
for a in picked:
|
|
239
|
-
title = a["title"].replace("{flowKey}", str(ctx.get("flowKey") or ""))
|
|
240
|
-
cards.append({
|
|
241
|
-
"id": a["id"],
|
|
242
|
-
"title": title,
|
|
243
|
-
"weight": a["weight"],
|
|
244
|
-
"walk": a["walk"],
|
|
245
|
-
"desc": a["desc"],
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
return {
|
|
249
|
-
"scene": scene,
|
|
250
|
-
"count": len(cards),
|
|
251
|
-
"title": "可做的 %d 件事" % len(cards),
|
|
252
|
-
"cards": cards,
|
|
253
|
-
"dropped": [a["id"] for a in scored[MAX_CARDS:]],
|
|
254
|
-
"hint": "" if cards else "按 contract-action-engine.md §7 空结果处理:不出卡片,说明缺什么与补法",
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
def main():
|
|
259
|
-
ap = argparse.ArgumentParser(description="合同动作推荐引擎")
|
|
260
|
-
ap.add_argument("--context", help="上下文状态 JSON 文件")
|
|
261
|
-
ap.add_argument("--context-json", help="上下文状态 JSON 字符串")
|
|
262
|
-
ap.add_argument("--pretty", action="store_true", help="缩进输出")
|
|
263
|
-
args = ap.parse_args()
|
|
264
|
-
|
|
265
|
-
if args.context:
|
|
266
|
-
with io.open(args.context, "r", encoding="utf-8-sig") as f:
|
|
267
|
-
ctx = json.load(f)
|
|
268
|
-
elif args.context_json:
|
|
269
|
-
ctx = json.loads(args.context_json)
|
|
270
|
-
else:
|
|
271
|
-
ap.error("必须提供 --context 或 --context-json")
|
|
272
|
-
|
|
273
|
-
result = plan(ctx)
|
|
274
|
-
print(json.dumps(result, ensure_ascii=False, indent=2 if args.pretty else None))
|
|
275
|
-
return 0
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if __name__ == "__main__":
|
|
279
|
-
sys.exit(main())
|