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.
Files changed (96) hide show
  1. package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
  2. package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-3NV2ETZR.js} +6 -6
  4. package/dist/chunks/{chunk-PSPOFLSU.js → chunk-3X7VOSBA.js} +1 -1
  5. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  6. package/dist/chunks/{chunk-FEP6ELMR.js → chunk-6GWU63YF.js} +1 -1
  7. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  8. package/dist/chunks/{chunk-EFOUMXIX.js → chunk-BRRW7CWA.js} +25 -25
  9. package/dist/chunks/{chunk-5B5JXTY2.js → chunk-D2QRZUW4.js} +209 -25
  10. package/dist/chunks/{chunk-OCYRVZGN.js → chunk-EJVA5ZVB.js} +2 -2
  11. package/dist/chunks/{chunk-BCACE6VV.js → chunk-GEOMANP7.js} +3 -3
  12. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  13. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  14. package/dist/chunks/{chunk-NK74RE5F.js → chunk-K3BT54CU.js} +3 -3
  15. package/dist/chunks/{chunk-R2HHLJNN.js → chunk-KV5SOWMS.js} +4 -4
  16. package/dist/chunks/{chunk-SVFG6EMV.js → chunk-ZKEUGS2U.js} +5 -5
  17. package/dist/chunks/{conflict-APGSD5E7.js → conflict-6347A7YK.js} +2 -2
  18. package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-7WG7LVX5.js} +6 -6
  19. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  20. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  21. package/dist/chunks/{env-B6GKA2J3.js → env-LHRKSLG6.js} +2 -2
  22. package/dist/chunks/{factory-MFCKLUT6.js → factory-2H7Z4RWJ.js} +1 -1
  23. package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-EW6PNDDT.js} +3 -3
  24. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  25. package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-N2FQBHXI.js} +10 -10
  26. package/dist/chunks/org-NFE7X7FK.js +12 -0
  27. package/dist/chunks/{reception-VL6TKVAW.js → reception-MYOKJULO.js} +429 -94
  28. package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
  29. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  30. package/dist/chunks/{registry-22O6UG4I.js → registry-CKUVBS53.js} +10 -10
  31. package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-MBCYENQ2.js} +4 -4
  32. package/dist/chunks/{schedule-SPPAHER2.js → schedule-5IFMCXME.js} +4 -4
  33. package/dist/index.js +12 -7
  34. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  35. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  36. package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
  37. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  38. package/dist/shortcuts/data/errors.js +64 -0
  39. package/dist/shortcuts/data/host.js +140 -0
  40. package/dist/shortcuts/data/index.js +429 -0
  41. package/dist/shortcuts/data/manifest.js +133 -0
  42. package/dist/shortcuts/data/operations/attend.js +62 -0
  43. package/dist/shortcuts/data/operations/conf.js +384 -0
  44. package/dist/shortcuts/data/operations/ds.js +686 -0
  45. package/dist/shortcuts/data/operations/field.js +68 -0
  46. package/dist/shortcuts/data/operations/index.js +65 -0
  47. package/dist/shortcuts/data/operations/module.js +383 -0
  48. package/dist/shortcuts/data/operations/noun.js +102 -0
  49. package/dist/shortcuts/data/operations/query.js +85 -0
  50. package/dist/shortcuts/data/operations/scene.js +235 -0
  51. package/dist/shortcuts/data/operations/shared.js +279 -0
  52. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
  53. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  54. package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
  55. package/dist/shortcuts/index.js +5 -0
  56. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  57. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  58. package/dist/shortcuts/reception/constants.js +11 -0
  59. package/dist/shortcuts/reception/index.js +3 -1
  60. package/dist/shortcuts/reception/manifest.js +3 -2
  61. package/dist/shortcuts/reception/operations/ask.js +20 -2
  62. package/dist/shortcuts/reception/operations/compose.js +11 -0
  63. package/dist/shortcuts/reception/operations/doc.js +59 -0
  64. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  65. package/dist/shortcuts/reception/operations/leads.js +1 -1
  66. package/dist/shortcuts/reception/operations/panels.js +84 -21
  67. package/dist/shortcuts/reception/operations/render.js +40 -0
  68. package/dist/shortcuts/reception/operations/restaurant.js +17 -4
  69. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
  70. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  71. package/dist/shortcuts/recruit-stage/shared.js +57 -0
  72. package/docs/SKILL.md +1 -0
  73. package/docs/_catalog.md +3 -0
  74. package/docs/data.md +149 -0
  75. package/docs/reception.md +59 -5
  76. package/package.json +1 -1
  77. package/scripts/check-skill-sync.mjs +188 -0
  78. package/scripts/package-skill.mjs +17 -3
  79. package/skill-template/business-info.json +23 -0
  80. package/skill-template/domains/data.md +15 -0
  81. package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
  82. package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
  83. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
  84. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
  85. package/skills/weaver-e10-data/SKILL.md +118 -0
  86. package/skills/weaver-e10-data/references/config-center.md +90 -0
  87. package/skills/weaver-e10-data/references/datasource.md +136 -0
  88. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  89. package/skills/weaver-e10-meeting/SKILL.md +39 -7
  90. package/skills/weaver-e10-reception-flow/SKILL.md +30 -16
  91. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  92. package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
  93. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
  94. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
  95. package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
  96. package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-2TRU2ZSP.js} +3 -3
