dsh-data-cleaning-agent 0.6.3 → 0.7.0

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.
@@ -7,6 +7,8 @@
7
7
  * - 历史、人员、招投标三域不属于当前版本字段目录。
8
8
  */
9
9
 
10
+ import { QCC_FIELD_CATALOG } from './qcc-field-catalog.js';
11
+
10
12
  export const WORKFLOW_SCHEMA_VERSION = 2;
11
13
 
12
14
  export const WORKFLOW_STAGES = Object.freeze([
@@ -49,84 +51,28 @@ export const MATCH_STATUSES = Object.freeze([
49
51
 
50
52
  export const MATCH_ANCHORS = Object.freeze(['company_name', 'credit_no', 'reg_no']);
51
53
 
52
- export const FIELD_CATALOG = Object.freeze([
53
- Object.freeze({
54
- id: 'identity',
55
- label: '基础工商信息',
56
- fields: Object.freeze([
57
- Object.freeze({ id: 'company_name', label: '企业名称', inputAnchor: true, defaultSelected: true }),
58
- Object.freeze({ id: 'credit_no', label: '统一社会信用代码', inputAnchor: true, defaultSelected: true }),
59
- Object.freeze({ id: 'reg_no', label: '注册号', inputAnchor: true }),
60
- Object.freeze({ id: 'org_no', label: '组织机构代码' }),
61
- Object.freeze({ id: 'reg_status', label: '登记状态', defaultSelected: true }),
62
- Object.freeze({ id: 'legal_rep', label: '法定代表人', defaultSelected: true }),
63
- Object.freeze({ id: 'reg_capital', label: '注册资本', defaultSelected: true }),
64
- Object.freeze({ id: 'paid_capital', label: '实缴资本' }),
65
- Object.freeze({ id: 'establish_date', label: '成立日期', defaultSelected: true }),
66
- Object.freeze({ id: 'company_type', label: '企业类型' }),
67
- Object.freeze({ id: 'registration_authority', label: '登记机关' }),
68
- Object.freeze({ id: 'former_name', label: '曾用名' }),
69
- Object.freeze({ id: 'english_name', label: '英文名' }),
70
- ]),
71
- }),
72
- Object.freeze({
73
- id: 'contact',
74
- label: '地址与联系方式',
75
- fields: Object.freeze([
76
- Object.freeze({ id: 'registered_address', label: '注册地址', defaultSelected: true }),
77
- Object.freeze({ id: 'province', label: '省份地区', matchAuxiliary: true }),
78
- Object.freeze({ id: 'city', label: '城市', matchAuxiliary: true }),
79
- Object.freeze({ id: 'district', label: '区县' }),
80
- Object.freeze({ id: 'phone', label: '电话', matchAuxiliary: true }),
81
- Object.freeze({ id: 'email', label: '邮箱' }),
82
- Object.freeze({ id: 'website', label: '官网' }),
83
- ]),
84
- }),
85
- Object.freeze({
86
- id: 'operation',
87
- label: '经营信息',
88
- fields: Object.freeze([
89
- Object.freeze({ id: 'business_scope', label: '经营范围' }),
90
- Object.freeze({ id: 'industry_category', label: '国标行业' }),
91
- Object.freeze({ id: 'industry_large', label: '一级行业' }),
92
- Object.freeze({ id: 'industry_middle', label: '二级行业' }),
93
- Object.freeze({ id: 'operating_period', label: '营业期限' }),
94
- Object.freeze({ id: 'company_size', label: '企业规模' }),
95
- Object.freeze({ id: 'company_profile', label: '企业简介' }),
96
- ]),
97
- }),
98
- Object.freeze({
99
- id: 'risk',
100
- label: '风险摘要',
101
- capability: 'qcc.risk',
102
- fields: Object.freeze([
103
- Object.freeze({ id: 'risk_summary', label: '风险摘要', capability: 'qcc.risk' }),
104
- Object.freeze({ id: 'operating_exception', label: '经营异常摘要', capability: 'qcc.risk' }),
105
- Object.freeze({ id: 'administrative_penalty', label: '行政处罚摘要', capability: 'qcc.risk' }),
106
- ]),
107
- }),
108
- Object.freeze({
109
- id: 'ipr',
110
- label: '知识产权摘要',
111
- capability: 'qcc.ipr',
112
- fields: Object.freeze([
113
- Object.freeze({ id: 'trademark_summary', label: '商标摘要', capability: 'qcc.ipr' }),
114
- Object.freeze({ id: 'patent_summary', label: '专利摘要', capability: 'qcc.ipr' }),
115
- Object.freeze({ id: 'software_copyright_summary', label: '软件著作权摘要', capability: 'qcc.ipr' }),
116
- ]),
117
- }),
118
- ]);
54
+ export const FIELD_CATALOG = QCC_FIELD_CATALOG;
119
55
 
120
56
  export const FIELD_LABELS = Object.freeze(Object.fromEntries(
121
57
  FIELD_CATALOG.flatMap((group) => group.fields.map((field) => [field.id, field.label])),
122
58
  ));
123
59
 
60
+ // 输入清洗字段可以参与字段映射与本地质量检查,但不是当前 QCC 可补全字段,
61
+ // 因此绝不能出现在 fieldSelection 或导出补全字段目录中。
62
+ export const INPUT_ONLY_MAPPING_FIELDS = Object.freeze([
63
+ Object.freeze({ id: 'phone', label: '联系电话' }),
64
+ ]);
65
+
124
66
  export function fieldLabel(fieldId) {
125
67
  const id = String(fieldId ?? '').trim();
126
68
  return FIELD_LABELS[id] ?? id;
127
69
  }
128
70
 
129
- const FIELD_IDS = new Set(FIELD_CATALOG.flatMap((group) => group.fields.map((field) => field.id)));
71
+ const ENRICHMENT_FIELD_IDS = new Set(FIELD_CATALOG.flatMap((group) => group.fields.map((field) => field.id)));
72
+ const MAPPING_FIELD_IDS = new Set([
73
+ ...ENRICHMENT_FIELD_IDS,
74
+ ...INPUT_ONLY_MAPPING_FIELDS.map((field) => field.id),
75
+ ]);
130
76
  const STAGE_IDS = new Set(WORKFLOW_STAGES.map((stage) => stage.id));
131
77
  const STATE_IDS = new Set(WORKFLOW_STATES);
132
78
 
@@ -170,7 +116,7 @@ export function normalizeMappings(value) {
170
116
  return value.slice(0, 128).map((mapping) => ({
171
117
  sourceField: text(mapping?.sourceField),
172
118
  targetField: text(mapping?.targetField),
173
- })).filter((mapping) => mapping.sourceField && FIELD_IDS.has(mapping.targetField));
119
+ })).filter((mapping) => mapping.sourceField && MAPPING_FIELD_IDS.has(mapping.targetField));
174
120
  }
175
121
 
176
122
  export function validateMappings(value) {
@@ -206,7 +152,7 @@ export function validateMappings(value) {
206
152
  }
207
153
 
208
154
  export function normalizeFieldSelection(value) {
209
- return uniqueStrings(value).filter((field) => FIELD_IDS.has(field));
155
+ return uniqueStrings(value, 256).filter((field) => ENRICHMENT_FIELD_IDS.has(field));
210
156
  }
211
157
 
212
158
  export function normalizeWorkflowDraft(value = {}) {
@@ -248,6 +194,7 @@ export function publicWorkflowContract() {
248
194
  matchStatuses: MATCH_STATUSES,
249
195
  matchAnchors: MATCH_ANCHORS,
250
196
  fieldCatalog: FIELD_CATALOG,
197
+ inputOnlyMappingFields: INPUT_ONLY_MAPPING_FIELDS,
251
198
  crossCuttingCapabilities: [
252
199
  { id: 'prompt', label: '任务设置' },
253
200
  { id: 'profile', label: '质量体检' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-data-cleaning-agent",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "description": "Clean, complete, and profile enterprise name lists in DeepSeek Harness — a data cleaning & completion agent plugin with local CSV/XLSX/JSON engine and optional Qichacha (QCC) MCP enrichment. Maintained by Qichacha/QCC.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -35,6 +35,7 @@
35
35
  "docs/RELEASE-0.6.1.md",
36
36
  "docs/RELEASE-0.6.2.md",
37
37
  "docs/RELEASE-0.6.3.md",
38
+ "docs/RELEASE-0.7.0.md",
38
39
  "docs/UI-WORKFLOW-V2.md",
39
40
  "docs/UI-WORKFLOW-V2-MIGRATION.md",
40
41
  "docs/UI-WORKFLOW-V2-ACCEPTANCE.md",
@@ -43,7 +44,7 @@
43
44
  ],
44
45
  "scripts": {
45
46
  "test": "node --test",
46
- "lint": "node --check lib/index.js && node --check lib/engine.js && node --check lib/artifacts.js && node --check lib/tools.js && node --check lib/skill.js && node --check lib/qcc-phase2.js && node --check lib/qcc-phase3.js && node --check lib/qcc-phase3-batch.js && node --check lib/qcc-phase2-acceptance.js && node --check lib/skill-enrich.js && node --check lib/jobs.js && node --check lib/workflow-contract.js && node --check lib/workflow.js && node --check lib/qcc-safety.js && node --check lib/qcc.js && node --check lib/qcc-command.js && node --check lib/qcc-runs.js && node --check lib/web.js && node --check lib/client.js && node --check scripts/check-readme-version.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/g5-e2e.mjs && node --check scripts/phase3-e2e.mjs && node --check scripts/phase2-acceptance.mjs",
47
+ "lint": "node --check lib/index.js && node --check lib/engine.js && node --check lib/artifacts.js && node --check lib/tools.js && node --check lib/skill.js && node --check lib/qcc-field-catalog.js && node --check lib/qcc-phase2.js && node --check lib/qcc-phase3.js && node --check lib/qcc-phase3-batch.js && node --check lib/qcc-phase2-acceptance.js && node --check lib/skill-enrich.js && node --check lib/jobs.js && node --check lib/workflow-contract.js && node --check lib/workflow.js && node --check lib/qcc-safety.js && node --check lib/qcc.js && node --check lib/qcc-command.js && node --check lib/qcc-runs.js && node --check lib/web.js && node --check lib/client.js && node --check scripts/check-readme-version.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/g5-e2e.mjs && node --check scripts/phase3-e2e.mjs && node --check scripts/phase2-acceptance.mjs",
47
48
  "docs:check": "node scripts/check-readme-version.mjs",
48
49
  "marketing:check": "node scripts/check-marketing.mjs",
49
50
  "verify-pack": "node scripts/verify-pack.mjs",