weaver-work-cli 0.1.48 → 0.1.49
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/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
- package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-MU2LPI5P.js} +3 -3
- package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-3NV2ETZR.js} +6 -6
- package/dist/chunks/{chunk-PSPOFLSU.js → chunk-3X7VOSBA.js} +1 -1
- package/dist/chunks/chunk-5QYE52LG.js +223 -0
- package/dist/chunks/{chunk-FEP6ELMR.js → chunk-6GWU63YF.js} +1 -1
- package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
- package/dist/chunks/{chunk-EFOUMXIX.js → chunk-BRRW7CWA.js} +25 -25
- package/dist/chunks/{chunk-5B5JXTY2.js → chunk-D2QRZUW4.js} +209 -25
- package/dist/chunks/{chunk-OCYRVZGN.js → chunk-EJVA5ZVB.js} +2 -2
- package/dist/chunks/{chunk-BCACE6VV.js → chunk-GEOMANP7.js} +3 -3
- package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
- package/dist/chunks/chunk-JEQHNNSS.js +158 -0
- package/dist/chunks/{chunk-NK74RE5F.js → chunk-K3BT54CU.js} +3 -3
- package/dist/chunks/{chunk-R2HHLJNN.js → chunk-KV5SOWMS.js} +4 -4
- package/dist/chunks/{chunk-SVFG6EMV.js → chunk-ZKEUGS2U.js} +5 -5
- package/dist/chunks/{conflict-APGSD5E7.js → conflict-6347A7YK.js} +2 -2
- package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-7WG7LVX5.js} +6 -6
- package/dist/chunks/data-QO7QWOIV.js +2525 -0
- package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
- package/dist/chunks/{env-B6GKA2J3.js → env-LHRKSLG6.js} +2 -2
- package/dist/chunks/{factory-MFCKLUT6.js → factory-2H7Z4RWJ.js} +1 -1
- package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-EW6PNDDT.js} +3 -3
- package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
- package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-N2FQBHXI.js} +10 -10
- package/dist/chunks/org-NFE7X7FK.js +12 -0
- package/dist/chunks/{reception-VL6TKVAW.js → reception-MYOKJULO.js} +429 -94
- package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
- package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
- package/dist/chunks/{registry-22O6UG4I.js → registry-CKUVBS53.js} +10 -10
- package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-MBCYENQ2.js} +4 -4
- package/dist/chunks/{schedule-SPPAHER2.js → schedule-5IFMCXME.js} +4 -4
- package/dist/index.js +12 -7
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
- package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
- package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
- package/dist/shortcuts/data/errors.js +64 -0
- package/dist/shortcuts/data/host.js +140 -0
- package/dist/shortcuts/data/index.js +429 -0
- package/dist/shortcuts/data/manifest.js +133 -0
- package/dist/shortcuts/data/operations/attend.js +62 -0
- package/dist/shortcuts/data/operations/conf.js +384 -0
- package/dist/shortcuts/data/operations/ds.js +686 -0
- package/dist/shortcuts/data/operations/field.js +68 -0
- package/dist/shortcuts/data/operations/index.js +65 -0
- package/dist/shortcuts/data/operations/module.js +383 -0
- package/dist/shortcuts/data/operations/noun.js +102 -0
- package/dist/shortcuts/data/operations/query.js +85 -0
- package/dist/shortcuts/data/operations/scene.js +235 -0
- package/dist/shortcuts/data/operations/shared.js +279 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/reception/constants.js +11 -0
- package/dist/shortcuts/reception/index.js +3 -1
- package/dist/shortcuts/reception/manifest.js +3 -2
- package/dist/shortcuts/reception/operations/ask.js +20 -2
- package/dist/shortcuts/reception/operations/compose.js +11 -0
- package/dist/shortcuts/reception/operations/doc.js +59 -0
- package/dist/shortcuts/reception/operations/docrender.js +25 -1
- package/dist/shortcuts/reception/operations/leads.js +1 -1
- package/dist/shortcuts/reception/operations/panels.js +84 -21
- package/dist/shortcuts/reception/operations/render.js +40 -0
- package/dist/shortcuts/reception/operations/restaurant.js +17 -4
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
- package/dist/shortcuts/recruit-stage/shared.js +57 -0
- package/docs/SKILL.md +1 -0
- package/docs/_catalog.md +3 -0
- package/docs/data.md +149 -0
- package/docs/reception.md +59 -5
- package/package.json +1 -1
- package/scripts/check-skill-sync.mjs +188 -0
- package/scripts/package-skill.mjs +17 -3
- package/skill-template/business-info.json +23 -0
- package/skill-template/domains/data.md +15 -0
- package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
- package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
- package/skills/weaver-e10-data/SKILL.md +118 -0
- package/skills/weaver-e10-data/references/config-center.md +90 -0
- package/skills/weaver-e10-data/references/datasource.md +136 -0
- package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
- package/skills/weaver-e10-meeting/SKILL.md +39 -7
- package/skills/weaver-e10-reception-flow/SKILL.md +30 -16
- package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
- package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
- package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
- package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-2TRU2ZSP.js} +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CUSTOMER_NEED_OPTIONS, LOGISTICS_FIELDS, LOGISTICS_HINT, LOGISTICS_LABEL, LOGISTICS_PLACEHOLDER, LOGISTICS_TITLE, } from '../constants.js';
|
|
1
|
+
import { CUSTOMER_NEED_OPTIONS, LOGISTICS_FIELDS, LOGISTICS_HINT, LOGISTICS_LABEL, LOGISTICS_PLACEHOLDER, LOGISTICS_TITLE, MEETING_OPTIONS, MEETING_TITLE, } from '../constants.js';
|
|
2
2
|
/**
|
|
3
3
|
* 后勤与人数自由文本 → 6 个子项。
|
|
4
4
|
*
|
|
@@ -32,8 +32,18 @@ export function parseLogistics(text) {
|
|
|
32
32
|
.map((item) => item.trim())
|
|
33
33
|
.filter(Boolean);
|
|
34
34
|
for (const part of segs) {
|
|
35
|
+
// 会议否定必须先于房间识别:「不用订会议室」「不安排会议」里既没有房间号,
|
|
36
|
+
// 也不能让后面的 named 兜底把它吞成一个叫「不用订会议室」的脏房间。
|
|
37
|
+
// 中间动词(订/定/预)要容忍,否则 SKILL 自己举的例子都认不出来。
|
|
38
|
+
const noMeeting = /(不需要|不用|无需|不安排|不订|不要|取消|没有)\s*(订|定|预)?\s*(会议|会议室|开会|座谈|汇报)/.test(part);
|
|
39
|
+
if (noMeeting) {
|
|
40
|
+
if (!out.meeting)
|
|
41
|
+
out.meeting = '否';
|
|
42
|
+
if (!out.meetingRoom)
|
|
43
|
+
out.meetingRoom = '不需会议室';
|
|
44
|
+
}
|
|
35
45
|
// 一个片段可能同时含多个子项(如「10人 总部130会议室」),因此逐项独立判断,不 continue
|
|
36
|
-
if (!out.meetingRoom) {
|
|
46
|
+
if (!out.meetingRoom && !noMeeting) {
|
|
37
47
|
// 兼容「总部131」「131会议室」「总部131会议室」三种写法;
|
|
38
48
|
// 数字前后不能紧邻数字,否则会从手机号里捞出 131。
|
|
39
49
|
const room = part.match(/(?:总部\s*)?(?<!\d)(129|130|131)(?!\d)\s*会议室/)
|
|
@@ -90,6 +100,15 @@ export function parseLogistics(text) {
|
|
|
90
100
|
out.gift = part;
|
|
91
101
|
}
|
|
92
102
|
}
|
|
103
|
+
if (!out.meeting && !noMeeting) {
|
|
104
|
+
// placeholder 里一直写着「是否会议」,但此前没有任何分支解析它:
|
|
105
|
+
// 用户手写「要开会」「不用订会议室」等于白写,会议字段只能靠 known 里猜。
|
|
106
|
+
// 否定已在片段开头处理(noMeeting),这里只判「要开会」这一侧。
|
|
107
|
+
if (/(要|需要|安排|预定|预订|订|开|有)\s*(会议|开会|座谈|汇报)|会议|开会|座谈/.test(part)) {
|
|
108
|
+
// 点名了房间(总部130会议室)也落到这里:已经给房间就是要开会
|
|
109
|
+
out.meeting = '是';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
93
112
|
}
|
|
94
113
|
return out;
|
|
95
114
|
}
|
|
@@ -109,12 +128,36 @@ export function setCompanionMobile(data, mobile) {
|
|
|
109
128
|
data.mobile = value;
|
|
110
129
|
}
|
|
111
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* 客户需求来源归一:`customerNeed`(SKILL 口径)→ `demand`(内部字段)。
|
|
133
|
+
*
|
|
134
|
+
* 两个字段并存过一段时间:面板与缺口判定只认 `demand`,而 SKILL 让模型写 `customerNeed`,
|
|
135
|
+
* 于是「原话已经说清需求」仍然被追问一屏。统一在入口处收敛,下游只认一个字段。
|
|
136
|
+
*/
|
|
137
|
+
export function normalizeDemand(data) {
|
|
138
|
+
const need = String(data.customerNeed ?? '').trim();
|
|
139
|
+
if (need)
|
|
140
|
+
data.demand = need;
|
|
141
|
+
delete data.customerNeed;
|
|
142
|
+
}
|
|
112
143
|
/** 合并 run 上下文与 ask_user 的 answers。 */
|
|
113
144
|
export function mergeAnswers(run, answers = {}) {
|
|
114
145
|
const data = { ...(run.data || {}) };
|
|
146
|
+
// run 重建(doc --known)走不到 ask,这里补一次归一,md 才不会丢掉客户需求
|
|
147
|
+
normalizeDemand(data);
|
|
115
148
|
if (answers && typeof answers === 'object') {
|
|
116
|
-
if (answers.fields && typeof answers.fields === 'object')
|
|
117
|
-
|
|
149
|
+
if (answers.fields && typeof answers.fields === 'object') {
|
|
150
|
+
// 小餐厅是 CLI 归一后的产物(booked / roomState / roomNo / 时间),
|
|
151
|
+
// answers.fields 里那份通常还是原始入参(没有 booked)。整体 assign 会把归一结果冲掉:
|
|
152
|
+
// 下游 compose 判定「没订餐」整段跳过,render 的缺包厢号硬校验也因为 booked 丢失而失效,
|
|
153
|
+
// 表现就是「文档写了包厢、页面上一行没有、还没有告警」。
|
|
154
|
+
// 因此只逐字段并入,派生字段(booked 等)保留。
|
|
155
|
+
const { restaurant: rawRestaurant, ...rest } = answers.fields;
|
|
156
|
+
Object.assign(data, rest);
|
|
157
|
+
if (rawRestaurant && typeof rawRestaurant === 'object' && !Array.isArray(rawRestaurant)) {
|
|
158
|
+
data.restaurant = { ...(data.restaurant || {}), ...rawRestaurant };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
118
161
|
if (answers.customer_need)
|
|
119
162
|
data.demand = String(answers.customer_need);
|
|
120
163
|
if (answers.logistics) {
|
|
@@ -141,11 +184,18 @@ export function mergeAnswers(run, answers = {}) {
|
|
|
141
184
|
*
|
|
142
185
|
* 硬约束(宿主实测):title 严格单行、超长截断成「…」;placeholder 正常渲染;hint 不渲染。
|
|
143
186
|
* 因此标题只留一句短话,完整清单放 placeholder,口径放 hint。
|
|
144
|
-
*
|
|
187
|
+
*
|
|
188
|
+
* 三屏,顺序固定:客户需求 → 接待细节 → 是否会议。
|
|
189
|
+
* - 客户需求:原话点到具体产品/场景/主题就不出;
|
|
190
|
+
* - 接待细节:**常驻**,已识别项作预填说明,不因信息齐全省略这一屏;
|
|
191
|
+
* - 是否会议:必问项,只有原话明确提及会议室才跳过。
|
|
145
192
|
*/
|
|
146
193
|
export function buildPanels(data) {
|
|
147
194
|
const panels = [];
|
|
148
|
-
|
|
195
|
+
// 双判:正常路径已由 normalizeDemand 收敛过,这里兜住直接调 buildPanels 的调用方,
|
|
196
|
+
// 免得只传 customerNeed 时又弹一屏「客户需求」。
|
|
197
|
+
const hasDemand = Boolean(String(data.demand || data.customerNeed || '').trim());
|
|
198
|
+
if (!hasDemand) {
|
|
149
199
|
panels.push({
|
|
150
200
|
id: 'customer_need',
|
|
151
201
|
// 同样受「标题单行」约束:不写 ①②③ 追问清单,只留一句
|
|
@@ -156,23 +206,36 @@ export function buildPanels(data) {
|
|
|
156
206
|
options: CUSTOMER_NEED_OPTIONS.map((item) => ({ label: item, value: item })),
|
|
157
207
|
});
|
|
158
208
|
}
|
|
159
|
-
|
|
209
|
+
// 接待细节常驻:原话已经写全了也照出,已识别项进 prefilled,由模型在问之前先说一遍。
|
|
210
|
+
// 省略这一屏的代价是「默认值静默生效」——用户不知道系统替他定了什么。
|
|
160
211
|
const mobile = ((data.companions || []).find((item) => item && item.mobile) || {}).mobile || '';
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
212
|
+
const known = LOGISTICS_FIELDS
|
|
213
|
+
.filter((key) => data[key])
|
|
214
|
+
.map((key) => `${LOGISTICS_LABEL[key]}:${data[key]}`);
|
|
215
|
+
if (mobile)
|
|
216
|
+
known.push(`${LOGISTICS_LABEL.mobile}:${mobile}`);
|
|
217
|
+
panels.push({
|
|
218
|
+
id: 'logistics',
|
|
219
|
+
// 标题严格单行:不拼字段清单、不拼已识别项、不讲规则——拼了必被截断成「…」
|
|
220
|
+
title: LOGISTICS_TITLE,
|
|
221
|
+
inputType: 'text',
|
|
222
|
+
required: false,
|
|
223
|
+
allowCustomInput: true,
|
|
224
|
+
hint: known.length ? `已识别:${known.join(';')}\n补没写的就行。\n${LOGISTICS_HINT}` : LOGISTICS_HINT,
|
|
225
|
+
placeholder: LOGISTICS_PLACEHOLDER,
|
|
226
|
+
prefilled: known,
|
|
227
|
+
});
|
|
228
|
+
// 第 3 问:是否会议。只有已知值(面板回传过,或原话明确表态)才跳过。
|
|
229
|
+
// 不在这里做任何推断:写着「晚上订小餐厅」也只算用餐场地,不算表态。
|
|
230
|
+
const meetingAnswered = data.meeting === '是' || data.meeting === '否';
|
|
231
|
+
if (!meetingAnswered) {
|
|
167
232
|
panels.push({
|
|
168
|
-
id: '
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
hint: known.length ? `已识别:${known.join(';')}\n补没写的就行。\n${LOGISTICS_HINT}` : LOGISTICS_HINT,
|
|
175
|
-
placeholder: LOGISTICS_PLACEHOLDER,
|
|
233
|
+
id: 'meeting',
|
|
234
|
+
title: MEETING_TITLE,
|
|
235
|
+
inputType: 'single',
|
|
236
|
+
required: true,
|
|
237
|
+
allowCustomInput: false,
|
|
238
|
+
options: MEETING_OPTIONS.map((item) => ({ label: item.label, value: item.value })),
|
|
176
239
|
});
|
|
177
240
|
}
|
|
178
241
|
return panels;
|
|
@@ -42,6 +42,17 @@ export async function render(input, ctx) {
|
|
|
42
42
|
// 以前只在「房间为空」时才定房,房间是脏值(如「总部130会议室」)就整组丢字段,
|
|
43
43
|
// 表现就是「有时完全不填会议信息」;反过来「已推荐房间却仍写三选一」也是同一处漏的。
|
|
44
44
|
applyMeetingPolicy(data);
|
|
45
|
+
// 会议是必问项:没表态就不出填单页。
|
|
46
|
+
// 这一条不依赖模型自觉——绕过面板直接调 doc-render 也会被拦,
|
|
47
|
+
// 否则会议室与 6 个会议字段会静默全空,只剩一行待办,提交时没人会注意。
|
|
48
|
+
// 「提了小餐厅」不构成表态:小餐厅是晚餐场地,与会议室预定是两条独立线索。
|
|
49
|
+
if (!normalizeMeeting(data.meeting)) {
|
|
50
|
+
throw receptionBusinessError('MEETING_UNCONFIRMED', '是否需要会议未确认,请先补问再出填单页', {
|
|
51
|
+
headcount: data.headcount || '',
|
|
52
|
+
hint: '先向用户确认「是否需要会议室座谈」,拿到答案后放进 answers.fields.meeting("是"/"否")重跑本条;'
|
|
53
|
+
+ '提了小餐厅不代表要开会,不得据此推断',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
if (normalizeMeeting(data.meeting) === '是') {
|
|
46
57
|
if (!Number(data.headcount)) {
|
|
47
58
|
data.todos = [...(Array.isArray(data.todos) ? data.todos : []), '人数未填,会议室按默认预留'];
|
|
@@ -63,6 +74,34 @@ export async function render(input, ctx) {
|
|
|
63
74
|
if (!data.empId)
|
|
64
75
|
composedWarnings.push('主联络人未取到登录人,请在页面上手动选择');
|
|
65
76
|
}
|
|
77
|
+
// 默认值回显:凡用户没给、由 CLI 兜底填的,都要在回包里点名。
|
|
78
|
+
// 默认值静默生效比缺字段更危险——用户会以为那是他自己确认过的。
|
|
79
|
+
const defaultsApplied = [];
|
|
80
|
+
const headcountKnown = Number(data.headcount) > 0;
|
|
81
|
+
if (normalizeMeeting(data.meeting) === '是' && !headcountKnown) {
|
|
82
|
+
defaultsApplied.push({
|
|
83
|
+
field: 'meetingRoom',
|
|
84
|
+
value: String(data.meetingRoom || ''),
|
|
85
|
+
reason: String((data.meetingRoomMeta && data.meetingRoomMeta.reason) || '人数未填,会议室按默认预留'),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (data.restaurant && data.restaurant.booked) {
|
|
89
|
+
if (!headcountKnown) {
|
|
90
|
+
defaultsApplied.push({
|
|
91
|
+
field: 'customerCount',
|
|
92
|
+
value: String(data.restaurant.headcount || ''),
|
|
93
|
+
reason: '人数未填,小餐厅按 10 人预留',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// 用户点名包厢(reason=按指定包厢)不算默认值,其余都是 CLI 按容量挑的
|
|
97
|
+
if (data.restaurant.roomNo && !/按指定包厢/.test(String(data.restaurant.roomReason || ''))) {
|
|
98
|
+
defaultsApplied.push({
|
|
99
|
+
field: 'restaurantRoom',
|
|
100
|
+
value: String(data.restaurant.roomNo),
|
|
101
|
+
reason: String(data.restaurant.roomReason || '按容量匹配'),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
66
105
|
const composed = composeInitialValues({
|
|
67
106
|
snapshot: resolved.snapshot,
|
|
68
107
|
data,
|
|
@@ -139,6 +178,7 @@ export async function render(input, ctx) {
|
|
|
139
178
|
attachmentPending: composed.attachmentPending,
|
|
140
179
|
sdkRenderType: resolveRenderType(input.sdkRender),
|
|
141
180
|
todos: composed.todos,
|
|
181
|
+
defaultsApplied,
|
|
142
182
|
browsertool,
|
|
143
183
|
browsertoolFile,
|
|
144
184
|
browsertoolRef: browsertoolFile ? `<browsertool-file path="${browsertoolFile}" />` : '',
|
|
@@ -181,7 +181,18 @@ function rawCandidateCount(input) {
|
|
|
181
181
|
*/
|
|
182
182
|
export function normalizeRestaurant(options = {}) {
|
|
183
183
|
const data = options.data || {};
|
|
184
|
-
|
|
184
|
+
// answers 里可能直接把餐厅信息写成 data.restaurant(原始对象,没有 booked)。
|
|
185
|
+
// 这份必须当作 explicit 参与取值:否则用户指定的包厢、人数、用餐时间全被忽略,
|
|
186
|
+
// 只剩「按候选挑一间 + 默认 10 人」,表面成功、实际不是他点的那间。
|
|
187
|
+
// 已经带 booked 的是上一轮 CLI 产物,走 prev 沿用逻辑,不能再当入参读。
|
|
188
|
+
const rawRestaurant = (data.restaurant && typeof data.restaurant === 'object'
|
|
189
|
+
&& !Array.isArray(data.restaurant) && data.restaurant.booked !== true)
|
|
190
|
+
? data.restaurant
|
|
191
|
+
: {};
|
|
192
|
+
const explicit = {
|
|
193
|
+
...rawRestaurant,
|
|
194
|
+
...((options.explicit && typeof options.explicit === 'object') ? options.explicit : {}),
|
|
195
|
+
};
|
|
185
196
|
const rooms = options.rooms ?? null;
|
|
186
197
|
const hay = [data.restaurantRaw, data.logisticsRaw, data.meal, explicit.raw, explicit.note]
|
|
187
198
|
.filter(Boolean).join(' ');
|
|
@@ -192,10 +203,12 @@ export function normalizeRestaurant(options = {}) {
|
|
|
192
203
|
|| TRIGGER.test(hay);
|
|
193
204
|
if (!mentioned)
|
|
194
205
|
return null;
|
|
195
|
-
// 人数:用户明确给 > 来访人数(区间取上界)>
|
|
196
|
-
|
|
206
|
+
// 人数:用户明确给 > 来访人数(区间取上界)> 10。
|
|
207
|
+
// 不拿「客户 + 陪同」凑数:客户人数没给时那样只会得到 1~2 人,
|
|
208
|
+
// 订出来的包厢装不下整桌人(实测出现过「1 人订 8 人包厢」)。
|
|
209
|
+
// 缺省 10 是业务确认过的口径,宁可多留也不能少留。
|
|
197
210
|
const visit = Number(data.headcountMax || data.headcount || 0) || 0;
|
|
198
|
-
const headcount = Number(explicit.headcount || data.restaurantHeadcount || visit ||
|
|
211
|
+
const headcount = Number(explicit.headcount || data.restaurantHeadcount || visit || 10) || 10;
|
|
199
212
|
const baseDate = pickStr(explicit.startDate || data.visitDate || '');
|
|
200
213
|
// 时段:说了具体时间就用它;否则按「中午/晚上」落档,都没提按晚上
|
|
201
214
|
const noon = /中午|午餐|午宴|午饭/.test(hay);
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { randomUUID } from 'node:crypto';
|
|
23
23
|
import { rsSuccess, schemaOf } from './types.js';
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
|
-
import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, getDsOptionsFull, findMenuNode, resolveCurrentUser, buildCardUrl,
|
|
25
|
+
import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, getDsOptionsFull, findMenuNode, resolveCurrentUser, buildCardUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, talentUiCardUrl, resolveInterviewListUrlOrNative, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
26
|
// 面试计划表单字段 dataKey(缓存 fields 里取)。
|
|
27
27
|
// 注意:digital_id 不放入此列表——它只在「面试方式含 AI」时才是必填,
|
|
28
28
|
// 放进来会让未部署数字人的环境连非 AI 面试都建不了(单独按需校验)。
|
|
@@ -512,8 +512,14 @@ async function resolveRequiredHint(plan, ctx) {
|
|
|
512
512
|
dataDetails: plan.dataDetails,
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
-
// 人才卡片详情 URL
|
|
516
|
-
|
|
515
|
+
// 人才卡片详情 URL:装了人才库 ecode 页面就用新卡片页,否则回退 EB 详情页
|
|
516
|
+
// {baseUrl}/sp/ebdpage/view/{ebdDetailPageId}?talentId={id}(2026-11-10 用户要求改指向新页面)
|
|
517
|
+
async function resolveTalentCardUrl(ctx, talentId) {
|
|
518
|
+
if (talentId) {
|
|
519
|
+
const ui = await talentUiCardUrl(ctx.host, ctx.cache, ctx.baseUrl, String(talentId));
|
|
520
|
+
if (ui)
|
|
521
|
+
return ui;
|
|
522
|
+
}
|
|
517
523
|
const pid = ctx.cache.ebdDetailPageId;
|
|
518
524
|
if (!pid || !talentId) {
|
|
519
525
|
// 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
|
|
@@ -758,7 +764,8 @@ async function applyCore(args, env, payload) {
|
|
|
758
764
|
const verifyWarnings = verification.mismatches.map((m) => '落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual + '(该字段可能未写入)');
|
|
759
765
|
const detailUrl = buildCardUrl(ctx.baseUrl, plan.objId, formDataId);
|
|
760
766
|
// 列表链接只打开列表;详情单页由 viewLink 单独给出,不再用「列表+滑出详情」组合地址。
|
|
761
|
-
|
|
767
|
+
// 2026-11-10 用户定稿:装了人才库 ecode 页面就指向新的「面试进展」页,否则回退原生面试台账列表。
|
|
768
|
+
const listLocateUrl = await resolveInterviewListUrlOrNative(ctx.host, ctx.cache, ctx.baseUrl, (ctx.cache.lists?.interview?.listId) || '');
|
|
762
769
|
return rsSuccess('recruit-stage.interview.arrange.apply', {
|
|
763
770
|
mode: 'apply', result: verification.mismatches.length ? 'partial' : 'success', interviewFormId: formDataId,
|
|
764
771
|
interviewCardUrl: detailUrl,
|
|
@@ -799,7 +806,7 @@ async function prefill(args, env) {
|
|
|
799
806
|
}
|
|
800
807
|
throw rsFail('面试方式「' + typeKey + '」不在枚举中(' + Object.keys(typeFull.map).join('/') + ')');
|
|
801
808
|
}
|
|
802
|
-
const cardUrl = resolveTalentCardUrl(ctx, talentId);
|
|
809
|
+
const cardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
803
810
|
const listUrl = await resolveInterviewListUrl(ctx).catch(() => null);
|
|
804
811
|
const jsExpr = `(() => { const W = window.WeFormSDK; const i = W && W.getWeFormInstance('ebuilderform', '${formId}');`
|
|
805
812
|
+ ` if (!i) return 'no-form-instance(请先在人才卡片点「安排面试」打开面试安排表单)';`
|
|
@@ -22,7 +22,7 @@ import path from 'node:path';
|
|
|
22
22
|
import schoolTiers from '../school-tiers.json';
|
|
23
23
|
import { rsSuccess, schemaOf } from './types.js';
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
|
-
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
25
|
+
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
26
|
import { scanResumeSource, findStructuredJson } from '../fs-scan.js';
|
|
27
27
|
import { saveBatchItems, loadBatchItems } from '../batch-store.js';
|
|
28
28
|
// 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
|
|
@@ -338,8 +338,13 @@ function makeBriefReader(ctx, formId, objId, fields) {
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
// 人才卡片 URL
|
|
342
|
-
function resolveTalentCardUrl(ctx, talentId) {
|
|
341
|
+
// 人才卡片 URL(装了人才库 ecode 页面就指向新卡片页;否则环境缓存 ebdDetailPageId,自用追加 recruitType=useSelf)
|
|
342
|
+
async function resolveTalentCardUrl(ctx, talentId) {
|
|
343
|
+
if (talentId) {
|
|
344
|
+
const ui = await talentUiCardUrl(ctx.host, ctx.cache, ctx.baseUrl, String(talentId));
|
|
345
|
+
if (ui)
|
|
346
|
+
return ui;
|
|
347
|
+
}
|
|
343
348
|
const pid = ctx.cache.ebdDetailPageId;
|
|
344
349
|
if (!pid || !talentId) {
|
|
345
350
|
// 缓存缺 ebdDetailPageId(首次运行/换环境)时禁止返回 null:退化为 EB 卡片单页,
|
|
@@ -350,12 +355,15 @@ function resolveTalentCardUrl(ctx, talentId) {
|
|
|
350
355
|
}
|
|
351
356
|
return `${ctx.baseUrl}/sp/ebdpage/view/${pid}?talentId=${talentId}${talentLinkExtra(ctx.cache)}`;
|
|
352
357
|
}
|
|
353
|
-
//
|
|
358
|
+
// 人才库列表(只打开列表):装了人才库 ecode 页面就指向新页面,否则 {baseUrl}/sp/ebdfpage/list/{listId}
|
|
354
359
|
// 2026-11-06 用户定稿:列表链接不携带 /card/... 段,也不拼 talentId 等 query,
|
|
355
360
|
// 避免打开列表时一同滑出人才详情单页;人才卡片由 talentCardUrl 单独给出。
|
|
356
361
|
// listId 取环境缓存 lists.talent.listId(运行时解析,跨环境不写死)。
|
|
357
|
-
function resolveTalentListLocateUrl(ctx, _talentId) {
|
|
362
|
+
async function resolveTalentListLocateUrl(ctx, _talentId) {
|
|
358
363
|
const listId = ctx.cache.lists?.talent?.listId;
|
|
364
|
+
const preferred = await resolveTalentListUrl(ctx.host, ctx.cache, ctx.baseUrl, listId || '');
|
|
365
|
+
if (preferred)
|
|
366
|
+
return preferred;
|
|
359
367
|
if (!listId)
|
|
360
368
|
return null;
|
|
361
369
|
return `${ctx.baseUrl.replace(/\/+$/, '')}/sp/ebdfpage/list/${listId}`;
|
|
@@ -955,8 +963,8 @@ async function findExistingTalents(ctx, opts) {
|
|
|
955
963
|
talentId: b.talentId,
|
|
956
964
|
candidateId: b.candidateId,
|
|
957
965
|
talentViewUrl: b.candidateId ? buildTalentViewUrl(ctx.baseUrl, b.candidateId) : null,
|
|
958
|
-
talentCardUrl: b.talentId ? resolveTalentCardUrl(ctx, b.talentId) : null,
|
|
959
|
-
talentListLocateUrl: b.talentId ? resolveTalentListLocateUrl(ctx, b.talentId) : null,
|
|
966
|
+
talentCardUrl: b.talentId ? await resolveTalentCardUrl(ctx, b.talentId) : null,
|
|
967
|
+
talentListLocateUrl: b.talentId ? await resolveTalentListLocateUrl(ctx, b.talentId) : null,
|
|
960
968
|
};
|
|
961
969
|
}
|
|
962
970
|
}
|
|
@@ -976,8 +984,8 @@ async function findExistingTalents(ctx, opts) {
|
|
|
976
984
|
if (rec) {
|
|
977
985
|
formConflicts.existing.push({
|
|
978
986
|
talentId: id, ...rec,
|
|
979
|
-
talentCardUrl: resolveTalentCardUrl(ctx, id),
|
|
980
|
-
talentListLocateUrl: resolveTalentListLocateUrl(ctx, id),
|
|
987
|
+
talentCardUrl: await resolveTalentCardUrl(ctx, id),
|
|
988
|
+
talentListLocateUrl: await resolveTalentListLocateUrl(ctx, id),
|
|
981
989
|
recordCardUrl: buildCardUrl(ctx.baseUrl, objId, id),
|
|
982
990
|
});
|
|
983
991
|
}
|
|
@@ -1271,8 +1279,8 @@ async function applyCore(args, env, payload) {
|
|
|
1271
1279
|
talentId: updateTalentId,
|
|
1272
1280
|
afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
|
|
1273
1281
|
verifyWarnings: verifyWarnings.length ? verifyWarnings : undefined,
|
|
1274
|
-
talentCardUrl: resolveTalentCardUrl(ctx, updateTalentId),
|
|
1275
|
-
talentListLocateUrl: resolveTalentListLocateUrl(ctx, updateTalentId),
|
|
1282
|
+
talentCardUrl: await resolveTalentCardUrl(ctx, updateTalentId),
|
|
1283
|
+
talentListLocateUrl: await resolveTalentListLocateUrl(ctx, updateTalentId),
|
|
1276
1284
|
parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || '(空)' },
|
|
1277
1285
|
});
|
|
1278
1286
|
}
|
|
@@ -1375,8 +1383,8 @@ async function applyCore(args, env, payload) {
|
|
|
1375
1383
|
writeWarnings.push('落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual);
|
|
1376
1384
|
}
|
|
1377
1385
|
const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
|
|
1378
|
-
const talentCardUrl = resolveTalentCardUrl(ctx, talentId);
|
|
1379
|
-
const talentListLocateUrl = resolveTalentListLocateUrl(ctx, talentId);
|
|
1386
|
+
const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
1387
|
+
const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
|
|
1380
1388
|
return rsSuccess('recruit-stage.resume.import.apply', {
|
|
1381
1389
|
mode: 'apply', result,
|
|
1382
1390
|
detailsState,
|
|
@@ -818,6 +818,63 @@ export function buildCardUrl(baseUrl, objId, dataId) {
|
|
|
818
818
|
return null;
|
|
819
819
|
return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/card/0/' + objId + '/' + dataId;
|
|
820
820
|
}
|
|
821
|
+
// ── 人才库 ecode 页面(recruit-talent-ui)优先 ────────────────────────────────
|
|
822
|
+
// 2026-11-10 用户定稿:「安排面试后返回的列表链接可以改;返回的人才卡片和人才列表也改,
|
|
823
|
+
// 改为新做的页面地址」。新页面是 ecode 独立页面(101 已发布,路由见该工程 entry.js)。
|
|
824
|
+
//
|
|
825
|
+
// 🔴 但不能硬用:自用等环境装不了这套 ecode(应用锁定),必须回退原生页。所以先探测再选。
|
|
826
|
+
// 探测判据(101 实测):/api/ecode/project/searchAll 的项目里有 projectName 以 recruit-talent-ui 开头。
|
|
827
|
+
// ❌ 不能拿页面 URL 的 HTTP 状态判:实测不存在的 /sp/custom/ecode/__no_such_app_xyz__ 也返回
|
|
828
|
+
// 200 + 完全相同的壳(3189 字节),会假绿。
|
|
829
|
+
export const TALENT_UI_ROUTE = '/sp/custom/ecode/recruit-talent';
|
|
830
|
+
/** 探测当前环境是否装了人才库 ecode 页面;结果缓存进 cache.talentUi('1'/'0'),一次运行只探一次。 */
|
|
831
|
+
export async function detectTalentUi(host, cache) {
|
|
832
|
+
const flag = String(cache.talentUi || '');
|
|
833
|
+
if (flag === '1')
|
|
834
|
+
return true;
|
|
835
|
+
if (flag === '0')
|
|
836
|
+
return false;
|
|
837
|
+
let installed = false;
|
|
838
|
+
try {
|
|
839
|
+
const r = await host.request({
|
|
840
|
+
path: '/api/ecode/project/searchAll',
|
|
841
|
+
method: 'GET',
|
|
842
|
+
query: { page: 1, size: 100 },
|
|
843
|
+
operation: 'detect-talent-ui',
|
|
844
|
+
});
|
|
845
|
+
const list = ((r && r.data && r.data.list) || (r && r.list) || []);
|
|
846
|
+
installed = Array.isArray(list)
|
|
847
|
+
&& list.some((x) => String((x && x.projectName) || '').startsWith('recruit-talent-ui'));
|
|
848
|
+
}
|
|
849
|
+
catch {
|
|
850
|
+
// 探测失败按「没装」处理:宁可回退到原生页,也不要给出打不开的链接。
|
|
851
|
+
installed = false;
|
|
852
|
+
}
|
|
853
|
+
cache.talentUi = installed ? '1' : '0';
|
|
854
|
+
return installed;
|
|
855
|
+
}
|
|
856
|
+
/** 人才库列表:装了 ecode 页面 → 新页面;否则原生台账列表。 */
|
|
857
|
+
export async function resolveTalentListUrl(host, cache, baseUrl, fallbackListId) {
|
|
858
|
+
if (await detectTalentUi(host, cache)) {
|
|
859
|
+
return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE;
|
|
860
|
+
}
|
|
861
|
+
return buildListUrl(baseUrl, fallbackListId);
|
|
862
|
+
}
|
|
863
|
+
/** 面试进展:装了 ecode 页面 → 新面试进展页;否则原生面试台账列表。 */
|
|
864
|
+
export async function resolveInterviewListUrlOrNative(host, cache, baseUrl, fallbackListId) {
|
|
865
|
+
if (await detectTalentUi(host, cache)) {
|
|
866
|
+
return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/interview';
|
|
867
|
+
}
|
|
868
|
+
return buildListUrl(baseUrl, fallbackListId);
|
|
869
|
+
}
|
|
870
|
+
/** 人才卡片:装了 ecode 页面 → /card?talentId=;返回 null 表示该环境用原生页(调用方走原逻辑)。 */
|
|
871
|
+
export async function talentUiCardUrl(host, cache, baseUrl, talentId) {
|
|
872
|
+
if (!talentId)
|
|
873
|
+
return null;
|
|
874
|
+
if (!(await detectTalentUi(host, cache)))
|
|
875
|
+
return null;
|
|
876
|
+
return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/card?talentId=' + encodeURIComponent(String(talentId));
|
|
877
|
+
}
|
|
821
878
|
/**
|
|
822
879
|
* 「只打开列表」URL:{base}/sp/ebdfpage/list/{listId}(2026-11-06 用户定稿)。
|
|
823
880
|
*
|
package/docs/SKILL.md
CHANGED
|
@@ -34,6 +34,7 @@ skills/weaver-e10-<name>/
|
|
|
34
34
|
- `invoice`:E10 业票通发票管理。源码说明先读 `docs/invoice.md`;面向 Agent 时先读 `skills/weaver-e10-yepiaotong/SKILL.md`,再按入口路由读取对应 reference。
|
|
35
35
|
- `fna`:E10 齐业成费控中心(预算查询/费用中心/报销报表 AI 问答/借款管理/发票核销)。源码说明先读 `docs/fna.md`;面向 Agent 时先读 `skills/weaver-e10-qiyecheng/SKILL.md`,再按入口路由读取对应 reference。写操作(提醒还款/催票)走 prepare/apply 确认链。
|
|
36
36
|
- `plan`:E10 计划报告(报告查询/新建/修改/发布/撤回/提交提醒/评论),自动适配标准版与 e10-ebuilder 两套报告接口链路。源码说明先读 `docs/plan.md`;面向 Agent 时先读 `skills/weaver-e10-plan/SKILL.md`,再按入口路由读取对应 reference。写操作走 prepare/apply 确认链。
|
|
37
|
+
- `data`:E10 问数聚合命令(DSL 查询 / 数据源发现与取数 / 词库 / 字段值翻译 / 配置中心 / 场景定位 / 模块接口调用 / 考勤),31 个 operation 全部只读,由原独立 CLI `e10-data` 迁移而来,参数名与输出口径逐字保留。源码说明先读 `docs/data.md`;面向 Agent 时先读 `skills/weaver-e10-data/SKILL.md`,再按入口路由读取对应 reference。`doc` 系列、`field.id2name`、`refusal`、`exp` 列为禁用边界(走配置中心 DOCUMENT / `field options` / 宿主平台 / `skills repo`)。
|
|
37
38
|
- `esb`:E10 ESB 中心自定义触发动作流(入参模板查询 + 触发)。源码说明先读 `docs/esb.md`;面向 Agent 时先读 `skills/weaver-e10-esb/SKILL.md`,再按入口路由读取对应 reference。触发动作流是写操作,走 prepare/apply 确认链。
|
|
38
39
|
- `okr`:E10 OKR 目标管理(目标分页查询/详情、关键成果查询与保存、目标对齐、目标评论、详情页链接),按 `ver_name` 自动适配 e10 标准版与 e10-ebuilder 两套接口链路。源码说明先读 `docs/okr.md`;面向 Agent 时先读 `skills/weaver-e10-okr/SKILL.md`,再按入口路由读取对应 reference。写操作(新建/编辑目标、保存关键成果、添加目标对齐)走 prepare/apply 确认链。
|
|
39
40
|
- `ebuilder-form`:E10 eBuilder 表单(菜单定位、List/NList 分页和配置、字段/选项/浏览字段解析、OpenAPI 与已发布自定义接口读写)。源码说明先读 `docs/ebuilder-form.md`;面向 Agent 时先读 `skills/weaver-e10-ebuilder-form/SKILL.md`,再按入口路由读取对应 reference。写操作走 prepare/apply 确认链。
|
package/docs/_catalog.md
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
| Agent Skill 模板、业务域关键词、入口和 reference 拆分方式 | `skill-template/` |
|
|
8
8
|
| Agent 共享规则、安装检查、JSON 输出、高风险写入 | `skills/weaver-e10-shared/SKILL.md` |
|
|
9
9
|
| Agent 共享规则细节:安装、E10 登录、JSON 输出、写入协议 | `skills/weaver-e10-shared/references/` |
|
|
10
|
+
| 泛微 E10 问数(数据源取数/配置中心/场景定位/模块接口调用)、data operation、31 个 operation 与 6 条禁用边界 | `docs/data.md` |
|
|
11
|
+
| Agent 调用 E10 数据助手 CLI 的入口路由 | `skills/weaver-e10-data/SKILL.md` |
|
|
12
|
+
| Agent 调用 E10 数据助手 CLI 的具体 reference(取数纪律/配置中心组参/场景与杂项) | `skills/weaver-e10-data/references/` |
|
|
10
13
|
| 业票通发票管理、报销填单、智能开票、invoice operation、写操作 prepare/apply | `docs/invoice.md` |
|
|
11
14
|
| E10 会议管理(标准版:查询/冲突/预约/回执/签到)、meeting operation、写操作 prepare/apply | `docs/meeting.md` |
|
|
12
15
|
| 聚才林人事云(人事档案/出勤/薪酬)、ehr operation、写操作 prepare/apply | `docs/ehr.md` |
|
package/docs/data.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# 泛微 E10 数据助手(data)
|
|
2
|
+
|
|
3
|
+
`data` 是 E10 问数能力的聚合命令,覆盖 8 个业务域:**DSL 查询(query)**、**数据源(ds)**、**词库(noun)**、**字段值翻译(field)**、**配置中心(conf)**、**场景定位(scene)**、**模块接口调用(module)**、**考勤(attend)**,共 **31 个 operation**。
|
|
4
|
+
|
|
5
|
+
由原独立 CLI `e10-data` 迁移而来。迁移只换了**承载进程**(登录与凭据改由 `weaver-work-cli` 统一托管),业务参数名与输出口径逐字保留,技能里 453 处 `e10-data …` 调用可直接换成 `weaver-work-cli data …`。
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
weaver-work-cli data --help
|
|
9
|
+
weaver-work-cli data schema
|
|
10
|
+
weaver-work-cli --json data run <operation> --input -
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`schema` 是能力清单的唯一事实来源:每个 operation 的 `inputSchema`、`command` 路径,以及 `withheldOperations`(刻意不迁的能力 + 书面理由)。
|
|
14
|
+
|
|
15
|
+
## 实现位置
|
|
16
|
+
|
|
17
|
+
| 路径 | 职责 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `src/shortcuts/data/index.ts` | 命令树、camelCase→snake_case 参数翻译、两种输出口径 |
|
|
20
|
+
| `src/shortcuts/data/manifest.ts` | `schema` 契约、inputSchema、禁用边界声明 |
|
|
21
|
+
| `src/shortcuts/data/host.ts` | E10 会话桥接、`ebbusinessid` 注入、JSON / form / multipart、退出码映射 |
|
|
22
|
+
| `src/shortcuts/data/errors.ts` | `DataCliError` 与退出码常量(数值与旧 CLI 一致) |
|
|
23
|
+
| `src/shortcuts/data/operations/index.ts` | 31 个 operation 注册表与统一分发 |
|
|
24
|
+
| `src/shortcuts/data/operations/{query,ds,noun,field,conf,scene,module,attend}.ts` | 按业务域拆分的实现 |
|
|
25
|
+
| `src/shortcuts/data/operations/shared.ts` | 雪花 ID 保精度、条件树、stat / order、平台提示扫描、人读渲染 |
|
|
26
|
+
|
|
27
|
+
命令树顺序固定:`schema` → `run <operation>` → 各业务便捷子命令。与仓库里其他 25 个 shortcut 同构。
|
|
28
|
+
|
|
29
|
+
## 认证
|
|
30
|
+
|
|
31
|
+
复用 `src/internal/e10` 的 E10 会话(`requireE10Session`),一次命令内只加载一次 session 并缓存复用。**`data` 不提供任何登录入口**,登录统一走:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
weaver-work-cli auth login --base-url <E10 域名>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
已登录态过期时 `host.ts` 抛 `authentication/session_expired`(退出码 2),不自行换票、不重放。
|
|
38
|
+
|
|
39
|
+
`ebbusinessid: 10000000000000000` 由本模块恒定下发(运行时不会自动注入),其他头(`Accept` / `langType` / `timeZoneOffset` / `Cookie` / `eteamsid` / `User-Agent` / `Origin`)由 `createE10RequestRuntime` 负责。`token` 属运行时保留头,INVOICE 场景必须走 `trustedHeaders`。
|
|
40
|
+
|
|
41
|
+
## 两种输出口径
|
|
42
|
+
|
|
43
|
+
| 入口 | 输出 | 适用 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `data <族> <动作>`(便捷命令) | **原始响应体**,不套信封、关闭超预算落盘 | 技能里的 jq 路径(`.data.records` 等)直接命中 |
|
|
46
|
+
| `data run <operation>` | `{schemaVersion, ok, operation, data, warnings}` 信封 | 需要统一契约的 Agent 调用 |
|
|
47
|
+
|
|
48
|
+
便捷命令刻意 `persist: false`:大结果被替换成 `{refId, preview}` 会直接打断下游 jq 解析。
|
|
49
|
+
|
|
50
|
+
## 命令树
|
|
51
|
+
|
|
52
|
+
| 族 | 便捷命令 | operation |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| DSL | `data query` | `data.dsl.query` |
|
|
55
|
+
| 数据源 | `data ds groups / find / describe / tables / fields / fields-dsl / list / chart / stat / count` | `data.ds.*` |
|
|
56
|
+
| 词库 | `data noun list / scope` | `data.noun.*` |
|
|
57
|
+
| 字段 | `data field name2id / options` | `data.field.*` |
|
|
58
|
+
| 配置中心 | `data conf get / batch / batch-file / group / group-file / resolve / resolve-file / add / add-file / update / delete` | `data.conf.*` |
|
|
59
|
+
| 场景 | `data scene groups / items / search` | `data.scene.*` |
|
|
60
|
+
| 模块接口 | `data module call` | `data.module.call` |
|
|
61
|
+
| 考勤 | `data attend statis` | `data.attend.statis` |
|
|
62
|
+
|
|
63
|
+
## 各业务域要点
|
|
64
|
+
|
|
65
|
+
### query:DSL 查询
|
|
66
|
+
|
|
67
|
+
`POST /api/dw/dsl/executeQueryDsl`,四个 URL query 参数(`dimension` / `confGroup` / `username` / `startDate`)**恒定发送**——缺键即失败,空值是合法的(表示"问句里没有")。
|
|
68
|
+
|
|
69
|
+
### ds:数据源发现与取数
|
|
70
|
+
|
|
71
|
+
- **`ds find` 的语义是「抓窗口 + 本地过滤」,不是后端精确搜索。**`/api/dw/newetl/chatBi/ds/listByPage` 当前忽略 `name`,所以命令会按 `--size`(≤2000)× `--pages`(≤50)抓取并在本地按表名过滤。**未命中只代表没落在窗口内,不等于表不存在** —— 输出里的 `nameFilter.note` 会写清本次比对了多少行。
|
|
72
|
+
- 默认只扫 `DS_CORE_GROUPS` 的核心分组;未命中且 `pages × size ≤ 2000` 时**自动升级全扫**(`--no-escalate` 关闭),仍在核心集则显式 `--all-groups`。
|
|
73
|
+
- 输出顶层带 `routeHint`:按命中分组给出该走哪条通道(WORKFLOW / DS_EB / DS_FORM / PROJECT/PMO / EHR / BLOG_DAILY / DOCUMENT / CRM / ESB / DS)。流程类问题**一律走 WORKFLOW 模块接口**,不用 DSL、也不走数据源。
|
|
74
|
+
- **`ds describe`** 一次并发取字段元数据 + 词库,并给出关联字段预判;`--require` 让失败分支直接失败。
|
|
75
|
+
- **取数四件套**(`list` / `chart` / `stat` / `count`)共用 DTO 骨架:`--group` + `--table` 定位,`--where` 走条件树(数组 = AND 根,元素可为内嵌条件组;对象 = 完整条件树),`--stat` 的聚合键是大写枚举(`aggregator: "SUM"`),`--order` 形如 `"create_time desc"`。
|
|
76
|
+
|
|
77
|
+
### conf:配置中心
|
|
78
|
+
|
|
79
|
+
- `confType` 默认由 `confKey` 前缀推导:`CONN_`→`conn`、`DS_`→`ds`、`WF_`→`wf`、`API_`→`api`;无法推导时报 `conf_type_unknown`(退出码 8),需显式 `--type`。
|
|
80
|
+
- `confGroup` 只在 `confType=api` 或显式传 `--group` 时下发,避免污染没有分组列的配置类型。
|
|
81
|
+
- 同一 `confKey` 可分布在多个 `confGroup`,内部用 `组|键` 做映射键,避免互相覆盖。
|
|
82
|
+
- 批量接口不可用时**自动降级逐条单查**;`batch-file` 直接跳过批量接口。
|
|
83
|
+
|
|
84
|
+
### module:配置中心驱动的接口调用
|
|
85
|
+
|
|
86
|
+
`module call` 是「已确定模块 + 接口」之后的通用执行器:按 `confAttrs` 的 `request_example` / 入参说明组装请求并发出去。
|
|
87
|
+
|
|
88
|
+
- `--show-params` 只打印入/出参说明;`--dry-run` 只组装不发送(凭据脱敏);`--raw` 原样输出响应体。
|
|
89
|
+
- **`body` 必须传对象,不能传已序列化的 JSON 字符串**:运行时会再 `JSON.stringify` 一次,传字符串会发出"被转义的 JSON 字面量",服务端表现为 HTTP 200 + 业务 500/400。form 提交走 `form` 字段。
|
|
90
|
+
- `--limit` 默认 50 行(`0` = 不截断),`--fields` 只保留指定行字段。
|
|
91
|
+
- **`/api/hrm/` 路径命中黑名单**(退出码 6):人员 / 部门 / 岗位一律走 `weaver-work-cli hrm`。
|
|
92
|
+
- **`hasSearchRight=false` 是权限受限的终端态**:结果字段必为空,命令以退出码 4 结束。不得交付为「无数据」,也不得换参重试。
|
|
93
|
+
|
|
94
|
+
### scene / noun:场景定位与词库
|
|
95
|
+
|
|
96
|
+
`scene search` 优先用后端 keyword 召回,后端不支持时才本地打分兜底(实际走哪条会打到 stderr)。`scene items` 的 `groupId` / 数据集 id 都是 19 位雪花号,**按字符串传**;`noun scope` 直接吃 `scene items` 里的数据集 id 列表。
|
|
97
|
+
|
|
98
|
+
### field:字段值翻译
|
|
99
|
+
|
|
100
|
+
- `field name2id`:名称 → 字段值 id,只管**浏览按钮类**字段(RelateBrowser / Ebuilder / Workflow,靠 `config.browserParams`)。
|
|
101
|
+
- `field options`:Select / Radio / Checkbox 的**选项值字典**(id↔name),选项类取值翻译走这个。
|
|
102
|
+
- 两者与 `ds fields`(字段元数据)是三件不同的事,不要混用。
|
|
103
|
+
|
|
104
|
+
### attend:考勤
|
|
105
|
+
|
|
106
|
+
`POST /api/attend/web/attendInfoV2/getAttendInfoStatis`,返回年假 / 带薪病假 / 带薪事假余额。`--user` 缺省当前登录用户,`--begin` / `--end` 缺省当月。
|
|
107
|
+
|
|
108
|
+
## 退出码
|
|
109
|
+
|
|
110
|
+
| 码 | 含义 | 框架映射 |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| 0 | 正常(**空结果也算正常**) | — |
|
|
113
|
+
| 2 | 未登录 / 凭据失效 | `UsageError` |
|
|
114
|
+
| 3 | 非 JSON 响应 / `confAttrs` 异常 | `AuthError` |
|
|
115
|
+
| 4 | 权限受限(`hasSearchRight=false`) | `PolicyError` |
|
|
116
|
+
| 6 | 命中 HRM 路径黑名单 | `PolicyError` |
|
|
117
|
+
| 7 | 请求失败(HTTP / 网络) | `NetworkError` |
|
|
118
|
+
| 8 | 用法错误(缺参、JSON 非法、未知 operation) | `UsageError` |
|
|
119
|
+
|
|
120
|
+
退出码数值**必须与旧 CLI 一致**,技能侧按码分流。
|
|
121
|
+
|
|
122
|
+
## 关键陷阱
|
|
123
|
+
|
|
124
|
+
**雪花 ID 精度**:E10 的 id 是 19 位,超出 `Number.MAX_SAFE_INTEGER`,`JSON.parse` 会把末几位归零且**后端不报错、只是查不到数据**。`parseJsonSafe` 在解析前把 ≥16 位整数预置为字符串,与旧 CLI 口径一致。
|
|
125
|
+
|
|
126
|
+
**平台范围提示**:平台在"范围过大不予查询"或"范围被收窄"时,只把 `tipTimeout` / `tipTimelimit`(及对应 Msg,含 `tipTimeLimit*` 变体)塞在响应**内层**(层级随通道不同)。`scanTips` 递归提取、`tipFields` 规范到输出顶层,`tipsLines` 打 `[!]` 行。看到 `tipTimeout=true` **不能当成 0 行**。
|
|
127
|
+
|
|
128
|
+
**`data --json` 不等于 `data run --json`**:前者是原始响应体(技能里 453 处 jq 依赖它),后者是信封。写新调用时按消费方选。
|
|
129
|
+
|
|
130
|
+
**并发扇出**:`ds find` / `ds describe` / `conf group-file` 在进程内并发,`--concurrency` 可调(默认 10)。分组失败不中断整体,失败明细在输出的 `errors` 里。
|
|
131
|
+
|
|
132
|
+
## 未迁移的能力(`withheldOperations`)
|
|
133
|
+
|
|
134
|
+
| operation | 理由 |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `data.doc.count` / `data.doc.list` | 由配置中心 DOCUMENT 覆盖(`data conf group api DOCUMENT` → `data module call`),不在 data 模块重复封装。注意 `documentList` 的 `data.total` 实测恒为 0,总量必须取 count 接口 |
|
|
137
|
+
| `data.field.id2name` | 已停用:技能里 19 处均为禁令;底层打的是 `/api/bcw/test/testRemoteBrowser` 探针接口。选项值显示映射改走 `field options` |
|
|
138
|
+
| `data.refusal.get` / `data.refusal.rules` | 拒答话术属智能问数宿主平台职责,场景技能明确「不做拒答 / 话术判定」 |
|
|
139
|
+
| `data.exp.*` | 专家包远端版本管理属 `weaver-work-cli skills repo …` 资源域 |
|
|
140
|
+
|
|
141
|
+
## 测试
|
|
142
|
+
|
|
143
|
+
`test/business/data-operations.test.ts` 覆盖:雪花 ID 保精度、BOM、条件树(数组 / 内嵌组 / 缺字段报错 / 空值)、stat 与 order 归一化、平台提示扫描、confType 推导、operation 注册表与 manifest 对齐(含 withheld 不与实现重叠)、参数翻译(含 `--no-escalate`)。
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
node --import tsx --test test/business/data-operations.test.ts
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
需要真实登录态的命令冒烟(`ds count` 新旧对照、`module call` 真实调用)不在单测内,需手工执行。
|