@@ -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(环境缓存 ebdDetailPageId;自用系统追加 recruitType=useSelf)
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
- // 人才库列表(只打开列表):{baseUrl}/sp/ebdfpage/list/{listId}
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('ehr.recruit.stage.resume.import.apply', {
1381
1389
  mode: 'apply', result,
1382
1390
  detailsState,
@@ -815,6 +815,63 @@ export function buildCardUrl(baseUrl, objId, dataId) {
815
815
  return null;
816
816
  return String(baseUrl).replace(/\/+$/, '') + '/sp/ebdfpage/card/0/' + objId + '/' + dataId;
817
817
  }
818
+ // ── 人才库 ecode 页面(recruit-talent-ui)优先 ────────────────────────────────
819
+ // 2026-11-10 用户定稿:「安排面试后返回的列表链接可以改;返回的人才卡片和人才列表也改,
820
+ // 改为新做的页面地址」。新页面是 ecode 独立页面(101 已发布,路由见该工程 entry.js)。
821
+ //
822
+ // 🔴 但不能硬用:自用等环境装不了这套 ecode(应用锁定),必须回退原生页。所以先探测再选。
823
+ // 探测判据(101 实测):/api/ecode/project/searchAll 的项目里有 projectName 以 recruit-talent-ui 开头。
824
+ // ❌ 不能拿页面 URL 的 HTTP 状态判:实测不存在的 /sp/custom/ecode/__no_such_app_xyz__ 也返回
825
+ // 200 + 完全相同的壳(3189 字节),会假绿。
826
+ export const TALENT_UI_ROUTE = '/sp/custom/ecode/recruit-talent';
827
+ /** 探测当前环境是否装了人才库 ecode 页面;结果缓存进 cache.talentUi('1'/'0'),一次运行只探一次。 */
828
+ export async function detectTalentUi(host, cache) {
829
+ const flag = String(cache.talentUi || '');
830
+ if (flag === '1')
831
+ return true;
832
+ if (flag === '0')
833
+ return false;
834
+ let installed = false;
835
+ try {
836
+ const r = await host.request({
837
+ path: '/api/ecode/project/searchAll',
838
+ method: 'GET',
839
+ query: { page: 1, size: 100 },
840
+ operation: 'detect-talent-ui',
841
+ });
842
+ const list = ((r && r.data && r.data.list) || (r && r.list) || []);
843
+ installed = Array.isArray(list)
844
+ && list.some((x) => String((x && x.projectName) || '').startsWith('recruit-talent-ui'));
845
+ }
846
+ catch {
847
+ // 探测失败按「没装」处理:宁可回退到原生页,也不要给出打不开的链接。
848
+ installed = false;
849
+ }
850
+ cache.talentUi = installed ? '1' : '0';
851
+ return installed;
852
+ }
853
+ /** 人才库列表:装了 ecode 页面 → 新页面;否则原生台账列表。 */
854
+ export async function resolveTalentListUrl(host, cache, baseUrl, fallbackListId) {
855
+ if (await detectTalentUi(host, cache)) {
856
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE;
857
+ }
858
+ return buildListUrl(baseUrl, fallbackListId);
859
+ }
860
+ /** 面试进展:装了 ecode 页面 → 新面试进展页;否则原生面试台账列表。 */
861
+ export async function resolveInterviewListUrlOrNative(host, cache, baseUrl, fallbackListId) {
862
+ if (await detectTalentUi(host, cache)) {
863
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/interview';
864
+ }
865
+ return buildListUrl(baseUrl, fallbackListId);
866
+ }
867
+ /** 人才卡片:装了 ecode 页面 → /card?talentId=;返回 null 表示该环境用原生页(调用方走原逻辑)。 */
868
+ export async function talentUiCardUrl(host, cache, baseUrl, talentId) {
869
+ if (!talentId)
870
+ return null;
871
+ if (!(await detectTalentUi(host, cache)))
872
+ return null;
873
+ return String(baseUrl).replace(/\/+$/, '') + TALENT_UI_ROUTE + '/card?talentId=' + encodeURIComponent(String(talentId));
874
+ }
818
875
  /**
819
876
  * 「只打开列表」URL:{base}/sp/ebdfpage/list/{listId}(2026-11-06 用户定稿)。
820
877
  *
@@ -150,6 +150,11 @@ export const builtinShortcuts = [
150
150
  description: '泛微客户参观接待流程 CLI(面板/行程单与内部方案/填单页预填)',
151
151
  load: async () => (await import('./reception/index.js')).receptionShortcut,
152
152
  }),
153
+ lazyShortcut({
154
+ name: 'data',
155
+ description: '泛微E10数据助手 CLI(数据源查询 / 配置中心 / 场景定位)',
156
+ load: async () => (await import('./data/index.js')).dataShortcut,
157
+ }),
153
158
  ];
154
159
  /** 全部 shortcut 的 CLI 元数据(不触发任何实现模块加载)。 */
155
160
  export function shortcutMetadata() {
@@ -0,0 +1,200 @@
1
+ /**
2
+ * 组织/人员展开(2026-11-10 用户要求:治本,不是治标)。
3
+ *
4
+ * 问题:小E 说「我们部门所有人」时,模型用 `hrm.employee.query` 不带部门条件 → 服务端返回全公司
5
+ * 分页数据,本地再筛,实测 **51 秒**。正确路径其实只要两步:
6
+ * `hrm.org.lookup`(2s)→ `hrm.dept.members`(1s)。
7
+ *
8
+ * 本 operation 把这两步(以及分部/多部门/模糊名)收成 **一次调用**,并做 30 天缓存(可用 refresh 或环境变量覆盖):
9
+ * - 部门检索结果按关键词缓存(同一个「会议模块组」第二次 <1s)
10
+ * - 部门成员按部门 id 缓存(组织架构一天内不会变)
11
+ * - 支持模糊名:命中多个 → 返回 candidates 让用户点,不猜
12
+ * - 支持一次传多个关键词/多个部门,自动并集去重
13
+ */
14
+ import { meetingValidationError } from '../../errors.js';
15
+ import { meetingSuccess } from '../types.js';
16
+ import { cacheScopeSuffix, readCache, writeCache } from './cache.js';
17
+ // ⛔ 2026-11-10 用户反馈:24h 太短(组织架构一天内不会变,反而是频繁重建缓存拖慢)。
18
+ // 默认 **30 天**(2026-11-10 用户定:组织架构变动不频繁,缓存越久越省);可用 WEAVER_MEETING_MEMBER_CACHE_TTL_HOURS 覆盖。
19
+ const TTL_HOURS = (() => {
20
+ const raw = Number(process.env.WEAVER_MEETING_MEMBER_CACHE_TTL_HOURS ?? '');
21
+ return Number.isFinite(raw) && raw > 0 ? Math.min(raw, 24 * 30) : 24 * 30;
22
+ })();
23
+ const TTL_ORG_MS = TTL_HOURS * 60 * 60 * 1000;
24
+ const TTL_MEMBERS_MS = TTL_ORG_MS;
25
+ const MAX_DEPARTMENTS = 30;
26
+ const MAX_MEMBERS_RETURN = 300;
27
+ async function runHrm(name, input, env) {
28
+ const { hrmOrgOperations } = await import('../../../hrm/operations/org.js');
29
+ const { hrmEmployeeOperations } = await import('../../../hrm/operations/employee.js');
30
+ const all = [...hrmOrgOperations, ...hrmEmployeeOperations];
31
+ const operation = all.find((item) => item.name === name);
32
+ if (!operation)
33
+ throw meetingValidationError('hrm_operation_missing', `当前 CLI 缺少 ${name}(请升级 weaver-work-cli)`);
34
+ return operation.handler(input, env);
35
+ }
36
+ async function lookupOrg(env, keyword, refresh) {
37
+ const scope = await cacheScopeSuffix(env);
38
+ const key = `org-lookup-v1-${scope}-${encodeURIComponent(keyword)}`;
39
+ if (!refresh) {
40
+ const hit = await readCache(env, key, { ttlMs: TTL_ORG_MS });
41
+ if (hit)
42
+ return { rows: hit.data, cached: true };
43
+ }
44
+ const result = await runHrm('hrm.org.lookup', { keyword, limit: 20 }, env);
45
+ const rows = (result?.data?.rows ?? []).map((row) => ({
46
+ id: String(row.id ?? ''),
47
+ name: String(row.name ?? ''),
48
+ type: String(row.type ?? ''),
49
+ ...(row.fullPath ? { fullPath: String(row.fullPath) } : {}),
50
+ ...(row.score !== undefined ? { score: Number(row.score) } : {}),
51
+ })).filter((row) => row.id && row.name);
52
+ await writeCache(env, key, rows);
53
+ return { rows, cached: false };
54
+ }
55
+ async function deptMembers(env, deptId, refresh) {
56
+ const scope = await cacheScopeSuffix(env);
57
+ const key = `dept-members-v1-${scope}-${deptId}`;
58
+ if (!refresh) {
59
+ const hit = await readCache(env, key, { ttlMs: TTL_MEMBERS_MS });
60
+ if (hit)
61
+ return { members: hit.data, cached: true };
62
+ }
63
+ const result = await runHrm('hrm.dept.members', { dept: deptId }, env);
64
+ const rows = (result?.data?.rows ?? result?.data?.members ?? []);
65
+ const members = rows.map((row) => ({
66
+ id: String(row.id ?? row.employeeId ?? ''),
67
+ name: String(row.name ?? row.employeeName ?? ''),
68
+ ...(row.department ? { department: String(row.department) } : {}),
69
+ ...(row.departmentId ? { departmentId: String(row.departmentId) } : {}),
70
+ ...(row.subCompany ? { subCompany: String(row.subCompany) } : {}),
71
+ })).filter((row) => row.id);
72
+ await writeCache(env, key, members);
73
+ return { members, cached: false };
74
+ }
75
+ async function deptsUnderSubcompany(env, subcompanyId) {
76
+ const result = await runHrm('hrm.org.query', { type: 'department', subcompany: [subcompanyId], pageSize: 100 }, env);
77
+ const rows = (result?.data?.rows ?? []);
78
+ return rows.map((row) => ({ id: String(row.id ?? ''), name: String(row.name ?? '') })).filter((row) => row.id);
79
+ }
80
+ const meetingMemberExpand = {
81
+ name: 'meeting.member.expand',
82
+ resource: 'member',
83
+ method: 'expand',
84
+ action: 'meeting.member.expand',
85
+ summary: '把「我们部门所有人 / 某分部 / 模糊部门名」一次展开成员工 id 列表(查组织 + 取成员,带 30 天缓存,refresh 可强制刷新)。'
86
+ + '支持 keywords 多个部门并集;模糊命中多个时返回 candidates(ambiguous=true)让用户点选,不猜。'
87
+ + '⛔ 不要用 hrm.employee.query 不带条件查全公司(实测 51 秒)。',
88
+ capability: 'eb.meeting',
89
+ risk: 'read',
90
+ inputSchema: {
91
+ type: 'object',
92
+ additionalProperties: false,
93
+ properties: {
94
+ keyword: { type: 'string', description: '部门/分部名称,支持模糊(如「会议模块组」「产品研发中心」「会议」)' },
95
+ keywords: { type: 'array', items: { type: 'string' }, description: '多个部门/分部名称(并集去重)' },
96
+ scope: { type: 'string', enum: ['any', 'department', 'subcompany'], description: '限定组织类型,默认 any' },
97
+ includeMembers: { type: 'boolean', description: '是否展开成员,默认 true;只查部门 id 时传 false' },
98
+ refresh: { type: 'boolean', description: '忽略缓存重新查(默认 false)' },
99
+ maxDepartments: { type: 'number', description: `分部展开时最多取几个部门,默认 ${MAX_DEPARTMENTS}` },
100
+ },
101
+ },
102
+ handler: async (args, env) => {
103
+ const tokens = [
104
+ ...(typeof args.keyword === 'string' ? [args.keyword] : []),
105
+ ...(Array.isArray(args.keywords) ? args.keywords.map((item) => String(item)) : []),
106
+ ].map((item) => item.trim()).filter((item) => item !== '');
107
+ if (tokens.length === 0) {
108
+ throw meetingValidationError('keyword_required', '请传 keyword(部门/分部名称)或 keywords(多个)');
109
+ }
110
+ const scope = String(args.scope ?? 'any');
111
+ const includeMembers = args.includeMembers !== false;
112
+ const refresh = args.refresh === true;
113
+ const maxDepartments = Math.max(1, Math.min(100, Number(args.maxDepartments) || MAX_DEPARTMENTS));
114
+ const warnings = [];
115
+ const resolved = [];
116
+ const unresolved = [];
117
+ const ambiguous = [];
118
+ let fromCache = true;
119
+ for (const keyword of tokens) {
120
+ const { rows, cached } = await lookupOrg(env, keyword, refresh);
121
+ fromCache = fromCache && cached;
122
+ const filtered = scope === 'any' ? rows : rows.filter((row) => row.type === scope);
123
+ if (filtered.length === 0) {
124
+ unresolved.push(keyword);
125
+ continue;
126
+ }
127
+ // 完全同名优先;否则若唯一候选就用它;多个候选 → 交给用户选,不猜
128
+ const exact = filtered.find((row) => row.name === keyword);
129
+ const picked = exact ?? (filtered.length === 1 ? filtered[0] : null);
130
+ if (!picked) {
131
+ ambiguous.push({ keyword, candidates: filtered.slice(0, 10) });
132
+ continue;
133
+ }
134
+ let members = [];
135
+ let deptCached = true;
136
+ if (includeMembers) {
137
+ if (picked.type === 'subcompany') {
138
+ const depts = await deptsUnderSubcompany(env, picked.id);
139
+ const limited = depts.slice(0, maxDepartments);
140
+ if (depts.length > limited.length) {
141
+ warnings.push(`「${picked.name}」下有 ${depts.length} 个部门,只展开了前 ${limited.length} 个(maxDepartments 可调)`);
142
+ }
143
+ for (const dept of limited) {
144
+ const part = await deptMembers(env, dept.id, refresh);
145
+ deptCached = deptCached && part.cached;
146
+ members.push(...part.members);
147
+ }
148
+ }
149
+ else {
150
+ const part = await deptMembers(env, picked.id, refresh);
151
+ deptCached = part.cached;
152
+ members = part.members;
153
+ }
154
+ }
155
+ fromCache = fromCache && deptCached;
156
+ resolved.push({ keyword, org: picked, members, cached: deptCached });
157
+ }
158
+ const seen = new Set();
159
+ const allMembers = [];
160
+ for (const item of resolved) {
161
+ for (const member of item.members) {
162
+ if (seen.has(member.id))
163
+ continue;
164
+ seen.add(member.id);
165
+ allMembers.push(member);
166
+ }
167
+ }
168
+ const overflow = allMembers.length > MAX_MEMBERS_RETURN;
169
+ const members = overflow ? allMembers.slice(0, MAX_MEMBERS_RETURN) : allMembers;
170
+ if (overflow)
171
+ warnings.push(`人员较多(${allMembers.length}),只返回前 ${MAX_MEMBERS_RETURN} 个;建议按更小的部门范围查`);
172
+ if (unresolved.length > 0)
173
+ warnings.push(`未找到组织:${unresolved.join('、')}`);
174
+ const isAmbiguous = ambiguous.length > 0;
175
+ if (isAmbiguous) {
176
+ warnings.push('存在多个同名/近名组织:请把 candidates 做成选项让用户点选,不要自己挑');
177
+ }
178
+ return meetingSuccess('meeting.member.expand', {
179
+ input: { keywords: tokens, scope, includeMembers },
180
+ departments: resolved.map((item) => ({
181
+ keyword: item.keyword,
182
+ id: item.org.id,
183
+ name: item.org.name,
184
+ type: item.org.type,
185
+ ...(item.org.fullPath ? { fullPath: item.org.fullPath } : {}),
186
+ memberCount: item.members.length,
187
+ })),
188
+ members,
189
+ count: members.length,
190
+ /** 直接可用的参会人入参(逗号分隔的员工 id) */
191
+ membersCsv: members.map((member) => member.id).join(','),
192
+ memberNames: members.map((member) => member.name).join('、'),
193
+ ambiguous: isAmbiguous,
194
+ candidates: ambiguous.flatMap((item) => item.candidates.map((row) => ({ keyword: item.keyword, ...row }))),
195
+ unresolved,
196
+ source: fromCache ? 'cache' : 'api',
197
+ }, warnings.length > 0 ? { warnings } : {});
198
+ },
199
+ };
200
+ export const meetingMemberExpandOperations = [meetingMemberExpand];
@@ -17,6 +17,7 @@ import { meetingMinuteFromGroupChatOperations } from './from-group-chat.js';
17
17
  import { meetingDecisionNotifyOperations } from './task-notify.js';
18
18
  import { meetingPipelineOperations } from './pipeline.js';
19
19
  import { meetingInvitationOperations } from './invitation.js';
20
+ import { meetingMemberExpandOperations } from './eb/member-expand.js';
20
21
  import { meetingInvitationPublishOperations } from './invitation-publish.js';
21
22
  import { meetingQrOperations } from './qrcode.js';
22
23
  import { meetingSummaryOperations } from './summary.js';
@@ -43,6 +44,7 @@ function buildRegistry() {
43
44
  ...meetingDecisionNotifyOperations,
44
45
  ...meetingPipelineOperations,
45
46
  ...meetingInvitationOperations,
47
+ ...meetingMemberExpandOperations,
46
48
  ...meetingInvitationPublishOperations,
47
49
  ...meetingQrOperations,
48
50
  ...meetingSummaryOperations,
@@ -47,6 +47,17 @@ export const CUSTOMER_NEED_OPTIONS = [
47
47
  '交流具体项目合作与实施细节',
48
48
  '暂未确定,先进待办',
49
49
  ];
50
+ /**
51
+ * 第 3 问:是否安排会议。
52
+ *
53
+ * 必问项——只有原话**明确提到会议室/座谈/汇报/指定房间**(`meetingExplicit:true`)才跳过。
54
+ * 「晚上订小餐厅」不算:小餐厅是晚餐场地,与会议室预定是两条独立线索,不得互相推断。
55
+ */
56
+ export const MEETING_TITLE = '是否安排会议(需预留场地)';
57
+ export const MEETING_OPTIONS = [
58
+ { label: '是,安排会议室', value: '是' },
59
+ { label: '否,不需要', value: '否' },
60
+ ];
50
61
  /** 快照文件的 kind 标识,用于拒收无关 JSON。 */
51
62
  export const SNAPSHOT_KIND = 'reception-fields-snapshot';
52
63
  /** python 探测结果的缓存时长(7 天)。 */
@@ -99,7 +99,7 @@ export const receptionShortcut = {
99
99
  await runOperation(ctx, String(operation), input, opts);
100
100
  }));
101
101
  reception.command('ask')
102
- .description('出交互面板(缺项才出屏,总屏数 ≤2)')
102
+ .description('出交互面板(缺项才出屏,最多 3 屏:客户需求 / 接待细节 / 是否会议)')
103
103
  .option('--known <json>', '7 项抽取结果(内联 JSON)')
104
104
  .option('--known-file <path>', '7 项抽取结果(JSON 文件,推荐)')
105
105
  .option('--user <names>', '陪同人员姓名,多人逗号分隔;不传用当前登录人兜底')
@@ -196,6 +196,7 @@ export const receptionShortcut = {
196
196
  .option('--snapshot <path>', '字段快照路径(同时用于推导 render.py)')
197
197
  .option('--render-py <path>', '显式指定 render.py')
198
198
  .option('--no-upload', '跳过附件上传,只出本地文件')
199
+ .option('--allow-missing-restaurant', '提了小餐厅但没包厢号时仍放行(明细留空进待办)')
199
200
  .option('--sdk-render <type>', '打开形态:inline / popup / drawer(默认 drawer)')
200
201
  .action(action(async (ctx, options) => {
201
202
  const opts = asOptions(options);
@@ -210,6 +211,7 @@ export const receptionShortcut = {
210
211
  snapshot: textOf(opts, 'snapshot') || undefined,
211
212
  renderPy: textOf(opts, 'renderPy') || undefined,
212
213
  noUpload: opts.upload === false,
214
+ allowMissingRestaurant: opts.allowMissingRestaurant === true,
213
215
  sdkRender: textOf(opts, 'sdkRender') || undefined,
214
216
  }, opts);
215
217
  }));
@@ -3,7 +3,7 @@ export const receptionOperations = [
3
3
  {
4
4
  name: 'reception.ask',
5
5
  risk: 'read',
6
- summary: '按 7 项抽取结果出交互面板:缺项才出屏,总屏数 ≤2(客户需求 + 接待细节)。返回 runId 供 doc 使用。',
6
+ summary: '按 7 项抽取结果出交互面板:客户需求(已明确则跳过)+ 接待细节(常驻)+ 是否会议(必问,原话明确提及会议室才跳过)。返回 runId 供 doc 使用。',
7
7
  inputSchema: {
8
8
  type: 'object',
9
9
  additionalProperties: false,
@@ -26,7 +26,7 @@ export const receptionOperations = [
26
26
  demand: { type: 'string', description: '客户需求(旧字段名,customerNeed 优先)' },
27
27
  customerNeed: { type: 'string', description: '客户需求原文;已给则不再出「客户需求」面板,并写入表单客户需求字段' },
28
28
  meeting: { type: 'string', enum: ['是', '否'], description: '是否需要会议室座谈;必须与 meetingExplicit 一起传才生效' },
29
- meetingExplicit: { type: 'boolean', description: '会议表态是否来自原话明确表述;false/缺省视为未表态,第三屏照问' },
29
+ meetingExplicit: { type: 'boolean', description: '原话是否明确提及预定会议室(会议室/订会议室/座谈场地/汇报场地,或指定 129/130/131)。只有 true 才跳过会议屏;「晚上订小餐厅」不算,不得据此推断' },
30
30
  restaurantIntent: { type: 'boolean', description: '原话是否提到小餐厅/包厢;true 则必须带 --restaurant-rooms-file' },
31
31
  logistics: { type: 'string', description: '接待细节原文:人数/接送/用餐/住宿/伴手礼/手机' },
32
32
  },
@@ -145,6 +145,7 @@ export const receptionOperations = [
145
145
  outDir: { type: 'string', description: '产物输出目录' },
146
146
  noUpload: { type: 'boolean', description: '跳过附件上传,只出本地文件' },
147
147
  snapshot: { type: 'string', description: '字段快照路径;同时用于推导技能包内 render.py 位置' },
148
+ allowMissingRestaurant: { type: 'boolean', description: '提了小餐厅但确实拿不到包厢号时放行(明细留空进待办),默认 false 直接报 RESTAURANT_DETAIL_MISSING' },
148
149
  renderPy: { type: 'string', description: '显式指定 render.py 路径' },
149
150
  sdkRender: {
150
151
  type: 'string',
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_WORKFLOW } from '../constants.js';
2
- import { buildPanels } from './panels.js';
2
+ import { buildPanels, normalizeDemand, parseLogistics, setCompanionMobile } from './panels.js';
3
3
  import { newRunId, saveRun } from './runs.js';
4
4
  import { normalizeMeeting } from './leads.js';
5
5
  import { nameList } from './shared.js';
@@ -17,9 +17,25 @@ export async function ask(input, ctx) {
17
17
  // 房间只能由 CLI 按人数选,known 里带的房间/后勤一律不采信
18
18
  delete data.meetingRoom;
19
19
  delete data.meetingRoomMeta;
20
+ // known.logistics 是「接待细节原文」,先拆成 6 个子项再丢原文:
21
+ // 不拆的话面板 prefilled 是空的,用户会被要求把已经说过的话重填一遍。
22
+ if (typeof data.logistics === 'string' && data.logistics.trim()) {
23
+ const parsed = parseLogistics(data.logistics);
24
+ const mobile = parsed.mobile;
25
+ delete parsed.mobile;
26
+ for (const [key, value] of Object.entries(parsed)) {
27
+ if (!data[key])
28
+ data[key] = value;
29
+ }
30
+ if (mobile)
31
+ setCompanionMobile(data, mobile);
32
+ }
20
33
  delete data.logistics;
21
34
  delete data.customer_need;
22
- // 会议表态必须带 meetingExplicit,否则视为「没说过」:清掉推断值,让第三屏问出来。
35
+ // 客户需求来源归一:SKILL 让模型写 `customerNeed`,而面板与缺口判定只认 `demand`,
36
+ // 两处不统一就会出现「原话已明确需求、面板仍追问」。这里只保留 demand 一个来源。
37
+ normalizeDemand(data);
38
+ // 会议表态必须带 meetingExplicit,否则视为「没说过」:清掉推断值,留给会议屏去问。
23
39
  // 值本身也要归一(需要/要/安排 → 是),否则 compose 里的 `=== '是'` 会静默漏填。
24
40
  if (data.meetingExplicit === true) {
25
41
  const meeting = normalizeMeeting(data.meeting);
@@ -70,6 +86,8 @@ export async function ask(input, ctx) {
70
86
  customer: data.customer || '',
71
87
  visitDate: data.visitDate || '',
72
88
  visitType: data.visitType || '',
89
+ demand: data.demand || '',
90
+ meeting: data.meeting || '',
73
91
  companions: data.companions || [],
74
92
  // 兜底由 render 阶段补:ask 不读会话,这里恒为空
75
93
  contactFallback: '',
@@ -218,6 +218,12 @@ export function composeInitialValues(options) {
218
218
  putRest(restaurant.fields.endTime, data.restaurant.endTime || '');
219
219
  }
220
220
  }
221
+ else if (data.restaurant) {
222
+ // 有餐厅入参却没归一成 booking(缺 booked):不能静默跳过。
223
+ // 「文档里写了包厢、页面上没有」这种矛盾,只能靠人工比对才发现,代价太高。
224
+ warnings.push('小餐厅明细未写入:入参未归一(缺少 booked),请确认包厢与用餐时间后手工补填');
225
+ todos.push('小餐厅预定明细待补填(包厢、人数、时间)');
226
+ }
221
227
  const built = buildCustomParams(items);
222
228
  params.values = built.values;
223
229
  params.keys = built.keys;
@@ -227,6 +233,11 @@ export function composeInitialValues(options) {
227
233
  todos.push('陪同人员未填');
228
234
  if (!data.demand)
229
235
  todos.push('客户需求未填');
236
+ // 会议没表态时不造数据,但也不能让它悄悄漏掉:接待细节里没写就进待办,
237
+ // 由行政在页面上确认,避免「会议室整段空着还没人发现」。
238
+ if (!normalizeMeeting(data.meeting)) {
239
+ todos.push('是否需要会议未表态:会议室未预留,提交前请行政确认');
240
+ }
230
241
  return {
231
242
  values: params.values,
232
243
  keys: params.keys,
@@ -2,7 +2,9 @@ import { readFileSync } from 'node:fs';
2
2
  import { basename, join } from 'node:path';
3
3
  import { DEFAULT_WORKFLOW } from '../constants.js';
4
4
  import { receptionValidationError } from '../errors.js';
5
+ import { applyMeetingPolicy, normalizeMeeting } from './leads.js';
5
6
  import { mergeAnswers } from './panels.js';
7
+ import { normalizeRestaurant } from './restaurant.js';
6
8
  import { requirePython, renderBoth, resolveRenderPy } from './render-assets.js';
7
9
  import { newRunId, saveRun, tryLoadRun } from './runs.js';
8
10
  import { canonical, ensureDir, parseJsonText, sha256, writeJson } from './shared.js';
@@ -50,6 +52,35 @@ function applyCases(data, casesFile) {
50
52
  data.expertsQuery = String(expertsQuery);
51
53
  }
52
54
  }
55
+ /**
56
+ * 读「小食堂包厢」候选文件。
57
+ *
58
+ * 允许直接丢 `e10-data ds list` 的原始输出(裸数组 / 裹在 data.list 里 / field_xxx 键),
59
+ * 归一交给 normalizeRoomCandidates;这里只负责把 JSON 读进来并给出可定位的报错。
60
+ */
61
+ function readRoomsFile(path) {
62
+ let raw;
63
+ try {
64
+ raw = readFileSync(path, 'utf8');
65
+ }
66
+ catch (error) {
67
+ throw receptionValidationError('RESTAURANT_ROOMS_UNREADABLE', `读不到 --restaurant-rooms-file:${path}`, {
68
+ path,
69
+ detail: error.message,
70
+ hint: '传「小食堂包厢」ds list 的原始输出,或 [{name,capacity}] 数组',
71
+ });
72
+ }
73
+ const parsed = parseJsonText(raw);
74
+ if (!parsed.ok) {
75
+ throw receptionValidationError('RESTAURANT_ROOMS_INVALID', `--restaurant-rooms-file 不是合法 JSON:${parsed.error}`, {
76
+ path,
77
+ preview: parsed.preview,
78
+ hasBom: parsed.hasBom,
79
+ hint: '常见原因:UTF-8 BOM、中文引号、尾随逗号;修 JSON 本身,不要换传参方式',
80
+ });
81
+ }
82
+ return parsed.value;
83
+ }
53
84
  export async function doc(input, ctx) {
54
85
  const startedAt = Date.now();
55
86
  const runIdArg = String(input.runId || '').trim();
@@ -83,6 +114,34 @@ export async function doc(input, ctx) {
83
114
  const data = mergeAnswers(run, answers);
84
115
  if (input.casesFile)
85
116
  applyCases(data, input.casesFile);
117
+ // 定房必须发生在出件之前:md/docx 在 doc 阶段一次成文,
118
+ // 若只在 render 里跑 applyMeetingPolicy,参考文档里永远写「场地待定」,
119
+ // 而填单页却有房间——两份产物互相打脸。
120
+ applyMeetingPolicy(data);
121
+ // 小餐厅:只有用户明确提到才归一(内部按触发词判定),候选来自「小食堂包厢」实查结果。
122
+ // 以前 --restaurant-rooms-file 只被 CLI 接收、无人消费,data.restaurant 恒不存在,
123
+ // 子表、md 段落、缺包厢号的硬校验三处一起失效。
124
+ const booking = normalizeRestaurant({
125
+ data,
126
+ rooms: input.restaurantRoomsFile ? readRoomsFile(input.restaurantRoomsFile) : null,
127
+ });
128
+ if (booking)
129
+ data.restaurant = booking;
130
+ // md 的「待确认事项」读 data.todo(不是 compose 的 todos):会议没表态、包厢没定,
131
+ // 都要在文档里写明,不能出现「场地待定」却把待确认事项写成「无」。
132
+ const todo = Array.isArray(data.todo) ? [...data.todo] : [];
133
+ const addTodo = (item) => {
134
+ if (item && !todo.includes(item))
135
+ todo.push(item);
136
+ };
137
+ if (!normalizeMeeting(data.meeting)) {
138
+ addTodo('是否需要会议未表态:会议室未预留,请行政确认后回填');
139
+ }
140
+ if (booking && booking.booked && !String(booking.roomNo || '').trim()) {
141
+ addTodo(`小餐厅包厢待确认:${booking.roomReason || '未取到可用包厢'}`);
142
+ }
143
+ if (todo.length)
144
+ data.todo = todo;
86
145
  const outDir = input.outDir || run.outDir || ctx.outDir;
87
146
  ensureDir(outDir);
88
147
  const warnings = [];
@@ -18,7 +18,31 @@ export async function docRender(input, ctx) {
18
18
  const runId = String((docResult.data || {}).runId || input.runId || '');
19
19
  // answers / snapshotPath 已经由 doc 写进 run,这里只传 runId;
20
20
  // sdkRender 属于 render 自己的入参,透传即可。
21
- const renderResult = await render({ runId, sdkRender: input.sdkRender }, ctx);
21
+ let renderResult;
22
+ try {
23
+ renderResult = await render({
24
+ runId,
25
+ sdkRender: input.sdkRender,
26
+ // answers 与 allowMissingRestaurant 必须透传:
27
+ // render 虽然会回落到 run.answers,但「同一 run 二次调用带新 answers」只能靠这里;
28
+ // 漏传 allowMissingRestaurant 会让 doc-render 上的放行开关整个失效。
29
+ answers: input.answers,
30
+ allowMissingRestaurant: input.allowMissingRestaurant === true,
31
+ }, ctx);
32
+ }
33
+ catch (error) {
34
+ // 出件已成功、只有填单参数被拦(典型:提了小餐厅却没给包厢号)。
35
+ // 把产物路径带进错误,调用方才知道「文件已经在本地,补参数重跑本条即可」,
36
+ // 不必重新出件、更不用重新检索案例。
37
+ const err = error;
38
+ const files = (docResult.data || {}).files;
39
+ if (err && err.details && typeof err.details === 'object' && Array.isArray(files) && files.length) {
40
+ err.details.files = files;
41
+ err.details.runId = runId;
42
+ err.details.note = '行程单与参考文档已生成,补齐后重跑 doc-render --run-id 即可,不必重出件';
43
+ }
44
+ throw error;
45
+ }
22
46
  return {
23
47
  state: renderResult.state,
24
48
  ok: renderResult.ok,
@@ -78,7 +78,7 @@ export function normalizeMeeting(value) {
78
78
  * - 明确「是」:有合法房间就沿用,否则按人数上界自动定;
79
79
  * - 明确「否」:房间清成「不需会议室」,6 个字段都不填;
80
80
  * - 只给了合法房间、没表态:视为要开会(已经点名房间,不该再问一次);
81
- * - 什么都没有:不造数据,留给第三屏去问。
81
+ * - 什么都没有:不造数据,留给会议屏去问;没答就被 render 的 MEETING_UNCONFIRMED 拦住
82
82
  */
83
83
  export function applyMeetingPolicy(data) {
84
84
  const declared = normalizeMeeting(data.meeting);